Browse Source

formatting

Dave Schuyler 20 years ago
parent
commit
64a75159c6

+ 15 - 15
direct/src/gui/DirectCheckButton.py

@@ -19,7 +19,7 @@ class DirectCheckButton(DirectButton):
         # state can have a different text/geom/image
         # state can have a different text/geom/image
         # State transitions happen automatically based upon mouse interaction
         # State transitions happen automatically based upon mouse interaction
         # Responds to click event and calls command if None
         # Responds to click event and calls command if None
-        
+
         self.colors = None
         self.colors = None
         optiondefs = (
         optiondefs = (
             ('indicatorValue', 0, self.setIndicatorValue),
             ('indicatorValue', 0, self.setIndicatorValue),
@@ -46,25 +46,25 @@ class DirectCheckButton(DirectButton):
                                               text = ('X', 'X'),
                                               text = ('X', 'X'),
                                               relief = self['boxRelief'],
                                               relief = self['boxRelief'],
                                               )
                                               )
-       
+
         # Call option initialization functions
         # Call option initialization functions
         self.initialiseoptions(DirectCheckButton)
         self.initialiseoptions(DirectCheckButton)
-        # After initialization with X giving it the correct size, put back space 
+        # After initialization with X giving it the correct size, put back space
         if self['boxImage'] ==  None:
         if self['boxImage'] ==  None:
             self.indicator['text'] = (' ', '*')
             self.indicator['text'] = (' ', '*')
-            self.indicator['text_pos'] = (0,-.2)
+            self.indicator['text_pos'] = (0, -.2)
         else:
         else:
             self.indicator['text'] = (' ', ' ')
             self.indicator['text'] = (' ', ' ')
         if self['boxImageColor'] != None and self['boxImage'] !=  None:
         if self['boxImageColor'] != None and self['boxImage'] !=  None:
-            self.colors = [VBase4(0,0,0,0), self['boxImageColor']]
-            self.component('indicator')['image_color'] = VBase4(0,0,0,0)
-            
+            self.colors = [VBase4(0, 0, 0, 0), self['boxImageColor']]
+            self.component('indicator')['image_color'] = VBase4(0, 0, 0, 0)
+
     # Override the resetFrameSize of DirectGuiWidget inorder to provide space for label
     # Override the resetFrameSize of DirectGuiWidget inorder to provide space for label
     def resetFrameSize(self):
     def resetFrameSize(self):
         self.setFrameSize(fClearFrame = 1)
         self.setFrameSize(fClearFrame = 1)
-        
+
     def setFrameSize(self, fClearFrame = 0):
     def setFrameSize(self, fClearFrame = 0):
-        
+
         if self['frameSize']:
         if self['frameSize']:
             # Use user specified bounds
             # Use user specified bounds
             self.bounds = self['frameSize']
             self.bounds = self['frameSize']
@@ -125,7 +125,7 @@ class DirectCheckButton(DirectButton):
             (frameType != PGFrameStyle.TFlat)):
             (frameType != PGFrameStyle.TFlat)):
             bw = self['borderWidth']
             bw = self['borderWidth']
         else:
         else:
