Author: bugman Date: Mon Dec 13 23:41:34 2010 New Revision: 11791 URL: http://svn.gna.org/viewcvs/relax?rev=11791&view=rev Log: Created the pipe.switch user function window. Modified: branches/bieri_gui/gui_bieri/user_functions/pipes.py 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=11791&r1=11790&r2=11791&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/user_functions/pipes.py (original) +++ branches/bieri_gui/gui_bieri/user_functions/pipes.py Mon Dec 13 23:41:34 2010 @@ -44,6 +44,7 @@ # The dialogs. self._create_window = Add_window(self.gui, self.interpreter) self._delete_window = Delete_window(self.gui, self.interpreter) + self._switch_window = Switch_window(self.gui, self.interpreter) def create(self, event): @@ -66,11 +67,23 @@ self._delete_window.Show() + def switch(self, event): + """The pipe.switch user function. + + @param event: The wx event. + @type event: wx event + """ + + self._switch_window.Show() + + def destroy(self): """Close all windows.""" self._create_window.Destroy() self._delete_window.Destroy() + self._switch_window.Destroy() + class Add_window(UF_window): @@ -163,3 +176,56 @@ # The list of pipe names. for name in pipe_names(): self.pipe_name.Append(name) + + + +class Switch_window(UF_window): + """The pipe.switch() user function window.""" + + # Some class variables. + size_x = 600 + size_y = 400 + button_apply = False + frame_title = 'Data pipe switching' + image_path = WIZARD_IMAGE_PATH + 'pipe.png' + main_text = 'This dialog allows you to switch between the various data pipes within the relax data store.' + title = 'Switch between data pipes' + + + 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()) + + # Switch the data pipe. + self.interpreter.pipe.switch(pipe_name) + + + 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)