summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Smith <bruce@nanorex.com>2009-03-13 22:31:34 +0000
committerBruce Smith <bruce@nanorex.com>2009-03-13 22:31:34 +0000
commit6b98057f70829d5c353cadc0f0bccf389c1674f3 (patch)
treea8ac67b813041f026ddfd0a55d198d5b65b1bd2f
parente72b43a99913b5f00d3ab548e38163d2c587ca93 (diff)
downloadnanoengineer-6b98057f70829d5c353cadc0f0bccf389c1674f3.tar.gz
nanoengineer-6b98057f70829d5c353cadc0f0bccf389c1674f3.zip
split DrawingSetCache into its own file, add some doc
-rw-r--r--cad/src/graphics/drawing/DrawingSetCache.py48
-rw-r--r--cad/src/graphics/widgets/GLPane_drawingset_methods.py21
2 files changed, 49 insertions, 20 deletions
diff --git a/cad/src/graphics/drawing/DrawingSetCache.py b/cad/src/graphics/drawing/DrawingSetCache.py
new file mode 100644
index 000000000..126696d17
--- /dev/null
+++ b/cad/src/graphics/drawing/DrawingSetCache.py
@@ -0,0 +1,48 @@
+# Copyright 2009 Nanorex, Inc. See LICENSE file for details.
+"""
+DrawingSetCache.py -- cache of DrawingSets with associated drawing intents
+
+@author: Bruce
+@version: $Id$
+@copyright: 2009 Nanorex, Inc. See LICENSE file for details.
+
+History:
+
+Bruce 090313 moved into its own file, from GLPane_drawingset_methods.py.
+
+TODO: add usage tracking.
+"""
+
+class DrawingSetCache(object): #bruce 090227
+ """
+ A persistent cache of DrawingSets, one for each "drawing intent"
+ ever passed to glpane.draw_csdl (as presently used by
+ GLPane_drawingset_methods).
+
+ The drawing sets are public for incremental construction and for
+ drawing, as is our dictionary of them, self.dsets.
+
+ All attributes and methods are public.
+ """
+ # default values of instance variables
+
+ saved_change_indicator = None #bruce 090309
+ # public for set and compare (by '==')
+
+ def __init__(self, cachename, temporary):
+ self.cachename = cachename
+ self.temporary = temporary
+ self.dsets = {} # maps drawing intent to DrawingSet;
+ # public for access and modification, and so are the dsets it contains
+ return
+
+ def destroy(self):
+ for dset in self.dsets.values():
+ dset.destroy()
+ self.dsets = {}
+ self.saved_change_indicator = None
+ return
+
+ pass
+
+# end
diff --git a/cad/src/graphics/widgets/GLPane_drawingset_methods.py b/cad/src/graphics/widgets/GLPane_drawingset_methods.py
index e2088a838..96933fa70 100644
--- a/cad/src/graphics/widgets/GLPane_drawingset_methods.py
+++ b/cad/src/graphics/widgets/GLPane_drawingset_methods.py
@@ -22,6 +22,7 @@ import foundation.env as env
from graphics.drawing.DrawingSet import DrawingSet
+from graphics.drawing.DrawingSetCache import DrawingSetCache
from graphics.widgets.GLPane_csdl_collector import GLPane_csdl_collector
from graphics.widgets.GLPane_csdl_collector import fake_GLPane_csdl_collector
@@ -30,26 +31,6 @@ _DEBUG_DSETS = False
# ==
-class DrawingSetCache(object): #bruce 090227
- """
- A persistent cache of DrawingSets, one for each "drawing intent"
- passed to draw_csdl.
- """
- saved_change_indicator = None #bruce 090309
- def __init__(self, cachename, temporary):
- self.cachename = cachename
- self.temporary = temporary
- self.dsets = {} # maps drawing intent to DrawingSet
- def destroy(self):
- for dset in self.dsets.values():
- dset.destroy()
- self.dsets = {}
- self.saved_change_indicator = None
- return
- pass
-
-# ==
-
class GLPane_drawingset_methods(object):
"""
DrawingSet/CSDL helpers for GLPane_minimal, as a mixin class