-            bw = (0,0)
+            bw = (0, 0)
         # Set frame to new dimensions
         # Set frame to new dimensions
         self.guiItem.setFrame(
         self.guiItem.setFrame(
             self.bounds[0] - bw[0],
             self.bounds[0] - bw[0],
@@ -137,7 +137,7 @@ class DirectCheckButton(DirectButton):
         if not self.indicator['pos']:
         if not self.indicator['pos']:
             bbounds = self.bounds
             bbounds = self.bounds
             lbounds = self.indicator.bounds
             lbounds = self.indicator.bounds
-            newpos = [0,0,0]
+            newpos = [0, 0, 0]
 
 
             if self['boxPlacement'] == 'left':            #left
             if self['boxPlacement'] == 'left':            #left
                 newpos[0] += bbounds[0]-lbounds[0] + self['boxBorder'] + ibw[0]
                 newpos[0] += bbounds[0]-lbounds[0] + self['boxBorder'] + ibw[0]
@@ -154,18 +154,18 @@ class DirectCheckButton(DirectButton):
             else:                                      #below
             else:                                      #below
                 newpos[2] += bbounds[2]-lbounds[2] + self['boxBorder'] + ibw[1]
                 newpos[2] += bbounds[2]-lbounds[2] + self['boxBorder'] + ibw[1]
 
 
-            self.indicator.setPos(newpos[0],newpos[1],newpos[2])
+            self.indicator.setPos(newpos[0], newpos[1], newpos[2])
+
 
 
-        
     def commandFunc(self, event):
     def commandFunc(self, event):
         self['indicatorValue'] = 1 - self['indicatorValue']
         self['indicatorValue'] = 1 - self['indicatorValue']
         if self.colors != None:
         if self.colors != None:
             self.component('indicator')['image_color'] = self.colors[self['indicatorValue']]
             self.component('indicator')['image_color'] = self.colors[self['indicatorValue']]
-            
+
         if self['command']:
         if self['command']:
             # Pass any extra args to command
             # Pass any extra args to command
             apply(self['command'], [self['indicatorValue']] + self['extraArgs'])
             apply(self['command'], [self['indicatorValue']] + self['extraArgs'])
-            
+
     def setIndicatorValue(self):
     def setIndicatorValue(self):
         self.component('indicator').guiItem.setState(self['indicatorValue'])
         self.component('indicator').guiItem.setState(self['indicatorValue'])
         if self.colors != None:
         if self.colors != None:

+ 17 - 17
direct/src/gui/DirectDialog.py

@@ -4,7 +4,7 @@ from DirectButton import *
 
 
 def findDialog(uniqueName):
 def findDialog(uniqueName):
     """findPanel(string uniqueName)
     """findPanel(string uniqueName)
-    
+
     Returns the panel whose uniqueName is given.  This is mainly
     Returns the panel whose uniqueName is given.  This is mainly
     useful for debugging, to get a pointer to the current onscreen
     useful for debugging, to get a pointer to the current onscreen
     panel of a particular type.
     panel of a particular type.
@@ -48,7 +48,7 @@ class DirectDialog(DirectFrame):
             buttonImageList      List of images to show on each button
             buttonImageList      List of images to show on each button
             buttonValueList      List of values sent to dialog command for
             buttonValueList      List of values sent to dialog command for
                                  each button.  If value is [] then the
                                  each button.  If value is [] then the
-                                 ordinal rank of the button is used as 
+                                 ordinal rank of the button is used as
                                  its value
                                  its value
             buttonHotKeyList     List of hotkeys to bind to each button.
             buttonHotKeyList     List of hotkeys to bind to each button.
                                  Typing hotkey is equivalent to pressing
                                  Typing hotkey is equivalent to pressing
@@ -64,7 +64,7 @@ class DirectDialog(DirectFrame):
             midPad               Extra space added between text/buttons
             midPad               Extra space added between text/buttons
             sidePad              Extra space added to either side of
             sidePad              Extra space added to either side of
                                  text/buttons
                                  text/buttons
-            buttonPadSF          Scale factor used to expand/contract 
+            buttonPadSF          Scale factor used to expand/contract
                                  button horizontal spacing
                                  button horizontal spacing
             command              Callback command used when a button is
             command              Callback command used when a button is
                                  pressed.  Value supplied to command
                                  pressed.  Value supplied to command
@@ -75,7 +75,7 @@ class DirectDialog(DirectFrame):
                Values of None are substituted for lists that are shorter
                Values of None are substituted for lists that are shorter
                than the max length
                than the max length
          """
          """
-            
+
         # Inherits from DirectFrame
         # Inherits from DirectFrame
         optiondefs = (
         optiondefs = (
             # Define type of DirectGuiWidget
             # Define type of DirectGuiWidget
@@ -95,8 +95,8 @@ class DirectDialog(DirectFrame):
             ('buttonImageList',   [],            INITOPT),
             ('buttonImageList',   [],            INITOPT),
             ('buttonValueList',   [],            INITOPT),
             ('buttonValueList',   [],            INITOPT),
             ('buttonHotKeyList',  [],            INITOPT),
             ('buttonHotKeyList',  [],            INITOPT),
-            ('button_borderWidth',(.01,.01),     None),
-            ('button_pad',        (.01,.01),     None),
+            ('button_borderWidth', (.01, .01),     None),
+            ('button_pad',        (.01, .01),     None),
             ('button_relief',     RAISED,        None),
             ('button_relief',     RAISED,        None),
             ('button_text_scale', 0.06,        None),
             ('button_text_scale', 0.06,        None),
             ('buttonSize',        None,          INITOPT),
             ('buttonSize',        None,          INITOPT),
@@ -126,7 +126,7 @@ class DirectDialog(DirectFrame):
         # Store this panel in our map of all open panels.
         # Store this panel in our map of all open panels.
         DirectDialog.AllDialogs[self['dialogName']] = self
         DirectDialog.AllDialogs[self['dialogName']] = self
         DirectDialog.PanelIndex += 1
         DirectDialog.PanelIndex += 1
-        
+
         # Determine number of buttons
         # Determine number of buttons
         self.numButtons = max(len(self['buttonTextList']),
         self.numButtons = max(len(self['buttonTextList']),
                               len(self['buttonGeomList']),
                               len(self['buttonGeomList']),
@@ -186,9 +186,9 @@ class DirectDialog(DirectFrame):
                                 extraArgs = [value])
                                 extraArgs = [value])
                     self.bind('press-' + key + '-', self.buttonCommand,
                     self.bind('press-' + key + '-', self.buttonCommand,
                               extraArgs = [value])
                               extraArgs = [value])
-                    
+
             else:
             else:
-                button.bind('press-' + hotKey + '-',self.buttonCommand,
+                button.bind('press-' + hotKey + '-', self.buttonCommand,
                             extraArgs = [value])
                             extraArgs = [value])
                 self.bind('press-' + hotKey + '-', self.buttonCommand,
                 self.bind('press-' + hotKey + '-', self.buttonCommand,
                           extraArgs = [value])
                           extraArgs = [value])
@@ -247,7 +247,7 @@ class DirectDialog(DirectFrame):
                 bt += bpad[1]
                 bt += bpad[1]
                 # Now resize buttons to match largest
                 # Now resize buttons to match largest
                 for button in self.buttonList:
                 for button in self.buttonList:
-                    button['frameSize'] = (bl,br,bb,bt)
+                    button['frameSize'] = (bl, br, bb, bt)
             # Must compensate for scale
             # Must compensate for scale
             scale = self['button_scale']
             scale = self['button_scale']
             # Can either be a Vec3 or a tuple of 3 values
             # Can either be a Vec3 or a tuple of 3 values
@@ -283,7 +283,7 @@ class DirectDialog(DirectFrame):
             bl = br = bb = bt = 0
             bl = br = bb = bt = 0
             bPos = 0
             bPos = 0
             bMax = 0
             bMax = 0
-            bpad = (0,0)
+            bpad = (0, 0)
             bHeight = bWidth = 0
             bHeight = bWidth = 0
         # Resize frame to fit text and buttons
         # Resize frame to fit text and buttons
         l = min(bPos + bl, l) - pad[0]
         l = min(bPos + bl, l) - pad[0]
@@ -296,7 +296,7 @@ class DirectDialog(DirectFrame):
         t = t + self['topPad'] + pad[1]
         t = t + self['topPad'] + pad[1]
         self['image_scale'] = (r - l, 1, t - b)
         self['image_scale'] = (r - l, 1, t - b)
         # Center frame about text and buttons
         # Center frame about text and buttons
-        self['image_pos'] = ((l+r)*0.5, 0.0,(b+t)*0.5)
+        self['image_pos'] = ((l+r)*0.5, 0.0, (b+t)*0.5)
         self.resetFrameSize()
         self.resetFrameSize()
 
 
     def show(self):
     def show(self):
@@ -316,7 +316,7 @@ class DirectDialog(DirectFrame):
     def setMessage(self, message):
     def setMessage(self, message):
         self['text'] = message
         self['text'] = message
         self.configureDialog()
         self.configureDialog()
-        
+
     def cleanup(self):
     def cleanup(self):
         # Remove this panel out of the AllDialogs list
         # Remove this panel out of the AllDialogs list
         uniqueName = self['dialogName']
         uniqueName = self['dialogName']
@@ -348,7 +348,7 @@ class OkCancelDialog(DirectDialog):
         optiondefs = (
         optiondefs = (
             # Define type of DirectGuiWidget
             # Define type of DirectGuiWidget
             ('buttonTextList',  ['OK','Cancel'],       INITOPT),
             ('buttonTextList',  ['OK','Cancel'],       INITOPT),
-            ('buttonValueList', [DIALOG_OK,DIALOG_CANCEL], INITOPT),
+            ('buttonValueList', [DIALOG_OK, DIALOG_CANCEL], INITOPT),
             )
             )
         # Merge keyword options with default options
         # Merge keyword options with default options
         self.defineoptions(kw, optiondefs)
         self.defineoptions(kw, optiondefs)
@@ -361,7 +361,7 @@ class YesNoDialog(DirectDialog):
         optiondefs = (
         optiondefs = (
             # Define type of DirectGuiWidget
             # Define type of DirectGuiWidget
             ('buttonTextList',  ['Yes', 'No'],       INITOPT),
             ('buttonTextList',  ['Yes', 'No'],       INITOPT),
-            ('buttonValueList', [DIALOG_YES,DIALOG_NO], INITOPT),
+            ('buttonValueList', [DIALOG_YES, DIALOG_NO], INITOPT),
             )
             )
         # Merge keyword options with default options
         # Merge keyword options with default options
         self.defineoptions(kw, optiondefs)
         self.defineoptions(kw, optiondefs)
@@ -374,7 +374,7 @@ class YesNoCancelDialog(DirectDialog):
         optiondefs = (
         optiondefs = (
             # Define type of DirectGuiWidget
             # Define type of DirectGuiWidget
             ('buttonTextList',  ['Yes', 'No', 'Cancel'],  INITOPT),
             ('buttonTextList',  ['Yes', 'No', 'Cancel'],  INITOPT),
-            ('buttonValueList', [DIALOG_YES,DIALOG_NO,DIALOG_CANCEL],
+            ('buttonValueList', [DIALOG_YES, DIALOG_NO, DIALOG_CANCEL],
              INITOPT),
              INITOPT),
             )
             )
         # Merge keyword options with default options
         # Merge keyword options with default options
@@ -388,7 +388,7 @@ class RetryCancelDialog(DirectDialog):
         optiondefs = (
         optiondefs = (
             # Define type of DirectGuiWidget
             # Define type of DirectGuiWidget
             ('buttonTextList',  ['Retry','Cancel'],   INITOPT),
             ('buttonTextList',  ['Retry','Cancel'],   INITOPT),
-            ('buttonValueList', [DIALOG_RETRY,DIALOG_CANCEL], INITOPT),
+            ('buttonValueList', [DIALOG_RETRY, DIALOG_CANCEL], INITOPT),
             )
             )
         # Merge keyword options with default options
         # Merge keyword options with default options
         self.defineoptions(kw, optiondefs)
         self.defineoptions(kw, optiondefs)

+ 10 - 10
direct/src/gui/DirectEntry.py

@@ -13,7 +13,7 @@ class DirectEntry(DirectFrame):
     """
     """
 
 
     directWtext = ConfigVariableBool('direct-wtext', 1)
     directWtext = ConfigVariableBool('direct-wtext', 1)
-    
+
     def __init__(self, parent = None, **kw):
     def __init__(self, parent = None, **kw):
         # Inherits from DirectFrame
         # Inherits from DirectFrame
         # A Direct Frame can have:
         # A Direct Frame can have:
@@ -48,9 +48,9 @@ class DirectEntry(DirectFrame):
             ('extraArgs',      [],                None),
             ('extraArgs',      [],                None),
             # commands to be called when focus is gained or lost
             # commands to be called when focus is gained or lost
             ('focusInCommand', None,              None),
             ('focusInCommand', None,              None),
-            ('focusInExtraArgs',[],              None),
-            ('focusOutCommand',None,              None),
-            ('focusOutExtraArgs',[],              None),
+            ('focusInExtraArgs', [],              None),
+            ('focusOutCommand', None,              None),
+            ('focusOutExtraArgs', [],              None),
             # Sounds to be used for button events
             # Sounds to be used for button events
             ('rolloverSound',   getDefaultRolloverSound(), self.setRolloverSound),
             ('rolloverSound',   getDefaultRolloverSound(), self.setRolloverSound),
             ('clickSound',    getDefaultClickSound(),    self.setClickSound),
             ('clickSound',    getDefaultClickSound(),    self.setClickSound),
@@ -64,7 +64,7 @@ class DirectEntry(DirectFrame):
         if self['entryFont'] == None:
         if self['entryFont'] == None:
             font = getDefaultFont()
             font = getDefaultFont()
         else:
         else:
-            font = self['entryFont'] 
+            font = self['entryFont']
 
 
         # Create Text Node Component
         # Create Text Node Component
         self.onscreenText = self.createcomponent(
         self.onscreenText = self.createcomponent(
@@ -146,11 +146,11 @@ class DirectEntry(DirectFrame):
     def focusInCommandFunc(self):
     def focusInCommandFunc(self):
         if self['focusInCommand']:
         if self['focusInCommand']:
             apply(self['focusInCommand'], self['focusInExtraArgs'])
             apply(self['focusInCommand'], self['focusInExtraArgs'])
-            
+
     def focusOutCommandFunc(self):
     def focusOutCommandFunc(self):
         if self['focusOutCommand']:
         if self['focusOutCommand']:
             apply(self['focusOutCommand'], self['focusOutExtraArgs'])
             apply(self['focusOutCommand'], self['focusOutExtraArgs'])
-            
+
     def set(self, text):
     def set(self, text):
         self.unicodeText = isinstance(text, types.UnicodeType)
         self.unicodeText = isinstance(text, types.UnicodeType)
         if self.unicodeText:
         if self.unicodeText:
@@ -164,7 +164,7 @@ class DirectEntry(DirectFrame):
             # return an 8-bit string.  This will be encoded if
             # return an 8-bit string.  This will be encoded if
             # necessary, according to Panda's default encoding.
             # necessary, according to Panda's default encoding.
             return self.guiItem.getText()
             return self.guiItem.getText()
-            
+
         if self.unicodeText:
         if self.unicodeText:
             return self.guiItem.getWtext()
             return self.guiItem.getWtext()
         else:
         else:
@@ -187,7 +187,7 @@ class DirectEntry(DirectFrame):
             self.guiItem.setCursorPosition(len(self.get()) + pos)
             self.guiItem.setCursorPosition(len(self.get()) + pos)
         else:
         else:
             self.guiItem.setCursorPosition(pos)
             self.guiItem.setCursorPosition(pos)
-            
+
     def enterText(self, text):
     def enterText(self, text):
         """ sets the entry's text, and moves the cursor to the end """
         """ sets the entry's text, and moves the cursor to the end """
         self.set(text)
         self.set(text)
@@ -215,7 +215,7 @@ class DirectEntry(DirectFrame):
 
 
         bottom = -0.3 * lineHeight - (lineHeight * (numLines - 1))
         bottom = -0.3 * lineHeight - (lineHeight * (numLines - 1))
         top = lineHeight
         top = lineHeight
-        
+
         self.ll.set(left, 0.0, bottom)
         self.ll.set(left, 0.0, bottom)
         self.ur.set(right, 0.0, top)
         self.ur.set(right, 0.0, top)
         self.ll = mat.xformPoint(self.ll)
         self.ll = mat.xformPoint(self.ll)

+ 41 - 41
direct/src/gui/DirectGuiBase.py

@@ -35,7 +35,7 @@ Code Overview:
     a dictionary of the keyword options specified as part of the constructor
     a dictionary of the keyword options specified as part of the constructor
     keywords can be of the form 'component_option', where component is
     keywords can be of the form 'component_option', where component is
     the name of a widget's component, a component group or a component alias
     the name of a widget's component, a component group or a component alias
-    
+
     self._dynamicGroups, a list of group names for which it is permissible
     self._dynamicGroups, a list of group names for which it is permissible
     to specify options before components of that group are created.
     to specify options before components of that group are created.
     If a widget is a derived class the order of execution would be:
     If a widget is a derived class the order of execution would be:
@@ -156,7 +156,7 @@ class DirectGuiBase(DirectObject.DirectObject):
         # to call when the value is changed.  If any option created by
         # to call when the value is changed.  If any option created by
         # base classes has the same name as one in <optionDefs>, the
         # base classes has the same name as one in <optionDefs>, the
         # base class's value and function will be overriden.
         # base class's value and function will be overriden.
-        
+
         # keywords is a dictionary of keyword/value pairs from the constructor
         # keywords is a dictionary of keyword/value pairs from the constructor
         # optionDefs is a dictionary of default options for the widget
         # optionDefs is a dictionary of default options for the widget
         # dynamicGroups is a tuple of component groups for which you can
         # dynamicGroups is a tuple of component groups for which you can
@@ -178,20 +178,20 @@ class DirectGuiBase(DirectObject.DirectObject):
         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)
-        
+
     def addoptions(self, optionDefs):
     def addoptions(self, optionDefs):
         """ 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
         # "defineoptions" for more details
         # "defineoptions" for more details
-        
+
         # optimisations:
         # optimisations:
         optionInfo = self._optionInfo
         optionInfo = self._optionInfo
         optionInfo_has_key = optionInfo.has_key
         optionInfo_has_key = optionInfo.has_key
         keywords = self._constructorKeywords
         keywords = self._constructorKeywords
         keywords_has_key = keywords.has_key
         keywords_has_key = keywords.has_key
         FUNCTION = _OPT_FUNCTION
         FUNCTION = _OPT_FUNCTION
-        
+
         for name, default, function in optionDefs:
         for name, default, function in optionDefs:
             if '_' not in name:
             if '_' not in name:
                 # The option will already exist if it has been defined
                 # The option will already exist if it has been defined
@@ -218,10 +218,10 @@ class DirectGuiBase(DirectObject.DirectObject):
                 # of an option of a component of a base class.
                 # of an option of a component of a base class.
                 if not keywords_has_key(name):
                 if not keywords_has_key(name):
                     keywords[name] = [default, 0]
                     keywords[name] = [default, 0]
-                
+
     def initialiseoptions(self, myClass):
     def initialiseoptions(self, myClass):
         """
         """
-        Call all initialisation functions to initialize widget 
+        Call all initialisation functions to initialize widget
         options to default of keyword value
         options to default of keyword value
         """
         """
         # This is to make sure this method class is only called by
         # This is to make sure this method class is only called by
@@ -262,13 +262,13 @@ class DirectGuiBase(DirectObject.DirectObject):
     def postInitialiseFunc(self):
     def postInitialiseFunc(self):
         for func in self.postInitialiseFuncList:
         for func in self.postInitialiseFuncList:
             func()
             func()
-                    
+
     def isinitoption(self, option):
     def isinitoption(self, option):
         """
         """
         Is this opition one that can only be specified at construction?
         Is this opition one that can only be specified at construction?
         """
         """
         return self._optionInfo[option][_OPT_FUNCTION] is INITOPT
         return self._optionInfo[option][_OPT_FUNCTION] is INITOPT
-    
+
     def options(self):
     def options(self):
         """
         """
         Print out a list of available widget options.
         Print out a list of available widget options.
@@ -282,7 +282,7 @@ class DirectGuiBase(DirectObject.DirectObject):
                 options.append((option, default, isinit))
                 options.append((option, default, isinit))
             options.sort()
             options.sort()
         return options
         return options
-    
+
     def configure(self, option=None, **kw):
     def configure(self, option=None, **kw):
         """
         """
         configure(option = None)
         configure(option = None)
@@ -301,7 +301,7 @@ class DirectGuiBase(DirectObject.DirectObject):
         #
         #
         # If *option* is a string, return the 3 element tuple for the
         # If *option* is a string, return the 3 element tuple for the
         # given configuration option.
         # given configuration option.
-        
+
         # First, deal with the option queries.
         # First, deal with the option queries.
         if len(kw) == 0:
         if len(kw) == 0:
             # This configure call is querying the values of one or all options.
             # This configure call is querying the values of one or all options.
@@ -317,7 +317,7 @@ class DirectGuiBase(DirectObject.DirectObject):
             else:
             else:
                 config = self._optionInfo[option]
                 config = self._optionInfo[option]
                 return (option, config[_OPT_DEFAULT], config[_OPT_VALUE])
                 return (option, config[_OPT_DEFAULT], config[_OPT_VALUE])
-            
+
         # optimizations:
         # optimizations:
         optionInfo = self._optionInfo
         optionInfo = self._optionInfo
         optionInfo_has_key = optionInfo.has_key
         optionInfo_has_key = optionInfo.has_key
@@ -327,11 +327,11 @@ class DirectGuiBase(DirectObject.DirectObject):
         componentAliases_has_key = componentAliases.has_key
         componentAliases_has_key = componentAliases.has_key
         VALUE = _OPT_VALUE
         VALUE = _OPT_VALUE
         FUNCTION = _OPT_FUNCTION
         FUNCTION = _OPT_FUNCTION
-        
+
         # This will contain a list of options in *kw* which
         # This will contain a list of options in *kw* which
         # are known to this gui item.
         # are known to this gui item.
         directOptions = []
         directOptions = []
-        
+
         # This will contain information about the options in
         # This will contain information about the options in
         # *kw* of the form <component>_<option>, where
         # *kw* of the form <component>_<option>, where
         # <component> is a component of this megawidget.  It is a
         # <component> is a component of this megawidget.  It is a
@@ -343,7 +343,7 @@ class DirectGuiBase(DirectObject.DirectObject):
 
 
         for option, value in kw.items():
         for option, value in kw.items():
             if optionInfo_has_key(option):
             if optionInfo_has_key(option):
-                # This is one of the options of this gui item. 
+                # This is one of the options of this gui item.
                 # Check it is an initialisation option.
                 # Check it is an initialisation option.
                 if optionInfo[option][FUNCTION] is INITOPT:
                 if optionInfo[option][FUNCTION] is INITOPT:
                     print 'Cannot configure initialisation option "' \
                     print 'Cannot configure initialisation option "' \
@@ -416,23 +416,23 @@ class DirectGuiBase(DirectObject.DirectObject):
         # Pass in the dictionary of keyword/values created above
         # Pass in the dictionary of keyword/values created above
         map(apply, indirectOptions.keys(),
         map(apply, indirectOptions.keys(),
                 ((),) * len(indirectOptions), indirectOptions.values())
                 ((),) * len(indirectOptions), indirectOptions.values())
-            
+
         # Call the configuration callback function for each option.
         # Call the configuration callback function for each option.
         for option in directOptions:
         for option in directOptions:
             info = optionInfo[option]
             info = optionInfo[option]
             func = info[_OPT_FUNCTION]
             func = info[_OPT_FUNCTION]
             if func is not None:
             if func is not None:
               func()
               func()
-              
+
     # Allow index style references
     # Allow index style references
     def __setitem__(self, key, value):
     def __setitem__(self, key, value):
         apply(self.configure, (), {key: value})
         apply(self.configure, (), {key: value})
-        
+
     def cget(self, option):
     def cget(self, option):
         """
         """
         Get current configuration setting for this option
         Get current configuration setting for this option
         """
         """
-        # Return the value of an option, for example myWidget['font']. 
+        # Return the value of an option, for example myWidget['font'].
         if self._optionInfo.has_key(option):
         if self._optionInfo.has_key(option):
             return self._optionInfo[option][_OPT_VALUE]
             return self._optionInfo[option][_OPT_VALUE]
         else:
         else:
@@ -466,10 +466,10 @@ class DirectGuiBase(DirectObject.DirectObject):
         # Option not found
         # Option not found
         raise KeyError, 'Unknown option "' + option + \
         raise KeyError, 'Unknown option "' + option + \
                 '" for ' + self.__class__.__name__
                 '" for ' + self.__class__.__name__
-    
+
     # Allow index style refererences
     # Allow index style refererences
     __getitem__ = cget
     __getitem__ = cget
-    
+
     def createcomponent(self, componentName, componentAliases, componentGroup,
     def createcomponent(self, componentName, componentAliases, componentGroup,
                         widgetClass, *widgetArgs, **kw):
                         widgetClass, *widgetArgs, **kw):
         """
         """
@@ -479,7 +479,7 @@ class DirectGuiBase(DirectObject.DirectObject):
         if '_' in componentName:
         if '_' in componentName:
             raise ValueError, \
             raise ValueError, \
                     'Component name "%s" must not contain "_"' % componentName
                     'Component name "%s" must not contain "_"' % componentName
-        
+
         # Get construction keywords
         # Get construction keywords
         if hasattr(self, '_constructorKeywords'):
         if hasattr(self, '_constructorKeywords'):
             keywords = self._constructorKeywords
             keywords = self._constructorKeywords
@@ -515,7 +515,7 @@ class DirectGuiBase(DirectObject.DirectObject):
 
 
         # First, walk through the option list looking for arguments
         # First, walk through the option list looking for arguments
         # than refer to this component's group.
         # than refer to this component's group.
-        
+
         for option in keywords.keys():
         for option in keywords.keys():
             # Check if this keyword argument refers to the group
             # Check if this keyword argument refers to the group
             # of this component.  If so, add this to the options
             # of this component.  If so, add this to the options
@@ -534,7 +534,7 @@ class DirectGuiBase(DirectObject.DirectObject):
         # this component specifically by name.  These are more
         # this component specifically by name.  These are more
         # specific than the group arguments, above; we walk through
         # specific than the group arguments, above; we walk through
         # the list afterwards so they will override.
         # the list afterwards so they will override.
-        
+
         for option in keywords.keys():
         for option in keywords.keys():
             if len(option) > nameLen and option[:nameLen] == componentPrefix:
             if len(option) > nameLen and option[:nameLen] == componentPrefix:
                 # The keyword argument refers to this component, so add
                 # The keyword argument refers to this component, so add
@@ -617,7 +617,7 @@ class DirectGuiBase(DirectObject.DirectObject):
         del self._optionInfo
         del self._optionInfo
         del self.__componentInfo
         del self.__componentInfo
         del self.postInitialiseFuncList
         del self.postInitialiseFuncList
-        
+
     def bind(self, event, command, extraArgs = []):
     def bind(self, event, command, extraArgs = []):
         """
         """
         Bind the command (which should expect one arg) to the specified
         Bind the command (which should expect one arg) to the specified
@@ -627,7 +627,7 @@ class DirectGuiBase(DirectObject.DirectObject):
         # Need to tack on gui item specific id
         # Need to tack on gui item specific id
         gEvent = event + self.guiId
         gEvent = event + self.guiId
         self.accept(gEvent, command, extraArgs = extraArgs)
         self.accept(gEvent, command, extraArgs = extraArgs)
-        
+
     def unbind(self, event):
     def unbind(self, event):
         """
         """
         Unbind the specified event
         Unbind the specified event
@@ -681,12 +681,12 @@ class DirectGuiWidget(DirectGuiBase, NodePath):
             ('state',          NORMAL,       self.setState),
             ('state',          NORMAL,       self.setState),
             # Widget's frame characteristics
             # Widget's frame characteristics
             ('relief',         FLAT,         self.setRelief),
             ('relief',         FLAT,         self.setRelief),
-            ('borderWidth',    (.1,.1),      self.setBorderWidth),
+            ('borderWidth',    (.1, .1),      self.setBorderWidth),
             ('frameSize',      None,         self.setFrameSize),
             ('frameSize',      None,         self.setFrameSize),
-            ('frameColor',     (.8,.8,.8,1), self.setFrameColor),
+            ('frameColor',     (.8, .8, .8, 1), self.setFrameColor),
             ('frameTexture',   None,         self.setFrameTexture),
             ('frameTexture',   None,         self.setFrameTexture),
-            ('frameVisibleScale', (1,1),     self.setFrameVisibleScale),
-            ('pad',            (0,0),        self.resetFrameSize),
+            ('frameVisibleScale', (1, 1),     self.setFrameVisibleScale),
+            ('pad',            (0, 0),        self.resetFrameSize),
             # Override button id (beware! your name may not be unique!)
             # Override button id (beware! your name may not be unique!)
             ('guiId',          None,         INITOPT),
             ('guiId',          None,         INITOPT),
             # Initial pos/scale of the widget
             # Initial pos/scale of the widget
@@ -779,7 +779,7 @@ class DirectGuiWidget(DirectGuiBase, NodePath):
 
 
         # Update frame when everything has been initialized
         # Update frame when everything has been initialized
         self.postInitialiseFuncList.append(self.frameInitialiseFunc)
         self.postInitialiseFuncList.append(self.frameInitialiseFunc)
-            
+
         # Call option initialization functions
         # Call option initialization functions
         self.initialiseoptions(DirectGuiWidget)
         self.initialiseoptions(DirectGuiWidget)
 
 
@@ -806,7 +806,7 @@ class DirectGuiWidget(DirectGuiBase, NodePath):
         #mb = base.mouseWatcherNode.getModifierButtons()
         #mb = base.mouseWatcherNode.getModifierButtons()
         #mb.removeButton(KeyboardButton.control())
         #mb.removeButton(KeyboardButton.control())
         #base.mouseWatcherNode.setModifierButtons(mb)
         #base.mouseWatcherNode.setModifierButtons(mb)
-        
+
     def editStart(self, event):
     def editStart(self, event):
         taskMgr.remove('guiEditTask')
         taskMgr.remove('guiEditTask')
         vWidget2render2d = self.getPos(render2d)
         vWidget2render2d = self.getPos(render2d)
@@ -859,15 +859,15 @@ class DirectGuiWidget(DirectGuiBase, NodePath):
     def resetFrameSize(self):
     def resetFrameSize(self):
         if not self.fInit:
         if not self.fInit:
             self.setFrameSize(fClearFrame = 1)
             self.setFrameSize(fClearFrame = 1)
-        
+
     def setFrameSize(self, fClearFrame = 0):
     def setFrameSize(self, fClearFrame = 0):
         # Use ready state to determine frame Type
         # Use ready state to determine frame Type
         frameType = self.getFrameType()
         frameType = self.getFrameType()
         if self['frameSize']:
         if self['frameSize']:
             # Use user specified bounds
             # Use user specified bounds
             self.bounds = self['frameSize']
             self.bounds = self['frameSize']
-            #print "%s bounds = %s" % (self.getName(),self.bounds)            
-            bw = (0,0)
+            #print "%s bounds = %s" % (self.getName(), self.bounds)
+            bw = (0, 0)
 
 
         else:
         else:
             if fClearFrame and (frameType != PGFrameStyle.TNone):
             if fClearFrame and (frameType != PGFrameStyle.TNone):
@@ -886,7 +886,7 @@ class DirectGuiWidget(DirectGuiBase, NodePath):
                 (frameType != PGFrameStyle.TFlat)):
                 (frameType != PGFrameStyle.TFlat)):
                 bw = self['borderWidth']
                 bw = self['borderWidth']
             else:
             else:
-                bw = (0,0)
+                bw = (0, 0)
 
 
         # Set frame to new dimensions
         # Set frame to new dimensions
         self.guiItem.setFrame(
         self.guiItem.setFrame(
@@ -906,19 +906,19 @@ class DirectGuiWidget(DirectGuiBase, NodePath):
         return self.bounds
         return self.bounds
 
 
     def getWidth(self):
     def getWidth(self):
-        return self.bounds[1] - self.bounds[0] 
-    
+        return self.bounds[1] - self.bounds[0]
+
     def getHeight(self):
     def getHeight(self):
         return self.bounds[3] - self.bounds[2]
         return self.bounds[3] - self.bounds[2]
 
 
     def getCenter(self):
     def getCenter(self):
         x = self.bounds[0] + (self.bounds[1] - self.bounds[0])/2.0
         x = self.bounds[0] + (self.bounds[1] - self.bounds[0])/2.0
         y = self.bounds[2] + (self.bounds[3] - self.bounds[2])/2.0
         y = self.bounds[2] + (self.bounds[3] - self.bounds[2])/2.0
-        return (x,y)
+        return (x, y)
 
 
     def getFrameType(self, state = 0):
     def getFrameType(self, state = 0):
         return self.frameStyle[state].getType()
         return self.frameStyle[state].getType()
-    
+
     def updateFrameStyle(self):
     def updateFrameStyle(self):
         if not self.fInit:
         if not self.fInit:
             for i in range(self['numStates']):
             for i in range(self['numStates']):
@@ -1011,7 +1011,7 @@ class DirectGuiWidget(DirectGuiBase, NodePath):
         del self.guiItem
         del self.guiItem
         # Call superclass destruction method (clears out hooks)
         # Call superclass destruction method (clears out hooks)
         DirectGuiBase.destroy(self)
         DirectGuiBase.destroy(self)
-        
+
     def printConfig(self, indent = 0):
     def printConfig(self, indent = 0):
         space = ' ' * indent
         space = ' ' * indent
         print space + self.guiId, '-', self.__class__.__name__
         print space + self.guiId, '-', self.__class__.__name__

+ 6 - 6
direct/src/gui/DirectGuiTest.py

@@ -20,7 +20,7 @@ if __name__ == "__main__":
         # Get a handle on the geometry for the rollover state
         # Get a handle on the geometry for the rollover state
         rolloverSmiley = db.component('geom2')
         rolloverSmiley = db.component('geom2')
         rolloverSmiley.setScale(db.component('geom0').getScale()[0])
         rolloverSmiley.setScale(db.component('geom0').getScale()[0])
-        rolloverSmiley.lerpScale(.1,.1,.1, 1.0, blendType = 'easeInOut',
+        rolloverSmiley.lerpScale(.1, .1, .1, 1.0, blendType = 'easeInOut',
                                  task = 'shrink')
                                  task = 'shrink')
 
 
     def expand(db):
     def expand(db):
@@ -28,7 +28,7 @@ if __name__ == "__main__":
         taskMgr.remove('shrink')
         taskMgr.remove('shrink')
         taskMgr.remove('expand')
         taskMgr.remove('expand')
         db.component('geom0').setScale(db.component('geom2').getScale()[0])
         db.component('geom0').setScale(db.component('geom2').getScale()[0])
-        db.component('geom0').lerpScale(1,1,1, 1, blendType = 'easeInOut',
+        db.component('geom0').lerpScale(1, 1, 1, 1, blendType = 'easeInOut',
                                  task = 'expand')
                                  task = 'expand')
         db.component('geom2').clearColor()
         db.component('geom2').clearColor()
 
 
@@ -39,7 +39,7 @@ if __name__ == "__main__":
         db.component('geom0').setScale(db.component('geom2').getScale()[0])
         db.component('geom0').setScale(db.component('geom2').getScale()[0])
         db.component('geom1').setScale(db.component('geom2').getScale()[0])
         db.component('geom1').setScale(db.component('geom2').getScale()[0])
         db['text2_text'] = 'Ouch!'
         db['text2_text'] = 'Ouch!'
-        db['geom2_color'] = Vec4(1,0,0,1)
+        db['geom2_color'] = Vec4(1, 0, 0, 1)
         newX = -1.0 + random() * 2.0
         newX = -1.0 + random() * 2.0
         newZ = -1.0 + random() * 2.0
         newZ = -1.0 + random() * 2.0
         db.lerpPos(Point3(newX, 0, newZ), 1.0, task = 'runAway',
         db.lerpPos(Point3(newX, 0, newZ), 1.0, task = 'runAway',
@@ -59,7 +59,7 @@ if __name__ == "__main__":
                           text = ('Hi!', 'Ouch!', 'Bye!', 'ZZZZ!'),
                           text = ('Hi!', 'Ouch!', 'Bye!', 'ZZZZ!'),
                           scale = .15, relief = 'raised',
                           scale = .15, relief = 'raised',
                           # Here we set an option for a component of the button
                           # Here we set an option for a component of the button
-                          geom1_color = Vec4(1,0,0,1),
+                          geom1_color = Vec4(1, 0, 0, 1),
                           # Here is an example of a component group option
                           # Here is an example of a component group option
                           text_pos = (.6, -.8),
                           text_pos = (.6, -.8),
                           # Set audio characteristics
                           # Set audio characteristics
@@ -80,7 +80,7 @@ if __name__ == "__main__":
         db.bind(B3PRESS, lambda x, db = db: db.place())
         db.bind(B3PRESS, lambda x, db = db: db.place())
 
 
         dbArray.append(db)
         dbArray.append(db)
-    
+
         # To get rid of button and clear out hooks call:
         # To get rid of button and clear out hooks call:
         # db.destroy()
         # db.destroy()
 
 
@@ -115,7 +115,7 @@ if __name__ == "__main__":
     fancyDialog = YesNoDialog(text = 'Testing Direct Dialog',
     fancyDialog = YesNoDialog(text = 'Testing Direct Dialog',
                               geom = smiley,
                               geom = smiley,
                               geom_scale = .1,
                               geom_scale = .1,
-                              geom_pos = (-0.3,0,0),
+                              geom_pos = (-0.3, 0, 0),
                               command = printDialogValue)
                               command = printDialogValue)
 
 
     customDialog = DirectDialog(text = 'Pick a number',
     customDialog = DirectDialog(text = 'Pick a number',

+ 11 - 11
direct/src/gui/DirectOptionMenu.py

@@ -20,11 +20,11 @@ class DirectOptionMenu(DirectButton):
             # Amount of padding to place around popup button indicator
             # Amount of padding to place around popup button indicator
             ('popupMarkerBorder', (.1, .1), None),
             ('popupMarkerBorder', (.1, .1), None),
             # Background color to use to highlight popup menu items
             # Background color to use to highlight popup menu items
-            ('highlightColor', (.5,.5,.5,1),None),
+            ('highlightColor', (.5, .5, .5, 1), None),
             # Alignment to use for text on popup menu button
             # Alignment to use for text on popup menu button
             # Changing this breaks button layout
             # Changing this breaks button layout
             ('text_align',  TextNode.ALeft, None),
             ('text_align',  TextNode.ALeft, None),
-            # Remove press effect because it looks a bit funny 
+            # Remove press effect because it looks a bit funny
             ('pressEffect',     0,          INITOPT),
             ('pressEffect',     0,          INITOPT),
            )
            )
         # Merge keyword options with default options
         # Merge keyword options with default options
@@ -47,7 +47,7 @@ class DirectOptionMenu(DirectButton):
         self.popupMarker.bind(B1RELEASE, self.selectHighlightedIndex)
         self.popupMarker.bind(B1RELEASE, self.selectHighlightedIndex)
         # Make popup marker have the same click sound
         # Make popup marker have the same click sound
         self.popupMarker.guiItem.setSound(
         self.popupMarker.guiItem.setSound(
-            B1PRESS + self.popupMarker.guiId,self['clickSound'])
+            B1PRESS + self.popupMarker.guiId, self['clickSound'])
         # This is created when you set the menu's items
         # This is created when you set the menu's items
         self.popupMenu = None
         self.popupMenu = None
         self.selectedIndex = None
         self.selectedIndex = None
@@ -56,7 +56,7 @@ class DirectOptionMenu(DirectButton):
         self.cancelFrame = self.createcomponent(
         self.cancelFrame = self.createcomponent(
             'cancelframe', (), None,
             'cancelframe', (), None,
             DirectFrame, (self,),
             DirectFrame, (self,),
-            frameSize = (-1,1,-1,1),
+            frameSize = (-1, 1, -1, 1),
             relief = None,
             relief = None,
             state = 'normal')
             state = 'normal')
         # Make sure this is on top of all the other widgets
         # Make sure this is on top of all the other widgets
@@ -130,11 +130,11 @@ class DirectOptionMenu(DirectButton):
             item.bind(B1RELEASE, self.hidePopupMenu)
             item.bind(B1RELEASE, self.hidePopupMenu)
             # Highlight background when mouse is in item
             # Highlight background when mouse is in item
             item.bind(WITHIN,
             item.bind(WITHIN,
-                      lambda x,i=i,item=item:self._highlightItem(item, i))
+                      lambda x, i=i, item=item:self._highlightItem(item, i))
             # Restore specified color upon exiting
             # Restore specified color upon exiting
             fc = item['frameColor']
             fc = item['frameColor']
             item.bind(WITHOUT,
             item.bind(WITHOUT,
-                      lambda x,item=item,fc=fc: self._unhighlightItem(item,fc))
+                      lambda x, item=item, fc=fc: self._unhighlightItem(item, fc))
         # Set popup menu frame size to encompass all items
         # Set popup menu frame size to encompass all items
         f = self.component('popupMenu')
         f = self.component('popupMenu')
         f['frameSize'] = (0, self.maxWidth, -self.maxHeight * itemIndex, 0)
         f['frameSize'] = (0, self.maxWidth, -self.maxHeight * itemIndex, 0)
@@ -145,7 +145,7 @@ class DirectOptionMenu(DirectButton):
         else:
         else:
             # No initial item specified, just use first item
             # No initial item specified, just use first item
             self.set(0, fCommand = 0)
             self.set(0, fCommand = 0)
-            
+
         # Position popup Marker to the right of the button
         # Position popup Marker to the right of the button
         pm = self.popupMarker
         pm = self.popupMarker
         pmw = (pm.getWidth() * pm.getScale()[0] +
         pmw = (pm.getWidth() * pm.getScale()[0] +
@@ -175,7 +175,7 @@ class DirectOptionMenu(DirectButton):
         # Show the menu
         # Show the menu
         self.popupMenu.show()
         self.popupMenu.show()
         # Make sure its at the right scale
         # Make sure its at the right scale
-        self.popupMenu.setScale(self, VBase3(1))       
+        self.popupMenu.setScale(self, VBase3(1))
         # Compute bounds
         # Compute bounds
         b = self.getBounds()
         b = self.getBounds()
         fb = self.popupMenu.getBounds()
         fb = self.popupMenu.getBounds()
@@ -205,8 +205,8 @@ class DirectOptionMenu(DirectButton):
         # Also display cancel frame to catch clicks outside of the popup
         # Also display cancel frame to catch clicks outside of the popup
         self.cancelFrame.show()
         self.cancelFrame.show()
         # Position and scale cancel frame to fill entire window
         # Position and scale cancel frame to fill entire window
-        self.cancelFrame.setPos(render2d,0,0,0)
-        self.cancelFrame.setScale(render2d,1,1,1)
+        self.cancelFrame.setPos(render2d, 0, 0, 0)
+        self.cancelFrame.setScale(render2d, 1, 1, 1)
 
 
     def hidePopupMenu(self, event = None):
     def hidePopupMenu(self, event = None):
         """ Put away popup and cancel frame """
         """ Put away popup and cancel frame """
@@ -259,7 +259,7 @@ class DirectOptionMenu(DirectButton):
     def get(self):
     def get(self):
         """ Get currently selected item """
         """ Get currently selected item """
         return self['items'][self.selectedIndex]
         return self['items'][self.selectedIndex]
-        
+
     def commandFunc(self, event):
     def commandFunc(self, event):
         """
         """
         Override popup menu button's command func
         Override popup menu button's command func

+ 6 - 6
direct/src/gui/DirectScrollBar.py

@@ -4,7 +4,7 @@ from DirectGuiBase import _OPT_VALUE
 
 
 """
 """
 import DirectScrollBar
 import DirectScrollBar
-d = DirectScrollBar(borderWidth=(0,0))
+d = DirectScrollBar(borderWidth=(0, 0))
 
 
 """
 """
 
 
@@ -18,7 +18,7 @@ class DirectScrollBar(DirectFrame):
             # Define type of DirectGuiWidget
             # Define type of DirectGuiWidget
             ('pgFunc',         PGSliderBar,        None),
             ('pgFunc',         PGSliderBar,        None),
             ('state',          NORMAL,             None),
             ('state',          NORMAL,             None),
-            ('frameColor',     (0.6,0.6,0.6,1),    None),
+            ('frameColor',     (0.6, 0.6, 0.6, 1),    None),
 
 
             ('range',          (0, 1),             self.setRange),
             ('range',          (0, 1),             self.setRange),
             ('value',          0,                  self.__setValue),
             ('value',          0,                  self.__setValue),
@@ -36,12 +36,12 @@ class DirectScrollBar(DirectFrame):
         if kw.get('orientation') == VERTICAL:
         if kw.get('orientation') == VERTICAL:
             # These are the default options for a vertical layout.
             # These are the default options for a vertical layout.
             optiondefs += (
             optiondefs += (
-                ('frameSize',      (-0.04,0.04,-0.5,0.5),   None),
+                ('frameSize',      (-0.04, 0.04, -0.5, 0.5),   None),
                 )
                 )
         else:
         else:
             # These are the default options for a horizontal layout.
             # These are the default options for a horizontal layout.
             optiondefs += (
             optiondefs += (
-                ('frameSize',      (-0.5,0.5,-0.04,0.04),  None),
+                ('frameSize',      (-0.5, 0.5, -0.04, 0.04),  None),
                 )
                 )
 
 
         # Merge keyword options with default options
         # Merge keyword options with default options
@@ -72,7 +72,7 @@ class DirectScrollBar(DirectFrame):
 
 
         # Call option initialization functions
         # Call option initialization functions
         self.initialiseoptions(DirectScrollBar)
         self.initialiseoptions(DirectScrollBar)
-        
+
     def setRange(self):
     def setRange(self):
         # Try to preserve the value across a setRange call.
         # Try to preserve the value across a setRange call.
         v = self['value']
         v = self['value']
@@ -126,4 +126,4 @@ class DirectScrollBar(DirectFrame):
 
 
         if self['command']:
         if self['command']:
             apply(self['command'], self['extraArgs'])
             apply(self['command'], self['extraArgs'])
-            
+

+ 6 - 6
direct/src/gui/DirectScrolledFrame.py

@@ -3,7 +3,7 @@ from DirectScrollBar import *
 
 
 """
 """
 import DirectScrolledFrame
 import DirectScrolledFrame
-d = DirectScrolledFrame(borderWidth=(0,0))
+d = DirectScrolledFrame(borderWidth=(0, 0))
 
 
 """
 """
 
 
@@ -23,9 +23,9 @@ class DirectScrolledFrame(DirectFrame):
         optiondefs = (
         optiondefs = (
             # Define type of DirectGuiWidget
             # Define type of DirectGuiWidget
             ('pgFunc',         PGScrollFrame,      None),
             ('pgFunc',         PGScrollFrame,      None),
-            ('frameSize',      (-0.5,0.5,-0.5,0.5), None),
-             
-            ('canvasSize',     (-1,1,-1,1),        self.setCanvasSize),
+            ('frameSize',      (-0.5, 0.5, -0.5, 0.5), None),
+
+            ('canvasSize',     (-1, 1, -1, 1),        self.setCanvasSize),
             ('manageScrollBars', 1,                self.setManageScrollBars),
             ('manageScrollBars', 1,                self.setManageScrollBars),
             ('autoHideScrollBars', 1,              self.setAutoHideScrollBars),
             ('autoHideScrollBars', 1,              self.setAutoHideScrollBars),
             ('scrollBarWidth', 0.08,               None),
             ('scrollBarWidth', 0.08,               None),
@@ -82,11 +82,11 @@ class DirectScrolledFrame(DirectFrame):
     def commandFunc(self):
     def commandFunc(self):
         if self['command']:
         if self['command']:
             apply(self['command'], self['extraArgs'])
             apply(self['command'], self['extraArgs'])
-            
+
     def destroy(self):
     def destroy(self):
         # Destroy children of the canvas
         # Destroy children of the canvas
         for child in self.canvas.getChildrenAsList():
         for child in self.canvas.getChildrenAsList():
             childGui = self.guiDict.get(child.getName())
             childGui = self.guiDict.get(child.getName())
             if childGui: childGui.destroy()
             if childGui: childGui.destroy()
         DirectFrame.destroy(self)
         DirectFrame.destroy(self)
-        
+

+ 27 - 27
direct/src/gui/DirectScrolledList.py

@@ -63,7 +63,7 @@ class DirectScrolledList(DirectFrame):
                 kw['items'] = kw['items'][:]
                 kw['items'] = kw['items'][:]
 
 
         self.nextItemID = 10
         self.nextItemID = 10
-        
+
         # Inherits from DirectFrame
         # Inherits from DirectFrame
         optiondefs = (
         optiondefs = (
             # Define type of DirectGuiWidget
             # Define type of DirectGuiWidget
@@ -100,13 +100,13 @@ class DirectScrolledList(DirectFrame):
         for item in self["items"]:
         for item in self["items"]:
             if item.__class__.__name__ != 'str':
             if item.__class__.__name__ != 'str':
                 item.reparentTo(self.itemFrame)
                 item.reparentTo(self.itemFrame)
-            
+
         self.initialiseoptions(DirectScrolledList)
         self.initialiseoptions(DirectScrolledList)
         self.recordMaxHeight()
         self.recordMaxHeight()
         #if len(self["items"]) > 0:
         #if len(self["items"]) > 0:
         #    self.scrollTo(0)
         #    self.scrollTo(0)
         self.scrollTo(0)
         self.scrollTo(0)
-        
+
     def setForceHeight(self):
     def setForceHeight(self):
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
         self.forceHeight = self["forceHeight"]
         self.forceHeight = self["forceHeight"]
@@ -120,7 +120,7 @@ class DirectScrolledList(DirectFrame):
             for item in self["items"]:
             for item in self["items"]:
                 if item.__class__.__name__ != 'str':
                 if item.__class__.__name__ != 'str':
                     self.maxHeight = max(self.maxHeight, item.getHeight())
                     self.maxHeight = max(self.maxHeight, item.getHeight())
-        
+
     def setScrollSpeed(self):
     def setScrollSpeed(self):
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
         # Items per second to move
         # Items per second to move
@@ -149,13 +149,13 @@ class DirectScrolledList(DirectFrame):
 
 
     def scrollBy(self, delta):
     def scrollBy(self, delta):
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
-        # print "scrollBy[",delta,"]"
+        # print "scrollBy[", delta,"]"
         return self.scrollTo(self.index + delta)
         return self.scrollTo(self.index + delta)
 
 
     def getItemIndexForItemID(self, itemID):
     def getItemIndexForItemID(self, itemID):
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
         #for i in range(len(self["items"])):
         #for i in range(len(self["items"])):
-        #    print "buttontext[",i,"]",self["items"][i]["text"]
+        #    print "buttontext[", i,"]", self["items"][i]["text"]
 
 
         if(len(self["items"])==0):
         if(len(self["items"])==0):
             return 0
             return 0
@@ -177,7 +177,7 @@ class DirectScrolledList(DirectFrame):
     def scrollTo(self, index, centered=0):
     def scrollTo(self, index, centered=0):
         """ scrolls list so selected index is at top, or centered in box"""
         """ scrolls list so selected index is at top, or centered in box"""
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
-        # print "scrollTo[",index,"] called, len(self[items])=",len(self["items"])," self[numItemsVisible]=",self["numItemsVisible"]
+        # print "scrollTo[", index,"] called, len(self[items])=", len(self["items"])," self[numItemsVisible]=", self["numItemsVisible"]
 
 
         numItemsVisible=self["numItemsVisible"]
         numItemsVisible=self["numItemsVisible"]
         numItemsTotal = len(self["items"])
         numItemsTotal = len(self["items"])
@@ -202,7 +202,7 @@ class DirectScrolledList(DirectFrame):
                 ret = 0
                 ret = 0
             elif (self.index >= (numItemsTotal - numItemsVisible)):
             elif (self.index >= (numItemsTotal - numItemsVisible)):
                 self.index = numItemsTotal - numItemsVisible
                 self.index = numItemsTotal - numItemsVisible
-                # print "at list end, ",len(self["items"]),"  ",self["numItemsVisible"]
+                # print "at list end, ", len(self["items"]),"  ", self["numItemsVisible"]
                 self.incButton['state'] = DISABLED
                 self.incButton['state'] = DISABLED
                 self.decButton['state'] = NORMAL
                 self.decButton['state'] = NORMAL
                 ret = 0
                 ret = 0
@@ -211,18 +211,18 @@ class DirectScrolledList(DirectFrame):
                 self.decButton['state'] = NORMAL
                 self.decButton['state'] = NORMAL
                 ret = 1
                 ret = 1
 
 
-        # print "self.index set to ",self.index
+        # print "self.index set to ", self.index
 
 
         # Hide them all
         # Hide them all
         for item in self["items"]:
         for item in self["items"]:
             if item.__class__.__name__ != 'str':
             if item.__class__.__name__ != 'str':
                 item.hide()
                 item.hide()
-                
-        # Then show the ones in range, and stack their positions 
+
+        # Then show the ones in range, and stack their positions
         upperRange = min(numItemsTotal, numItemsVisible)
         upperRange = min(numItemsTotal, numItemsVisible)
         for i in range(self.index, self.index + upperRange):
         for i in range(self.index, self.index + upperRange):
             item = self["items"][i]
             item = self["items"][i]
-            #print "stacking buttontext[",i,"]",self["items"][i]["text"]
+            #print "stacking buttontext[", i,"]", self["items"][i]["text"]
             # If the item is a 'str', then it has not been created (scrolled list is 'as needed')
             # If the item is a 'str', then it has not been created (scrolled list is 'as needed')
             #  Therefore, use the the function given to make it or just make it a frame
             #  Therefore, use the the function given to make it or just make it a frame
             if item.__class__.__name__ == 'str':
             if item.__class__.__name__ == 'str':
@@ -234,15 +234,15 @@ class DirectScrolledList(DirectFrame):
                                        text_align = self['itemsAlign'],
                                        text_align = self['itemsAlign'],
                                        text_wordwrap = self['itemsWordwrap'],
                                        text_wordwrap = self['itemsWordwrap'],
                                        relief = None)
                                        relief = None)
-                #print "str stacking buttontext[",i,"]",self["items"][i]["text"]
+                #print "str stacking buttontext[", i,"]", self["items"][i]["text"]
                 # Then add the newly formed item back into the normal item list
                 # Then add the newly formed item back into the normal item list
                 self["items"][i] = item
                 self["items"][i] = item
                 item.reparentTo(self.itemFrame)
                 item.reparentTo(self.itemFrame)
                 self.recordMaxHeight()
                 self.recordMaxHeight()
-                
+
             item.show()
             item.show()
-            item.setPos(0,0,  -(i-self.index) * self.maxHeight)
-       
+            item.setPos(0, 0,  -(i-self.index) * self.maxHeight)
+
         if self['command']:
         if self['command']:
             # Pass any extra args to command
             # Pass any extra args to command
             apply(self['command'], self['extraArgs'])
             apply(self['command'], self['extraArgs'])
@@ -282,7 +282,7 @@ class DirectScrolledList(DirectFrame):
                 return Task.cont
                 return Task.cont
             else:
             else:
                 return Task.done
                 return Task.done
-            
+
     def __incButtonDown(self, event):
     def __incButtonDown(self, event):
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
         task = Task.Task(self.__scrollByTask)
         task = Task.Task(self.__scrollByTask)
@@ -291,7 +291,7 @@ class DirectScrolledList(DirectFrame):
         task.delta = 1
         task.delta = 1
         self.scrollBy(task.delta)
         self.scrollBy(task.delta)
         taskMgr.add(task, self.taskName("scroll"))
         taskMgr.add(task, self.taskName("scroll"))
-        
+
 
 
     def __decButtonDown(self, event):
     def __decButtonDown(self, event):
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
@@ -341,7 +341,7 @@ class DirectScrolledList(DirectFrame):
             return 1
             return 1
         else:
         else:
             return 0
             return 0
-        
+
     def refresh(self):
     def refresh(self):
         """
         """
         Update the list - useful when adding or deleting items
         Update the list - useful when adding or deleting items
@@ -351,7 +351,7 @@ class DirectScrolledList(DirectFrame):
         self.recordMaxHeight()
         self.recordMaxHeight()
         #print "refresh called"
         #print "refresh called"
         self.scrollTo(self.index)
         self.scrollTo(self.index)
-        
+
     def getSelectedIndex(self):
     def getSelectedIndex(self):
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
         return self.index
         return self.index
@@ -359,7 +359,7 @@ class DirectScrolledList(DirectFrame):
     def getSelectedText(self):
     def getSelectedText(self):
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
         return self['items'][self.index]['text']
         return self['items'][self.index]['text']
-    
+
 
 
 
 
 """
 """
@@ -370,7 +370,7 @@ def makeButton(itemName, itemNum, *extraArgs):
         print itemName, itemNum
         print itemName, itemNum
     return DirectButton(text = itemName,
     return DirectButton(text = itemName,
                         relief = RAISED,
                         relief = RAISED,
-                        frameSize = (-3.5,3.5,-0.2,0.8),
+                        frameSize = (-3.5, 3.5, -0.2, 0.8),
                         scale = 0.85,
                         scale = 0.85,
                         command = buttonCommand)
                         command = buttonCommand)
 
 
@@ -380,13 +380,13 @@ s = scrollList = DirectScrolledList(
     # Use the default dialog box image as the background
     # Use the default dialog box image as the background
     image = getDefaultDialogGeom(),
     image = getDefaultDialogGeom(),
     # Scale it to fit around everyting
     # Scale it to fit around everyting
-    image_scale = (0.7,1,.8),
+    image_scale = (0.7, 1, .8),
     # Give it a label
     # Give it a label
     text = "Scrolled List Example",
     text = "Scrolled List Example",
     text_scale = 0.06,
     text_scale = 0.06,
     text_align = TextNode.ACenter,
     text_align = TextNode.ACenter,
-    text_pos = (0,0.3),
-    text_fg = (0,0,0,1),
+    text_pos = (0, 0.3),
+    text_fg = (0, 0, 0, 1),
     # inc and dec are DirectButtons
     # inc and dec are DirectButtons
     # They can contain a combination of text, geometry and images
     # They can contain a combination of text, geometry and images
     # Just a simple text one for now
     # Just a simple text one for now
@@ -401,7 +401,7 @@ s = scrollList = DirectScrolledList(
     decButton_scale = 0.1,
     decButton_scale = 0.1,
     # each item is a button with text on it
     # each item is a button with text on it
     numItemsVisible = 4,
     numItemsVisible = 4,
-    itemMakeFunction = makeButton, 
+    itemMakeFunction = makeButton,
     items = ['Able', 'Baker', 'Charlie', 'Delta', 'Echo', 'Foxtrot',
     items = ['Able', 'Baker', 'Charlie', 'Delta', 'Echo', 'Foxtrot',
              'Golf', 'Hotel', 'India', 'Juliet', 'Kilo', 'Lima'],
              'Golf', 'Hotel', 'India', 'Juliet', 'Kilo', 'Lima'],
     # itemFrame is a DirectFrame
     # itemFrame is a DirectFrame
@@ -409,7 +409,7 @@ s = scrollList = DirectScrolledList(
     # to eveything else
     # to eveything else
     itemFrame_pos = (0, 0, 0.06),
     itemFrame_pos = (0, 0, 0.06),
     itemFrame_scale = 0.1,
     itemFrame_scale = 0.1,
-    itemFrame_frameSize = (-3.1,3.1,-3.3,0.8),
+    itemFrame_frameSize = (-3.1, 3.1, -3.3, 0.8),
     itemFrame_relief = GROOVE,
     itemFrame_relief = GROOVE,
     )
     )
 """
 """

+ 10 - 10
direct/src/gui/DirectSlider.py

@@ -4,7 +4,7 @@ from DirectGuiBase import _OPT_VALUE
 
 
 """
 """
 import DirectSlider
 import DirectSlider
-d = DirectSlider(borderWidth=(0,0))
+d = DirectSlider(borderWidth=(0, 0))
 
 
 """
 """
 
 
@@ -18,7 +18,7 @@ class DirectSlider(DirectFrame):
             # Define type of DirectGuiWidget
             # Define type of DirectGuiWidget
             ('pgFunc',         PGSliderBar,        None),
             ('pgFunc',         PGSliderBar,        None),
             ('state',          NORMAL,             None),
             ('state',          NORMAL,             None),
-            ('frameColor',     (0.6,0.6,0.6,1),    None),
+            ('frameColor',     (0.6, 0.6, 0.6, 1),    None),
 
 
             ('range',          (0, 1),             self.setRange),
             ('range',          (0, 1),             self.setRange),
             ('value',          0,                  self.__setValue),
             ('value',          0,                  self.__setValue),
@@ -33,14 +33,14 @@ class DirectSlider(DirectFrame):
         if kw.get('orientation') == VERTICAL:
         if kw.get('orientation') == VERTICAL:
             # These are the default options for a vertical layout.
             # These are the default options for a vertical layout.
             optiondefs += (
             optiondefs += (
-                ('frameSize',      (-0.08,0.08,-1,1),   None),
-                ('frameVisibleScale', (0.25,1),         None),
+                ('frameSize',      (-0.08, 0.08, -1, 1),   None),
+                ('frameVisibleScale', (0.25, 1),         None),
                 )
                 )
         else:
         else:
             # These are the default options for a horizontal layout.
             # These are the default options for a horizontal layout.
             optiondefs += (
             optiondefs += (
-                ('frameSize',      (-1,1,-0.08,0.08),  None),
-                ('frameVisibleScale', (1,0.25),        None),
+                ('frameSize',      (-1, 1, -0.08, 0.08),  None),
+                ('frameVisibleScale', (1, 0.25),        None),
                 )
                 )
 
 
         # Merge keyword options with default options
         # Merge keyword options with default options
@@ -57,9 +57,9 @@ class DirectSlider(DirectFrame):
             # Compute a default frameSize for the thumb.
             # Compute a default frameSize for the thumb.
             f = self['frameSize']
             f = self['frameSize']
             if self['orientation'] == HORIZONTAL:
             if self['orientation'] == HORIZONTAL:
-                self.thumb['frameSize'] = (f[0]*0.05,f[1]*0.05,f[2],f[3])
+                self.thumb['frameSize'] = (f[0]*0.05, f[1]*0.05, f[2], f[3])
             else:
             else:
-                self.thumb['frameSize'] = (f[0],f[1],f[2]*0.05,f[3]*0.05)
+                self.thumb['frameSize'] = (f[0], f[1], f[2]*0.05, f[3]*0.05)
 
 
         self.guiItem.setThumbButton(self.thumb.guiItem)
         self.guiItem.setThumbButton(self.thumb.guiItem)
 
 
@@ -68,7 +68,7 @@ class DirectSlider(DirectFrame):
 
 
         # Call option initialization functions
         # Call option initialization functions
         self.initialiseoptions(DirectSlider)
         self.initialiseoptions(DirectSlider)
-        
+
     def setRange(self):
     def setRange(self):
         # Try to preserve the value across a setRange call.
         # Try to preserve the value across a setRange call.
         v = self['value']
         v = self['value']
@@ -110,6 +110,6 @@ class DirectSlider(DirectFrame):
     def commandFunc(self):
     def commandFunc(self):
         # Store the updated value in self['value']
         # Store the updated value in self['value']
         self._optionInfo['value'][_OPT_VALUE] = self.guiItem.getValue()
         self._optionInfo['value'][_OPT_VALUE] = self.guiItem.getValue()
-        
+
         if self['command']:
         if self['command']:
             apply(self['command'], self['extraArgs'])
             apply(self['command'], self['extraArgs'])

+ 9 - 9
direct/src/gui/DirectWaitBar.py

@@ -2,7 +2,7 @@ from DirectFrame import *
 
 
 """
 """
 import DirectWaitBar
 import DirectWaitBar
-d = DirectWaitBar(borderWidth=(0,0))
+d = DirectWaitBar(borderWidth=(0, 0))
 
 
 """
 """
 
 
@@ -20,18 +20,18 @@ class DirectWaitBar(DirectFrame):
         optiondefs = (
         optiondefs = (
             # Define type of DirectGuiWidget
             # Define type of DirectGuiWidget
             ('pgFunc',         PGWaitBar,          None),
             ('pgFunc',         PGWaitBar,          None),
-            ('frameSize',      (-1,1,-0.08,0.08),  None),
-            ('borderWidth',    (0,0),              None),
+            ('frameSize',      (-1, 1, -0.08, 0.08),  None),
+            ('borderWidth',    (0, 0),              None),
             ('range',          100,                self.setRange),
             ('range',          100,                self.setRange),
             ('value',          0,                  self.setValue),
             ('value',          0,                  self.setValue),
-            ('barBorderWidth', (0,0),              self.setBarBorderWidth),
-            ('barColor',       (1,0,0,1),          self.setBarColor),
+            ('barBorderWidth', (0, 0),              self.setBarBorderWidth),
+            ('barColor',       (1, 0, 0, 1),          self.setBarColor),
             ('barRelief',      FLAT,               self.setBarRelief),
             ('barRelief',      FLAT,               self.setBarRelief),
             ('sortOrder',      NO_FADE_SORT_INDEX, None),
             ('sortOrder',      NO_FADE_SORT_INDEX, None),
             )
             )
         if kw.has_key('text'):
         if kw.has_key('text'):
             textoptiondefs = (
             textoptiondefs = (
-                ('text_pos',    (0,-0.025),          None),
+                ('text_pos',    (0, -0.025),          None),
                 ('text_scale',  0.1,                 None)
                 ('text_scale',  0.1,                 None)
                 )
                 )
         else:
         else:
@@ -48,7 +48,7 @@ class DirectWaitBar(DirectFrame):
     def destroy(self):
     def destroy(self):
         del self.barStyle
         del self.barStyle
         DirectFrame.destroy(self)
         DirectFrame.destroy(self)
-        
+
     def setRange(self):
     def setRange(self):
         self.guiItem.setRange(self['range'])
         self.guiItem.setRange(self['range'])
 
 
@@ -60,7 +60,7 @@ class DirectWaitBar(DirectFrame):
 
 
     def updateBarStyle(self):
     def updateBarStyle(self):
         if not self.fInit:
         if not self.fInit:
-            self.guiItem.setBarStyle(self.barStyle)            
+            self.guiItem.setBarStyle(self.barStyle)
 
 
     def setBarRelief(self):
     def setBarRelief(self):
         self.barStyle.setType(self['barRelief'])
         self.barStyle.setType(self['barRelief'])
@@ -95,4 +95,4 @@ class DirectWaitBar(DirectFrame):
                 if count > self['range']:
                 if count > self['range']:
                     count = self['range']
                     count = self['range']
                 self.update(count)
                 self.update(count)
-        
+

+ 5 - 5
direct/src/gui/OnscreenGeom.py

@@ -27,7 +27,7 @@ class OnscreenGeom(DirectObject, NodePath):
                This maybe a 3-tuple of floats or a vector.
                This maybe a 3-tuple of floats or a vector.
                y should be zero
                y should be zero
 
 
-          hpr: the h,p,r of the geometry on the screen.
+          hpr: the h, p, r of the geometry on the screen.
                This maybe a 3-tuple of floats or a vector.
                This maybe a 3-tuple of floats or a vector.
 
 
           scale: the size of the geometry.  This may either be a single
           scale: the size of the geometry.  This may either be a single
@@ -106,7 +106,7 @@ class OnscreenGeom(DirectObject, NodePath):
 
 
     def getGeom(self):
     def getGeom(self):
         return self
         return self
-    
+
     def configure(self, option=None, **kw):
     def configure(self, option=None, **kw):
         for option, value in kw.items():
         for option, value in kw.items():
             # Use option string to access setter function
             # Use option string to access setter function
@@ -118,7 +118,7 @@ class OnscreenGeom(DirectObject, NodePath):
                      (setter == self.setScale)) and
                      (setter == self.setScale)) and
                     (isinstance(value, types.TupleType) or
                     (isinstance(value, types.TupleType) or
                      isinstance(value, types.ListType))):
                      isinstance(value, types.ListType))):
-                    apply(setter,value)
+                    apply(setter, value)
                 else:
                 else:
                     setter(value)
                     setter(value)
             except AttributeError:
             except AttributeError:
@@ -127,7 +127,7 @@ class OnscreenGeom(DirectObject, NodePath):
     # Allow index style references
     # Allow index style references
     def __setitem__(self, key, value):
     def __setitem__(self, key, value):
         apply(self.configure, (), {key: value})
         apply(self.configure, (), {key: value})
-        
+
     def cget(self, option):
     def cget(self, option):
         # Get current configuration setting.
         # Get current configuration setting.
         # This is for compatability with DirectGui functions
         # This is for compatability with DirectGui functions
@@ -136,6 +136,6 @@ class OnscreenGeom(DirectObject, NodePath):
 
 
     # Allow index style refererences
     # Allow index style refererences
     __getitem__ = cget
     __getitem__ = cget
-    
+
     def destroy(self):
     def destroy(self):
         self.removeNode()
         self.removeNode()

+ 5 - 5
direct/src/gui/OnscreenImage.py

@@ -27,7 +27,7 @@ class OnscreenImage(DirectObject, NodePath):
                This maybe a 3-tuple of floats or a vector.
                This maybe a 3-tuple of floats or a vector.
                y should be zero
                y should be zero
 
 
-          hpr: the h,p,r of the geometry on the screen.
+          hpr: the h, p, r of the geometry on the screen.
                This maybe a 3-tuple of floats or a vector.
                This maybe a 3-tuple of floats or a vector.
 
 
           scale: the size of the geometry.  This may either be a single
           scale: the size of the geometry.  This may either be a single
@@ -123,7 +123,7 @@ class OnscreenImage(DirectObject, NodePath):
 
 
     def getImage(self):
     def getImage(self):
         return self
         return self
-    
+
     def configure(self, option=None, **kw):
     def configure(self, option=None, **kw):
         for option, value in kw.items():
         for option, value in kw.items():
             # Use option string to access setter function
             # Use option string to access setter function
@@ -135,7 +135,7 @@ class OnscreenImage(DirectObject, NodePath):
                      (setter == self.setScale)) and
                      (setter == self.setScale)) and
                     (isinstance(value, types.TupleType) or
                     (isinstance(value, types.TupleType) or
                      isinstance(value, types.ListType))):
                      isinstance(value, types.ListType))):
-                    apply(setter,value)
+                    apply(setter, value)
                 else:
                 else:
                     setter(value)
                     setter(value)
             except AttributeError:
             except AttributeError:
@@ -144,7 +144,7 @@ class OnscreenImage(DirectObject, NodePath):
     # Allow index style references
     # Allow index style references
     def __setitem__(self, key, value):
     def __setitem__(self, key, value):
         apply(self.configure, (), {key: value})
         apply(self.configure, (), {key: value})
-        
+
     def cget(self, option):
     def cget(self, option):
         # Get current configuration setting.
         # Get current configuration setting.
         # This is for compatability with DirectGui functions
         # This is for compatability with DirectGui functions
@@ -153,6 +153,6 @@ class OnscreenImage(DirectObject, NodePath):
 
 
     # Allow index style refererences
     # Allow index style refererences
     __getitem__ = cget
     __getitem__ = cget
-    
+
     def destroy(self):
     def destroy(self):
         self.removeNode()
         self.removeNode()

+ 13 - 13
direct/src/gui/OnscreenText.py

@@ -26,7 +26,7 @@ class OnscreenText(DirectObject, NodePath):
                  fg = None,
                  fg = None,
                  bg = None,
                  bg = None,
                  shadow = None,
                  shadow = None,
-                 shadowOffset = (0.04,0.04),
+                 shadowOffset = (0.04, 0.04),
                  frame = None,
                  frame = None,
                  align = None,
                  align = None,
                  wordwrap = None,
                  wordwrap = None,
@@ -152,7 +152,7 @@ class OnscreenText(DirectObject, NodePath):
             raise ValueError
             raise ValueError
 
 
         if not isinstance(scale, types.TupleType):
         if not isinstance(scale, types.TupleType):
-            # If the scale is already a tuple, it's a 2-d (x,y) scale.
+            # If the scale is already a tuple, it's a 2-d (x, y) scale.
             # Otherwise, it's a uniform scale--make it a tuple.
             # Otherwise, it's a uniform scale--make it a tuple.
             scale = (scale, scale)
             scale = (scale, scale)
 
 
@@ -166,7 +166,7 @@ class OnscreenText(DirectObject, NodePath):
 
 
         if font == None:
         if font == None:
             font = DirectGuiGlobals.getDefaultFont()
             font = DirectGuiGlobals.getDefaultFont()
-        
+
         textNode.setFont(font)
         textNode.setFont(font)
         textNode.setTextColor(fg[0], fg[1], fg[2], fg[3])
         textNode.setTextColor(fg[0], fg[1], fg[2], fg[3])
         textNode.setAlign(align)
         textNode.setAlign(align)
@@ -213,12 +213,12 @@ class OnscreenText(DirectObject, NodePath):
             # If we aren't going to change the text later, we can
             # If we aren't going to change the text later, we can
             # throw away the TextNode.
             # throw away the TextNode.
             self.textNode = textNode.generate()
             self.textNode = textNode.generate()
-        
+
         self.isClean = 0
         self.isClean = 0
 
 
         # Set ourselves up as the NodePath that points to this node.
         # Set ourselves up as the NodePath that points to this node.
         self.assign(parent.attachNewNode(self.textNode, sort))
         self.assign(parent.attachNewNode(self.textNode, sort))
-    
+
     def cleanup(self):
     def cleanup(self):
         self.textNode = None
         self.textNode = None
         if self.isClean == 0:
         if self.isClean == 0:
@@ -282,7 +282,7 @@ class OnscreenText(DirectObject, NodePath):
 
 
     def setY(self, y):
     def setY(self, y):
         self.setPos(self.pos[0], y)
         self.setPos(self.pos[0], y)
-        
+
     def setPos(self, x, y):
     def setPos(self, x, y):
         """setPos(self, float, float)
         """setPos(self, float, float)
         Position the onscreen text in 2d screen space
         Position the onscreen text in 2d screen space
@@ -302,7 +302,7 @@ class OnscreenText(DirectObject, NodePath):
 
 
     def getRoll(self):
     def getRoll(self):
         return self.roll
         return self.roll
-        
+
     def setScale(self, sx, sy = None):
     def setScale(self, sx, sy = None):
         """setScale(self, float, float)
         """setScale(self, float, float)
         Scale the text in 2d space.  You may specify either a single
         Scale the text in 2d space.  You may specify either a single
@@ -320,21 +320,21 @@ class OnscreenText(DirectObject, NodePath):
 
 
     def updateTransformMat(self):
     def updateTransformMat(self):
         mat = (
         mat = (
-            Mat4.scaleMat(self.scale[0],1,self.scale[1]) *
-            Mat4.rotateMat(self.roll, Vec3(0,-1,0)) *
+            Mat4.scaleMat(self.scale[0], 1, self.scale[1]) *
+            Mat4.rotateMat(self.roll, Vec3(0, -1, 0)) *
             Mat4.translateMat(self.pos[0], 0, self.pos[1])
             Mat4.translateMat(self.pos[0], 0, self.pos[1])
             )
             )
         self.textNode.setTransform(mat)
         self.textNode.setTransform(mat)
 
 
     def getScale(self):
     def getScale(self):
         return self.scale
         return self.scale
-        
+
     def setWordwrap(self, wordwrap):
     def setWordwrap(self, wordwrap):
         if wordwrap:
         if wordwrap:
             self.textNode.setWordwrap(wordwrap)
             self.textNode.setWordwrap(wordwrap)
         else:
         else:
             self.textNode.clearWordwrap()
             self.textNode.clearWordwrap()
-        
+
     def setFg(self, fg):
     def setFg(self, fg):
         self.textNode.setTextColor(fg[0], fg[1], fg[2], fg[3])
         self.textNode.setTextColor(fg[0], fg[1], fg[2], fg[3])
 
 
@@ -385,7 +385,7 @@ class OnscreenText(DirectObject, NodePath):
     # Allow index style references
     # Allow index style references
     def __setitem__(self, key, value):
     def __setitem__(self, key, value):
         apply(self.configure, (), {key: value})
         apply(self.configure, (), {key: value})
-        
+
     def cget(self, option):
     def cget(self, option):
         # Get current configuration setting.
         # Get current configuration setting.
         # This is for compatability with DirectGui functions
         # This is for compatability with DirectGui functions
@@ -397,4 +397,4 @@ class OnscreenText(DirectObject, NodePath):
 
 
     # Allow index style refererences
     # Allow index style refererences
     __getitem__ = cget
     __getitem__ = cget
-    
+

+ 14 - 14
direct/src/interval/FunctionInterval.py

@@ -33,7 +33,7 @@ class FunctionInterval(Interval.Interval):
             del kw['openEnded']
             del kw['openEnded']
         if kw.has_key('extraArgs'):
         if kw.has_key('extraArgs'):
             del kw['extraArgs']
             del kw['extraArgs']
-        
+
         # Record instance variables
         # Record instance variables
         self.function = function
         self.function = function
         # Create a unique name for the interval if necessary
         # Create a unique name for the interval if necessary
@@ -50,7 +50,7 @@ class FunctionInterval(Interval.Interval):
         # Event, Accept, Ignore intervals default to openEnded = 0
         # Event, Accept, Ignore intervals default to openEnded = 0
         # Parent, Pos, Hpr, etc intervals default to openEnded = 1
         # Parent, Pos, Hpr, etc intervals default to openEnded = 1
         Interval.Interval.__init__(self, name, duration = 0.0, openEnded = openEnded)
         Interval.Interval.__init__(self, name, duration = 0.0, openEnded = openEnded)
-    
+
     def privInstant(self):
     def privInstant(self):
         # Evaluate the function
         # Evaluate the function
         self.function(*self.extraArgs, **self.kw)
         self.function(*self.extraArgs, **self.kw)
@@ -231,7 +231,7 @@ class HprScaleInterval(FunctionInterval):
             if other:
             if other:
                 np.setHprScale(other, hpr, scale)
                 np.setHprScale(other, hpr, scale)
             else:
             else:
-                np.setHprScale(hpr, scale)                
+                np.setHprScale(hpr, scale)
         # Determine name
         # Determine name
         if (name == None):
         if (name == None):
             name = ('HprScale-%d' %
             name = ('HprScale-%d' %
@@ -254,7 +254,7 @@ class PosHprScaleInterval(FunctionInterval):
             if other:
             if other:
                 np.setPosHprScale(other, pos, hpr, scale)
                 np.setPosHprScale(other, pos, hpr, scale)
             else:
             else:
-                np.setPosHprScale(pos, hpr, scale)                
+                np.setPosHprScale(pos, hpr, scale)
         # Determine name
         # Determine name
         if (name == None):
         if (name == None):
             name = ('PosHprScale-%d' %
             name = ('PosHprScale-%d' %
@@ -354,11 +354,11 @@ def printTrackStart():
 
 
 i1 = Func(printStart)
 i1 = Func(printStart)
 # Just to take time
 # Just to take time
-i2 = LerpPosInterval(camera, 2.0, Point3(0,10,5))
+i2 = LerpPosInterval(camera, 2.0, Point3(0, 10, 5))
 # This will be relative to end of camera move
 # This will be relative to end of camera move
 i3 = FunctionInterval(printPreviousEnd)
 i3 = FunctionInterval(printPreviousEnd)
 # Just to take time
 # Just to take time
-i4 = LerpPosInterval(camera, 2.0, Point3(0,0,5))
+i4 = LerpPosInterval(camera, 2.0, Point3(0, 0, 5))
 # This will be relative to the start of the camera move
 # This will be relative to the start of the camera move
 i5 = FunctionInterval(printPreviousStart)
 i5 = FunctionInterval(printPreviousStart)
 # This will be relative to track start
 # This will be relative to track start
@@ -385,23 +385,23 @@ donald.loadAnims({"steer":"phase_6/models/char/donald-wheel-wheel"})
 donald.reparentTo(render)
 donald.reparentTo(render)
 
 
 
 
-seq = Sequence(Func(donald.setPos, 0,0,0),
+seq = Sequence(Func(donald.setPos, 0, 0, 0),
                donald.actorInterval('steer', duration=1.0),
                donald.actorInterval('steer', duration=1.0),
-               donald.posInterval(1, Point3(0,0,1)),
+               donald.posInterval(1, Point3(0, 0, 1)),
                Parallel(donald.actorInterval('steer', duration=1.0),
                Parallel(donald.actorInterval('steer', duration=1.0),
-                        donald.posInterval(1, Point3(0,0,0)),
+                        donald.posInterval(1, Point3(0, 0, 0)),
                         ),
                         ),
                Wait(1.0),
                Wait(1.0),
                Func(base.toggleWireframe),
                Func(base.toggleWireframe),
                Wait(1.0),
                Wait(1.0),
                Parallel(donald.actorInterval('steer', duration=1.0),
                Parallel(donald.actorInterval('steer', duration=1.0),
-                        donald.posInterval(1, Point3(0,0,-1)),
-                        Sequence(donald.hprInterval(1, Vec3(180,0,0)),
-                                 donald.hprInterval(1, Vec3(0,0,0)),
+                        donald.posInterval(1, Point3(0, 0, -1)),
+                        Sequence(donald.hprInterval(1, Vec3(180, 0, 0)),
+                                 donald.hprInterval(1, Vec3(0, 0, 0)),
                                  ),
                                  ),
                         ),
                         ),
-               Func(base.toggleWireframe),               
-               Func(messenger.send, 'hello'),               
+               Func(base.toggleWireframe),
+               Func(messenger.send, 'hello'),
                )
                )
 
 
 
 

+ 11 - 11
direct/src/interval/Interval.py

@@ -66,7 +66,7 @@ class Interval(DirectObject):
         # breaks looping intervals.  The interval code should properly
         # breaks looping intervals.  The interval code should properly
         # handle t values outside the proper range.
         # handle t values outside the proper range.
         #t = min(max(t, 0.0), self.getDuration())
         #t = min(max(t, 0.0), self.getDuration())
-        
+
         state = self.getState()
         state = self.getState()
         if state == CInterval.SInitial:
         if state == CInterval.SInitial:
             self.privInitialize(t)
             self.privInitialize(t)
@@ -98,7 +98,7 @@ class Interval(DirectObject):
         else:
         else:
             self.notify.error("Invalid state: %s" % (state))
             self.notify.error("Invalid state: %s" % (state))
         self.privPostEvent()
         self.privPostEvent()
-        
+
     def getT(self):
     def getT(self):
         return self.currT
         return self.currT
 
 
@@ -126,7 +126,7 @@ class Interval(DirectObject):
 
 
     def resumeUntil(self, endT):
     def resumeUntil(self, endT):
         duration = self.getDuration()
         duration = self.getDuration()
-        
+
         if endT < 0 or endT >= duration:
         if endT < 0 or endT >= duration:
             self.__endT = duration
             self.__endT = duration
             self.__endTAtEnd = 1
             self.__endTAtEnd = 1
@@ -137,7 +137,7 @@ class Interval(DirectObject):
         self.setupResume()
         self.setupResume()
         if not self.isPlaying():
         if not self.isPlaying():
             self.__spawnTask()
             self.__spawnTask()
-        
+
     def finish(self):
     def finish(self):
         state = self.getState()
         state = self.getState()
         if state == CInterval.SInitial:
         if state == CInterval.SInitial:
@@ -146,7 +146,7 @@ class Interval(DirectObject):
             self.privFinalize()
             self.privFinalize()
         self.privPostEvent()
         self.privPostEvent()
         self.__removeTask()
         self.__removeTask()
-        
+
     def clearToInitial(self):
     def clearToInitial(self):
         # This method resets the interval's internal state to the
         # This method resets the interval's internal state to the
         # initial state, abandoning any parts of the interval that
         # initial state, abandoning any parts of the interval that
@@ -237,7 +237,7 @@ class Interval(DirectObject):
 
 
     def setupPlay(self, startT, endT, playRate, doLoop):
     def setupPlay(self, startT, endT, playRate, doLoop):
         duration = self.getDuration()
         duration = self.getDuration()
-        
+
         if startT <= 0:
         if startT <= 0:
             self.__startT = 0
             self.__startT = 0
             self.__startTAtStart = 1
             self.__startTAtStart = 1
@@ -247,7 +247,7 @@ class Interval(DirectObject):
         else:
         else:
             self.__startT = startT
             self.__startT = startT
             self.__startTAtStart = 0
             self.__startTAtStart = 0
-            
+
         if endT < 0 or endT >= duration:
         if endT < 0 or endT >= duration:
             self.__endT = duration
             self.__endT = duration
             self.__endTAtEnd = 1
             self.__endTAtEnd = 1
@@ -275,7 +275,7 @@ class Interval(DirectObject):
 
 
             if self.__endTAtEnd:
             if self.__endTAtEnd:
                 self.__endT = self.getDuration()
                 self.__endT = self.getDuration()
-                
+
             if t < self.__endT:
             if t < self.__endT:
                 # In the middle of the interval, not a problem.
                 # In the middle of the interval, not a problem.
                 if self.isStopped():
                 if self.isStopped():
@@ -386,7 +386,7 @@ class Interval(DirectObject):
             tl = Toplevel()
             tl = Toplevel()
             tl.title('Interval Controls')
             tl.title('Interval Controls')
         outerFrame = Frame(tl)
         outerFrame = Frame(tl)
-        def entryScaleCommand(t,s=self):
+        def entryScaleCommand(t, s=self):
             s.setT(t)
             s.setT(t)
             s.pause()
             s.pause()
         self.es = es = EntryScale.EntryScale(
         self.es = es = EntryScale.EntryScale(
@@ -409,7 +409,7 @@ class Interval(DirectObject):
         # Stop/play buttons
         # Stop/play buttons
         def doPlay(s=self, es=es):
         def doPlay(s=self, es=es):
             s.resume(es.get())
             s.resume(es.get())
-                       
+
         stop = Button(bf, text = 'Stop',
         stop = Button(bf, text = 'Stop',
                       command = lambda s=self: s.pause())
                       command = lambda s=self: s.pause())
         play = Button(
         play = Button(
@@ -423,7 +423,7 @@ class Interval(DirectObject):
         bf.pack(expand = 1, fill = X)
         bf.pack(expand = 1, fill = X)
         outerFrame.pack(expand = 1, fill = X)
         outerFrame.pack(expand = 1, fill = X)
         # Add function to update slider during setT calls
         # Add function to update slider during setT calls
-        def update(t,es=es):
+        def update(t, es=es):
             es.set(t, fCommand = 0)
             es.set(t, fCommand = 0)
         if not hasattr(self, "setTHooks"):
         if not hasattr(self, "setTHooks"):
             self.setTHooks = []
             self.setTHooks = []

+ 13 - 13
direct/src/interval/IntervalManager.py

@@ -19,16 +19,16 @@ class IntervalManager(CIntervalManager):
             # "constructing" a Python wrapper around the global
             # "constructing" a Python wrapper around the global
             # CIntervalManager object.
             # CIntervalManager object.
             ##self.cObj = CIntervalManager.getGlobalPtr()
             ##self.cObj = CIntervalManager.getGlobalPtr()
-            ##Dtool_BarrowThisRefrence(self,self.cObj)
-            ##self.dd = self        
+            ##Dtool_BarrowThisRefrence(self, self.cObj)
+            ##self.dd = self
             if globalPtr:
             if globalPtr:
                 self.cObj = CIntervalManager.getGlobalPtr()
                 self.cObj = CIntervalManager.getGlobalPtr()
-                Dtool_BarrowThisRefrence(self,self.cObj)
+                Dtool_BarrowThisRefrence(self, self.cObj)
                 self.dd = self
                 self.dd = self
             else:
             else:
-                CIntervalManager.__init__(self)           
+                CIntervalManager.__init__(self)
             self.eventQueue = EventQueue()
             self.eventQueue = EventQueue()
-            self.MyEventmanager = EventManager.EventManager(self.eventQueue)        
+            self.MyEventmanager = EventManager.EventManager(self.eventQueue)
             self.setEventQueue(self.eventQueue)
             self.setEventQueue(self.eventQueue)
             self.ivals = []
             self.ivals = []
             self.removedIvals = {}
             self.removedIvals = {}
@@ -50,14 +50,14 @@ class IntervalManager(CIntervalManager):
             self.MyEventmanager = EventManager.EventManager(self.eventQueue)
             self.MyEventmanager = EventManager.EventManager(self.eventQueue)
             self.setEventQueue(self.eventQueue)
             self.setEventQueue(self.eventQueue)
             self.ivals = []
             self.ivals = []
-            self.removedIvals = {}     
-    
-                
+            self.removedIvals = {}
+
+
 
 
     def addInterval(self, interval):
     def addInterval(self, interval):
         index = self.addCInterval(interval, 1)
         index = self.addCInterval(interval, 1)
         self.__storeInterval(interval, index)
         self.__storeInterval(interval, index)
-        
+
     def removeInterval(self, interval):
     def removeInterval(self, interval):
         index = self.findCInterval(interval.getName())
         index = self.findCInterval(interval.getName())
         if index >= 0:
         if index >= 0:
@@ -73,7 +73,7 @@ class IntervalManager(CIntervalManager):
         return None
         return None
 
 
     def finishIntervalsMatching(self, pattern):
     def finishIntervalsMatching(self, pattern):
-        count = 0       
+        count = 0
         maxIndex = self.getMaxIndex()
         maxIndex = self.getMaxIndex()
         for index in range(maxIndex):
         for index in range(maxIndex):
             ival = self.getCInterval(index)
             ival = self.getCInterval(index)
@@ -90,7 +90,7 @@ class IntervalManager(CIntervalManager):
                     ival.finish()
                     ival.finish()
 
 
         return count
         return count
-            
+
 
 
     def step(self):
     def step(self):
         # This method should be called once per frame to perform all
         # This method should be called once per frame to perform all
@@ -134,8 +134,8 @@ class IntervalManager(CIntervalManager):
         # these immediately, rather than waiting for the global event
         # these immediately, rather than waiting for the global event
         # queue to be serviced (which might not be till next frame).
         # queue to be serviced (which might not be till next frame).
         self.MyEventmanager.doEvents()
         self.MyEventmanager.doEvents()
-        
-        
+
+
     def __storeInterval(self, interval, index):
     def __storeInterval(self, interval, index):
         while index >= len(self.ivals):
         while index >= len(self.ivals):
             self.ivals.append(None)
             self.ivals.append(None)

+ 45 - 45
direct/src/interval/IntervalTest.py

@@ -6,30 +6,30 @@ if __name__ == "__main__":
     from direct.actor.Actor import *
     from direct.actor.Actor import *
 
 
     from direct.directutil import Mopath
     from direct.directutil import Mopath
-    
+
     boat = loader.loadModel('models/misc/smiley')
     boat = loader.loadModel('models/misc/smiley')
     boat.reparentTo(render)
     boat.reparentTo(render)
-    
+
     donald = Actor()
     donald = Actor()
     donald.loadModel("phase_6/models/char/donald-wheel-1000")
     donald.loadModel("phase_6/models/char/donald-wheel-1000")
     donald.loadAnims({"steer":"phase_6/models/char/donald-wheel-wheel"})
     donald.loadAnims({"steer":"phase_6/models/char/donald-wheel-wheel"})
     donald.reparentTo(boat)
     donald.reparentTo(boat)
-    
+
     dock = loader.loadModel('models/misc/smiley')
     dock = loader.loadModel('models/misc/smiley')
     dock.reparentTo(render)
     dock.reparentTo(render)
-    
+
     sound = loader.loadSfx('phase_6/audio/sfx/SZ_DD_waterlap.mp3')
     sound = loader.loadSfx('phase_6/audio/sfx/SZ_DD_waterlap.mp3')
     foghorn = loader.loadSfx('phase_6/audio/sfx/SZ_DD_foghorn.mp3')
     foghorn = loader.loadSfx('phase_6/audio/sfx/SZ_DD_foghorn.mp3')
-    
+
     mp = Mopath.Mopath()
     mp = Mopath.Mopath()
     mp.loadFile(Filename('phase_6/paths/dd-e-w'))
     mp.loadFile(Filename('phase_6/paths/dd-e-w'))
-    
+
     # Set up the boat
     # Set up the boat
     boatMopath = MopathInterval(mp, boat, 'boatpath')
     boatMopath = MopathInterval(mp, boat, 'boatpath')
     boatTrack = Track([boatMopath], 'boattrack')
     boatTrack = Track([boatMopath], 'boattrack')
     BOAT_START = boatTrack.getIntervalStartTime('boatpath')
     BOAT_START = boatTrack.getIntervalStartTime('boatpath')
     BOAT_END = boatTrack.getIntervalEndTime('boatpath')
     BOAT_END = boatTrack.getIntervalEndTime('boatpath')
-    
+
     # This will create an anim interval that is posed every frame
     # This will create an anim interval that is posed every frame
     donaldSteerInterval = ActorInterval(donald, 'steer')
     donaldSteerInterval = ActorInterval(donald, 'steer')
     # This will create an anim interval that is started at t = 0 and then
     # This will create an anim interval that is started at t = 0 and then
@@ -37,12 +37,12 @@ if __name__ == "__main__":
     donaldLoopInterval = ActorInterval(donald, 'steer', loop=1, duration = 10.0)
     donaldLoopInterval = ActorInterval(donald, 'steer', loop=1, duration = 10.0)
     donaldSteerTrack = Track([donaldSteerInterval, donaldLoopInterval],
     donaldSteerTrack = Track([donaldSteerInterval, donaldLoopInterval],
                              name = 'steerTrack')
                              name = 'steerTrack')
-    
+
     # Make the dock lerp up so that it's up when the boat reaches the end of
     # Make the dock lerp up so that it's up when the boat reaches the end of
     # its mopath
     # its mopath
-    dockLerp = LerpPosHprInterval(dock, 5.0, 
-                                  pos=Point3(0, 0, -5), 
-                                  hpr=Vec3(0, 0, 0), 
+    dockLerp = LerpPosHprInterval(dock, 5.0,
+                                  pos=Point3(0, 0, -5),
+                                  hpr=Vec3(0, 0, 0),
                                   name='dock-lerp')
                                   name='dock-lerp')
     # We need the dock's state to be defined before the lerp
     # We need the dock's state to be defined before the lerp
     dockPos = PosHprInterval(dock, dock.getPos(), dock.getHpr(), 1.0, 'dockpos')
     dockPos = PosHprInterval(dock, dock.getPos(), dock.getHpr(), 1.0, 'dockpos')
@@ -52,58 +52,58 @@ if __name__ == "__main__":
     dockTrack = Track([dockLerp2, dockPos, dockLerp], 'docktrack')
     dockTrack = Track([dockLerp2, dockPos, dockLerp], 'docktrack')
     dockTrack.setIntervalStartTime('dock-lerp', dockUpTime)
     dockTrack.setIntervalStartTime('dock-lerp', dockUpTime)
     dockTrack.setIntervalStartTime('hpr-lerp', BOAT_START)
     dockTrack.setIntervalStartTime('hpr-lerp', BOAT_START)
-    
+
     # Start the water sound 5 seconds after the boat starts moving
     # Start the water sound 5 seconds after the boat starts moving
     waterStartTime = BOAT_START + 5.0
     waterStartTime = BOAT_START + 5.0
     waterSound = SoundInterval(sound, name='watersound')
     waterSound = SoundInterval(sound, name='watersound')
     soundTrack = Track([waterSound], 'soundtrack')
     soundTrack = Track([waterSound], 'soundtrack')
     soundTrack.setIntervalStartTime('watersound', waterStartTime)
     soundTrack.setIntervalStartTime('watersound', waterStartTime)
-    
+
     # Throw an event when the water track ends
     # Throw an event when the water track ends
     eventTime = soundTrack.getIntervalEndTime('watersound')
     eventTime = soundTrack.getIntervalEndTime('watersound')
     waterDone = EventInterval('water-is-done')
     waterDone = EventInterval('water-is-done')
     waterEventTrack = Track([waterDone])
     waterEventTrack = Track([waterDone])
     waterEventTrack.setIntervalStartTime('water-is-done', eventTime)
     waterEventTrack.setIntervalStartTime('water-is-done', eventTime)
-    
+
     def handleWaterDone():
     def handleWaterDone():
         print 'water is done'
         print 'water is done'
-    
+
     # Interval can handle its own event
     # Interval can handle its own event
     messenger.accept('water-is-done', waterDone, handleWaterDone)
     messenger.accept('water-is-done', waterDone, handleWaterDone)
-    
+
     foghornStartTime = BOAT_START + 4.0
     foghornStartTime = BOAT_START + 4.0
     foghornSound = SoundInterval(foghorn, name='foghorn')
     foghornSound = SoundInterval(foghorn, name='foghorn')
     soundTrack2 = Track([(foghornStartTime, foghornSound)], 'soundtrack2')
     soundTrack2 = Track([(foghornStartTime, foghornSound)], 'soundtrack2')
-    
+
     mtrack = MultiTrack([boatTrack, dockTrack, soundTrack, soundTrack2, waterEventTrack,
     mtrack = MultiTrack([boatTrack, dockTrack, soundTrack, soundTrack2, waterEventTrack,
                          donaldSteerTrack])
                          donaldSteerTrack])
     # Print out MultiTrack parameters
     # Print out MultiTrack parameters
     print(mtrack)
     print(mtrack)
-    
+
     ### Using lambdas and functions ###
     ### Using lambdas and functions ###
     # Using a lambda
     # Using a lambda
     i1 = FunctionInterval(lambda: base.transitions.fadeOut())
     i1 = FunctionInterval(lambda: base.transitions.fadeOut())
     i2 = FunctionInterval(lambda: base.transitions.fadeIn())
     i2 = FunctionInterval(lambda: base.transitions.fadeIn())
-    
+
     def caughtIt():
     def caughtIt():
         print 'Caught here-is-an-event'
         print 'Caught here-is-an-event'
-    
+
     class DummyAcceptor(DirectObject):
     class DummyAcceptor(DirectObject):
         pass
         pass
-    
+
     da = DummyAcceptor()
     da = DummyAcceptor()
     i3 = AcceptInterval(da, 'here-is-an-event', caughtIt)
     i3 = AcceptInterval(da, 'here-is-an-event', caughtIt)
-    
+
     i4 = EventInterval('here-is-an-event')
     i4 = EventInterval('here-is-an-event')
-    
+
     i5 = IgnoreInterval(da, 'here-is-an-event')
     i5 = IgnoreInterval(da, 'here-is-an-event')
-    
+
     # Using a function
     # Using a function
     def printDone():
     def printDone():
         print 'done'
         print 'done'
-    
+
     i6 = FunctionInterval(printDone)
     i6 = FunctionInterval(printDone)
-    
+
     # Create track
     # Create track
     t1 = Track([
     t1 = Track([
         # Fade out
         # Fade out
@@ -120,53 +120,53 @@ if __name__ == "__main__":
         (7.0, i4),
         (7.0, i4),
         # Print done
         # Print done
         (8.0, i6)], name = 'demo')
         (8.0, i6)], name = 'demo')
-    
+
     print(t1)
     print(t1)
-    
+
     ### Specifying interval start times during track construction ###
     ### Specifying interval start times during track construction ###
     # Interval start time can be specified relative to three different points:
     # Interval start time can be specified relative to three different points:
     # PREVIOUS_END
     # PREVIOUS_END
     # PREVIOUS_START
     # PREVIOUS_START
     # TRACK_START
     # TRACK_START
-    
+
     startTime = 0.0
     startTime = 0.0
     def printStart():
     def printStart():
         global startTime
         global startTime
         startTime = globalClock.getFrameTime()
         startTime = globalClock.getFrameTime()
         print 'Start'
         print 'Start'
-    
+
     def printPreviousStart():
     def printPreviousStart():
         global startTime
         global startTime
         currTime = globalClock.getFrameTime()
         currTime = globalClock.getFrameTime()
         print 'PREVIOUS_END %0.2f' % (currTime - startTime)
         print 'PREVIOUS_END %0.2f' % (currTime - startTime)
-    
+
     def printPreviousEnd():
     def printPreviousEnd():
         global startTime
         global startTime
         currTime = globalClock.getFrameTime()
         currTime = globalClock.getFrameTime()
         print 'PREVIOUS_END %0.2f' % (currTime - startTime)
         print 'PREVIOUS_END %0.2f' % (currTime - startTime)
-    
+
     def printTrackStart():
     def printTrackStart():
         global startTime
         global startTime
         currTime = globalClock.getFrameTime()
         currTime = globalClock.getFrameTime()
         print 'TRACK_START %0.2f' % (currTime - startTime)
         print 'TRACK_START %0.2f' % (currTime - startTime)
-    
-    def printArguments(a,b,c):
-        print 'My args were %d, %d, %d' % (a,b,c)
-    
+
+    def printArguments(a, b, c):
+        print 'My args were %d, %d, %d' % (a, b, c)
+
     i1 = FunctionInterval(printStart)
     i1 = FunctionInterval(printStart)
     # Just to take time
     # Just to take time
-    i2 = LerpPosInterval(camera, 2.0, Point3(0,10,5))
+    i2 = LerpPosInterval(camera, 2.0, Point3(0, 10, 5))
     # This will be relative to end of camera move
     # This will be relative to end of camera move
     i3 = FunctionInterval(printPreviousEnd)
     i3 = FunctionInterval(printPreviousEnd)
     # Just to take time
     # Just to take time
-    i4 = LerpPosInterval(camera, 2.0, Point3(0,0,5))
+    i4 = LerpPosInterval(camera, 2.0, Point3(0, 0, 5))
     # This will be relative to the start of the camera move
     # This will be relative to the start of the camera move
     i5 = FunctionInterval(printPreviousStart)
     i5 = FunctionInterval(printPreviousStart)
     # This will be relative to track start
     # This will be relative to track start
     i6 = FunctionInterval(printTrackStart)
     i6 = FunctionInterval(printTrackStart)
     # This will print some arguments
     # This will print some arguments
     # This will be relative to track start
     # This will be relative to track start
-    i7 = FunctionInterval(printArguments, extraArgs = [1,10,100])
+    i7 = FunctionInterval(printArguments, extraArgs = [1, 10, 100])
     # Create the track, if you don't specify offset type in tuple it defaults to
     # Create the track, if you don't specify offset type in tuple it defaults to
     # relative to TRACK_START (first entry below)
     # relative to TRACK_START (first entry below)
     t2 = Track([(0.0, i1),                 # i1 start at t = 0, duration = 0.0
     t2 = Track([(0.0, i1),                 # i1 start at t = 0, duration = 0.0
@@ -177,20 +177,20 @@ if __name__ == "__main__":
                 (10.0, i6, TRACK_START),   # i6 start at t = 10, duration = 0.0
                 (10.0, i6, TRACK_START),   # i6 start at t = 10, duration = 0.0
                 (12.0, i7)],               # i7 start at t = 12, duration = 0.0
                 (12.0, i7)],               # i7 start at t = 12, duration = 0.0
                name = 'startTimeDemo')
                name = 'startTimeDemo')
-    
+
     print(t2)
     print(t2)
-    
+
     # Play tracks
     # Play tracks
     # mtrack.play()
     # mtrack.play()
     # t1.play()
     # t1.play()
     # t2.play()
     # t2.play()
-    
-    
+
+
     def test(n):
     def test(n):
         lerps = []
         lerps = []
         for i in range(n):
         for i in range(n):
-            lerps.append(LerpPosHprInterval(dock, 5.0, 
-                                            pos=Point3(0, 0, -5), 
+            lerps.append(LerpPosHprInterval(dock, 5.0,
+                                            pos=Point3(0, 0, -5),
                                             hpr=Vec3(0, 0, 0),
                                             hpr=Vec3(0, 0, 0),
                                             startPos=dock.getPos(),
                                             startPos=dock.getPos(),
                                             startHpr=dock.getHpr(),
                                             startHpr=dock.getHpr(),

+ 2 - 2
direct/src/interval/ProjectileIntervalTest.py

@@ -6,8 +6,8 @@ def doTest():
     smiley = loader.loadModel('models/misc/smiley')
     smiley = loader.loadModel('models/misc/smiley')
     smiley.reparentTo(render)
     smiley.reparentTo(render)
 
 
-    pi = ProjectileInterval(smiley, startPos=Point3(0,0,0),
-                            endZ = -10, wayPoint=Point3(10,0,0),
+    pi = ProjectileInterval(smiley, startPos=Point3(0, 0, 0),
+                            endZ = -10, wayPoint=Point3(10, 0, 0),
                             timeToWayPoint=3)
                             timeToWayPoint=3)
     pi.loop()
     pi.loop()
     return pi
     return pi