summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Smith <bruce@nanorex.com>2008-12-17 00:57:14 +0000
committerBruce Smith <bruce@nanorex.com>2008-12-17 00:57:14 +0000
commite6f76da234523f90e4feea05afae86c0f454876e (patch)
tree29ac08720fac23e9d5a94b404a2da41a63924cc2
parentf3d04c4b5d2939b638816346aecd98eb0c736d42 (diff)
downloadnanoengineer-e6f76da234523f90e4feea05afae86c0f454876e.tar.gz
nanoengineer-e6f76da234523f90e4feea05afae86c0f454876e.zip
remove obsolete prefsTree code
-rwxr-xr-xcad/src/model/assembly.py17
-rwxr-xr-xcad/src/modelTree/TreeModel.py38
-rw-r--r--cad/src/outtakes/prefsTree-in-other-files.py77
-rwxr-xr-xcad/src/outtakes/prefsTree.py (renamed from cad/src/model/prefsTree.py)0
-rw-r--r--cad/src/tools/packageData.py1
5 files changed, 86 insertions, 47 deletions
diff --git a/cad/src/model/assembly.py b/cad/src/model/assembly.py
index 400de77a6..f245c577f 100755
--- a/cad/src/model/assembly.py
+++ b/cad/src/model/assembly.py
@@ -103,7 +103,6 @@ from commands.PartProperties.PartProp import PartProp
from PyQt4 import QtGui
from foundation.Assembly_API import Assembly_API
-from model.prefsTree import MainPrefsGroupPart
import foundation.undo_manager as undo_manager
from files.mmp.files_mmp_writing import writemmpfile_assy
@@ -806,8 +805,6 @@ class Assembly( StateMixin, Assembly_API):
# == Parts
- prefs_node = None #bruce 050602; default value of instance variable; experimental
-
def topnode_partmaker_pairs(self): #bruce 050602
"""
Return a list of (node, partclass) pairs,
@@ -823,14 +820,10 @@ class Assembly( StateMixin, Assembly_API):
res = [(self.tree, MainPart)]
for node in self.shelf.members:
res.append(( node, ClipboardItemPart ))
- if self.prefs_node is not None:
- res.append(( self.prefs_node, MainPrefsGroupPart ))
return res
def topnodes_with_own_parts(self): #bruce 050602; should match topnode_partmaker_pairs
res = [self.tree] + self.shelf.members
- if self.prefs_node is not None:
- res.append( self.prefs_node)
return res
def all_parts(self): #bruce 080319
@@ -891,7 +884,7 @@ class Assembly( StateMixin, Assembly_API):
# in the future we're likely to do this separately for efficiency (only on nodes that might need it).
partnodes = self.topnodes_with_own_parts() # do this again in case the nodes changed (though I doubt that can happen)
for node in partnodes:
- # do this for all parts, even though the experimental prefsnode doesn't need it (as such)
+ # do this for all parts, even though the experimental PrefNode doesn't need it (as such)
# (as a kluge, it might use it for smth else; if so, could #e rename the method and then say this is no longer a kluge)
node.part.break_interpart_bonds()
# note: this is not needed when shelf has no members, unless there are bugs its assertions catch.
@@ -1203,11 +1196,13 @@ class Assembly( StateMixin, Assembly_API):
then return True, otherwise False (not an error).
Never has side effects.
"""
- if sg is None: return False
- if sg.assy is not self: return False
+ if sg is None:
+ return False
+ if sg.assy is not self:
+ return False
if not sg.is_top_of_selection_group():
return False
- if not (self.root.is_ascendant(sg) or self.prefs_node is sg): #bruce 050602 kluge: added prefs_node
+ if not self.root.is_ascendant(sg):
return False # can this ever happen??
# I think we won't check the Part, even though it could, in theory,
# be present but wrong (in the sense that sg.part.topnode is not sg),
diff --git a/cad/src/modelTree/TreeModel.py b/cad/src/modelTree/TreeModel.py
index ff6ff3530..2ee0c9a3a 100755
--- a/cad/src/modelTree/TreeModel.py
+++ b/cad/src/modelTree/TreeModel.py
@@ -35,8 +35,6 @@ from utilities.GlobalPreferences import pref_show_highlighting_in_MT
from utilities.constants import gensym
from utilities.constants import noop
-_DEBUG_PREFTREE = False # bruce 050602 experiment; do not commit with True
-
# ===
class TreeModel(TreeModel_api):
@@ -65,20 +63,6 @@ class TreeModel(TreeModel_api):
# [not anymore, as of some time before 050417] inserts assy.viewdata.members into assy.tree
self.tree_node, self.shelf_node = self.assy.tree, self.assy.shelf
topnodes = [self.assy.tree, self.assy.shelf]
- if _DEBUG_PREFTREE: #bruce 050602
- try:
- from foundation.Utility import Node
- ## print "reloading prefsTree"
- import model.prefsTree as _X
- reload(_X)
- from model.prefsTree import prefsTree # constructor for an object which has a tree of nodes and controls them
- self.pt = prefsTree(self.assy) # guess; guessing it's ok to remake it each time
- ptnode = self.pt.topnode
- assert ptnode is not None
- assert isinstance(ptnode, Node)
- topnodes.append(ptnode)
- except:
- print_compact_traceback("error importing prefsTree or making one: ")
return topnodes
def get_nodes_to_highlight(self): #bruce 080507
@@ -392,21 +376,7 @@ class TreeModel(TreeModel_api):
submenu = []
if submenu:
res.extend(submenu)
- pass
-
- # Customize command [bruce 050602 experiment -- unfinished and commented out ###@@@]
- # [later comment, bruce 050704: I think this was intended to suggest PrefsNodes applicable to the selected item or items,
- # and to make them and group them with it. Or (later) to put up a dialog whose end result might be to do that.]
- # Provide this when all items are in the same group? no, any items could be grouped...
- # so for initial experiments, always provide it. If it's a submenu, the selected items might affect
- # what's in it, and some things in it might be already checkmarked if PrefsNodes are above them ...
- # for very initial experiment let's provide it only for single items.
- # Do we ask them what can be customized about them? I guess so.
-##unfinished...
-## if _DEBUG_PREFTREE and len(nodeset) == 1:
-## mspec = nodeset[0].customize_menuspec()
-## submenu = []
-
+ pass
# copy, cut, delete, maybe duplicate...
# bruce 050704 revisions:
@@ -532,10 +502,8 @@ class TreeModel(TreeModel_api):
def cm_hide(self):
env.history.message("Hide: %d selected items or groups" % \
len(self.topmost_selected_nodes()))
- #####@@@@@ bruce 050517 comment: the following line (of unknown reason or date, but by me) causes bug 500;
- # that method was added 050125 and used in chunk.pick on same date, so adding it here must be then or later.
- # Let's see what happens if I remove it?
- ## self.assy.permit_pick_parts() #e should not be needed here, but see if it fixes my bugs ###@@@ #k still needed? if so, why?
+ #bruce 050517/081216 comment: doing self.assy.permit_pick_parts() here
+ # (by me, unknown when or why) caused bug 500; removing it seems ok.
self.assy.Hide() # includes win_update
def cm_unhide(self):
diff --git a/cad/src/outtakes/prefsTree-in-other-files.py b/cad/src/outtakes/prefsTree-in-other-files.py
new file mode 100644
index 000000000..389f4456c
--- /dev/null
+++ b/cad/src/outtakes/prefsTree-in-other-files.py
@@ -0,0 +1,77 @@
+
+
+see also model/prefsTree.py
+since then moved to outtakes
+
+=====
+
+from modelTree/TreeModel.py:
+
+
+
+_DEBUG_PREFTREE = False # bruce 050602 experiment; do not commit with True
+
+
+from end of get_topnodes in TreeModel
+
+ if _DEBUG_PREFTREE: #bruce 050602
+ try:
+ from foundation.Utility import Node
+ ## print "reloading prefsTree"
+ import model.prefsTree as _X
+ reload(_X)
+ from model.prefsTree import prefsTree # constructor for an object which has a tree of nodes and controls them
+ self.pt = prefsTree(self.assy) # guess; guessing it's ok to remake it each time
+ ptnode = self.pt.topnode
+ assert ptnode is not None
+ assert isinstance(ptnode, Node)
+ topnodes.append(ptnode)
+ except:
+ print_compact_traceback("error importing prefsTree or making one: ")
+
+
+ from TreeModel.make_cmenuspec... just before copy, cut, delete
+
+ # Customize command [bruce 050602 experiment -- unfinished and commented out ###@@@]
+ # [later comment, bruce 050704: I think this was intended to suggest PrefsNodes applicable to the selected item or items,
+ # and to make them and group them with it. Or (later) to put up a dialog whose end result might be to do that.]
+ # Provide this when all items are in the same group? no, any items could be grouped...
+ # so for initial experiments, always provide it. If it's a submenu, the selected items might affect
+ # what's in it, and some things in it might be already checkmarked if PrefsNodes are above them ...
+ # for very initial experiment let's provide it only for single items.
+ # Do we ask them what can be customized about them? I guess so.
+##unfinished...
+## if _DEBUG_PREFTREE and len(nodeset) == 1:
+## mspec = nodeset[0].customize_menuspec()
+## submenu = []
+
+
+
+======
+
+from assembly.py
+
+
+from model.prefsTree import MainPrefsGroupPart
+
+
+in class Assembly:
+
+ prefs_node = None #bruce 050602; default value of instance variable; experimental
+
+
+near end of topnode_partmaker_pairs:
+
+ if self.prefs_node is not None:
+ res.append(( self.prefs_node, MainPrefsGroupPart ))
+
+near end of topnodes_with_own_parts
+
+ if self.prefs_node is not None:
+ res.append( self.prefs_node)
+
+in valid_selgroup:
+
+ if not (self.root.is_ascendant(sg) or self.prefs_node is sg): #bruce 050602 kluge: added prefs_node
+ return False # can this ever happen??
+
diff --git a/cad/src/model/prefsTree.py b/cad/src/outtakes/prefsTree.py
index 3e72bc717..3e72bc717 100755
--- a/cad/src/model/prefsTree.py
+++ b/cad/src/outtakes/prefsTree.py
diff --git a/cad/src/tools/packageData.py b/cad/src/tools/packageData.py
index d6b9f59ed..73ebb8485 100644
--- a/cad/src/tools/packageData.py
+++ b/cad/src/tools/packageData.py
@@ -520,7 +520,6 @@ packageMapping_for_files = {
"PovrayScenePropDialog" : "ui/dialog|commands/PovraySceneProperties?", # for povray package, maybe
"preferences" : "foundation", # see module docstring for explanation
- "prefsTree" : "model", # see docstring for caveats
"prefs_constants" : "utilities", # or constants? see module docstring for explanation
"prefs_widgets" : "widgets", #? - might not work -- ### needs splitting, some goes in foundation