diff --git a/direct/src/actor/Actor.py b/direct/src/actor/Actor.py index ca5f2f655c..bba6af27bd 100644 --- a/direct/src/actor/Actor.py +++ b/direct/src/actor/Actor.py @@ -470,9 +470,9 @@ class Actor(PandaObject, NodePath): if (animControlDict.has_key(partName)): del(animControlDict[partName]) - def hidePart(self, partName, lodName="lodName"): + def hidePart(self, partName, lodName="lodRoot"): """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. NOTE: this will affect child geometry""" if (self.__partBundleDict.has_key(lodName)): diff --git a/direct/src/gui/Button.py b/direct/src/gui/Button.py index cb8483aef8..93fef8c288 100644 --- a/direct/src/gui/Button.py +++ b/direct/src/gui/Button.py @@ -51,9 +51,9 @@ class Button: 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): self.button.manage(guiMgr, base.eventMgr.eventHandler) diff --git a/direct/src/gui/Frame.py b/direct/src/gui/Frame.py index 1dcff6f2ec..a65dac2f53 100644 --- a/direct/src/gui/Frame.py +++ b/direct/src/gui/Frame.py @@ -12,6 +12,7 @@ class Frame: def __init__(self, name): self.name = name self.managed = 0 + self.offset = 0 self.frame = GuiFrame.GuiFrame(name) self.items = [] @@ -42,6 +43,12 @@ class Frame: def setScale(self, scale): self.frame.setScale(scale) + def getOffset(self): + return self.offset + + def setOffset(self, offset): + self.offset = offset + # content functions def addItem(self, item): self.frame.addItem(item.getGuiItem()) @@ -55,24 +62,24 @@ class Frame: def packItem(self, itemNum, relation, otherItemNum): self.frame.packItem(self.items[itemNum].getGuiItem(), relation, - self.items[otherItemNum].getGuiItem()) + self.items[otherItemNum].getGuiItem(), self.offset) # convenience functions def makeVertical(self): # remove any previous packing - #self.frame.clearAllPacking() + self.frame.clearAllPacking() # make each item (except first) align under the last 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.ALIGNLEFT, itemNum - 1) + def makeHorizontal(self): # remove any previous packing - #self.frame.clearAllPacking() + self.frame.clearAllPacking() # make each item (except first) align right of the last 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.ALIGNABOVE, itemNum - 1) def makeWideAsWidest(self): # make all the buttons as wide as the widest button in @@ -86,6 +93,9 @@ class Frame: widest = self.items.index(item) widestWidth = thisWidth + # re-pack based on new widths + self.frame.recompute() + # make them all this wide for item in self.items: item.setWidth(widestWidth)