Author: bugman Date: Tue May 8 16:17:40 2012 New Revision: 16103 URL: http://svn.gna.org/viewcvs/relax?rev=16103&view=rev Log: Converted the fix user function to the auto-generation design. The object-locked and object-unlocked Oxygen icons have been combined to create a wizard graphic for this user function. Added: branches/uf_redesign/graphics/oxygen_icons/modified/ branches/uf_redesign/graphics/oxygen_icons/modified/object-locked-unlocked.svgz (with props) branches/uf_redesign/graphics/wizards/object-locked-unlocked.png (with props) branches/uf_redesign/user_functions/fix.py - copied, changed from r16100, branches/uf_redesign/prompt/fix.py Removed: branches/uf_redesign/prompt/fix.py Modified: branches/uf_redesign/prompt/__init__.py branches/uf_redesign/prompt/interpreter.py branches/uf_redesign/user_functions/__init__.py Added: branches/uf_redesign/graphics/oxygen_icons/modified/object-locked-unlocked.svgz URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/graphics/oxygen_icons/modified/object-locked-unlocked.svgz?rev=16103&view=auto ============================================================================== Binary file - no diff available. Propchange: branches/uf_redesign/graphics/oxygen_icons/modified/object-locked-unlocked.svgz ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: branches/uf_redesign/graphics/wizards/object-locked-unlocked.png URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/graphics/wizards/object-locked-unlocked.png?rev=16103&view=auto ============================================================================== Binary file - no diff available. Propchange: branches/uf_redesign/graphics/wizards/object-locked-unlocked.png ------------------------------------------------------------------------------ svn:mime-type = image/png Modified: branches/uf_redesign/prompt/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/__init__.py?rev=16103&r1=16102&r2=16103&view=diff ============================================================================== --- branches/uf_redesign/prompt/__init__.py (original) +++ branches/uf_redesign/prompt/__init__.py Tue May 8 16:17:40 2012 @@ -24,7 +24,6 @@ __all__ = ['base_class', 'command', 'doc_string', - 'fix', 'frame_order', 'frq', 'gpl', Removed: branches/uf_redesign/prompt/fix.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/fix.py?rev=16102&view=auto ============================================================================== --- branches/uf_redesign/prompt/fix.py (original) +++ branches/uf_redesign/prompt/fix.py (removed) @@ -1,77 +1,0 @@ -############################################################################### -# # -# Copyright (C) 2003-2012 Edward d'Auvergne # -# # -# This file is part of the program relax. # -# # -# relax is free software; you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation; either version 2 of the License, or # -# (at your option) any later version. # -# # -# relax is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with relax; if not, write to the Free Software # -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# # -############################################################################### - -# Module docstring. -"""Module containing the 'fix' user function class.""" -__docformat__ = 'plaintext' - -# relax module imports. -import arg_check -from generic_fns import fix -from status import Status; status = Status() - - -class Fix: - """Class containing the function for fixing or allowing parameter values to change.""" - - def fix(self, element=None, fixed=True): - """Function for either fixing or allowing parameter values to change during optimisation. - - Keyword Arguments - ~~~~~~~~~~~~~~~~~ - - element: Which element to fix. - - fixed: A flag specifying if the parameters should be fixed or allowed to change. - - - Description - ~~~~~~~~~~~ - - The keyword argument 'element' can be any of the following: - - 'diff' - the diffusion tensor parameters. This will allow all diffusion tensor parameters - to be toggled. - - 'all_spins' - using this keyword, all parameters from all spins will be toggled. - - 'all' - all parameter will be toggled. This is equivalent to combining both 'diff' and - 'all_spins'. - - - The flag 'fixed', if set to True, will fix parameters during optimisation whereas a value of - False will allow parameters to vary. - """ - - # Function intro text. - if status.prompt_intro: - text = status.ps3 + "fix(" - text = text + "element=" + repr(element) - text = text + ", fixed=" + repr(fixed) + ")" - print(text) - - # The argument checks. - arg_check.is_str(element, 'element') - arg_check.is_bool(fixed, 'fixed') - - # Execute the functional code. - fix.fix(element=element, fixed=fixed) Modified: branches/uf_redesign/prompt/interpreter.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/prompt/interpreter.py?rev=16103&r1=16102&r2=16103&view=diff ============================================================================== --- branches/uf_redesign/prompt/interpreter.py (original) +++ branches/uf_redesign/prompt/interpreter.py Tue May 8 16:17:40 2012 @@ -55,7 +55,6 @@ from status import Status; status = Status() # User functions. -from fix import Fix from gpl import GPL from reset import Reset from sys_info import Sys_info @@ -190,13 +189,11 @@ objects['gpl'] = objects['GPL'] = GPL() # Initialise the user functions (those not in user function classes) - fix = Fix() reset = Reset() sys_info = Sys_info() temp = Temp() # Place the user functions in the local namespace. - objects['fix'] = fix.fix objects['reset'] = reset.reset objects['sys_info'] = sys_info.sys_info objects['temperature'] = temp.set Modified: branches/uf_redesign/user_functions/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/user_functions/__init__.py?rev=16103&r1=16102&r2=16103&view=diff ============================================================================== --- branches/uf_redesign/user_functions/__init__.py (original) +++ branches/uf_redesign/user_functions/__init__.py Tue May 8 16:17:40 2012 @@ -44,6 +44,7 @@ 'diffusion_tensor', 'dx', 'eliminate', + 'fix', 'minimisation', 'model_selection', 'molmol', @@ -66,6 +67,7 @@ import user_functions.diffusion_tensor import user_functions.dx import user_functions.eliminate +import user_functions.fix import user_functions.minimisation import user_functions.model_selection import user_functions.molmol Copied: branches/uf_redesign/user_functions/fix.py (from r16100, branches/uf_redesign/prompt/fix.py) URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/user_functions/fix.py?p2=branches/uf_redesign/user_functions/fix.py&p1=branches/uf_redesign/prompt/fix.py&r1=16100&r2=16103&rev=16103&view=diff ============================================================================== --- branches/uf_redesign/prompt/fix.py (original) +++ branches/uf_redesign/user_functions/fix.py Tue May 8 16:17:40 2012 @@ -21,57 +21,57 @@ ############################################################################### # Module docstring. -"""Module containing the 'fix' user function class.""" -__docformat__ = 'plaintext' +"""Module containing the 'fix' user function data.""" # relax module imports. -import arg_check from generic_fns import fix -from status import Status; status = Status() +from graphics import WIZARD_IMAGE_PATH +from user_functions.data import Uf_info; uf_info = Uf_info() -class Fix: - """Class containing the function for fixing or allowing parameter values to change.""" +# The fix user function. +uf = uf_info.add_uf('fix') +uf.title = "Fix or allow parameter values to change during optimisation." +uf.title_short = "Fixing of parameters." +uf.display = True +uf.add_keyarg( + name = "element", + py_type = "str", + desc_short = "element", + desc = "Which element to fix.", + wiz_element_type = "combo", + wiz_combo_choices = [ + "Diffusion tensor parameters", + "All parameters from all spins", + "All parameters (diffusion and spin)"], + wiz_combo_data = [ + "diff", + "all_spins", + "all"], + wiz_read_only = True, +) +uf.add_keyarg( + name = "fixed", + default = True, + py_type = "bool", + desc_short = "fixed", + desc = "A flag specifying if the parameters should be fixed or allowed to change." +) +uf.desc = """ +The keyword argument 'element' can be any of the following: - def fix(self, element=None, fixed=True): - """Function for either fixing or allowing parameter values to change during optimisation. + 'diff' - the diffusion tensor parameters. This will allow all diffusion tensor parameters to be toggled. + + 'all_spins' - using this keyword, all parameters from all spins will be toggled. + + 'all' - all parameters will be toggled. This is equivalent to combining both 'diff' and 'all_spins'. - Keyword Arguments - ~~~~~~~~~~~~~~~~~ - - element: Which element to fix. - - fixed: A flag specifying if the parameters should be fixed or allowed to change. - - - Description - ~~~~~~~~~~~ - - The keyword argument 'element' can be any of the following: - - 'diff' - the diffusion tensor parameters. This will allow all diffusion tensor parameters - to be toggled. - - 'all_spins' - using this keyword, all parameters from all spins will be toggled. - - 'all' - all parameter will be toggled. This is equivalent to combining both 'diff' and - 'all_spins'. - - - The flag 'fixed', if set to True, will fix parameters during optimisation whereas a value of - False will allow parameters to vary. - """ - - # Function intro text. - if status.prompt_intro: - text = status.ps3 + "fix(" - text = text + "element=" + repr(element) - text = text + ", fixed=" + repr(fixed) + ")" - print(text) - - # The argument checks. - arg_check.is_str(element, 'element') - arg_check.is_bool(fixed, 'fixed') - - # Execute the functional code. - fix.fix(element=element, fixed=fixed) +The flag 'fixed', if set to True, will fix parameters during optimisation whereas a value of False will allow parameters to vary. +""" +uf.backend = fix.fix +uf.menu_text = "&fix" +uf.gui_icon = "oxygen.status.object-locked" +uf.wizard_height_desc = 400 +uf.wizard_size = (800, 600) +uf.wizard_apply_button = False +uf.wizard_image = WIZARD_IMAGE_PATH + 'object-locked-unlocked.png'