mail[task #6847] The Bieri graphical user interface.


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Michael Bieri on February 19, 2010 - 01:54:

Follow-up Comment #38, task #6847 (project relax):

Hi Edward

I am not sure that I understand the committing exactly. How can I make
changes or am i not allowed to make them myself, yet?

Nevertheless, I'll try to send a 'commit' for you dealing with the maximum
lines in the relaxGUI log window. I set it to be 1000 lines, but we should
discuss the final amout.


------------------ controller patch

The number of maximum lines in the relaxGUI log window is limited to 1000
lines.

relaxGUI calculation crashed during local tm calculation due to too many
lines in the relaxGUI log window. Therefore, the maximum amout of numbers is
limited to 1000 as discussed with Edward d'Auvergne
(https://gna.org/bugs/?15173).

A new function to limit maximum lines in relaxGUI log windows was introduced
into controller.py.

Modified:
    branches/bieri_gui/gui_bieri/controller.py
    (Revision 10707)

Index: gui_bieri/controller.py
===================================================================
--- gui_bieri/controller.py     (Revision 10707)
+++ gui_bieri/controller.py     (Arbeitskopie)
@@ -26,6 +26,7 @@
 
 # Python module imports.
 from os import sep
+from string import split
 import sys
 import time
 import thread
@@ -185,10 +186,36 @@
         self.out=aWxTextCtrl
 
 
+    def limit_entries(self):
+        """ Function to overcome feedback problem of wx.CallAfter()
command"""
+
+        # Maximum allowed number of lines in log window.
+        max_entries = 1000
+
+        # read number of lines in log window.
+        total_entries = self.out.log_panel.GetNumberOfLines()
+
+        # Shift entries backwards if maximum of line exeeded.
+        if total_entries > max_entries:
+            # Convert entries to list
+            list_of_entries = split(self.out.log_panel.GetValue(), '\n')
+
+            for i in range(1, max_entries + 1):
+                list_of_entries[i-1] = list_of_entries[i]
+
+            # Reset log window entries
+            new_entries = str(list_of_entries)
+            self.out.log_panel.SetValue(new_entries)
+
+
     def write(self,string):
         global progress
 
-        wx.CallAfter(self.out.log_panel.WriteText, string)
+        # Limit panle entries to max_entries Lines.
+        wx.CallAfter(self.limit_entries)
+
+        # Add new output.
+        wx.CallAfter(self.out.log_panel.AppendText, string)
         time.sleep(0.001)  # allow relaxGUI log panel to get refreshed
 
         # split print out into list


_____________________________________________

Cheers
Michael


(file #8165)
    _______________________________________________________

Additional Item Attachment:

File name: controller_patch               Size:1 KB


    _______________________________________________________

Reply to this item at:

  <http://gna.org/task/?6847>

_______________________________________________
  Nachricht geschickt von/durch Gna!
  http://gna.org/




Related Messages


Powered by MHonArc, Updated Thu Feb 25 00:40:33 2010