Browse Source

yell if invalid orientation given

David Rose 20 years ago
parent
commit
ba4c626028
2 changed files with 6 additions and 2 deletions
  1. 3 1
      direct/src/gui/DirectScrollBar.py
  2. 3 1
      direct/src/gui/DirectSlider.py

+ 3 - 1
direct/src/gui/DirectScrollBar.py

@@ -106,8 +106,10 @@ class DirectScrollBar(DirectFrame):
     def setOrientation(self):
     def setOrientation(self):
         if self['orientation'] == HORIZONTAL:
         if self['orientation'] == HORIZONTAL:
             self.guiItem.setAxis(Vec3(1, 0, 0))
             self.guiItem.setAxis(Vec3(1, 0, 0))
-        else:
+        elif self['orientation'] == VERTICAL:
             self.guiItem.setAxis(Vec3(0, 0, -1))
             self.guiItem.setAxis(Vec3(0, 0, -1))
+        else:
+            raise ValueError, 'Invalid value for orientation: %s' % (self['orientation'])
 
 
     def setManageButtons(self):
     def setManageButtons(self):
         self.guiItem.setManagePieces(self['manageButtons'])
         self.guiItem.setManagePieces(self['manageButtons'])

+ 3 - 1
direct/src/gui/DirectSlider.py

@@ -99,8 +99,10 @@ class DirectSlider(DirectFrame):
     def setOrientation(self):
     def setOrientation(self):
         if self['orientation'] == HORIZONTAL:
         if self['orientation'] == HORIZONTAL:
             self.guiItem.setAxis(Vec3(1, 0, 0))
             self.guiItem.setAxis(Vec3(1, 0, 0))
-        else:
+        elif self['orientation'] == VERTICAL:
             self.guiItem.setAxis(Vec3(0, 0, 1))
             self.guiItem.setAxis(Vec3(0, 0, 1))
+        else:
+            raise ValueError, 'Invalid value for orientation: %s' % (self['orientation'])
 
 
     def destroy(self):
     def destroy(self):
         DirectFrame.destroy(self)
         DirectFrame.destroy(self)