diff options
author | Piotr Rotkiewicz <piotr@pirx.com> | 2008-08-13 22:50:37 +0000 |
---|---|---|
committer | Piotr Rotkiewicz <piotr@pirx.com> | 2008-08-13 22:50:37 +0000 |
commit | d6084f06bcd79effd99b90e7473b9ace3e5182c5 (patch) | |
tree | 9feab6d0b6e4d54e449440c931a9680bba29d920 | |
parent | 78f2b16038c03bcfcb2c48dd10aa3a43e06712e9 (diff) | |
download | nanoengineer-d6084f06bcd79effd99b90e7473b9ace3e5182c5.tar.gz nanoengineer-d6084f06bcd79effd99b90e7473b9ace3e5182c5.zip |
=Refactoring of the code that uses modelAndSimulateProteins global constant.
12 files changed, 38 insertions, 35 deletions
diff --git a/cad/src/ne1_ui/MWsemantics.py b/cad/src/ne1_ui/MWsemantics.py index 319d0778a..8021ca1dd 100755 --- a/cad/src/ne1_ui/MWsemantics.py +++ b/cad/src/ne1_ui/MWsemantics.py @@ -1760,8 +1760,8 @@ class MWsemantics(QMainWindow, Activates the Protein toolbar. """ commandSequencer = self.commandSequencer - from protein.commands.ModelAndSimulateProtein.ModelAndSimulateProtein_Command import modelAndSimulateProteins - if modelAndSimulateProteins: + from utilities.GlobalPreferences import MODEL_AND_SIMULATE_PROTEINS + if MODEL_AND_SIMULATE_PROTEINS: commandSequencer.userEnterCommand('MODEL_AND_SIMULATE_PROTEIN') #assert commandSequencer.currentCommand.commandName == 'MODEL_AND_SIMULATE_PROTEIN' #commandSequencer.currentCommand.runCommand() diff --git a/cad/src/protein/commands/BuildPeptide/Peptide_EditCommand.py b/cad/src/protein/commands/BuildPeptide/Peptide_EditCommand.py index 470b28802..b3db852ed 100644 --- a/cad/src/protein/commands/BuildPeptide/Peptide_EditCommand.py +++ b/cad/src/protein/commands/BuildPeptide/Peptide_EditCommand.py @@ -17,7 +17,7 @@ from protein.commands.BuildPeptide.PeptideGenerator import PeptideGenerator from utilities.constants import gensym from commands.SelectChunks.SelectChunks_GraphicsMode import SelectChunks_GraphicsMode from protein.temporary_commands.PeptideLineMode import PeptideLine_GM -from protein.commands.ModelAndSimulateProtein.ModelAndSimulateProtein_Command import modelAndSimulateProteins +from utilities.GlobalPreferences import MODEL_AND_SIMULATE_PROTEINS from utilities.debug import print_compact_stack, print_compact_traceback from protein.commands.ModelAndSimulateProtein.ModelAndSimulateProtein_Command import ModelAndSimulateProtein_Command @@ -35,7 +35,7 @@ class Peptide_EditCommand(EditCommand): command_level = CL_SUBCOMMAND command_parent = 'BUILD_PROTEIN' - if modelAndSimulateProteins: + if MODEL_AND_SIMULATE_PROTEINS: command_parent = 'MODEL_AND_SIMULATE_PROTEIN' create_name_from_prefix = True @@ -83,7 +83,7 @@ class Peptide_EditCommand(EditCommand): #Clear the segmentList as it may still be maintaining a list of segments #from the previous run of the command. self._segmentList = [] - if modelAndSimulateProteins: + if MODEL_AND_SIMULATE_PROTEINS: self._init_gui_flyout_action( 'buildPeptideAction', 'MODEL_AND_SIMULATE_PROTEIN' ) else: self._init_gui_flyout_action( 'buildPeptideAction') @@ -309,6 +309,7 @@ class Peptide_EditCommand(EditCommand): This is used in isinstance test. @see: EditCommand._getStructureType() (overridden here) """ + return self.win.assy.Chunk # Things needed for CntLine_GraphicsMode (NanotubeLine_GM) ====================== @@ -371,8 +372,10 @@ class Peptide_EditCommand(EditCommand): Returns a string that gives the length of the Nanotube for the cursor text """ - self.secondary, self.phi, self.psi, aa_type = self._gatherParameters() + # This should be moved to more appropriate place. piotr 081308 + self.secondary, self.phi, self.psi, aa_type = self._gatherParameters() + peptideLengthString = '' lengthUnitString = 'AA' diff --git a/cad/src/protein/commands/CompareProteins/CompareProteins_Command.py b/cad/src/protein/commands/CompareProteins/CompareProteins_Command.py index b3cbb42c0..631ac63b4 100644 --- a/cad/src/protein/commands/CompareProteins/CompareProteins_Command.py +++ b/cad/src/protein/commands/CompareProteins/CompareProteins_Command.py @@ -35,8 +35,8 @@ class CompareProteins_Command(EditCommand): from utilities.constants import CL_SUBCOMMAND command_level = CL_SUBCOMMAND command_parent = 'BUILD_PROTEIN' - from protein.commands.ModelAndSimulateProtein.ModelAndSimulateProtein_Command import modelAndSimulateProteins - if modelAndSimulateProteins: + from utilities.GlobalPreferences import MODEL_AND_SIMULATE_PROTEINS + if MODEL_AND_SIMULATE_PROTEINS: command_parent = 'MODEL_PROTEIN' GraphicsMode_class = CompareProteins_GraphicsMode @@ -52,8 +52,8 @@ class CompareProteins_Command(EditCommand): """ Initialize GUI for this mode """ - from protein.commands.ModelAndSimulateProtein.ModelAndSimulateProtein_Command import modelAndSimulateProteins - if modelAndSimulateProteins: + from utilities.GlobalPreferences import MODEL_AND_SIMULATE_PROTEINS + if MODEL_AND_SIMULATE_PROTEINS: self._init_gui_flyout_action( 'compareProteinsAction', 'MODEL_AND_SIMULATE_PROTEIN' ) else: self._init_gui_flyout_action( 'compareProteinsAction') diff --git a/cad/src/protein/commands/EditResidues/EditResidues_Command.py b/cad/src/protein/commands/EditResidues/EditResidues_Command.py index d80091429..15036771b 100644 --- a/cad/src/protein/commands/EditResidues/EditResidues_Command.py +++ b/cad/src/protein/commands/EditResidues/EditResidues_Command.py @@ -35,8 +35,8 @@ class EditResidues_Command(EditCommand): from utilities.constants import CL_SUBCOMMAND command_level = CL_SUBCOMMAND command_parent = 'BUILD_PROTEIN' - from protein.commands.ModelAndSimulateProtein.ModelAndSimulateProtein_Command import modelAndSimulateProteins - if modelAndSimulateProteins: + from utilities.GlobalPreferences import MODEL_AND_SIMULATE_PROTEINS + if MODEL_AND_SIMULATE_PROTEINS: command_parent = 'SIMULATE_PROTEIN' GraphicsMode_class = EditResidues_GraphicsMode @@ -52,8 +52,8 @@ class EditResidues_Command(EditCommand): """ Initialize GUI for this mode """ - from protein.commands.ModelAndSimulateProtein.ModelAndSimulateProtein_Command import modelAndSimulateProteins - if modelAndSimulateProteins: + from utilities.GlobalPreferences import MODEL_AND_SIMULATE_PROTEINS + if MODEL_AND_SIMULATE_PROTEINS: self._init_gui_flyout_action( 'editResiduesAction', 'MODEL_AND_SIMULATE_PROTEIN' ) else: self._init_gui_flyout_action( 'editResiduesAction') diff --git a/cad/src/protein/commands/EditResidues/EditResidues_PropertyManager.py b/cad/src/protein/commands/EditResidues/EditResidues_PropertyManager.py index 176401d1b..0517ba8b6 100644 --- a/cad/src/protein/commands/EditResidues/EditResidues_PropertyManager.py +++ b/cad/src/protein/commands/EditResidues/EditResidues_PropertyManager.py @@ -233,8 +233,8 @@ class EditResidues_PropertyManager( PM_Dialog, DebugMenuMixin ): #"current protein" in this mode. self.current_protein = "" - from protein.commands.ModelAndSimulateProtein.ModelAndSimulateProtein_Command import modelAndSimulateProteins - if modelAndSimulateProteins: + from utilities.GlobalPreferences import MODEL_AND_SIMULATE_PROTEINS + if MODEL_AND_SIMULATE_PROTEINS: previousCommand = self.command.find_parent_command_named('MODEL_AND_SIMULATE_PROTEIN') else: previousCommand = self.command.find_parent_command_named('BUILD_PROTEIN') diff --git a/cad/src/protein/commands/EditRotamers/EditRotamers_Command.py b/cad/src/protein/commands/EditRotamers/EditRotamers_Command.py index 8dd300877..04fdf766e 100644 --- a/cad/src/protein/commands/EditRotamers/EditRotamers_Command.py +++ b/cad/src/protein/commands/EditRotamers/EditRotamers_Command.py @@ -35,8 +35,8 @@ class EditRotamers_Command(EditCommand): from utilities.constants import CL_SUBCOMMAND command_level = CL_SUBCOMMAND command_parent = 'BUILD_PROTEIN' - from protein.commands.ModelAndSimulateProtein.ModelAndSimulateProtein_Command import modelAndSimulateProteins - if modelAndSimulateProteins: + from utilities.GlobalPreferences import MODEL_AND_SIMULATE_PROTEINS + if MODEL_AND_SIMULATE_PROTEINS: command_parent = 'MODEL_PROTEIN' GraphicsMode_class = EditRotamers_GraphicsMode @@ -52,8 +52,8 @@ class EditRotamers_Command(EditCommand): """ Initialize GUI for this mode """ - from protein.commands.ModelAndSimulateProtein.ModelAndSimulateProtein_Command import modelAndSimulateProteins - if modelAndSimulateProteins: + from utilities.GlobalPreferences import MODEL_AND_SIMULATE_PROTEINS + if MODEL_AND_SIMULATE_PROTEINS: self._init_gui_flyout_action( 'editRotamersAction', 'MODEL_AND_SIMULATE_PROTEIN' ) else: self._init_gui_flyout_action( 'editRotamersAction') diff --git a/cad/src/protein/commands/EditRotamers/EditRotamers_PropertyManager.py b/cad/src/protein/commands/EditRotamers/EditRotamers_PropertyManager.py index 788b08066..7528ee2dc 100644 --- a/cad/src/protein/commands/EditRotamers/EditRotamers_PropertyManager.py +++ b/cad/src/protein/commands/EditRotamers/EditRotamers_PropertyManager.py @@ -157,8 +157,8 @@ class EditRotamers_PropertyManager( PM_Dialog, DebugMenuMixin ): #Urmi 20080728: Update the residue combo box with amino acids for the #currently selected protein in build protein mode self.current_protein = "" - from protein.commands.ModelAndSimulateProtein.ModelAndSimulateProtein_Command import modelAndSimulateProteins - if modelAndSimulateProteins: + from utilities.GlobalPreferences import MODEL_AND_SIMULATE_PROTEINS + if MODEL_AND_SIMULATE_PROTEINS: previousCommand = self.command.find_parent_command_named('MODEL_AND_SIMULATE_PROTEIN') else: previousCommand = self.command.find_parent_command_named('BUILD_PROTEIN') @@ -247,8 +247,8 @@ class EditRotamers_PropertyManager( PM_Dialog, DebugMenuMixin ): self.current_protein = "" #Urmi 20080728: fill up the combo box with amino acids belonging to the # current protein in build protein mode - from protein.commands.ModelAndSimulateProtein.ModelAndSimulateProtein_Command import modelAndSimulateProteins - if modelAndSimulateProteins: + from utilities.GlobalPreferences import MODEL_AND_SIMULATE_PROTEINS + if MODEL_AND_SIMULATE_PROTEINS: previousCommand = self.command.find_parent_command_named('MODEL_AND_SIMULATE_PROTEIN') else: previousCommand = self.command.find_parent_command_named('BUILD_PROTEIN') @@ -529,7 +529,7 @@ class EditRotamers_PropertyManager( PM_Dialog, DebugMenuMixin ): current_aa = chunk.protein.get_current_amino_acid() if current_aa: chunk.protein.expand_rotamer(current_aa) - current_aa.set_chi_angle(chi, angle, lock=self.lockEditedCheckBox.isChecked()) + current_aa.set_chi_angle(chi, angle) self.win.glpane.gl_update() return diff --git a/cad/src/protein/commands/ModelAndSimulateProtein/ModelAndSimulateProtein_Command.py b/cad/src/protein/commands/ModelAndSimulateProtein/ModelAndSimulateProtein_Command.py index cd8f3710b..6dab8d824 100644 --- a/cad/src/protein/commands/ModelAndSimulateProtein/ModelAndSimulateProtein_Command.py +++ b/cad/src/protein/commands/ModelAndSimulateProtein/ModelAndSimulateProtein_Command.py @@ -13,10 +13,6 @@ from utilities.constants import gensym from ne1_ui.toolbars.Ui_ProteinFlyout_v2 import ProteinFlyout_v2 from protein.commands.ModelAndSimulateProtein.ModelAndSimulateProtein_PropertyManager import ModelAndSimulateProtein_PropertyManager from utilities.debug_prefs import debug_pref, Choice_boolean_False -modelAndSimulateProteins = debug_pref("Enable model and simulate protein flyout? (next session)", - Choice_boolean_False, - non_debug = True, - prefs_key = True) _superclass = EditCommand class ModelAndSimulateProtein_Command(EditCommand): diff --git a/cad/src/protein/commands/ProteinDisplayStyle/ProteinDisplayStyle_Command.py b/cad/src/protein/commands/ProteinDisplayStyle/ProteinDisplayStyle_Command.py index 8b6fa17e9..fa6c48f49 100644 --- a/cad/src/protein/commands/ProteinDisplayStyle/ProteinDisplayStyle_Command.py +++ b/cad/src/protein/commands/ProteinDisplayStyle/ProteinDisplayStyle_Command.py @@ -52,8 +52,8 @@ class ProteinDisplayStyle_Command(EditCommand): """ Initialize GUI for this mode """ - from protein.commands.ModelAndSimulateProtein.ModelAndSimulateProtein_Command import modelAndSimulateProteins - if modelAndSimulateProteins: + from utilities.GlobalPreferences import MODEL_AND_SIMULATE_PROTEINS + if MODEL_AND_SIMULATE_PROTEINS: self._init_gui_flyout_action( 'displayProteinStyleAction' , 'MODEL_AND_SIMULATE_PROTEIN') else: diff --git a/cad/src/protein/model/Protein.py b/cad/src/protein/model/Protein.py index e30fa3116..b6fb9e3ec 100644 --- a/cad/src/protein/model/Protein.py +++ b/cad/src/protein/model/Protein.py @@ -1053,8 +1053,8 @@ class Protein: model. May be we'll take care of that when we move to the new model """ - from protein.commands.ModelAndSimulateProtein.ModelAndSimulateProtein_Command import modelAndSimulateProteins - if modelAndSimulateProteins: + from utilities.GlobalPreferences import MODEL_AND_SIMULATE_PROTEINS + if MODEL_AND_SIMULATE_PROTEINS: win.commandSequencer.userEnterCommand('MODEL_AND_SIMULATE_PROTEIN') else: win.commandSequencer.userEnterTemporaryCommand('BUILD_PROTEIN') diff --git a/cad/src/simulation/ROSETTA/runRosetta.py b/cad/src/simulation/ROSETTA/runRosetta.py index 777619acd..cc6ee3dbf 100644 --- a/cad/src/simulation/ROSETTA/runRosetta.py +++ b/cad/src/simulation/ROSETTA/runRosetta.py @@ -1107,8 +1107,8 @@ class RosettaRunner: @type outProtein: L{Chunk} """ - from protein.commands.ModelAndSimulateProtein.ModelAndSimulateProtein_Command import modelAndSimulateProteins - if modelAndSimulateProteins: + from utilities.GlobalPreferences import MODEL_AND_SIMULATE_PROTEINS + if MODEL_AND_SIMULATE_PROTEINS: command = self.win.commandSequencer.find_innermost_command_named('MODEL_AND_SIMULATE_PROTEIN') else: command = self.win.commandSequencer.find_innermost_command_named('BUILD_PROTEIN') diff --git a/cad/src/utilities/GlobalPreferences.py b/cad/src/utilities/GlobalPreferences.py index 57fd71815..e6367fd4f 100644 --- a/cad/src/utilities/GlobalPreferences.py +++ b/cad/src/utilities/GlobalPreferences.py @@ -484,6 +484,10 @@ enableProteins = debug_pref("Enable Proteins? (next session)", prefs_key = True ) +MODEL_AND_SIMULATE_PROTEINS = debug_pref("Enable model and simulate protein flyout? (next session)", + Choice_boolean_False, + non_debug = True, + prefs_key = True) def _debug_pref_keep_signals_always_connected(): #Ninad 2008-08-13 #-The current code always connects signals while shown a PM and |