diff --git a/lightningbeam.py b/lightningbeam.py index 43e84dd..54ed914 100755 --- a/lightningbeam.py +++ b/lightningbeam.py @@ -418,10 +418,13 @@ def run_file(self=None): outputtext.scroll_bottom() # this doesn't work except: pass - r = misc_funcs.RepeatTimer(0.02, updatetrace, args=[outputtext]) - print dir(outputwin.window) - r.daemon = True - r.start() + return True + if hasattr(svlgui, 'gobject'): + svlgui.gobject.timeout_add(20, updatetrace, outputtext) + else: + r = misc_funcs.RepeatTimer(0.02, updatetrace, args=[outputtext]) + r.daemon = True + r.start() if svlgui.PLATFORM=="osx": osx_flash_player_loc = "/Applications/Flash\ Player\ Debugger.app" success = svlgui.execute("open -a "+osx_flash_player_loc+" "+os.getenv('HOME')+"/test.swf") diff --git a/lightningbeam_windows.py b/lightningbeam_windows.py index 5f11268..63d79ae 100755 --- a/lightningbeam_windows.py +++ b/lightningbeam_windows.py @@ -231,7 +231,7 @@ class MainWindowOSX: # self.toolbox.buttons[1][0]._int().enabled = False self.toolbox.buttons[3][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") def setmode(self): svlgui.PMODE = self.value diff --git a/svlgui.py b/svlgui.py index bb40e79..36d8351 100644 --- a/svlgui.py +++ b/svlgui.py @@ -1211,7 +1211,7 @@ class TextView(Widget): if SYSTEM=="osx": self.box.text = text 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": self.sw=ScrolledWindow() self.box=gtk.TextView() @@ -1229,8 +1229,10 @@ class TextView(Widget): def mouse_down(self, event): self.become_target() GUI.TextEditor.mouse_down(self, event) - # self.box = OSXTextEditor(scrolling="hv") - self.box = CodeEditor() + if code: + self.box = CodeEditor() + else: + self.box = OSXTextEditor(scrolling="hv") self.box.font = Font("Courier", 12, []) if width and height: self.box.size = (width, height) @@ -1246,6 +1248,7 @@ class TextView(Widget): def scroll_bottom(self): if SYSTEM=="osx": self.scroll_page_down(); + self.box.invalidate() class TextEntry(Widget): def __init__(self,text="",password=False):