Fixed bugs in CustomStyledTextCtrl
authorLaurent Bessard
Mon, 06 May 2013 11:15:05 +0200
changeset 1092 e91f2c8d6f51
parent 1091 5f612651d227
child 1093 b5f78cff4459
Fixed bugs in CustomStyledTextCtrl
controls/CustomStyledTextCtrl.py
controls/__init__.py
--- a/controls/CustomStyledTextCtrl.py	Mon May 06 10:28:47 2013 +0200
+++ b/controls/CustomStyledTextCtrl.py	Mon May 06 11:15:05 2013 +0200
@@ -45,7 +45,7 @@
 class CustomStyledTextCtrl(wx.stc.StyledTextCtrl):
     
     def __init__(self, *args, **kwargs):
-        wx.stc.StyledTextCtrl(self, *args, **kwargs)
+        wx.stc.StyledTextCtrl.__init__(self, *args, **kwargs)
         
         self.Bind(wx.EVT_MOTION, self.OnMotion)
         
@@ -55,22 +55,18 @@
                 x, y = event.GetPosition()
                 margin_width = reduce(
                         lambda x, y: x + y,
-                        [self.LogConsole.GetMarginWidth(i)
+                        [self.GetMarginWidth(i)
                          for i in xrange(3)],
                         0)
                 if x <= margin_width:
-                    self.LogConsole.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
+                    self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
                 else:
-                    self.LogConsole.SetCursor(wx.StockCursor(wx.CURSOR_IBEAM))
+                    self.SetCursor(wx.StockCursor(wx.CURSOR_IBEAM))
+            else:
+                event.Skip()
         else:
             event.Skip()
 
     def AppendText(self, text):
-        last_position = self.GetLength()
-        current_selection = self.GetSelection()
-        self.GotoPos(last_position)
+        self.GotoPos(self.GetLength())
         self.AddText(text)
-        if current_selection[0] != last_position:
-            self.SetSelection(*current_selection)
-        else:
-            self.ScrollToLine(self.GetLineCount())
--- a/controls/__init__.py	Mon May 06 10:28:47 2013 +0200
+++ b/controls/__init__.py	Mon May 06 11:15:05 2013 +0200
@@ -39,3 +39,4 @@
 from TextCtrlAutoComplete import TextCtrlAutoComplete
 from FolderTree import FolderTree
 from LogViewer import LogViewer
+from CustomStyledTextCtrl import CustomStyledTextCtrl