Fixed LogConsole not cleared when building several times
authorLaurent Bessard
Tue, 09 Apr 2013 18:41:24 +0200
changeset 1025 36e38d3c28b2
parent 1024 626de4ff4bdc
child 1026 96a2dc05651a
Fixed LogConsole not cleared when building several times
Beremiz.py
--- a/Beremiz.py	Tue Apr 09 18:29:21 2013 +0200
+++ b/Beremiz.py	Tue Apr 09 18:41:24 2013 +0200
@@ -254,9 +254,14 @@
                 if style is None : style=self.black_white
                 if style != self.black_white:
                     self.output.StartStyling(self.output.GetLength(), 0xff)
+                
+                # Temporary deactivate read only mode on StyledTextCtrl for adding text
+                # It seems that text modifications, even programmatically, are disabled
+                # in StyledTextCtrl when read only is active 
                 self.output.SetReadOnly(False)
                 self.output.AddText(s)
                 self.output.SetReadOnly(True)
+                
                 if style != self.black_white:
                     self.output.SetStyling(len(s), style)
             self.stack = []
@@ -284,7 +289,12 @@
         wx.GetApp().Yield()
 
     def flush(self):
+        # Temporary deactivate read only mode on StyledTextCtrl for clearing text
+        # It seems that text modifications, even programmatically, are disabled
+        # in StyledTextCtrl when read only is active 
+        self.output.SetReadOnly(False)
         self.output.SetText("")
+        self.output.SetReadOnly(True)
     
     def isatty(self):
         return false