summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNinad Sathaye <ninad@nanorex.com>2008-09-05 22:10:12 +0000
committerNinad Sathaye <ninad@nanorex.com>2008-09-05 22:10:12 +0000
commit6a80ec6fedad48c9a10d7c78634457acf1349c61 (patch)
treeec2ec20f67ea2cb5523bcd05235c4312d1e60edf
parent2271b377573ef0b0653373d47042dd223a78b92a (diff)
downloadnanoengineer-theirix-6a80ec6fedad48c9a10d7c78634457acf1349c61.tar.gz
nanoengineer-theirix-6a80ec6fedad48c9a10d7c78634457acf1349c61.zip
major cleanup and refactoring.
1. removed 'win' arg from EditCommand_PM and subclasses 2. #1 now facilitate use of class attr PM_class . so implemented that to a number of commands. (I am likely to be missing some commands and will do that later. It should be implemented for *all* direct and indirect subclasses of Editcommand. 3. ported some commands to new command API. 4. Bug fixes and code cleanup (needed to do it while making above changes. Notable change include: change in 'create_and_or_show_PM_if_wanted'. I have done a lot of testing (with both USE_COMMAND_STACK and without that debug flag) but some bugs could still have slipped in.
-rw-r--r--cad/src/cnt/commands/BuildNanotube/BuildNanotube_EditCommand.py22
-rw-r--r--cad/src/cnt/commands/BuildNanotube/BuildNanotube_PropertyManager.py6
-rw-r--r--cad/src/cnt/commands/InsertNanotube/InsertNanotube_EditCommand.py20
-rw-r--r--cad/src/cnt/commands/InsertNanotube/InsertNanotube_PropertyManager.py6
-rw-r--r--cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_EditCommand.py26
-rw-r--r--cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_PropertyManager.py6
-rwxr-xr-xcad/src/command_support/Command.py6
-rw-r--r--cad/src/command_support/DnaOrCnt_PropertyManager.py6
-rw-r--r--cad/src/command_support/EditCommand.py122
-rw-r--r--cad/src/command_support/EditCommand_PM.py18
-rw-r--r--cad/src/command_support/MotorPropertyManager.py6
-rwxr-xr-xcad/src/commands/InsertGraphene/GrapheneGeneratorPropertyManager.py4
-rw-r--r--cad/src/commands/InsertGraphene/Graphene_EditCommand.py22
-rw-r--r--cad/src/commands/LinearMotorProperties/LinearMotor_EditCommand.py15
-rwxr-xr-xcad/src/commands/PlaneProperties/PlanePropertyManager.py6
-rwxr-xr-xcad/src/commands/PlaneProperties/Plane_EditCommand.py17
-rw-r--r--cad/src/commands/RotaryMotorProperties/RotaryMotor_EditCommand.py19
-rw-r--r--cad/src/dna/command_support/BreakOrJoinStrands_Command.py13
-rw-r--r--cad/src/dna/commands/BreakStrands/BreakStrands_Command.py5
-rw-r--r--cad/src/dna/commands/BuildDna/BuildDna_EditCommand.py26
-rw-r--r--cad/src/dna/commands/BuildDna/BuildDna_PropertyManager.py6
-rw-r--r--cad/src/dna/commands/BuildDuplex/DnaDuplexPropertyManager.py6
-rw-r--r--cad/src/dna/commands/BuildDuplex/DnaDuplex_EditCommand.py24
-rw-r--r--cad/src/dna/commands/DnaDisplayStyle/DnaDisplayStyle_Command.py37
-rw-r--r--cad/src/dna/commands/DnaSegment/DnaSegment_EditCommand.py25
-rw-r--r--cad/src/dna/commands/DnaSegment/DnaSegment_PropertyManager.py4
-rw-r--r--cad/src/dna/commands/DnaStrand/DnaStrand_EditCommand.py24
-rw-r--r--cad/src/dna/commands/DnaStrand/DnaStrand_PropertyManager.py6
-rw-r--r--cad/src/dna/commands/JoinStrands/JoinStrands_Command.py10
-rw-r--r--cad/src/dna/commands/MakeCrossovers/MakeCrossovers_Command.py6
-rw-r--r--cad/src/dna/commands/MultipleDnaSegmentResize/MultipleDnaSegmentResize_EditCommand.py21
-rw-r--r--cad/src/dna/commands/MultipleDnaSegmentResize/MultipleDnaSegmentResize_PropertyManager.py6
-rw-r--r--cad/src/protein/commands/BackrubProteinSim/BackrubProteinSim_Command.py4
-rwxr-xr-xcad/src/protein/commands/BuildPeptide/PeptideGeneratorPropertyManager.py4
-rw-r--r--cad/src/protein/commands/BuildPeptide/Peptide_EditCommand.py17
-rw-r--r--cad/src/protein/commands/BuildProtein/BuildProtein_EditCommand.py22
-rw-r--r--cad/src/protein/commands/BuildProtein/BuildProtein_PropertyManager.py10
-rw-r--r--cad/src/protein/commands/CompareProteins/CompareProteins_Command.py7
-rw-r--r--cad/src/protein/commands/EditResidues/EditResidues_Command.py7
-rw-r--r--cad/src/protein/commands/EditRotamers/EditRotamers_Command.py7
-rw-r--r--cad/src/protein/commands/FixedBBProteinSim/FixedBBProteinSim_Command.py6
-rw-r--r--cad/src/protein/commands/ModelAndSimulateProtein/ModelAndSimulateProtein_Command.py5
-rw-r--r--cad/src/protein/commands/ModelAndSimulateProtein/ModelAndSimulateProtein_PropertyManager.py10
-rw-r--r--cad/src/protein/commands/ProteinDisplayStyle/ProteinDisplayStyle_Command.py8
44 files changed, 275 insertions, 378 deletions
diff --git a/cad/src/cnt/commands/BuildNanotube/BuildNanotube_EditCommand.py b/cad/src/cnt/commands/BuildNanotube/BuildNanotube_EditCommand.py
index 0416b18f1..274d56e0f 100644
--- a/cad/src/cnt/commands/BuildNanotube/BuildNanotube_EditCommand.py
+++ b/cad/src/cnt/commands/BuildNanotube/BuildNanotube_EditCommand.py
@@ -37,12 +37,21 @@ from model.bonds import Bond
##from SelectChunks_GraphicsMode import SelectChunks_GraphicsMode
from cnt.commands.BuildNanotube.BuildNanotube_GraphicsMode import BuildNanotube_GraphicsMode
+from cnt.commands.BuildNanotube.BuildNanotube_PropertyManager import BuildNanotube_PropertyManager
+
class BuildNanotube_EditCommand(EditCommand):
"""
BuildNanotube_EditCommand provides a convenient way to edit or create
a NanotubeGroup object
"""
+
+ #GraphicsMode
+ GraphicsMode_class = BuildNanotube_GraphicsMode
+
+ #PropertyManager
+ PM_class = BuildNanotube_PropertyManager
+
cmd = greenmsg("Build Nanotube: ")
prefix = 'NanotubeGroup' # used for gensym
cmdname = "Build Nanotube"
@@ -52,8 +61,6 @@ class BuildNanotube_EditCommand(EditCommand):
from utilities.constants import CL_ENVIRONMENT_PROVIDING
command_level = CL_ENVIRONMENT_PROVIDING
- GraphicsMode_class = BuildNanotube_GraphicsMode
-
command_should_resume_prevMode = False
command_has_its_own_PM = True
command_can_be_suspended = True
@@ -215,17 +222,6 @@ class BuildNanotube_EditCommand(EditCommand):
"""
return self.win.assy.NanotubeGroup
-
- def _createPropMgrObject(self):
- """
- Creates a property manager object (that defines UI things) for this
- editCommand.
- """
- assert not self.propMgr
- propMgr = self.win.createBuildNanotubePropMgr_if_needed(self)
- return propMgr
-
-
def _createStructure(self):
"""
creates and returns the structure (in this case a L{Group} object that
diff --git a/cad/src/cnt/commands/BuildNanotube/BuildNanotube_PropertyManager.py b/cad/src/cnt/commands/BuildNanotube/BuildNanotube_PropertyManager.py
index 6bb6b60e0..db771c19a 100644
--- a/cad/src/cnt/commands/BuildNanotube/BuildNanotube_PropertyManager.py
+++ b/cad/src/cnt/commands/BuildNanotube/BuildNanotube_PropertyManager.py
@@ -63,7 +63,7 @@ class BuildNanotube_PropertyManager( EditCommand_PM, DebugMenuMixin ):
pmName = title
iconPath = "ui/actions/Tools/Build Structures/Nanotube.png"
- def __init__( self, win, command ):
+ def __init__( self, command ):
"""
Constructor for the Build Nanotube property manager.
"""
@@ -77,9 +77,7 @@ class BuildNanotube_PropertyManager( EditCommand_PM, DebugMenuMixin ):
self.sequenceEditor = None
- EditCommand_PM.__init__( self,
- win,
- command)
+ EditCommand_PM.__init__( self, command)
DebugMenuMixin._init1( self )
diff --git a/cad/src/cnt/commands/InsertNanotube/InsertNanotube_EditCommand.py b/cad/src/cnt/commands/InsertNanotube/InsertNanotube_EditCommand.py
index c2ab0c417..7649207f8 100644
--- a/cad/src/cnt/commands/InsertNanotube/InsertNanotube_EditCommand.py
+++ b/cad/src/cnt/commands/InsertNanotube/InsertNanotube_EditCommand.py
@@ -61,6 +61,12 @@ class InsertNanotube_EditCommand(EditCommand):
#Temporary attr 'command_porting_status. See baseCommand for details.
command_porting_status = "NOT_PORTED"
+ #Graphics Mode set to CntLine graphics mode
+ GraphicsMode_class = NanotubeLine_GM
+
+ #Property Manager
+ PM_class = InsertNanotube_PropertyManager
+
cmd = greenmsg("Insert Nanotube: ")
prefix = 'Nanotube' # used for gensym
@@ -80,9 +86,7 @@ class InsertNanotube_EditCommand(EditCommand):
# generated (in GeneratorBaseClass) from the prefix.
create_name_from_prefix = True
- #Graphics Mode set to CntLine graphics mode
- GraphicsMode_class = NanotubeLine_GM
-
+
#required by NanotubeLine_GM
mouseClickPoints = []
@@ -225,15 +229,7 @@ class InsertNanotube_EditCommand(EditCommand):
self.graphicsMode.resetVariables()
- def _createPropMgrObject(self):
- """
- Creates a property manager object (that defines UI things) for this
- editCommand.
- """
- assert not self.propMgr
- propMgr = InsertNanotube_PropertyManager(self.win, self)
- return propMgr
-
+
def _getStructureType(self):
"""
Subclasses override this method to define their own structure type.
diff --git a/cad/src/cnt/commands/InsertNanotube/InsertNanotube_PropertyManager.py b/cad/src/cnt/commands/InsertNanotube/InsertNanotube_PropertyManager.py
index 9fd1762b7..4097ad4da 100644
--- a/cad/src/cnt/commands/InsertNanotube/InsertNanotube_PropertyManager.py
+++ b/cad/src/cnt/commands/InsertNanotube/InsertNanotube_PropertyManager.py
@@ -66,7 +66,7 @@ class InsertNanotube_PropertyManager( DnaOrCnt_PropertyManager):
pmName = title
iconPath = "ui/actions/Tools/Build Structures/InsertNanotube.png"
- def __init__( self, win, command ):
+ def __init__( self, command ):
"""
Constructor for the Nanotube property manager.
"""
@@ -75,9 +75,7 @@ class InsertNanotube_PropertyManager( DnaOrCnt_PropertyManager):
self.nanotube = Nanotube() # A 5x5 CNT.
- _superclass.__init__( self,
- win,
- command)
+ _superclass.__init__( self, command)
self.showTopRowButtons( PM_DONE_BUTTON | \
PM_CANCEL_BUTTON | \
diff --git a/cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_EditCommand.py b/cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_EditCommand.py
index c4356abdf..ca9318b30 100644
--- a/cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_EditCommand.py
+++ b/cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_EditCommand.py
@@ -70,6 +70,8 @@ from utilities.prefs_constants import nanotubeSegmentEditCommand_cursorTextCheck
from utilities.prefs_constants import nanotubeSegmentEditCommand_showCursorTextCheckBox_prefs_key
from utilities.prefs_constants import cursorTextColor_prefs_key
+from cnt.commands.NanotubeSegment.NanotubeSegment_PropertyManager import NanotubeSegment_PropertyManager
+
CYLINDER_WIDTH_DEFAULT_VALUE = 0.0
HANDLE_RADIUS_DEFAULT_VALUE = 1.2
ORIGIN = V(0,0,0)
@@ -94,6 +96,17 @@ class NanotubeSegment_EditCommand(State_preMixin, EditCommand):
enters NanotubeSegment_Editcommand and shows the property manager with its
widgets showing the properties of selected segment.
"""
+
+ #Temporary attr 'command_porting_status. See baseCommand for details.
+ command_porting_status = "NOT_PORTED"
+
+ #Graphics Mode
+ GraphicsMode_class = NanotubeSegment_GraphicsMode
+
+ #Property Manager
+ PM_class = NanotubeSegment_PropertyManager
+
+
cmd = 'Nanotube Segment'
prefix = 'NanotubeSegment' # used for gensym
cmdname = "NANOTUBE_SEGMENT"
@@ -112,9 +125,6 @@ class NanotubeSegment_EditCommand(State_preMixin, EditCommand):
call_makeMenus_for_each_event = True
- #Graphics Mode
- GraphicsMode_class = NanotubeSegment_GraphicsMode
-
#This is set to BuildDna_EditCommand.flyoutToolbar (as of 2008-01-14,
#it only uses
flyoutToolbar = None
@@ -412,15 +422,7 @@ class NanotubeSegment_EditCommand(State_preMixin, EditCommand):
self._resizeHandle_stopper_length = - total_length + nanotubeRise
return
- def _createPropMgrObject(self):
- """
- Creates a property manager object (that defines UI things) for this
- editCommand.
- """
- assert not self.propMgr
- propMgr = self.win.createNanotubeSegmentPropMgr_if_needed(self)
- return propMgr
-
+
def _gatherParameters(self):
"""
Return the parameters from the property manager UI.
diff --git a/cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_PropertyManager.py b/cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_PropertyManager.py
index 83dd56570..23f423904 100644
--- a/cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_PropertyManager.py
+++ b/cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_PropertyManager.py
@@ -51,7 +51,7 @@ class NanotubeSegment_PropertyManager( DnaOrCnt_PropertyManager ):
pmName = title
iconPath = "ui/actions/Tools/Build Structures/Nanotube.png"
- def __init__( self, win, command ):
+ def __init__( self, command ):
"""
Constructor for the Cnt Segment Properties property manager.
"""
@@ -68,9 +68,7 @@ class NanotubeSegment_PropertyManager( DnaOrCnt_PropertyManager ):
self.endPoint1 = V(0, 0, 0)
self.endPoint2 = V(0, 0, 0)
- _superclass.__init__( self,
- win,
- command)
+ _superclass.__init__( self, command)
self.showTopRowButtons( PM_DONE_BUTTON | \
diff --git a/cad/src/command_support/Command.py b/cad/src/command_support/Command.py
index e0c9351dd..b7040b073 100755
--- a/cad/src/command_support/Command.py
+++ b/cad/src/command_support/Command.py
@@ -503,9 +503,9 @@ class basicCommand(anyCommand):
#@bug BUG: following is a workaround for bug 2494.
#This bug is mitigated as propMgr object no longer gets recreated
#for modes -- ninad 2007-08-29
- changes.keep_forever(self.propMgr)
-
-
+ if self.propMgr:
+ changes.keep_forever(self.propMgr)
+
if not USE_COMMAND_STACK:
def command_exit_PM(self):
"""
diff --git a/cad/src/command_support/DnaOrCnt_PropertyManager.py b/cad/src/command_support/DnaOrCnt_PropertyManager.py
index b914e13d8..fc86d3fd8 100644
--- a/cad/src/command_support/DnaOrCnt_PropertyManager.py
+++ b/cad/src/command_support/DnaOrCnt_PropertyManager.py
@@ -48,7 +48,7 @@ class DnaOrCnt_PropertyManager(EditCommand_PM, DebugMenuMixin):
@see: DnaDuplexPropertyManager (subclass)
"""
- def __init__( self, win, command ):
+ def __init__( self, command ):
"""
Constructor for the DNA Duplex property manager.
"""
@@ -70,9 +70,7 @@ class DnaOrCnt_PropertyManager(EditCommand_PM, DebugMenuMixin):
self.isAlreadyDisconnected = False
- _superclass.__init__( self,
- win,
- command)
+ _superclass.__init__( self, command)
DebugMenuMixin._init1( self )
diff --git a/cad/src/command_support/EditCommand.py b/cad/src/command_support/EditCommand.py
index 8da0a8104..7fdb92b23 100644
--- a/cad/src/command_support/EditCommand.py
+++ b/cad/src/command_support/EditCommand.py
@@ -83,6 +83,13 @@ class EditCommand(Select_Command):
propMgr = None
flyoutToolbar = None
+
+
+ PM_class = None
+ #Command subclasses can override this class constant with the appropriate
+ #Property Manager class. See baseCommand class definition for more
+ #details.
+
def __init__(self, commandSequencer):
"""
@@ -148,29 +155,6 @@ class EditCommand(Select_Command):
"""
pass
- def command_enter_PM(self):
- """
- Setup GUI related to the Property Manager (PM)
- May be overridden in subclasses. Default implementation creates and
- shows PM (if requested)
- Overrides the superclass method.
- @see: baseCommand.command_enter_PM()
- @see: self.command_exit_PM()
- @see: self.command_enter_flyout()
- """
- self.create_and_or_show_PM_if_wanted()
-
- def command_exit_PM(self):
- """
- Reset/ change GUI related to the Property Manager (PM)
- May be overridden in subclasses.
- @see: self.command_enter_PM()
- @see: baseCommand.command_exit_PM()
- @see: self.command_exit_flyout()
- """
- if not USE_COMMAND_STACK:
- if self.propMgr:
- self.propMgr.close()
def command_enter_misc_actions(self):
pass
@@ -179,31 +163,55 @@ class EditCommand(Select_Command):
pass
#=== END NEW command API methods ========================================
+
+ if not USE_COMMAND_STACK:
- def init_gui(self):
+ def init_gui(self):
+
+ """
+ Do changes to the GUI while entering this command. This includes opening
+ the property manager, updating the command toolbar , connecting widget
+ slots (if any) etc. Note: The slot connection in property manager and
+ command toolbar is handled in those classes.
+
+ Called once each time the command is entered; should be called only
+ by code in modes.py
+
+ @see: L{self.restore_gui}
+ """
+ self.create_and_or_show_PM_if_wanted()
+ self.command_enter_flyout()
+ self.command_enter_misc_actions()
+
+ def restore_gui(self):
+ """
+ """
+
+ self.command_exit_flyout()
+ self.command_exit_misc_actions()
+ if self.propMgr:
+ self.propMgr.close()
+
+ def create_and_or_show_PM_if_wanted(self, showPropMgr = True):
"""
- Do changes to the GUI while entering this command. This includes opening
- the property manager, updating the command toolbar , connecting widget
- slots (if any) etc. Note: The slot connection in property manager and
- command toolbar is handled in those classes.
-
- Called once each time the command is entered; should be called only
- by code in modes.py
-
- @see: L{self.restore_gui}
+ Create the property manager object if one doesn't already exist
+ and then (if not USE_COMMAND_STACK) show the propMgr if wanted
+ by the user
+
+ @param showPropMgr: If True, show the property manager
+ @type showPropMgr: boolean
"""
- self.command_enter_PM()
- self.command_enter_flyout()
- self.command_enter_misc_actions()
+ if not self.propMgr:
+ self.propMgr = self._createPropMgrObject()
+ if self.propMgr:
+ #IMPORTANT keep this propMgr permanently -- needed to fix bug 2563
+ # (REVIEW: still needed, given that it's stored in self? [bruce 080819 question])
+ changes.keep_forever(self.propMgr)
- def restore_gui(self):
- """
- """
- self.command_exit_PM()
- self.command_exit_flyout()
- self.command_exit_misc_actions()
-
+ if showPropMgr and self.propMgr:
+ self.propMgr.show()
+
def runCommand(self):
"""
Used to run this editCommand . Depending upon the
@@ -220,26 +228,6 @@ class EditCommand(Select_Command):
self.struct = None
self.createStructure()
- def create_and_or_show_PM_if_wanted(self, showPropMgr = True):
- """
- Create the property manager object if one doesn't already exist
- and then (if not USE_COMMAND_STACK) show the propMgr if wanted
- by the user
-
- @param showPropMgr: If True, show the property manager
- @type showPropMgr: boolean
- """
- if not self.propMgr:
- self.propMgr = self._createPropMgrObject()
- #IMPORTANT keep this propMgr permanently -- needed to fix bug 2563
- # (REVIEW: still needed, given that it's stored in self? [bruce 080819 question])
- changes.keep_forever(self.propMgr)
-
- if not USE_COMMAND_STACK:
-
- if showPropMgr:
- self.propMgr.show()
-
def createStructure(self, showPropMgr = True):
"""
Default implementation of createStructure method.
@@ -387,13 +375,7 @@ class EditCommand(Select_Command):
"""
raise AbstractMethod()
- def _createPropMgrObject(self):
- """
- Abstract method (overridden in subclasses). Creates a property manager
- object (that defines UI things) for this editCommand.
- """
- raise AbstractMethod()
-
+
def _modifyStructure(self, params):
"""
Abstract method that modifies the structure (i.e. the object created
diff --git a/cad/src/command_support/EditCommand_PM.py b/cad/src/command_support/EditCommand_PM.py
index b918b9611..d852f915f 100644
--- a/cad/src/command_support/EditCommand_PM.py
+++ b/cad/src/command_support/EditCommand_PM.py
@@ -36,7 +36,7 @@ class EditCommand_PM(PM_Dialog):
# The relative path to the PNG file that appears in the header
iconPath = ""
- def __init__(self, win, command = None):
+ def __init__(self, command):
"""
Constructor for the EditCommand_PM
"""
@@ -50,13 +50,9 @@ class EditCommand_PM(PM_Dialog):
# might be one of them .--- ninad 20070613
self.command = command
- if command:
- self.struct = self.command.struct
- else:
- self.struct = None
- self.win = win
- self.w = win
+ self.win = self.command.win
+ self.w = self.command.win
self.pw = None
PM_Dialog.__init__(self,
@@ -73,8 +69,8 @@ class EditCommand_PM(PM_Dialog):
"""
assert command
self.command = command
- self.struct = self.command.struct
-
+
+
def show(self):
"""
Shows the Property Manager. Overrides PM_Dialog.show)
@@ -148,8 +144,8 @@ class EditCommand_PM(PM_Dialog):
# [ninad 2007-10-09 comment]
#called from updatePropertyManager in Ui_PartWindow.py (Partwindowclass)
- if hasattr(self.struct, 'updateCosmeticProps'):
- self.struct.updateCosmeticProps()
+ if self.command.struct and hasattr(self.command.struct, 'updateCosmeticProps'):
+ self.command.struct.updateCosmeticProps()
self.enable_or_disable_gui_actions(bool_enable = True)
def enable_or_disable_gui_actions(self, bool_enable = False):
diff --git a/cad/src/command_support/MotorPropertyManager.py b/cad/src/command_support/MotorPropertyManager.py
index 94a7e6c20..016fcd8d7 100644
--- a/cad/src/command_support/MotorPropertyManager.py
+++ b/cad/src/command_support/MotorPropertyManager.py
@@ -34,14 +34,12 @@ class MotorPropertyManager(EditCommand_PM):
#This should be overridden in subclasses
iconPath = "ui/actions/Simulation/Motor_JUNK.png"
- def __init__(self, win, motorEditCommand):
+ def __init__(self, command):
"""
Construct the Motor Property Manager.
"""
- EditCommand_PM.__init__( self,
- win,
- motorEditCommand)
+ EditCommand_PM.__init__( self, command)
msg = "Attach a " + self.title + " to the selected atoms"
diff --git a/cad/src/commands/InsertGraphene/GrapheneGeneratorPropertyManager.py b/cad/src/commands/InsertGraphene/GrapheneGeneratorPropertyManager.py
index b32bce091..2138fe32e 100755
--- a/cad/src/commands/InsertGraphene/GrapheneGeneratorPropertyManager.py
+++ b/cad/src/commands/InsertGraphene/GrapheneGeneratorPropertyManager.py
@@ -40,11 +40,11 @@ class GrapheneGeneratorPropertyManager(EditCommand_PM):
# The relative path to PNG file that appears in the header.
iconPath = "ui/actions/Tools/Build Structures/Graphene.png"
- def __init__( self, win, command ):
+ def __init__( self, command ):
"""
Construct the "Build Graphene" Property Manager.
"""
- _superclass.__init__( self, win, command )
+ _superclass.__init__( self, command )
msg = "Edit the Graphene sheet parameters and select <b>Preview</b> to" \
"preview the structure. Click <b>Done</b> to insert it into the model."
diff --git a/cad/src/commands/InsertGraphene/Graphene_EditCommand.py b/cad/src/commands/InsertGraphene/Graphene_EditCommand.py
index 58887e0c3..7f145d082 100644
--- a/cad/src/commands/InsertGraphene/Graphene_EditCommand.py
+++ b/cad/src/commands/InsertGraphene/Graphene_EditCommand.py
@@ -21,6 +21,7 @@ from commands.InsertGraphene.GrapheneGenerator import GrapheneGenerator
from utilities.constants import gensym
from commands.SelectChunks.SelectChunks_GraphicsMode import SelectChunks_GraphicsMode
from ne1_ui.toolbars.Ui_GrapheneFlyout import GrapheneFlyout
+from commands.InsertGraphene.GrapheneGeneratorPropertyManager import GrapheneGeneratorPropertyManager
_superclass = EditCommand
class Graphene_EditCommand(EditCommand):
@@ -39,6 +40,9 @@ class Graphene_EditCommand(EditCommand):
GraphicsMode_class = SelectChunks_GraphicsMode
+ #Property Manager
+ PM_class = GrapheneGeneratorPropertyManager
+
def _gatherParameters(self):
"""
Return the parameters from the property manager.
@@ -106,17 +110,7 @@ class Graphene_EditCommand(EditCommand):
self.struct = self._createStructure()
- def _createPropMgrObject(self):
- """
- Creates a property manager object (that defines UI things) for this
- editCommand.
- """
- assert not self.propMgr
-
- propMgr = self.win.createBuildGraphenePropMgr_if_needed(self)
-
- return propMgr
-
+
def command_enter_flyout(self):
"""
Overrides superclass method.
@@ -155,9 +149,3 @@ class Graphene_EditCommand(EditCommand):
"""
return self.win.assy.Chunk
-
-
-
-
-
-
diff --git a/cad/src/commands/LinearMotorProperties/LinearMotor_EditCommand.py b/cad/src/commands/LinearMotorProperties/LinearMotor_EditCommand.py
index 28056425d..af7c88c73 100644
--- a/cad/src/commands/LinearMotorProperties/LinearMotor_EditCommand.py
+++ b/cad/src/commands/LinearMotorProperties/LinearMotor_EditCommand.py
@@ -17,6 +17,7 @@ from operations.jigmakers_Mixin import atom_limit_exceeded_and_confirmed
from command_support.EditCommand import EditCommand
from commands.SelectAtoms.SelectAtoms_GraphicsMode import SelectAtoms_GraphicsMode
+from commands.LinearMotorProperties.LinearMotorPropertyManager import LinearMotorPropertyManager
class LinearMotor_EditCommand(EditCommand):
"""
@@ -24,6 +25,9 @@ class LinearMotor_EditCommand(EditCommand):
The editCommand, depending on what client code needs it to do, may create
a new linear motor or it may be used for an existing linear motor.
"""
+
+ PM_class = LinearMotorPropertyManager
+
cmd = greenmsg("Linear Motor: ")
#
prefix = '' # Not used by jigs.
@@ -190,16 +194,7 @@ class LinearMotor_EditCommand(EditCommand):
self.win.win_update() # Update model tree
self.win.assy.changed()
- def _createPropMgrObject(self):
- """
- Creates a property manager object (that defines UI things) for this
- editCommand.
- """
- assert not self.propMgr
-
- propMgr = self.win.createLinearMotorPropMgr_if_needed(self)
-
- return propMgr
+
##=====================================##
def _checkMotorAtomLimits(self, numberOfAtoms):
diff --git a/cad/src/commands/PlaneProperties/PlanePropertyManager.py b/cad/src/commands/PlaneProperties/PlanePropertyManager.py
index 1d06f20ce..02c3bd2f1 100755
--- a/cad/src/commands/PlaneProperties/PlanePropertyManager.py
+++ b/cad/src/commands/PlaneProperties/PlanePropertyManager.py
@@ -48,7 +48,7 @@ class PlanePropertyManager(EditCommand_PM):
# The relative path to the PNG file that appears in the header
iconPath = "ui/actions/Insert/Reference Geometry/Plane.png"
- def __init__(self, win, planeEditCommand):
+ def __init__(self, command):
"""
Construct the Plane Property Manager.
@@ -61,9 +61,7 @@ class PlanePropertyManager(EditCommand_PM):
self.isAlreadyDisconnected = False
- EditCommand_PM.__init__( self,
- win,
- planeEditCommand)
+ EditCommand_PM.__init__( self, command)
diff --git a/cad/src/commands/PlaneProperties/Plane_EditCommand.py b/cad/src/commands/PlaneProperties/Plane_EditCommand.py
index 4e4b8c00a..44f5c848a 100755
--- a/cad/src/commands/PlaneProperties/Plane_EditCommand.py
+++ b/cad/src/commands/PlaneProperties/Plane_EditCommand.py
@@ -33,6 +33,8 @@ from commands.SelectAtoms.SelectAtoms_GraphicsMode import SelectAtoms_GraphicsMo
from utilities.Comparison import same_vals
from utilities.prefs_constants import PlanePM_showGridLabels_prefs_key, PlanePM_showGrid_prefs_key
+from commands.PlaneProperties.PlanePropertyManager import PlanePropertyManager
+
class Plane_EditCommand(EditCommand):
"""
The Plane_EditCommand class provides an editCommand Object.
@@ -41,6 +43,8 @@ class Plane_EditCommand(EditCommand):
"""
#@NOTE: self.struct is the Plane object
+
+ PM_class = PlanePropertyManager
cmd = greenmsg("Plane: ")
#
@@ -126,18 +130,7 @@ class Plane_EditCommand(EditCommand):
"""
return Plane
- def _createPropMgrObject(self):
- """
- Creates a property manager object (that defines UI things) for this
- editCommand.
- """
- assert not self.propMgr
-
- propMgr = self.win.createPlanePropMgr_if_needed(self)
-
- return propMgr
-
-
+
def placePlaneParallelToScreen(self):
"""
Orient this plane such that it is placed parallel to the screen
diff --git a/cad/src/commands/RotaryMotorProperties/RotaryMotor_EditCommand.py b/cad/src/commands/RotaryMotorProperties/RotaryMotor_EditCommand.py
index 3b3150e96..3f1558f08 100644
--- a/cad/src/commands/RotaryMotorProperties/RotaryMotor_EditCommand.py
+++ b/cad/src/commands/RotaryMotorProperties/RotaryMotor_EditCommand.py
@@ -17,6 +17,7 @@ from operations.jigmakers_Mixin import atom_limit_exceeded_and_confirmed
from command_support.EditCommand import EditCommand
from commands.SelectAtoms.SelectAtoms_GraphicsMode import SelectAtoms_GraphicsMode
+from commands.RotaryMotorProperties.RotaryMotorPropertyManager import RotaryMotorPropertyManager
class RotaryMotor_EditCommand(EditCommand):
"""
@@ -24,6 +25,12 @@ class RotaryMotor_EditCommand(EditCommand):
The editCommand, depending on what client code needs it to do, may create
a new rotary motor or it may be used for an existing rotary motor.
"""
+ #GraphicsMode
+ GraphicsMode_class = SelectAtoms_GraphicsMode
+
+ #Property Manager
+ PM_class = RotaryMotorPropertyManager
+
cmd = greenmsg("Rotary Motor: ")
#
prefix = '' # Not used by jigs.
@@ -41,7 +48,7 @@ class RotaryMotor_EditCommand(EditCommand):
from utilities.constants import CL_EDIT_GENERIC
command_level = CL_EDIT_GENERIC
- GraphicsMode_class = SelectAtoms_GraphicsMode
+
def __init__(self, commandSequencer, struct = None):
"""
@@ -200,16 +207,6 @@ class RotaryMotor_EditCommand(EditCommand):
self.win.win_update() # Update model tree
self.win.assy.changed()
- def _createPropMgrObject(self):
- """
- Creates a property manager object (that defines UI things) for this
- editCommand.
- """
- assert not self.propMgr
-
- propMgr = self.win.createRotaryMotorPropMgr_if_needed(self)
-
- return propMgr
##=====================================##
def _checkMotorAtomLimits(self, numberOfAtoms):
diff --git a/cad/src/dna/command_support/BreakOrJoinStrands_Command.py b/cad/src/dna/command_support/BreakOrJoinStrands_Command.py
index 307ecd9cc..152d01851 100644
--- a/cad/src/dna/command_support/BreakOrJoinStrands_Command.py
+++ b/cad/src/dna/command_support/BreakOrJoinStrands_Command.py
@@ -25,7 +25,7 @@ class BreakOrJoinStrands_Command(BuildAtoms_Command):
"""
#Temporary attr 'command_porting_status. See baseCommand for details.
- command_porting_status = "PARTIAL: 2008-0--05: needs PM_class refactoring"
+ command_porting_status = "PARTIAL: 2008-0--05: ?? check"
command_level = CL_SUBCOMMAND
command_parent = 'BUILD_DNA'
@@ -36,16 +36,7 @@ class BreakOrJoinStrands_Command(BuildAtoms_Command):
command_has_its_own_PM = True
flyoutToolbar = None
-
-
-
- def _createPropMgrObject(self):
- """
- Overrides superclass method and also raises an abstract method.
- Break and join strands must override this method in order to create their
- own PM objects.
- """
- raise AbstractMethod()
+
def _get_init_gui_flyout_action_string(self):
raise AbstractMethod
diff --git a/cad/src/dna/commands/BreakStrands/BreakStrands_Command.py b/cad/src/dna/commands/BreakStrands/BreakStrands_Command.py
index 6410cc365..d4b51a4f0 100644
--- a/cad/src/dna/commands/BreakStrands/BreakStrands_Command.py
+++ b/cad/src/dna/commands/BreakStrands/BreakStrands_Command.py
@@ -27,10 +27,9 @@ class BreakStrands_Command(BreakOrJoinStrands_Command):
commandName = 'BREAK_STRANDS'
featurename = "Break Strands"
GraphicsMode_class = BreakStrands_GraphicsMode
+ PM_class = BreakStrands_PropertyManager
+
- def _createPropMgrObject(self):
- propMgr = BreakStrands_PropertyManager(self)
- return propMgr
def _get_init_gui_flyout_action_string(self):
return 'breakStrandAction'
diff --git a/cad/src/dna/commands/BuildDna/BuildDna_EditCommand.py b/cad/src/dna/commands/BuildDna/BuildDna_EditCommand.py
index 37757a8c7..fd75dcfd2 100644
--- a/cad/src/dna/commands/BuildDna/BuildDna_EditCommand.py
+++ b/cad/src/dna/commands/BuildDna/BuildDna_EditCommand.py
@@ -35,6 +35,8 @@ from model.chunk import Chunk
from model.bonds import Bond
from dna.commands.BuildDna.BuildDna_GraphicsMode import BuildDna_GraphicsMode
+from dna.commands.BuildDna.BuildDna_PropertyManager import BuildDna_PropertyManager
+
class BuildDna_EditCommand(EditCommand):
"""
@@ -43,7 +45,13 @@ class BuildDna_EditCommand(EditCommand):
"""
#Temporary attr 'command_porting_status. See baseCommand for details.
- command_porting_status = "PARTIAL: 2008-09-05: needs PM_class refactoring"
+ command_porting_status = None
+
+ #GraphicsMode
+ GraphicsMode_class = BuildDna_GraphicsMode
+
+ #Property Manager
+ PM_class = BuildDna_PropertyManager
cmd = greenmsg("Build DNA: ")
prefix = 'DnaGroup' # used for gensym
@@ -53,8 +61,8 @@ class BuildDna_EditCommand(EditCommand):
featurename = "Build Dna"
from utilities.constants import CL_ENVIRONMENT_PROVIDING
command_level = CL_ENVIRONMENT_PROVIDING
-
- GraphicsMode_class = BuildDna_GraphicsMode
+
+
command_should_resume_prevMode = False
command_has_its_own_PM = True
@@ -235,17 +243,7 @@ class BuildDna_EditCommand(EditCommand):
"""
return self.win.assy.DnaGroup
-
- def _createPropMgrObject(self):
- """
- Creates a property manager object (that defines UI things) for this
- editCommand.
- """
- assert not self.propMgr
- propMgr = self.win.createBuildDnaPropMgr_if_needed(self)
- return propMgr
-
-
+
def _createStructure(self):
"""
creates and returns the structure (in this case a L{Group} object that
diff --git a/cad/src/dna/commands/BuildDna/BuildDna_PropertyManager.py b/cad/src/dna/commands/BuildDna/BuildDna_PropertyManager.py
index 11958a912..c9ad3e13a 100644
--- a/cad/src/dna/commands/BuildDna/BuildDna_PropertyManager.py
+++ b/cad/src/dna/commands/BuildDna/BuildDna_PropertyManager.py
@@ -65,7 +65,7 @@ class BuildDna_PropertyManager( EditCommand_PM, DebugMenuMixin ):
sponsor_keyword = None # Nanorex is the sponsor. Change to 'DNA' to the
# the NUPACK logo.
- def __init__( self, win, command ):
+ def __init__( self, command ):
"""
Constructor for the Build DNA property manager.
"""
@@ -79,9 +79,7 @@ class BuildDna_PropertyManager( EditCommand_PM, DebugMenuMixin ):
self.isAlreadyConnected = False
self.isAlreadyDisconnected = False
- EditCommand_PM.__init__( self,
- win,
- command)
+ EditCommand_PM.__init__( self, command)
DebugMenuMixin._init1( self )
diff --git a/cad/src/dna/commands/BuildDuplex/DnaDuplexPropertyManager.py b/cad/src/dna/commands/BuildDuplex/DnaDuplexPropertyManager.py
index 310168853..41c13ef7c 100644
--- a/cad/src/dna/commands/BuildDuplex/DnaDuplexPropertyManager.py
+++ b/cad/src/dna/commands/BuildDuplex/DnaDuplexPropertyManager.py
@@ -75,7 +75,7 @@ class DnaDuplexPropertyManager( DnaOrCnt_PropertyManager ):
pmName = title
iconPath = "ui/actions/Tools/Build Structures/InsertDsDna.png"
- def __init__( self, win, command ):
+ def __init__( self, command ):
"""
Constructor for the DNA Duplex property manager.
"""
@@ -90,9 +90,7 @@ class DnaDuplexPropertyManager( DnaOrCnt_PropertyManager ):
self._numberOfBases)
- _superclass.__init__( self,
- win,
- command)
+ _superclass.__init__( self, command)
self.showTopRowButtons( PM_DONE_BUTTON | \
PM_CANCEL_BUTTON | \
diff --git a/cad/src/dna/commands/BuildDuplex/DnaDuplex_EditCommand.py b/cad/src/dna/commands/BuildDuplex/DnaDuplex_EditCommand.py
index a14a68f09..da340549e 100644
--- a/cad/src/dna/commands/BuildDuplex/DnaDuplex_EditCommand.py
+++ b/cad/src/dna/commands/BuildDuplex/DnaDuplex_EditCommand.py
@@ -76,7 +76,15 @@ class DnaDuplex_EditCommand(EditCommand):
"""
#Temporary attr 'command_porting_status. See baseCommand for details.
- command_porting_status = "PARTIAL: 2008-09-05: needs PM_class refactoring"
+ command_porting_status = "PARTIAL: 2008-09-05 : ?? check"
+
+
+ #Graphics Mode set to DnaLine graphics mode
+ GraphicsMode_class = DnaDuplex_GraphicsMode
+
+ #Property Manager
+ PM_class = DnaDuplexPropertyManager
+
cmd = greenmsg("Build DNA: ")
prefix = 'DnaSegment' # used for gensym
@@ -96,8 +104,7 @@ class DnaDuplex_EditCommand(EditCommand):
# generated (in GeneratorBaseClass) from the prefix.
create_name_from_prefix = True
- #Graphics Mode set to DnaLine graphics mode
- GraphicsMode_class = DnaDuplex_GraphicsMode
+
#required by DnaLine_GM
mouseClickPoints = []
@@ -385,16 +392,7 @@ class DnaDuplex_EditCommand(EditCommand):
self.graphicsMode.resetVariables()
self.win.win_update() #fixes bug 2810
- def _createPropMgrObject(self):
- """
- Creates a property manager object (that defines UI things) for this
- editCommand.
- """
- assert not self.propMgr
- propMgr = DnaDuplexPropertyManager(self.win, self)
- return propMgr
-
-
+
def _getStructureType(self):
"""
Subclasses override this method to define their own structure type.
diff --git a/cad/src/dna/commands/DnaDisplayStyle/DnaDisplayStyle_Command.py b/cad/src/dna/commands/DnaDisplayStyle/DnaDisplayStyle_Command.py
index 7bc967c86..674aac176 100644
--- a/cad/src/dna/commands/DnaDisplayStyle/DnaDisplayStyle_Command.py
+++ b/cad/src/dna/commands/DnaDisplayStyle/DnaDisplayStyle_Command.py
@@ -38,19 +38,20 @@ class DnaDisplayStyle_Command(EditCommand):
"""
#Temporary attr 'command_porting_status. See baseCommand for details.
- command_porting_status = "PARTIAL: 2008-09-05: needs PM_class refactoring"
+ command_porting_status = "PARTIAL: 2008-09-05: ?? check"
# class constants
+ GraphicsMode_class = DnaDisplayStyle_GraphicsMode
+
+ PM_class = DnaDisplayStyle_PropertyManager
+
commandName = 'EDIT_DNA_DISPLAY_STYLE'
featurename = "DNA Display Style"
from utilities.constants import CL_GLOBAL_PROPERTIES
command_level = CL_GLOBAL_PROPERTIES
- GraphicsMode_class = DnaDisplayStyle_GraphicsMode
-
-
command_can_be_suspended = False
command_should_resume_prevMode = True
command_has_its_own_PM = True
@@ -84,24 +85,7 @@ class DnaDisplayStyle_Command(EditCommand):
#START new command API methods =============================================
- def command_enter_PM(self):
- """
- Overrides superclass method.
-
- @see: baseCommand.command_enter_PM() for documentation
- """
- #important to check for old propMgr object. Reusing propMgr object
- #significantly improves the performance.
- if not self.propMgr:
- self.propMgr = self._createPropMgrObject()
- #@bug BUG: following is a workaround for bug 2494.
- #This bug is mitigated as propMgr object no longer gets recreated
- #for modes -- ninad 2007-08-29
- changes.keep_forever(self.propMgr)
-
-
- if not USE_COMMAND_STACK:
- self.propMgr.show()
+
def command_enter_flyout(self):
@@ -119,14 +103,7 @@ class DnaDisplayStyle_Command(EditCommand):
"""
if self.flyoutToolbar:
self.flyoutToolbar.editDnaDisplayStyleAction.setChecked(False)
-
-
- def _createPropMgrObject(self):
- propMgr = DnaDisplayStyle_PropertyManager(self)
- return propMgr
-
-
-
+
def keep_empty_group(self, group):
"""
Returns True if the empty group should not be automatically deleted.
diff --git a/cad/src/dna/commands/DnaSegment/DnaSegment_EditCommand.py b/cad/src/dna/commands/DnaSegment/DnaSegment_EditCommand.py
index b488b0b5c..686e749e0 100644
--- a/cad/src/dna/commands/DnaSegment/DnaSegment_EditCommand.py
+++ b/cad/src/dna/commands/DnaSegment/DnaSegment_EditCommand.py
@@ -82,7 +82,7 @@ from utilities.prefs_constants import dnaSegmentResizeHandle_discThickness_prefs
from utilities.prefs_constants import cursorTextColor_prefs_key
from dna.model.Dna_Constants import getDuplexLength
-
+from dna.commands.DnaSegment.DnaSegment_PropertyManager import DnaSegment_PropertyManager
CYLINDER_WIDTH_DEFAULT_VALUE = 0.0
HANDLE_RADIUS_DEFAULT_VALUE = 1.2
@@ -105,7 +105,13 @@ class DnaSegment_EditCommand(State_preMixin, EditCommand):
"""
#Temporary attr 'command_porting_status. See baseCommand for details.
- command_porting_status = "PARTIAL: 2008-09-05: needs PM_class refactoring"
+ command_porting_status = "PARTIAL: 2008-09-05:?? check"
+
+ #Graphics Mode
+ GraphicsMode_class = DnaSegment_GraphicsMode
+
+ #Property Manager
+ PM_class = DnaSegment_PropertyManager
cmd = 'Dna Segment'
@@ -129,8 +135,7 @@ class DnaSegment_EditCommand(State_preMixin, EditCommand):
call_makeMenus_for_each_event = True
- #Graphics Mode
- GraphicsMode_class = DnaSegment_GraphicsMode
+
#This is set to BuildDna_EditCommand.flyoutToolbar (as of 2008-01-14,
#it only uses
@@ -228,7 +233,7 @@ class DnaSegment_EditCommand(State_preMixin, EditCommand):
self.grabbedHandle = None
- def command_enter_PM(self):
+ def ORIG_command_enter_PM(self):
"""
See superclass dor documentation.
"""
@@ -617,15 +622,7 @@ class DnaSegment_EditCommand(State_preMixin, EditCommand):
self._resizeHandle_stopper_length = - total_length + two_bases_length
- def _createPropMgrObject(self):
- """
- Creates a property manager object (that defines UI things) for this
- editCommand.
- """
- assert not self.propMgr
- propMgr = self.win.createDnaSegmentPropMgr_if_needed(self)
- return propMgr
-
+
def _gatherParameters(self):
"""
Return the parameters from the property manager UI.
diff --git a/cad/src/dna/commands/DnaSegment/DnaSegment_PropertyManager.py b/cad/src/dna/commands/DnaSegment/DnaSegment_PropertyManager.py
index cb09ab40c..378148e56 100644
--- a/cad/src/dna/commands/DnaSegment/DnaSegment_PropertyManager.py
+++ b/cad/src/dna/commands/DnaSegment/DnaSegment_PropertyManager.py
@@ -54,7 +54,7 @@ class DnaSegment_PropertyManager( DnaOrCnt_PropertyManager):
title = "DnaSegment Properties"
iconPath = "ui/actions/Tools/Build Structures/DNA.png"
- def __init__( self, win, command ):
+ def __init__( self, command ):
"""
Constructor for the Build DNA property manager.
"""
@@ -69,7 +69,7 @@ class DnaSegment_PropertyManager( DnaOrCnt_PropertyManager):
self.basesPerTurn = 10
self.dnaModel = 'PAM3'
- _superclass.__init__( self, win, command)
+ _superclass.__init__( self, command)
self.showTopRowButtons( PM_DONE_BUTTON | \
diff --git a/cad/src/dna/commands/DnaStrand/DnaStrand_EditCommand.py b/cad/src/dna/commands/DnaStrand/DnaStrand_EditCommand.py
index d49604460..dc67b86a4 100644
--- a/cad/src/dna/commands/DnaStrand/DnaStrand_EditCommand.py
+++ b/cad/src/dna/commands/DnaStrand/DnaStrand_EditCommand.py
@@ -58,6 +58,9 @@ from utilities.prefs_constants import dnaStrandEditCommand_cursorTextCheckBox_nu
from utilities.prefs_constants import dnaStrandEditCommand_showCursorTextCheckBox_prefs_key
from utilities.prefs_constants import cursorTextColor_prefs_key
+from dna.commands.DnaStrand.DnaStrand_PropertyManager import DnaStrand_PropertyManager
+
+
CYLINDER_WIDTH_DEFAULT_VALUE = 0.0
HANDLE_RADIUS_DEFAULT_VALUE = 1.5
@@ -75,7 +78,13 @@ class DnaStrand_EditCommand(State_preMixin, EditCommand):
"""
#Temporary attr 'command_porting_status. See baseCommand for details.
- command_porting_status = "PARTIAL: 2008-09-05: needs PM_class refactoring"
+ command_porting_status = "PARTIAL: 2008-09-05 ?? check"
+
+ #Graphics Mode
+ GraphicsMode_class = DnaStrand_GraphicsMode
+
+ #Property Manager
+ PM_class = DnaStrand_PropertyManager
cmd = 'Dna Strand'
prefix = 'Strand ' # used for gensym
@@ -97,8 +106,7 @@ class DnaStrand_EditCommand(State_preMixin, EditCommand):
call_makeMenus_for_each_event = True
- #Graphics Mode
- GraphicsMode_class = DnaStrand_GraphicsMode
+
#@see: self.updateHandlePositions for details on how these variables are
#used in computation.
@@ -283,15 +291,7 @@ class DnaStrand_EditCommand(State_preMixin, EditCommand):
return bool_keep
- def _createPropMgrObject(self):
- """
- Creates a property manager object (that defines UI things) for this
- editCommand.
- """
- assert not self.propMgr
- propMgr = self.win.createDnaStrandPropMgr_if_needed(self)
- return propMgr
-
+
def _gatherParameters(self):
"""
Return the parameters from the property manager UI. Delegates this to
diff --git a/cad/src/dna/commands/DnaStrand/DnaStrand_PropertyManager.py b/cad/src/dna/commands/DnaStrand/DnaStrand_PropertyManager.py
index 02a1664de..ad11c8e86 100644
--- a/cad/src/dna/commands/DnaStrand/DnaStrand_PropertyManager.py
+++ b/cad/src/dna/commands/DnaStrand/DnaStrand_PropertyManager.py
@@ -59,7 +59,7 @@ class DnaStrand_PropertyManager( DnaOrCnt_PropertyManager):
title = "DnaStrand Properties"
iconPath = "ui/actions/Properties Manager/Strand.png"
- def __init__( self, win, command ):
+ def __init__( self, command ):
"""
Constructor for the Build DNA property manager.
"""
@@ -71,9 +71,7 @@ class DnaStrand_PropertyManager( DnaOrCnt_PropertyManager):
self.dnaModel = 'PAM3'
- _superclass.__init__( self,
- win,
- command)
+ _superclass.__init__( self, command)
diff --git a/cad/src/dna/commands/JoinStrands/JoinStrands_Command.py b/cad/src/dna/commands/JoinStrands/JoinStrands_Command.py
index c7f713381..edcf54c46 100644
--- a/cad/src/dna/commands/JoinStrands/JoinStrands_Command.py
+++ b/cad/src/dna/commands/JoinStrands/JoinStrands_Command.py
@@ -26,13 +26,9 @@ class JoinStrands_Command(BreakOrJoinStrands_Command):
commandName = 'JOIN_STRANDS'
featurename = "Join Strands"
- GraphicsMode_class = JoinStrands_GraphicsMode
-
- def _createPropMgrObject(self):
- propMgr = JoinStrands_PropertyManager(self)
- return propMgr
-
-
+ GraphicsMode_class = JoinStrands_GraphicsMode
+ PM_class = JoinStrands_PropertyManager
+
def _get_init_gui_flyout_action_string(self):
return 'joinStrandsAction'
diff --git a/cad/src/dna/commands/MakeCrossovers/MakeCrossovers_Command.py b/cad/src/dna/commands/MakeCrossovers/MakeCrossovers_Command.py
index d939c48b7..4e4e06130 100644
--- a/cad/src/dna/commands/MakeCrossovers/MakeCrossovers_Command.py
+++ b/cad/src/dna/commands/MakeCrossovers/MakeCrossovers_Command.py
@@ -43,6 +43,10 @@ class MakeCrossovers_Command(SelectChunks_Command,
#Temporary attr 'command_porting_status. See baseCommand for details.
command_porting_status = None
+ GraphicsMode_class = MakeCrossovers_Graphicsmode
+
+ PM_class = MakeCrossovers_PropertyManager
+
# class constants
commandName = 'MAKE_CROSSOVERS'
featurename = "Make Crossovers"
@@ -57,9 +61,7 @@ class MakeCrossovers_Command(SelectChunks_Command,
flyoutToolbar = None
- GraphicsMode_class = MakeCrossovers_Graphicsmode
- PM_class = MakeCrossovers_PropertyManager
def Enter(self):
diff --git a/cad/src/dna/commands/MultipleDnaSegmentResize/MultipleDnaSegmentResize_EditCommand.py b/cad/src/dna/commands/MultipleDnaSegmentResize/MultipleDnaSegmentResize_EditCommand.py
index eeee10d18..fe5ef7cdb 100644
--- a/cad/src/dna/commands/MultipleDnaSegmentResize/MultipleDnaSegmentResize_EditCommand.py
+++ b/cad/src/dna/commands/MultipleDnaSegmentResize/MultipleDnaSegmentResize_EditCommand.py
@@ -37,6 +37,7 @@ from widgets.prefs_widgets import ObjAttr_StateRef
from dna.commands.DnaSegment.DnaSegment_ResizeHandle import DnaSegment_ResizeHandle
from utilities.debug import print_compact_stack
from dna.command_support.DnaSegmentList import DnaSegmentList
+from dna.commands.MultipleDnaSegmentResize.MultipleDnaSegmentResize_PropertyManager import MultipleDnaSegmentResize_PropertyManager
CYLINDER_WIDTH_DEFAULT_VALUE = 0.0
HANDLE_RADIUS_DEFAULT_VALUE = 4.0
@@ -47,7 +48,13 @@ _superclass = DnaSegment_EditCommand
class MultipleDnaSegmentResize_EditCommand(DnaSegment_EditCommand):
#Temporary attr 'command_porting_status. See baseCommand for details.
- command_porting_status = "PARTIAL: 2008-09-05: needs PM_class refactoring; may be some update code needs to be in methods like command_update_internal_state"
+ command_porting_status = "PARTIAL: 2008-09-05: may be some update code needs to be in methods like command_update_internal_state"
+
+ #Graphics Mode
+ GraphicsMode_class = MultipleDnaSegmentResize_GraphicsMode
+
+ #Property Manager
+ PM_class = MultipleDnaSegmentResize_PropertyManager
cmdname = 'MULTIPLE_DNA_SEGMENT_RESIZE' # REVIEW: needed? correct?
@@ -65,8 +72,7 @@ class MultipleDnaSegmentResize_EditCommand(DnaSegment_EditCommand):
#@see: self.modifyStructure()
currentStruct = None
- #Graphics Mode
- GraphicsMode_class = MultipleDnaSegmentResize_GraphicsMode
+
handlePoint1 = State( Point, ORIGIN)
@@ -652,11 +658,4 @@ class MultipleDnaSegmentResize_EditCommand(DnaSegment_EditCommand):
return numberOfBasesToAddOrRemove
- def _createPropMgrObject(self):
- """
- Creates a property manager object (that defines UI things) for this
- command.
- """
- assert not self.propMgr
- propMgr = self.win.createMultipleDnaSegmentPropMgr_if_needed(self)
- return propMgr
+ \ No newline at end of file
diff --git a/cad/src/dna/commands/MultipleDnaSegmentResize/MultipleDnaSegmentResize_PropertyManager.py b/cad/src/dna/commands/MultipleDnaSegmentResize/MultipleDnaSegmentResize_PropertyManager.py
index d029c4dae..ba39da4e8 100644
--- a/cad/src/dna/commands/MultipleDnaSegmentResize/MultipleDnaSegmentResize_PropertyManager.py
+++ b/cad/src/dna/commands/MultipleDnaSegmentResize/MultipleDnaSegmentResize_PropertyManager.py
@@ -39,7 +39,7 @@ class MultipleDnaSegmentResize_PropertyManager( DnaOrCnt_PropertyManager ):
title = "Resize Dna Segments"
iconPath = "ui/actions/Properties Manager/Resize_Multiple_Segments.png"
- def __init__( self, win, command ):
+ def __init__( self, command ):
"""
Constructor for the Build DNA property manager.
"""
@@ -54,9 +54,7 @@ class MultipleDnaSegmentResize_PropertyManager( DnaOrCnt_PropertyManager ):
self.basesPerTurn = 10
self.dnaModel = 'PAM3'
- _superclass.__init__( self,
- win,
- command)
+ _superclass.__init__( self, command)
self.showTopRowButtons( PM_DONE_BUTTON | \
PM_WHATS_THIS_BUTTON)
diff --git a/cad/src/protein/commands/BackrubProteinSim/BackrubProteinSim_Command.py b/cad/src/protein/commands/BackrubProteinSim/BackrubProteinSim_Command.py
index 945ed9f6a..a2f2e372c 100644
--- a/cad/src/protein/commands/BackrubProteinSim/BackrubProteinSim_Command.py
+++ b/cad/src/protein/commands/BackrubProteinSim/BackrubProteinSim_Command.py
@@ -30,6 +30,8 @@ class BackrubProteinSim_Command(EditCommand):
Class for protein sequence design with rosetta when backrub motion is allowed
"""
# class constants
+ GraphicsMode_class = BackrubProteinSim_GraphicsMode
+ PM_class = BackrubProteinSim_PropertyManager
commandName = 'BACKRUB_PROTEIN_SEQUENCE_DESIGN'
featurename = "Backrub Protein Sequence Design"
@@ -43,7 +45,7 @@ class BackrubProteinSim_Command(EditCommand):
command_parent = 'SIMULATE_PROTEIN'
- GraphicsMode_class = BackrubProteinSim_GraphicsMode
+
command_can_be_suspended = False
command_should_resume_prevMode = True
diff --git a/cad/src/protein/commands/BuildPeptide/PeptideGeneratorPropertyManager.py b/cad/src/protein/commands/BuildPeptide/PeptideGeneratorPropertyManager.py
index 94bc2b04d..993e253eb 100755
--- a/cad/src/protein/commands/BuildPeptide/PeptideGeneratorPropertyManager.py
+++ b/cad/src/protein/commands/BuildPeptide/PeptideGeneratorPropertyManager.py
@@ -90,11 +90,11 @@ class PeptideGeneratorPropertyManager(EditCommand_PM):
# The relative path to PNG file that appears in the header.
iconPath = "ui/actions/Tools/Build Structures/Peptide.png"
- def __init__( self, win, command ):
+ def __init__( self, command ):
"""
Construct the "Build Graphene" Property Manager.
"""
- _superclass.__init__( self, win, command )
+ _superclass.__init__( self, command )
self.showTopRowButtons( PM_DONE_BUTTON | \
diff --git a/cad/src/protein/commands/BuildPeptide/Peptide_EditCommand.py b/cad/src/protein/commands/BuildPeptide/Peptide_EditCommand.py
index e788a6037..de8f21e5f 100644
--- a/cad/src/protein/commands/BuildPeptide/Peptide_EditCommand.py
+++ b/cad/src/protein/commands/BuildPeptide/Peptide_EditCommand.py
@@ -24,10 +24,15 @@ import foundation.env as env
from utilities.prefs_constants import cursorTextColor_prefs_key
from protein.commands.ModelAndSimulateProtein.ModelAndSimulateProtein_Command import ModelAndSimulateProtein_Command
+from protein.commands.BuildPeptide.PeptideGeneratorPropertyManager import PeptideGeneratorPropertyManager
+
#_superclass = ModelAndSimulateProtein_Command
_superclass = EditCommand
class Peptide_EditCommand(EditCommand):
#class Peptide_EditCommand(ModelAndSimulateProtein_Command):
+
+ PM_class = PeptideGeneratorPropertyManager
+
cmd = greenmsg("Build Peptide: ")
prefix = 'Peptide' # used for gensym
cmdname = 'Build Peptide'
@@ -293,17 +298,7 @@ class Peptide_EditCommand(EditCommand):
)
return
- def _createPropMgrObject(self):
- """
- Creates a property manager object (that defines UI things) for this
- editCommand.
- """
- assert not self.propMgr
-
- propMgr = self.win.createBuildPeptidePropMgr_if_needed(self)
-
- return propMgr
-
+
def _getStructureType(self):
"""
diff --git a/cad/src/protein/commands/BuildProtein/BuildProtein_EditCommand.py b/cad/src/protein/commands/BuildProtein/BuildProtein_EditCommand.py
index 65c08769a..cbd997e01 100644
--- a/cad/src/protein/commands/BuildProtein/BuildProtein_EditCommand.py
+++ b/cad/src/protein/commands/BuildProtein/BuildProtein_EditCommand.py
@@ -12,11 +12,18 @@ from utilities.Log import greenmsg
from utilities.constants import gensym
from ne1_ui.toolbars.Ui_ProteinFlyout import ProteinFlyout
+from protein.commands.BuildProtein.BuildProtein_PropertyManager import BuildProtein_PropertyManager
+
class BuildProtein_EditCommand(EditCommand):
"""
BuildProtein_EditCommand provides a convenient way to edit or create
a Protein object
"""
+
+ #Property Manager
+ PM_class = BuildProtein_PropertyManager
+
+
cmd = greenmsg("Build Protein: ")
prefix = 'ProteinGroup' # used for gensym
cmdname = "Build Protein"
@@ -30,6 +37,8 @@ class BuildProtein_EditCommand(EditCommand):
command_can_be_suspended = True
create_name_from_prefix = True
call_makeMenus_for_each_event = True
+
+
def __init__(self, commandSequencer, struct = None):
"""
@@ -148,15 +157,4 @@ class BuildProtein_EditCommand(EditCommand):
"If you change the sequence, make sure to "\
"hit Enter key at the end so that the changes "
"can be saved."
- "<br>"
- )
-
- def _createPropMgrObject(self):
- """
- Creates a property manager object (that defines UI things) for this
- editCommand.
- """
- assert not self.propMgr
- propMgr = self.win.createBuildProteinPropMgr_if_needed(self)
- return propMgr
-
+ "<br>" ) \ No newline at end of file
diff --git a/cad/src/protein/commands/BuildProtein/BuildProtein_PropertyManager.py b/cad/src/protein/commands/BuildProtein/BuildProtein_PropertyManager.py
index 2b3c2cc89..219a86b50 100644
--- a/cad/src/protein/commands/BuildProtein/BuildProtein_PropertyManager.py
+++ b/cad/src/protein/commands/BuildProtein/BuildProtein_PropertyManager.py
@@ -45,21 +45,19 @@ class BuildProtein_PropertyManager( EditCommand_PM, DebugMenuMixin ):
#change this ico path later
iconPath = "ui/actions/Tools/Build Structures/Peptide.png"
- def __init__( self, win, command ):
+ def __init__( self, command ):
"""
Constructor for the Build DNA property manager.
"""
- self.win = win
+
self.current_protein = ""
- self.sequenceEditor = win.createProteinSequenceEditorIfNeeded()
+ self.sequenceEditor = command.win.createProteinSequenceEditorIfNeeded()
#see self.connect_or_disconnect_signals for comment about this flag
self.isAlreadyConnected = False
self.isAlreadyDisconnected = False
- EditCommand_PM.__init__( self,
- win,
- command)
+ EditCommand_PM.__init__( self, command)
DebugMenuMixin._init1( self )
diff --git a/cad/src/protein/commands/CompareProteins/CompareProteins_Command.py b/cad/src/protein/commands/CompareProteins/CompareProteins_Command.py
index 631ac63b4..23c015ef6 100644
--- a/cad/src/protein/commands/CompareProteins/CompareProteins_Command.py
+++ b/cad/src/protein/commands/CompareProteins/CompareProteins_Command.py
@@ -29,6 +29,11 @@ class CompareProteins_Command(EditCommand):
"""
# class constants
+ GraphicsMode_class = CompareProteins_GraphicsMode
+
+ PM_class = CompareProteins_PropertyManager
+
+
commandName = 'COMPARE_PROTEINS'
featurename = "Compare Proteins"
@@ -39,7 +44,7 @@ class CompareProteins_Command(EditCommand):
if MODEL_AND_SIMULATE_PROTEINS:
command_parent = 'MODEL_PROTEIN'
- GraphicsMode_class = CompareProteins_GraphicsMode
+
command_can_be_suspended = False
diff --git a/cad/src/protein/commands/EditResidues/EditResidues_Command.py b/cad/src/protein/commands/EditResidues/EditResidues_Command.py
index 15036771b..69baa6ecd 100644
--- a/cad/src/protein/commands/EditResidues/EditResidues_Command.py
+++ b/cad/src/protein/commands/EditResidues/EditResidues_Command.py
@@ -29,6 +29,11 @@ class EditResidues_Command(EditCommand):
"""
# class constants
+ GraphicsMode_class = EditResidues_GraphicsMode
+
+ PM_class = EditResidues_PropertyManager
+
+
commandName = 'EDIT_RESIDUES'
featurename = "Edit Residues"
@@ -39,7 +44,7 @@ class EditResidues_Command(EditCommand):
if MODEL_AND_SIMULATE_PROTEINS:
command_parent = 'SIMULATE_PROTEIN'
- GraphicsMode_class = EditResidues_GraphicsMode
+
command_can_be_suspended = False
diff --git a/cad/src/protein/commands/EditRotamers/EditRotamers_Command.py b/cad/src/protein/commands/EditRotamers/EditRotamers_Command.py
index 04fdf766e..25f6e860d 100644
--- a/cad/src/protein/commands/EditRotamers/EditRotamers_Command.py
+++ b/cad/src/protein/commands/EditRotamers/EditRotamers_Command.py
@@ -29,6 +29,11 @@ class EditRotamers_Command(EditCommand):
"""
# class constants
+ GraphicsMode_class = EditRotamers_GraphicsMode
+
+ PM_class = EditRotamers_PropertyManager
+
+
commandName = 'EDIT_ROTAMERS'
featurename = "Edit Rotamers"
@@ -39,7 +44,7 @@ class EditRotamers_Command(EditCommand):
if MODEL_AND_SIMULATE_PROTEINS:
command_parent = 'MODEL_PROTEIN'
- GraphicsMode_class = EditRotamers_GraphicsMode
+
command_can_be_suspended = False
diff --git a/cad/src/protein/commands/FixedBBProteinSim/FixedBBProteinSim_Command.py b/cad/src/protein/commands/FixedBBProteinSim/FixedBBProteinSim_Command.py
index db5fb1057..1b715e78c 100644
--- a/cad/src/protein/commands/FixedBBProteinSim/FixedBBProteinSim_Command.py
+++ b/cad/src/protein/commands/FixedBBProteinSim/FixedBBProteinSim_Command.py
@@ -30,13 +30,17 @@ class FixedBBProteinSim_Command(EditCommand):
"""
# class constants
+ GraphicsMode_class = FixedBBProteinSim_GraphicsMode
+
+ PM_class = FixedBBProteinSim_PropertyManager
+
commandName = 'FIXED_BACKBONE_PROTEIN_SEQUENCE_DESIGN'
featurename = "Fixed Backbone Sequence Design"
from utilities.constants import CL_SUBCOMMAND
command_level = CL_SUBCOMMAND
command_parent = 'SIMULATE_PROTEIN'
- GraphicsMode_class = FixedBBProteinSim_GraphicsMode
+
command_can_be_suspended = False
diff --git a/cad/src/protein/commands/ModelAndSimulateProtein/ModelAndSimulateProtein_Command.py b/cad/src/protein/commands/ModelAndSimulateProtein/ModelAndSimulateProtein_Command.py
index 83264ecbe..241f06594 100644
--- a/cad/src/protein/commands/ModelAndSimulateProtein/ModelAndSimulateProtein_Command.py
+++ b/cad/src/protein/commands/ModelAndSimulateProtein/ModelAndSimulateProtein_Command.py
@@ -21,6 +21,9 @@ class ModelAndSimulateProtein_Command(EditCommand):
ModelAndSimulateProtein_EditCommand provides a convenient way to edit or create
or simulate a Protein object
"""
+
+ PM_class = ModelAndSimulateProtein_PropertyManager
+
cmd = greenmsg("Model and simulate protein: ")
prefix = 'ProteinGroup' # used for gensym
cmdname = "Model and simulate protein"
@@ -94,7 +97,7 @@ class ModelAndSimulateProtein_Command(EditCommand):
return flyoutToolbar
def _createPropMgrObject(self):
- propMgr = ModelAndSimulateProtein_PropertyManager(self.w, self)
+ propMgr = ModelAndSimulateProtein_PropertyManager(self)
return propMgr
diff --git a/cad/src/protein/commands/ModelAndSimulateProtein/ModelAndSimulateProtein_PropertyManager.py b/cad/src/protein/commands/ModelAndSimulateProtein/ModelAndSimulateProtein_PropertyManager.py
index 959daee66..7b1ab4fc3 100644
--- a/cad/src/protein/commands/ModelAndSimulateProtein/ModelAndSimulateProtein_PropertyManager.py
+++ b/cad/src/protein/commands/ModelAndSimulateProtein/ModelAndSimulateProtein_PropertyManager.py
@@ -43,21 +43,19 @@ class ModelAndSimulateProtein_PropertyManager( EditCommand_PM, DebugMenuMixin ):
#change this ico path later
iconPath = "ui/actions/Tools/Build Structures/Peptide.png"
- def __init__( self, win, command):
+ def __init__( self, command):
"""
Constructor for the Build DNA property manager.
"""
- self.win = win
+
self.current_protein = ""
- self.sequenceEditor = win.createProteinSequenceEditorIfNeeded()
+ self.sequenceEditor = command.win.createProteinSequenceEditorIfNeeded()
#see self.connect_or_disconnect_signals for comment about this flag
self.isAlreadyConnected = False
self.isAlreadyDisconnected = False
- EditCommand_PM.__init__( self,
- win,
- command)
+ EditCommand_PM.__init__( self, command)
DebugMenuMixin._init1( self )
diff --git a/cad/src/protein/commands/ProteinDisplayStyle/ProteinDisplayStyle_Command.py b/cad/src/protein/commands/ProteinDisplayStyle/ProteinDisplayStyle_Command.py
index fa6c48f49..2b7d93e17 100644
--- a/cad/src/protein/commands/ProteinDisplayStyle/ProteinDisplayStyle_Command.py
+++ b/cad/src/protein/commands/ProteinDisplayStyle/ProteinDisplayStyle_Command.py
@@ -33,13 +33,15 @@ class ProteinDisplayStyle_Command(EditCommand):
"""
# class constants
+ GraphicsMode_class = ProteinDisplayStyle_GraphicsMode
+
+ PM_class = ProteinDisplayStyle_PropertyManager
+
+
commandName = 'EDIT_PROTEIN_DISPLAY_STYLE'
featurename = "Protein Display Style"
from utilities.constants import CL_GLOBAL_PROPERTIES
command_level = CL_GLOBAL_PROPERTIES
-
- GraphicsMode_class = ProteinDisplayStyle_GraphicsMode
-
command_can_be_suspended = False
command_should_resume_prevMode = True