Browse Source

allowing the call of defineoptions() in all subclasses of a direct gui object. It should now correctly process your optiondefs

Josh Wilson 17 years ago
parent
commit
5101b87561
1 changed files with 4 additions and 3 deletions
  1. 4 3
      direct/src/gui/DirectGuiBase.py

+ 4 - 3
direct/src/gui/DirectGuiBase.py

@@ -182,9 +182,9 @@ class DirectGuiBase(DirectObject.DirectObject):
             self._dynamicGroups = ()
             self._dynamicGroups = ()
         self._dynamicGroups = self._dynamicGroups + tuple(dynamicGroups)
         self._dynamicGroups = self._dynamicGroups + tuple(dynamicGroups)
         # Reconcile command line and default options
         # Reconcile command line and default options
-        self.addoptions(optionDefs)
+        self.addoptions(optionDefs, keywords)
 
 
-    def addoptions(self, optionDefs):
+    def addoptions(self, optionDefs, optionkeywords):
         """ addoptions(optionDefs) - add option def to option info """
         """ addoptions(optionDefs) - add option def to option info """
         # Add additional options, providing the default value and the
         # Add additional options, providing the default value and the
         # method to call when the value is changed.  See
         # method to call when the value is changed.  See
@@ -199,6 +199,7 @@ class DirectGuiBase(DirectObject.DirectObject):
 
 
         for name, default, function in optionDefs:
         for name, default, function in optionDefs:
             if '_' not in name:
             if '_' not in name:
+                default = optionkeywords.get(name, default)
                 # The option will already exist if it has been defined
                 # The option will already exist if it has been defined
                 # in a derived class.  In this case, do not override the
                 # in a derived class.  In this case, do not override the
                 # default value of the option or the callback function
                 # default value of the option or the callback function
@@ -651,7 +652,7 @@ def toggleGuiGridSnap():
 def setGuiGridSpacing(spacing):
 def setGuiGridSpacing(spacing):
     DirectGuiWidget.gridSpacing = spacing
     DirectGuiWidget.gridSpacing = spacing
 
 
-if config.GetBool('record-gui-creation-stack', 0):
+if config.GetBool('record-gui-creation-stack', __dev__):
     # this will help track down the code that created DirectGui objects
     # this will help track down the code that created DirectGui objects
     # call obj.printCreationStackTrace() to figure out what code created it
     # call obj.printCreationStackTrace() to figure out what code created it
     DirectGuiBase = recordCreationStackStr(DirectGuiBase)
     DirectGuiBase = recordCreationStackStr(DirectGuiBase)