Browse Source

*** empty log message ***

gregw 25 years ago
parent
commit
a149926ba7
3 changed files with 21 additions and 11 deletions
  1. 2 2
      direct/src/actor/Actor.py
  2. 3 3
      direct/src/gui/Button.py
  3. 16 6
      direct/src/gui/Frame.py

+ 2 - 2
direct/src/actor/Actor.py

@@ -470,9 +470,9 @@ class Actor(PandaObject, NodePath):
         if (animControlDict.has_key(partName)):
         if (animControlDict.has_key(partName)):
             del(animControlDict[partName])
             del(animControlDict[partName])
             
             
-    def hidePart(self, partName, lodName="lodName"):
+    def hidePart(self, partName, lodName="lodRoot"):
         """hidePart(self, string, key="lodName")
         """hidePart(self, string, key="lodName")
-        Make the given part of the optional given lod not render,
+        Make the given part of the optionally given lod not render,
         even though still in the tree.
         even though still in the tree.
         NOTE: this will affect child geometry"""
         NOTE: this will affect child geometry"""
         if (self.__partBundleDict.has_key(lodName)):
         if (self.__partBundleDict.has_key(lodName)):

+ 3 - 3
direct/src/gui/Button.py

@@ -51,9 +51,9 @@ class Button:
 
 
     
     
     def setWidth(self, width):
     def setWidth(self, width):
-        self.l1.setWidth(width / self.button.getScale())
-        self.l2.setWidth(width / self.button.getScale())
-        self.l3.setWidth(width / self.button.getScale())
+        self.l1.setWidth(width)
+        self.l2.setWidth(width)
+        self.l3.setWidth(width)
         
         
     def manage(self):
     def manage(self):
         self.button.manage(guiMgr, base.eventMgr.eventHandler)
         self.button.manage(guiMgr, base.eventMgr.eventHandler)

+ 16 - 6
direct/src/gui/Frame.py

@@ -12,6 +12,7 @@ class Frame:
     def __init__(self, name):
     def __init__(self, name):
         self.name = name
         self.name = name
         self.managed = 0
         self.managed = 0
+        self.offset = 0
         self.frame = GuiFrame.GuiFrame(name)
         self.frame = GuiFrame.GuiFrame(name)
         self.items = []
         self.items = []
 
 
@@ -42,6 +43,12 @@ class Frame:
     def setScale(self, scale):
     def setScale(self, scale):
         self.frame.setScale(scale)
         self.frame.setScale(scale)
 
 
+    def getOffset(self):
+        return self.offset
+
+    def setOffset(self, offset):
+        self.offset = offset
+        
     # content functions
     # content functions
     def addItem(self, item):
     def addItem(self, item):
         self.frame.addItem(item.getGuiItem())
         self.frame.addItem(item.getGuiItem())
@@ -55,24 +62,24 @@ class Frame:
         
         
     def packItem(self, itemNum, relation, otherItemNum):
     def packItem(self, itemNum, relation, otherItemNum):
         self.frame.packItem(self.items[itemNum].getGuiItem(), relation,
         self.frame.packItem(self.items[itemNum].getGuiItem(), relation,
-                            self.items[otherItemNum].getGuiItem())
+                            self.items[otherItemNum].getGuiItem(), self.offset)
 
 
     # convenience functions
     # convenience functions
     def makeVertical(self):
     def makeVertical(self):
         # remove any previous packing
         # remove any previous packing
-        #self.frame.clearAllPacking()
+        self.frame.clearAllPacking()
         # make each item (except first) align under the last
         # make each item (except first) align under the last
         for itemNum in range(1, len(self.items)):
         for itemNum in range(1, len(self.items)):
-            # self.frame.clearPacking(self.items[itemNum].getGuiItem())
             self.packItem(itemNum, GuiFrame.GuiFrame.UNDER, itemNum - 1)
             self.packItem(itemNum, GuiFrame.GuiFrame.UNDER, itemNum - 1)
-
+            self.packItem(itemNum, GuiFrame.GuiFrame.ALIGNLEFT, itemNum - 1)
+            
     def makeHorizontal(self):
     def makeHorizontal(self):
         # remove any previous packing
         # remove any previous packing
-        #self.frame.clearAllPacking()        
+        self.frame.clearAllPacking()
         # make each item (except first) align right of the last
         # make each item (except first) align right of the last
         for itemNum in range(1, len(self.items)):
         for itemNum in range(1, len(self.items)):
-            #self.frame.clearPacking(self.items[itemNum].getGuiItem())
             self.packItem(itemNum, GuiFrame.GuiFrame.RIGHT, itemNum - 1)
             self.packItem(itemNum, GuiFrame.GuiFrame.RIGHT, itemNum - 1)
+            self.packItem(itemNum, GuiFrame.GuiFrame.ALIGNABOVE, itemNum - 1)
             
             
     def makeWideAsWidest(self):
     def makeWideAsWidest(self):
         # make all the buttons as wide as the widest button in
         # make all the buttons as wide as the widest button in
@@ -86,6 +93,9 @@ class Frame:
                 widest = self.items.index(item)
                 widest = self.items.index(item)
                 widestWidth = thisWidth
                 widestWidth = thisWidth
 
 
+        # re-pack based on new widths
+        self.frame.recompute()
+
         # make them all this wide
         # make them all this wide
         for item in self.items:
         for item in self.items:
             item.setWidth(widestWidth)
             item.setWidth(widestWidth)