summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNinad Sathaye <ninad@nanorex.com>2008-09-26 15:37:18 +0000
committerNinad Sathaye <ninad@nanorex.com>2008-09-26 15:37:18 +0000
commit07c90b249a76367a90ad63e18fdccd61c6f32f33 (patch)
tree50e484461a2442484add363f577d8a8ea9eed441
parent35b7223ddb9231ff39200b18c08d2158debd5ea7 (diff)
downloadnanoengineer-theirix-07c90b249a76367a90ad63e18fdccd61c6f32f33.tar.gz
nanoengineer-theirix-07c90b249a76367a90ad63e18fdccd61c6f32f33.zip
stripped out the old command API code for all commands in pkg : [src/cnt]
This is the code that used to run when 'USE_COMMAND_STACK' flag was NOT true
-rw-r--r--cad/src/cnt/commands/BuildNanotube/BuildNanotube_EditCommand.py54
-rw-r--r--cad/src/cnt/commands/BuildNanotube/BuildNanotube_PropertyManager.py38
-rw-r--r--cad/src/cnt/commands/InsertNanotube/InsertNanotube_EditCommand.py66
-rw-r--r--cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_EditCommand.py28
4 files changed, 6 insertions, 180 deletions
diff --git a/cad/src/cnt/commands/BuildNanotube/BuildNanotube_EditCommand.py b/cad/src/cnt/commands/BuildNanotube/BuildNanotube_EditCommand.py
index 850d001c0..2cd35e61b 100644
--- a/cad/src/cnt/commands/BuildNanotube/BuildNanotube_EditCommand.py
+++ b/cad/src/cnt/commands/BuildNanotube/BuildNanotube_EditCommand.py
@@ -36,9 +36,6 @@ from model.bonds import Bond
from cnt.commands.BuildNanotube.BuildNanotube_GraphicsMode import BuildNanotube_GraphicsMode
from cnt.commands.BuildNanotube.BuildNanotube_PropertyManager import BuildNanotube_PropertyManager
-
-from utilities.GlobalPreferences import USE_COMMAND_STACK
-
_superclass = EditCommand
class BuildNanotube_EditCommand(EditCommand):
"""
@@ -83,57 +80,6 @@ class BuildNanotube_EditCommand(EditCommand):
#See also other examples of its use in older Commands such as
#BuildAtoms_Command (earlier depositmode)
call_makeMenus_for_each_event = True
-
-
-
-
- if not USE_COMMAND_STACK:
-
- def command_enter_flyout(self):
- """
- Overrides superclass method
- """
- if self.flyoutToolbar is None:
- self.flyoutToolbar = NanotubeFlyout(self)
-
- self.flyoutToolbar.activateFlyoutToolbar()
-
- def command_exit_flyout(self):
- """
- Overrides superclass method.
- """
- if self.flyoutToolbar:
- self.flyoutToolbar.deActivateFlyoutToolbar()
-
- def resume_gui(self):
- """
- Called when this command, that was suspended earlier, is being resumed.
- The temporary command (which was entered by suspending this command)
- might have made some changes to the model which need to be reflected
- while resuming command.
-
- Example: A user enters BreakStrands_Command by suspending
- BuildNanotube_EditCommand, then breaks a few strands, thereby creating new
- strand chunks. Now when the user returns to the BuildNanotube_EditCommand,
- the command's property manager needs to update the list of strands
- because of the changes done while in BreakStrands_Command.
- @see: Command.resume_gui
- @see: Command._enterMode where this method is called.
- """
- #NOTE: Doing command toolbar updates in this method doesn't alwayswork.
- #consider this situation : You are in a) BuildNanotube_EditCommand, then you
- #b) enter CntDuplex_EditCommand(i.e. Cnt line) and from this temporary
- #command, you directly c) enter BreakStrands_Command
- #-- During b to c, 1) it first exits (b) , 2) resumes (a)
- #and then 3)enters (c)
- #This method is called during operation #2 and any changes to flyout
- #toolbar are reset during #3 --- Ninad 2008-01-14
- if self.propMgr:
- self.propMgr.updateListWidgets()
-
- if self.flyoutToolbar:
- self.flyoutToolbar.resetStateOfActions()
- return
def runCommand(self):
"""
diff --git a/cad/src/cnt/commands/BuildNanotube/BuildNanotube_PropertyManager.py b/cad/src/cnt/commands/BuildNanotube/BuildNanotube_PropertyManager.py
index 224cbd2ab..e14eea002 100644
--- a/cad/src/cnt/commands/BuildNanotube/BuildNanotube_PropertyManager.py
+++ b/cad/src/cnt/commands/BuildNanotube/BuildNanotube_PropertyManager.py
@@ -40,7 +40,6 @@ from PM.PM_Constants import PM_CANCEL_BUTTON
from PM.PM_Colors import pmReferencesListWidgetColor
from utilities.Comparison import same_vals
from cnt.model.NanotubeSegment import NanotubeSegment
-from utilities.GlobalPreferences import USE_COMMAND_STACK
class BuildNanotube_PropertyManager( EditCommand_PM, DebugMenuMixin ):
"""
@@ -148,19 +147,9 @@ class BuildNanotube_PropertyManager( EditCommand_PM, DebugMenuMixin ):
#New command API method -- implemented on 2008-08-27
def _update_UI_do_updates(self):
"""
- This method should replace model_changed() eventually.
- This is used with USE_COMMAND_STACK debug flag
-
- @see: self._currentStructureParams()
- """
- self.model_changed()
-
- def model_changed(self):
- """
- When the command is treated as a 'command' by the
- commandSequencer, this method will override basicCommand.model_changed.
- For more info, see BuildAtomsPropertyManager.model_changed docstring.
+ Overrides superclass method.
+ @see: PM_Dialog._update_UI_do_updates() for documentation
@see: self._currentStructureParams()
"""
currentSelectionParams = self._currentSelectionParams()
@@ -200,7 +189,7 @@ class BuildNanotube_PropertyManager( EditCommand_PM, DebugMenuMixin ):
"""
Returns a tuple containing current selection parameters. These
parameters are then used to decide whether updating widgets
- in this property manager is needed when L{self.model_changed}
+ in this property manager is needed when L{self._update_UI_do_updates()}
method is called.
@return: A tuple that contains following selection parameters
@@ -257,10 +246,7 @@ class BuildNanotube_PropertyManager( EditCommand_PM, DebugMenuMixin ):
As of 2007-11-20, it also shows the Sequence Editor widget and hides
the history widget. This implementation may change in the near future
"""
- EditCommand_PM.show(self)
- if not USE_COMMAND_STACK:
- self.updateListWidgets()
-
+ EditCommand_PM.show(self)
self.updateMessage("Use appropriate command in the command "\
"toolbar to create or modify a CNT Object"\
"<br>" )
@@ -280,21 +266,7 @@ class BuildNanotube_PropertyManager( EditCommand_PM, DebugMenuMixin ):
##selectedSegments = self.command.struct.getSelectedSegments()
##if len(selectedSegments) == 1:
##selectedSegments[0].edit()
-
- def _update_widgets_in_PM_before_show(self):
- """
- Update various widgets in this Property manager.
- Overrides EditCommand_PM._update_widgets_in_PM_before_show.
- The various widgets , (e.g. spinboxes) will get values from the
- structure for which this propMgr is constructed for
- (self.editcCommand.struct)
-
- @see: MotorPropertyManager._update_widgets_in_PM_before_show
- @see: self.show
- """
- if not USE_COMMAND_STACK:
- self.updateListWidgets()
-
+
def updateListWidgets(self):
"""
Update the Cnt segment list widget in this property manager
diff --git a/cad/src/cnt/commands/InsertNanotube/InsertNanotube_EditCommand.py b/cad/src/cnt/commands/InsertNanotube/InsertNanotube_EditCommand.py
index d9d8d504e..5af89c48b 100644
--- a/cad/src/cnt/commands/InsertNanotube/InsertNanotube_EditCommand.py
+++ b/cad/src/cnt/commands/InsertNanotube/InsertNanotube_EditCommand.py
@@ -42,7 +42,6 @@ from utilities.prefs_constants import insertNanotubeEditCommand_cursorTextCheckB
from utilities.prefs_constants import insertNanotubeEditCommand_cursorTextCheckBox_length_prefs_key
from utilities.prefs_constants import insertNanotubeEditCommand_showCursorTextCheckBox_prefs_key
from utilities.prefs_constants import cursorTextColor_prefs_key
-from utilities.GlobalPreferences import USE_COMMAND_STACK
_superclass = EditCommand
class InsertNanotube_EditCommand(EditCommand):
@@ -103,68 +102,6 @@ class InsertNanotube_EditCommand(EditCommand):
#Maintain a list of segments created while this command was running.
self._segmentList = []
- if not USE_COMMAND_STACK:
- 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}
- """
- _superclass.init_gui(self)
-
- if isinstance(self.graphicsMode, NanotubeLine_GM):
- self._setParamsForCntLineGraphicsMode()
- self.mouseClickPoints = []
-
- #Clear the segmentList as it may still be maintaining a list of segments
- #from the previous run of the command.
- self._segmentList = []
-
- self._init_gui_flyout_action( 'insertNanotubeAction' )
-
- def restore_gui(self):
- """
- Do changes to the GUI while exiting this command. This includes closing
- this mode's property manager, updating the command toolbar ,
- Note: The slot connection/disconnection in property manager and
- command toolbar is handled in those classes.
- @see: L{self.init_gui}
- """
- _superclass.restore_gui(self)
-
- if isinstance(self.graphicsMode, NanotubeLine_GM):
- self.mouseClickPoints = []
-
- self.graphicsMode.resetVariables()
-
- if self.flyoutToolbar:
- self.flyoutToolbar.insertNanotubeAction.setChecked(False)
-
- self._segmentList = []
-
- def command_enter_flyout(self):
- """
- Overrides superclass method.
- @see: basecommand.command_enter_flyout() for documentation.
- """
- self._init_gui_flyout_action( 'insertNanotubeAction' )
-
- def command_exit_flyout(self):
- """
- Overrides superclass method.
- @see: basecommand.command_exit_flyout() for documentation.
- """
- if self.flyoutToolbar:
- self.flyoutToolbar.insertNanotubeAction.setChecked(False)
-
- #START New command API methods==============================================
-
def command_entered(self):
"""
Overrides superclass method.
@@ -201,9 +138,6 @@ class InsertNanotube_EditCommand(EditCommand):
return flyoutActionToCheck, parentCommandName
-
- #START New command API methods==============================================
-
def runCommand(self):
"""
Overrides EditCommand.runCommand
diff --git a/cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_EditCommand.py b/cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_EditCommand.py
index cd5b339e0..1f66a02ec 100644
--- a/cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_EditCommand.py
+++ b/cad/src/cnt/commands/NanotubeSegment/NanotubeSegment_EditCommand.py
@@ -66,8 +66,6 @@ from utilities.prefs_constants import cursorTextColor_prefs_key
from cnt.commands.NanotubeSegment.NanotubeSegment_PropertyManager import NanotubeSegment_PropertyManager
-from utilities.GlobalPreferences import USE_COMMAND_STACK
-
CYLINDER_WIDTH_DEFAULT_VALUE = 0.0
HANDLE_RADIUS_DEFAULT_VALUE = 1.2
ORIGIN = V(0,0,0)
@@ -212,31 +210,7 @@ class NanotubeSegment_EditCommand(State_preMixin, EditCommand):
#Initialize DEBUG preference
pref_nt_segment_resize_by_recreating_nanotube()
return
-
- if not USE_COMMAND_STACK:
- def init_gui(self):
- """
- Initialize gui.
- """
-
- #Note that NanotubeSegment_EditCommand only act as an edit command for an
- #existing structure. The call to self.propMgr.show() is done only during
- #the call to self.editStructure ..i .e. only after self.struct is
- #updated. This is done because of the following reason:
- # - self.init_gui is called immediately after entering the command.
- # - self.init_gui in turn, initialized propMgr object and may also
- # show the property manager. The self.propMgr.show routine calls
- # an update widget method just before the show. This update method
- # updates the widgets based on the parameters from the existing
- # structure of the command (self.editCommand.struct)
- # Although, it checks whether this structure exists, the editCommand
- # could still have a self.struct attr from a previous run. (Note that
- # EditCommand API was written before the command sequencer API and
- # it has some loose ends like this. ) -- Ninad 2008-01-22
- self.create_and_or_show_PM_if_wanted(showPropMgr = False)
- return
-
-
+
def editStructure(self, struct = None):
EditCommand.editStructure(self, struct)