Trace window updating in real-time on Linux

This commit is contained in:
Skyler Lehmkuhl 2013-01-19 16:47:30 -05:00
parent fd55f0854d
commit 8b5b174ba1
3 changed files with 14 additions and 8 deletions

View File

@ -418,8 +418,11 @@ def run_file(self=None):
outputtext.scroll_bottom() # this doesn't work outputtext.scroll_bottom() # this doesn't work
except: except:
pass pass
return True
if hasattr(svlgui, 'gobject'):
svlgui.gobject.timeout_add(20, updatetrace, outputtext)
else:
r = misc_funcs.RepeatTimer(0.02, updatetrace, args=[outputtext]) r = misc_funcs.RepeatTimer(0.02, updatetrace, args=[outputtext])
print dir(outputwin.window)
r.daemon = True r.daemon = True
r.start() r.start()
if svlgui.PLATFORM=="osx": if svlgui.PLATFORM=="osx":

View File

@ -231,7 +231,7 @@ class MainWindowOSX:
# self.toolbox.buttons[1][0]._int().enabled = False # self.toolbox.buttons[1][0]._int().enabled = False
self.toolbox.buttons[3][0]._int().enabled = False self.toolbox.buttons[3][0]._int().enabled = False
self.toolbox.buttons[4][0]._int().enabled = False self.toolbox.buttons[4][0]._int().enabled = False
self.scriptwindow = svlgui.TextView() self.scriptwindow = svlgui.TextView(code=True)
self.paintgroup = svlgui.RadioGroup("Draw straight", "Draw smooth", "Draw as inked") self.paintgroup = svlgui.RadioGroup("Draw straight", "Draw smooth", "Draw as inked")
def setmode(self): def setmode(self):
svlgui.PMODE = self.value svlgui.PMODE = self.value

View File

@ -1211,7 +1211,7 @@ class TextView(Widget):
if SYSTEM=="osx": if SYSTEM=="osx":
self.box.text = text self.box.text = text
text = property(_gettext, _settext) text = property(_gettext, _settext)
def __init__(self,editable=True,width=False,height=False): def __init__(self,editable=True,width=False,height=False,code=False):
if SYSTEM=="gtk": if SYSTEM=="gtk":
self.sw=ScrolledWindow() self.sw=ScrolledWindow()
self.box=gtk.TextView() self.box=gtk.TextView()
@ -1229,8 +1229,10 @@ class TextView(Widget):
def mouse_down(self, event): def mouse_down(self, event):
self.become_target() self.become_target()
GUI.TextEditor.mouse_down(self, event) GUI.TextEditor.mouse_down(self, event)
# self.box = OSXTextEditor(scrolling="hv") if code:
self.box = CodeEditor() self.box = CodeEditor()
else:
self.box = OSXTextEditor(scrolling="hv")
self.box.font = Font("Courier", 12, []) self.box.font = Font("Courier", 12, [])
if width and height: if width and height:
self.box.size = (width, height) self.box.size = (width, height)
@ -1246,6 +1248,7 @@ class TextView(Widget):
def scroll_bottom(self): def scroll_bottom(self):
if SYSTEM=="osx": if SYSTEM=="osx":
self.scroll_page_down(); self.scroll_page_down();
self.box.invalidate()
class TextEntry(Widget): class TextEntry(Widget):
def __init__(self,text="",password=False): def __init__(self,text="",password=False):