# HG changeset patch
# User Laurent Bessard
# Date 1365525684 -7200
# Node ID 36e38d3c28b232fd17d00b7648cc8bcff376c9f1
# Parent  626de4ff4bdc9a05bbbc9d55fe5b7e94a046ae80
Fixed LogConsole not cleared when building several times

diff -r 626de4ff4bdc -r 36e38d3c28b2 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