Author: bugman Date: Fri Dec 17 18:15:30 2010 New Revision: 11883 URL: http://svn.gna.org/viewcvs/relax?rev=11883&view=rev Log: Fixed the 'Parameter file settings' dialog. This dialog was killed by r11823 (https://mail.gna.org/public/relax-commits/2010-12/msg00123.html). The problem was two fold. Firstly the settings were not being placed into the relax data store, but instead in a copy of the relevant data structure. Secondly blank entries were fatal for both the conversion to int and conversion back again. Modified: branches/bieri_gui/gui_bieri/misc.py branches/bieri_gui/gui_bieri/relax_gui.py branches/bieri_gui/gui_bieri/settings.py Modified: branches/bieri_gui/gui_bieri/misc.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/misc.py?rev=11883&r1=11882&r2=11883&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/misc.py (original) +++ branches/bieri_gui/gui_bieri/misc.py Fri Dec 17 18:15:30 2010 @@ -71,3 +71,20 @@ # Convert. return int(string) + + +def int_to_gui(num): + """Convert the int into the GUI string. + + @param num: The number in int or None form. + @type num: int or None + @return: The GUI string. + @rtype: str + """ + + # No input. + if num == None: + return '' + + # Convert. + return str(num) Modified: branches/bieri_gui/gui_bieri/relax_gui.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/relax_gui.py?rev=11883&r1=11882&r2=11883&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/relax_gui.py (original) +++ branches/bieri_gui/gui_bieri/relax_gui.py Fri Dec 17 18:15:30 2010 @@ -508,7 +508,7 @@ def param_file_setting(self, event): # set up parameter files - set_relax_params = Inputfile(ds.relax_gui.file_setting, self, -1, "") + set_relax_params = Inputfile(self, -1, "") set_relax_params.Show() Modified: branches/bieri_gui/gui_bieri/settings.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/settings.py?rev=11883&r1=11882&r2=11883&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/settings.py (original) +++ branches/bieri_gui/gui_bieri/settings.py Fri Dec 17 18:15:30 2010 @@ -26,10 +26,13 @@ import sys import wx +# relax module imports. +from data import Relax_data_store; ds = Relax_data_store() + # relax GUI module imports. from filedialog import openfile from message import error_message -from misc import gui_to_int +from misc import gui_to_int, int_to_gui from paths import IMAGE_PATH @@ -171,10 +174,7 @@ class Inputfile(wx.Dialog): - def __init__(self, settings, *args, **kwds): - # Link settings list. - self.settings = settings - + def __init__(self, *args, **kwds): # begin inputfile.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Dialog.__init__(self, *args, **kwds) @@ -182,21 +182,17 @@ self.bitmap_1_copy_copy = wx.StaticBitmap(self, -1, wx.Bitmap(IMAGE_PATH+'relax.gif', wx.BITMAP_TYPE_ANY)) self.subheader = wx.StaticText(self, -1, "Please specify column number below:\n") self.label_2_copy_copy = wx.StaticText(self, -1, "Molecule name") - self.mol_nam = wx.TextCtrl(self, -1, str(self.settings[0])) self.label_3_copy_copy = wx.StaticText(self, -1, "Residue number") - self.res_num_col = wx.TextCtrl(self, -1, str(self.settings[1])) self.label_5_copy_copy = wx.StaticText(self, -1, "Residue name") - self.res_nam_col = wx.TextCtrl(self, -1, str(self.settings[2])) self.label_6_copy_copy = wx.StaticText(self, -1, "Spin number") - self.spin_num_col = wx.TextCtrl(self, -1, str(self.settings[3])) self.label_9_copy_copy = wx.StaticText(self, -1, "Spin name") - self.spin_nam_col = wx.TextCtrl(self, -1, str(self.settings[4])) self.label_7_copy_copy = wx.StaticText(self, -1, "Values") - self.value_col = wx.TextCtrl(self, -1, str(self.settings[5])) self.label_8_copy_copy = wx.StaticText(self, -1, "Errors") - self.error_col = wx.TextCtrl(self, -1, str(self.settings[6])) self.ok_copy_copy = wx.Button(self, -1, "Ok") self.cancel_copy_copy = wx.Button(self, -1, "Cancel") + + # Update the fields. + self.update() self.__set_properties() self.__do_layout() @@ -256,16 +252,32 @@ def accept_settings(self, event): # change settings - self.settings = [] - self.settings.append(gui_to_int(self.mol_nam.GetValue())) - self.settings.append(gui_to_int(self.res_num_col.GetValue())) - self.settings.append(gui_to_int(self.res_nam_col.GetValue())) - self.settings.append(gui_to_int(self.spin_num_col.GetValue())) - self.settings.append(gui_to_int(self.spin_nam_col.GetValue())) - self.settings.append(gui_to_int(self.value_col.GetValue())) - self.settings.append(gui_to_int(self.error_col.GetValue())) + ds.relax_gui.file_setting = [] + ds.relax_gui.file_setting.append(gui_to_int(self.mol_nam.GetValue())) + ds.relax_gui.file_setting.append(gui_to_int(self.res_num_col.GetValue())) + ds.relax_gui.file_setting.append(gui_to_int(self.res_nam_col.GetValue())) + ds.relax_gui.file_setting.append(gui_to_int(self.spin_num_col.GetValue())) + ds.relax_gui.file_setting.append(gui_to_int(self.spin_nam_col.GetValue())) + ds.relax_gui.file_setting.append(gui_to_int(self.value_col.GetValue())) + ds.relax_gui.file_setting.append(gui_to_int(self.error_col.GetValue())) + + # Update the fields. + self.update() + self.Destroy() def cancel_settings(self, event): # cancel self.Destroy() + + + def update(self): + """Update all the fields.""" + + self.mol_nam = wx.TextCtrl(self, -1, int_to_gui(ds.relax_gui.file_setting[0])) + self.res_num_col = wx.TextCtrl(self, -1, int_to_gui(ds.relax_gui.file_setting[1])) + self.res_nam_col = wx.TextCtrl(self, -1, int_to_gui(ds.relax_gui.file_setting[2])) + self.spin_num_col = wx.TextCtrl(self, -1, int_to_gui(ds.relax_gui.file_setting[3])) + self.spin_nam_col = wx.TextCtrl(self, -1, int_to_gui(ds.relax_gui.file_setting[4])) + self.value_col = wx.TextCtrl(self, -1, int_to_gui(ds.relax_gui.file_setting[5])) + self.error_col = wx.TextCtrl(self, -1, int_to_gui(ds.relax_gui.file_setting[6]))