浏览代码

yell if invalid orientation given

David Rose 20 年之前
父节点
当前提交
ba4c626028
共有 2 个文件被更改,包括 6 次插入2 次删除
  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):
         if self['orientation'] == HORIZONTAL:
             self.guiItem.setAxis(Vec3(1, 0, 0))
-        else:
+        elif self['orientation'] == VERTICAL:
             self.guiItem.setAxis(Vec3(0, 0, -1))
+        else:
+            raise ValueError, 'Invalid value for orientation: %s' % (self['orientation'])
 
     def setManageButtons(self):
         self.guiItem.setManagePieces(self['manageButtons'])

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

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