mailr10371 - /branches/bieri_gui/gui_bieri/derived_wx_classes.py


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

Header


Content

Posted by edward on January 26, 2010 - 13:26:
Author: bugman
Date: Tue Jan 26 13:26:40 2010
New Revision: 10371

URL: http://svn.gna.org/viewcvs/relax?rev=10371&view=rev
Log:
Changed the open_file() method to only change variables in its own class.


Modified:
    branches/bieri_gui/gui_bieri/derived_wx_classes.py

Modified: branches/bieri_gui/gui_bieri/derived_wx_classes.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/derived_wx_classes.py?rev=10371&r1=10370&r2=10371&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/derived_wx_classes.py (original)
+++ branches/bieri_gui/gui_bieri/derived_wx_classes.py Tue Jan 26 13:26:40 
2010
@@ -27,23 +27,33 @@
 # Python module imports.
 import wx
 
+# relax GUI module imports.
+from filedialog import openfile
+
+
 
 class StructureTextCtrl(wx.TextCtrl):
     """Class for structural file selection."""
 
-    def open_file(self, event): # structure file
-        backup = self.structure_noe1.GetValue()
-        structure_file_pdb = openfile('Select PDB File', 
self.res_noe1.GetValue() + sep, '*.*', 'PDB files (*.pdb)|*.pdb|all files 
(*.*)|*.*')
-        if structure_file_pdb == None:
-            structure_file_pdb = backup
-        self.structure_noe1.SetValue(structure_file_pdb)
-        self.structure_r11.SetValue(structure_file_pdb)
-        self.structure_r21.SetValue(structure_file_pdb)
-        self.structure_noe1_copy.SetValue(structure_file_pdb)
-        self.structure_r11_copy.SetValue(structure_file_pdb)
-        self.structure_r21_copy.SetValue(structure_file_pdb)
-        self.structure_noe1_copy_1.SetValue(structure_file_pdb)
-        self.structure_r11_copy_1.SetValue(structure_file_pdb)
-        self.structure_r21_copy_1.SetValue(structure_file_pdb)
-        self.structure_r21_copy_1_copy.SetValue(structure_file_pdb)
+    def open_file(self, event):
+        """Open the structural file.
+
+        @param event:   The wx event.
+        @type event:    wx event
+        """
+
+        # Store the original file name in case of failure.
+        backup = self.GetValue()
+
+        # Open the file dialog.
+        file_name = openfile('Select PDB File', getcwd(), '*.*', 'PDB files 
(*.pdb)|*.pdb|all files (*.*)|*.*')
+
+        # Restore the original file name.
+        if file_name == None:
+            file_name = backup
+
+        # Set the value.
+        self.SetValue(file_name)
+
+        # Skip the event.
         event.Skip()




Related Messages


Powered by MHonArc, Updated Tue Jan 26 13:40:02 2010