Author: bugman Date: Mon Dec 13 14:53:27 2010 New Revision: 11777 URL: http://svn.gna.org/viewcvs/relax?rev=11777&view=rev Log: Created the pipe.delete user function menu entry and window. Modified: branches/bieri_gui/gui_bieri/menu.py branches/bieri_gui/gui_bieri/user_functions/pipes.py Modified: branches/bieri_gui/gui_bieri/menu.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/menu.py?rev=11777&r1=11776&r2=11777&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/menu.py (original) +++ branches/bieri_gui/gui_bieri/menu.py Mon Dec 13 14:53:27 2010 @@ -196,7 +196,8 @@ [id_base + 002, "&delete", paths.icon_16x16.cancel, self.gui.user_functions.molecule.delete] ]], [id_base + 100, "&pipe", paths.icon_16x16.load, None, [ - [id_base + 101, "&create", paths.icon_16x16.add, self.gui.user_functions.pipes.create] + [id_base + 101, "&create", paths.icon_16x16.add, self.gui.user_functions.pipes.create], + [id_base + 102, "&delete", paths.icon_16x16.cancel, self.gui.user_functions.pipes.delete] ]], [id_base + 200, "&script", paths.icon_16x16.uf_script, self.gui.user_functions.script.run, []] ] Modified: branches/bieri_gui/gui_bieri/user_functions/pipes.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/user_functions/pipes.py?rev=11777&r1=11776&r2=11777&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/user_functions/pipes.py (original) +++ branches/bieri_gui/gui_bieri/user_functions/pipes.py Mon Dec 13 14:53:27 2010 @@ -27,7 +27,7 @@ import wx # relax module imports. -from generic_fns.pipes import VALID_TYPES +from generic_fns.pipes import VALID_TYPES, pipe_names # GUI module imports. from base import UF_base, UF_window @@ -43,6 +43,7 @@ # The dialogs. self._create_window = Add_window(self.gui, self.interpreter) + self._delete_window = Delete_window(self.gui, self.interpreter) def create(self, event): @@ -53,6 +54,16 @@ """ self._create_window.Show() + + + def delete(self, event): + """The pipe.delete user function. + + @param event: The wx event. + @type event: wx event + """ + + self._delete_window.Show() def destroy(self): @@ -96,3 +107,58 @@ # Set the name. self.interpreter.pipe.create(pipe_name=pipe_name, pipe_type=pipe_type) + + + +class Delete_window(UF_window): + """The pipe.delete() user function window.""" + + # Some class variables. + size_x = 600 + size_y = 400 + frame_title = 'Delete a data pipe' + image_path = WIZARD_IMAGE_PATH + 'molecule.png' + main_text = 'This dialog allows you to delete data pipes from the relax data store.' + title = 'Data pipe deletion' + + + def add_uf(self, sizer): + """Add the pipe specific GUI elements. + + @param sizer: A sizer object. + @type sizer: wx.Sizer instance + """ + + # The pipe selection. + self.pipe_name = self.combo_box(sizer, "The pipe:", []) + + + def execute(self): + """Execute the user function.""" + + # Get the name. + pipe_name = str(self.pipe_name.GetValue()) + + # Delete the data pipe. + self.interpreter.pipe.delete(pipe_name) + + # Update. + self.update(None) + + + def update(self, event): + """Update the UI. + + @param event: The wx event. + @type event: wx event + """ + + # Clear the previous data. + self.pipe_name.Clear() + + # Clear the pipe name. + self.pipe_name.SetValue('') + + # The list of pipe names. + for name in pipe_names(): + self.pipe_name.Append(name)