Author: bugman Date: Tue Aug 9 15:56:10 2011 New Revision: 14298 URL: http://svn.gna.org/viewcvs/relax?rev=14298&view=rev Log: Implemented the structure.get_pos user function page and menu entry. Modified: branches/gui_testing/gui/menu.py branches/gui_testing/gui/user_functions/structure.py Modified: branches/gui_testing/gui/menu.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/menu.py?rev=14298&r1=14297&r2=14298&view=diff ============================================================================== --- branches/gui_testing/gui/menu.py (original) +++ branches/gui_testing/gui/menu.py Tue Aug 9 15:56:10 2011 @@ -260,6 +260,7 @@ [wx.NewId(), "&create_diff_tensor_pdb", None, self.gui.user_functions.structure.create_diff_tensor_pdb], [wx.NewId(), "&create_vector_dist", None, self.gui.user_functions.structure.create_vector_dist], [wx.NewId(), "&delete", paths.icon_16x16.remove, self.gui.user_functions.structure.delete], + [wx.NewId(), "&get_pos", None, self.gui.user_functions.structure.get_pos], [wx.NewId(), "&load_spins", paths.icon_16x16.spin, self.gui.user_functions.structure.load_spins], [wx.NewId(), "&read_pdb", paths.icon_16x16.open, self.gui.user_functions.structure.read_pdb], [wx.NewId(), "&write_pdb", paths.icon_16x16.save, self.gui.user_functions.structure.write_pdb], Modified: branches/gui_testing/gui/user_functions/structure.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/user_functions/structure.py?rev=14298&r1=14297&r2=14298&view=diff ============================================================================== --- branches/gui_testing/gui/user_functions/structure.py (original) +++ branches/gui_testing/gui/user_functions/structure.py Tue Aug 9 15:56:10 2011 @@ -90,6 +90,22 @@ wizard.run() + def get_pos(self, event): + """The structure.get_pos user function. + + @param event: The wx event. + @type event: wx event + """ + + # Create the wizard. + wizard = Wiz_window(size_x=800, size_y=600, title=self.get_title('structure', 'get_pos')) + page = Get_pos_page(wizard, self.gui) + wizard.add_page(page) + + # Execute the wizard. + wizard.run() + + def load_spins(self, event): """The structure.load_spins user function. @@ -266,6 +282,39 @@ # Delete all structures. self.gui.interpreter.structure.delete() + + + +class Get_pos_page(UF_page): + """The structure.get_pos() user function page.""" + + # Some class variables. + uf_path = ['structure', 'get_pos'] + height_desc = 300 + + def add_contents(self, sizer): + """Add the structure specific GUI elements. + + @param sizer: A sizer object. + @type sizer: wx.Sizer instance + """ + + # The spin_id arg. + self.spin_id = self.spin_id_element(sizer, default='@N') + + # The ave_pos arg. + self.ave_pos = self.boolean_selector(sizer, "Average the atom position across models:", tooltip=self.uf._doc_args_dict['ave_pos'], default=True) + + + def on_execute(self): + """Execute the user function.""" + + # The args. + spin_id = gui_to_str(self.spin_id.GetValue()) + ave_pos = gui_to_bool(self.ave_pos.GetValue()) + + # Delete all structures. + self.gui.interpreter.structure.get_pos(spin_id=spin_id, ave_pos=ave_pos)