Hi,
Awesome, you have your commit access up and running! I'll go through
each commit and check for issues line by line. I have a few below for
this commit:
On 24 February 2010 05:00, <michael.bieri@xxxxxx> wrote:
Author: michaelbieri
Date: Wed Feb 24 05:00:23 2010
New Revision: 10887
URL: http://svn.gna.org/viewcvs/relax?rev=10887&view=rev
Log:
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
Modified: branches/bieri_gui/gui_bieri/controller.py
URL:
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/controller.py?rev=10887&r1=10886&r2=10887&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/controller.py (original)
+++ branches/bieri_gui/gui_bieri/controller.py Wed Feb 24 05:00:23 2010
@@ -26,6 +26,7 @@
# Python module imports.
from os import sep
+from string import split, replace
import sys
import time
import thread
@@ -185,10 +186,37 @@
self.out=aWxTextCtrl
+ def limit_entries(self):
+ """ Function to overcome feedback problem of wx.CallAfter()
command"""
This is an incredibly important one. The reason is because of the
automatic parsing of docstrings performed through out relax. This is
used for building the API documentation
(http://www.nmr-relax.com/api/1.3/), for the automatic building of the
user function section of the relax manual, for the help() function
provided on the prompt interface, etc. The problem is that automatic
parsing will break here. The fix is simple, there should be no space
between """ and the first word, and there should be a '.' character at
the end of the sentence.
+
+ # Maximum allowed number of lines in log window.
+ max_entries = 1000
+ new_entries = ''
I would suggest 10,000 max_entries. In future versions, maybe the
user could set this in the 'settings' menu?
+
+ # 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):
+ new_entries = new_entries + (list_of_entries[i]) + '\n'
+
+ # Reset log window entries
+ #new_entries = str(list_of_entries)
This last line looks like debugging code that can be eliminated. It
could be confusing in the future when the reason for this commenting
out is long forgotten.
+ 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
This all looks good! Does this solve the segfault problem you see? I
can think of one other problem here. The text should be removed from
the buffer as your are reading it into the log window. This will
prevent the buffer from blowing up and taking up all of the RAM + swap
space.
Cheers,
Edward
_______________________________________________
relax (http://nmr-relax.com)
This is the relax-devel mailing list
relax-devel@xxxxxxx
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel