Author: bugman Date: Thu Aug 4 12:47:38 2011 New Revision: 14116 URL: http://svn.gna.org/viewcvs/relax?rev=14116&view=rev Log: Implemented the gpl user function in the GUI. Added: branches/gui_testing/gui/user_functions/gpl.py - copied, changed from r14110, branches/gui_testing/gui/user_functions/script.py Modified: branches/gui_testing/gui/menu.py branches/gui_testing/gui/user_functions/__init__.py Modified: branches/gui_testing/gui/menu.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/menu.py?rev=14116&r1=14115&r2=14116&view=diff ============================================================================== --- branches/gui_testing/gui/menu.py (original) +++ branches/gui_testing/gui/menu.py Thu Aug 4 12:47:38 2011 @@ -169,6 +169,7 @@ [wx.NewId(), "re&verse", None, self.gui.user_functions.deselect.reverse], [wx.NewId(), "&spin", paths.icon_16x16.spin, self.gui.user_functions.deselect.spin], ]], + [wx.NewId(), "&gpl", None, self.gui.user_functions.gpl.run, []], [wx.NewId(), "&molecule", paths.icon_16x16.molecule, None, [ [wx.NewId(), "©", paths.icon_16x16.copy, self.gui.user_functions.molecule.copy], [wx.NewId(), "crea&te", paths.icon_16x16.add, self.gui.user_functions.molecule.create], Modified: branches/gui_testing/gui/user_functions/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/user_functions/__init__.py?rev=14116&r1=14115&r2=14116&view=diff ============================================================================== --- branches/gui_testing/gui/user_functions/__init__.py (original) +++ branches/gui_testing/gui/user_functions/__init__.py Thu Aug 4 12:47:38 2011 @@ -28,6 +28,7 @@ # GUI module imports. from deselect import Deselect +from gpl import Gpl from molecule import Molecule from noe import Noe from pipe import Pipe @@ -46,6 +47,7 @@ # The package __all__ list. __all__ = ['base', 'deselect', + 'gpl', 'molecule', 'noe', 'pipe', @@ -75,6 +77,7 @@ # The user functions. self.deselect = Deselect(self.gui) + self.gpl = Gpl(self.gui) self.molecule = Molecule(self.gui) self.noe = Noe(self.gui) self.pipe = Pipe(self.gui) @@ -95,6 +98,7 @@ # Send the commands onwards to the user function classes. self.deselect.destroy() + self.gpl.destroy() self.molecule.destroy() self.noe.destroy() self.pipe.destroy() Copied: branches/gui_testing/gui/user_functions/gpl.py (from r14110, branches/gui_testing/gui/user_functions/script.py) URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/user_functions/gpl.py?p2=branches/gui_testing/gui/user_functions/gpl.py&p1=branches/gui_testing/gui/user_functions/script.py&r1=14110&r2=14116&rev=14116&view=diff ============================================================================== --- branches/gui_testing/gui/user_functions/script.py (original) +++ branches/gui_testing/gui/user_functions/gpl.py Thu Aug 4 12:47:38 2011 @@ -21,58 +21,24 @@ ############################################################################### # Module docstring. -"""The script user functions.""" - -# Python module imports. -import thread -import wx +"""The gpl user function.""" # relax module imports. -from status import Status; status = Status() +from prompt.gpl import gpl # GUI module imports. from base import UF_base -from gui.filedialog import RelaxFileDialog -class Script(UF_base): - """The script user function GUI class.""" +class Gpl(UF_base): + """The gpl user function GUI class.""" - def run(self, event, file=None): - """The script user function GUI element. + def run(self, event): + """The gpl user function. @param event: The wx event. @type event: wx event - @param file: The path of the script to execute, if already known. If not given, a file selection dialog will appear. - @type file: str """ - # User selection of the file. - if not file: - dialog = RelaxFileDialog(parent=self, message='Select the relax script to execute', wildcard='relax scripts (*.py)|*.py', style=wx.FD_OPEN) - - # Show the dialog and catch if no file has been selected. - if dialog.ShowModal() != wx.ID_OK: - # Don't do anything. - return - - # The file. - file = dialog.get_file() - - # Show the relax controller. - if status.show_gui: - self.gui.controller.Show() - - # Execute the script in a thread. - id = thread.start_new_thread(self.script_exec, (file,)) - - - def script_exec(self, file): - """Execute the script in a thread. - - @param file: The script file name. - @type file: str - """ - - # Execute the user function. - self.gui.interpreter.script(str(file)) + # Send the GPL text to STDOUT. + print gpl.__doc__