summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Smith <bruce@nanorex.com>2008-08-07 00:21:08 +0000
committerBruce Smith <bruce@nanorex.com>2008-08-07 00:21:08 +0000
commiteb9a2de8aaa09b2fac668cef06cc083104a018c8 (patch)
tree46d03c87ef98c7a5567a08f97b3494d961cbb784
parentc905f68dd1867a50eacda31f46152df9cbd5ef89 (diff)
downloadnanoengineer-theirix-eb9a2de8aaa09b2fac668cef06cc083104a018c8.tar.gz
nanoengineer-theirix-eb9a2de8aaa09b2fac668cef06cc083104a018c8.zip
remove obs code (some commented out in prior commit); make Backup private, not part of Command API
-rwxr-xr-xcad/src/command_support/Command.py49
-rwxr-xr-xcad/src/commands/BuildCrystal/cookieMode.py4
-rwxr-xr-xcad/src/commands/Fuse/FuseChunks_Command.py68
-rwxr-xr-xcad/src/ne1_ui/MWsemantics.py13
4 files changed, 48 insertions, 86 deletions
diff --git a/cad/src/command_support/Command.py b/cad/src/command_support/Command.py
index f8986b100..6fe8b5352 100755
--- a/cad/src/command_support/Command.py
+++ b/cad/src/command_support/Command.py
@@ -377,7 +377,7 @@ class basicCommand(anyCommand):
# later note: as of 070521, we always get warned "subclass movieMode
# overrides basicMode._exitMode". I am not sure whether this override is
# legitimate, so I'm not removing the warning for now. [bruce 070521]
- weird_to_override = ['Cancel', 'StartOver', ## 'Flush', 'Restart',
+ weird_to_override = ['Cancel', 'StartOver',
'_f_userEnterCommand', '_exitMode', 'Abandon', '_cleanup',
'clear', #bruce 080806
]
@@ -398,7 +398,6 @@ class basicCommand(anyCommand):
('StateDone', ""),
('StateCancel', ""),
('restore_gui', ""),
- ('Backup', ""),
):
weird_to_override += [methodname]
# todo: print howtofix when needed
@@ -1659,12 +1658,10 @@ class basicCommand(anyCommand):
"""
return
- # [bruce comment 040923]
-
- # The preceding and following methods, StartOver Cancel Backup
- # Done, handle the common tools on the dashboards. (Before
- # 040923, Cancel was called ... and StartOver was called
- # .... Now the internal names match the user-visible names.)
+ # [bruce comment 040923; trimmed, 080806]
+ #
+ # The preceding and following methods, StartOver Cancel
+ # Done, handle the common tools on the dashboards.
#
# Each dashboard uses instances of the same tools, for a uniform
# look and action; the tool itself does not know which command it
@@ -1679,41 +1676,19 @@ class basicCommand(anyCommand):
#
# StartOver should also never be customized, since the generic
# method here should always work.
- #
- # For Backup, I [bruce 040923] have not yet revised it in any
- # way. Some subclasses override it, but AFAIK mostly don't do so
- # properly yet.
# other dashboard tools
- def StartOver(self): # may work; only callable from UI of extrude & cookie [bruce 080806 comment]
- # it looks like only cookieMode tried to do this [bruce 040923];
- # now we do it generically here [bruce 040924]
+ def StartOver(self):
+ # may work (not tested recently); only callable from UI of extrude & cookie;
+ # needs rename ### [bruce 080806 comment]
+ #### works, but has wrong error message when nim in sketch command -- fix later [older comment]
"""
- Start Over tool in dashboard (used to be called ...);
- subclasses should NOT override this
+ Support Start Over action for a few commands which implement this
+
+ [subclasses should NOT override this]
"""
self.Cancel(new_mode = self.commandName)
- #### works, but has wrong error message when nim in sketch command -- fix later
-
- def Backup(self): # might be obs... only call (verify) is in cookiemode cmenu;
- # works there but private to that cmd; uncallable def in fuse [bruce 080806 comment]
- """
- Backup tool in dashboard; subclasses should override this
- """
- # note: it looks like only cookieMode tries to do this [bruce 040923]
- print "%s: Backup not implemented yet" % self.get_featurename()
-
-## # compatibility methods -- remove these after we fix
-## # MWsemantics.py to use only their new names
-## # (unfortunately these old names still appear there as of 071010)
-## # [doing this, bruce 080806]
-##
-## def Flush(self):
-## self.Cancel()
-##
-## def Restart(self):
-## self.StartOver()
# ==
diff --git a/cad/src/commands/BuildCrystal/cookieMode.py b/cad/src/commands/BuildCrystal/cookieMode.py
index f0a7acfac..27f9add51 100755
--- a/cad/src/commands/BuildCrystal/cookieMode.py
+++ b/cad/src/commands/BuildCrystal/cookieMode.py
@@ -328,7 +328,7 @@ class cookieMode(basicMode):
self.selCurve_List = []
self.o.pov = V(self.oldPov[0], self.oldPov[1], self.oldPov[2])
- def Backup(self): # called from our glpane context menu
+ def _Backup(self): # called only from our glpane context menu [made private by bruce 080806]
if self.o.shape:
self.o.shape.undo(self.currentLayer)
# If no curves left, let users do what they can just like
@@ -981,7 +981,7 @@ class cookieMode(basicMode):
self.Menu_spec = [
('Cancel', self.Cancel),
('Start Over', self.StartOver),
- ('Backup', self.Backup),
+ ('Backup', self._Backup),
('Done', self.Done), # bruce 041217
#None,
#('Add New Layer', self.addLayer),
diff --git a/cad/src/commands/Fuse/FuseChunks_Command.py b/cad/src/commands/Fuse/FuseChunks_Command.py
index 4ee726b2c..6c5ca1681 100755
--- a/cad/src/commands/Fuse/FuseChunks_Command.py
+++ b/cad/src/commands/Fuse/FuseChunks_Command.py
@@ -140,41 +140,39 @@ class FuseChunks_Command(Move_Command, fusechunksBase):
return
- def Backup(self): # REVIEW: I suspect there is no way to call this method. [bruce 080806 comment]
- """
- Undo any bonds made between chunks.
- """
- # This undoes only the last fused chunks. Will work on supporting
- # multiple undos when we get a single undo working. Mark 050326
-
- # Bust bonds between last pair/set of fused chunks.
- if self.bondable_pairs_atoms:
- for a1, a2 in self.bondable_pairs_atoms:
- b = a1.get_neighbor_bond(a2)
- if b: b.bust()
-
-
- if self.merged_chunks:
- nchunks_str = "%d" % (len(self.merged_chunks) + 1,)
- msg = "Fuse Chunks: Bonds broken between %s chunks." % (nchunks_str)
- env.history.message(msg)
- msg = "Warning: Cannot separate the original chunks. You can " \
- "do this yourself using <b>Modify > Separate</b>."
- env.history.message(orangemsg(msg))
-
- cnames = "Their names were: "
- # Here are the original names...
- for chunk in self.merged_chunks:
- cnames += '[' + chunk.name + '] '
- env.history.message(cnames)
-
- self.o.gl_update()
-
- else:
- msg = "Fuse Chunks: No bonds have been made yet. Undo ignored."
- env.history.message(redmsg(msg))
-
-
+## def Backup(self): # REVIEW: I suspect there is no way to call this method, so I commented it out. [bruce 080806 comment]
+## """
+## Undo any bonds made between chunks.
+## """
+## # This undoes only the last fused chunks. Will work on supporting
+## # multiple undos when we get a single undo working. Mark 050326
+##
+## # Bust bonds between last pair/set of fused chunks.
+## if self.bondable_pairs_atoms:
+## for a1, a2 in self.bondable_pairs_atoms:
+## b = a1.get_neighbor_bond(a2)
+## if b: b.bust()
+##
+##
+## if self.merged_chunks:
+## nchunks_str = "%d" % (len(self.merged_chunks) + 1,)
+## msg = "Fuse Chunks: Bonds broken between %s chunks." % (nchunks_str)
+## env.history.message(msg)
+## msg = "Warning: Cannot separate the original chunks. You can " \
+## "do this yourself using <b>Modify > Separate</b>."
+## env.history.message(orangemsg(msg))
+##
+## cnames = "Their names were: "
+## # Here are the original names...
+## for chunk in self.merged_chunks:
+## cnames += '[' + chunk.name + '] '
+## env.history.message(cnames)
+##
+## self.o.gl_update()
+##
+## else:
+## msg = "Fuse Chunks: No bonds have been made yet. Undo ignored."
+## env.history.message(redmsg(msg))
def tolerance_changed(self, val):
"""
diff --git a/cad/src/ne1_ui/MWsemantics.py b/cad/src/ne1_ui/MWsemantics.py
index 216efc397..cfe3fee03 100755
--- a/cad/src/ne1_ui/MWsemantics.py
+++ b/cad/src/ne1_ui/MWsemantics.py
@@ -2240,24 +2240,13 @@ class MWsemantics(QMainWindow,
env.history.message(redmsg("Mirror Circular Boundary Tool: Not implemented yet."))
###################################
- # Slots for Dashboard widgets
+ # Slots for Done and Cancel actions for current command
###################################
- # fill the shape created in the cookiecutter with actual
- # carbon atoms in a diamond lattice (including bonds)
- # this works for all modes, not just add atom
def toolsDone(self):
# note: this is apparently still called from several places [bruce 080806 comment]
self.currentCommand.Done()
- # toolsStartOver is not called in any .py or .ui files, so I think it's obsolete. [bruce 080806]
-## def toolsStartOver(self):
-## self.currentCommand.StartOver() #bruce 080806 changed this from calling synonym Restart, nothing else calls it
-
- # toolsBackUp is not called in any .py or .ui files, so I think it's obsolete. [bruce 080806]
-## def toolsBackUp(self):
-## self.currentCommand.Backup()
-
def toolsCancel(self):
# note: this is apparently still called from several places [bruce 080806 comment]
self.currentCommand.Cancel()