mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
*** empty log message ***
This commit is contained in:
parent
f8365c88f0
commit
7c3ddd7643
@ -4,9 +4,6 @@ import GuiLabel
|
|||||||
import GuiButton
|
import GuiButton
|
||||||
import Vec3
|
import Vec3
|
||||||
|
|
||||||
#import ClockObject
|
|
||||||
#clock = ClockObject.ClockObject.getGlobalClock()
|
|
||||||
|
|
||||||
guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node())
|
guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node())
|
||||||
font = (loader.loadModelOnce("phase_3/models/fonts/ttf-comic")).node()
|
font = (loader.loadModelOnce("phase_3/models/fonts/ttf-comic")).node()
|
||||||
|
|
||||||
@ -21,26 +18,18 @@ class Button:
|
|||||||
self.label = label
|
self.label = label
|
||||||
# up
|
# up
|
||||||
self.l1 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label, font)
|
self.l1 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label, font)
|
||||||
#print "made the label: t = %.3f" % clock.getRealTime()
|
|
||||||
self.l1.setForegroundColor(0., 0., 0., 1.)
|
self.l1.setForegroundColor(0., 0., 0., 1.)
|
||||||
#print "set the label colors: t = %.3f" % clock.getRealTime()
|
|
||||||
# roll-over up
|
# roll-over up
|
||||||
self.l2 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label, font)
|
self.l2 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label, font)
|
||||||
#print "made the label: t = %.3f" % clock.getRealTime()
|
|
||||||
self.l2.setForegroundColor(0., 0., 0., 1.)
|
self.l2.setForegroundColor(0., 0., 0., 1.)
|
||||||
self.l2.setBackgroundColor(1., 1., 0., 1.)
|
self.l2.setBackgroundColor(1., 1., 0., 1.)
|
||||||
#print "set the label colors: t = %.3f" % clock.getRealTime()
|
|
||||||
# roll-over down
|
# roll-over down
|
||||||
self.l3 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label, font)
|
self.l3 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label, font)
|
||||||
#print "made the label: t = %.3f" % clock.getRealTime()
|
|
||||||
self.l3.setForegroundColor(1., 1., 1., 1.)
|
self.l3.setForegroundColor(1., 1., 1., 1.)
|
||||||
self.l3.setBackgroundColor(0., 0., 0., 1.)
|
self.l3.setBackgroundColor(0., 0., 0., 1.)
|
||||||
#print "set the label colors: t = %.3f" % clock.getRealTime()
|
|
||||||
self.button = GuiButton.GuiButton(self.name, self.l1, self.l2,
|
self.button = GuiButton.GuiButton(self.name, self.l1, self.l2,
|
||||||
self.l3, self.l3, self.l1)
|
self.l3, self.l3, self.l1)
|
||||||
#print "made the button: t = %.3f" % clock.getRealTime()
|
|
||||||
self.setScale(0.1)
|
self.setScale(0.1)
|
||||||
#print "scale button: t = %.3f" % clock.getRealTime()
|
|
||||||
self.managed = 0
|
self.managed = 0
|
||||||
|
|
||||||
|
|
||||||
@ -86,3 +75,4 @@ class Button:
|
|||||||
|
|
||||||
def setScale(self, scale):
|
def setScale(self, scale):
|
||||||
self.button.setScale(scale)
|
self.button.setScale(scale)
|
||||||
|
|
||||||
|
@ -80,21 +80,15 @@ class Frame:
|
|||||||
|
|
||||||
# convenience functions
|
# convenience functions
|
||||||
def makeVertical(self):
|
def makeVertical(self):
|
||||||
# remove any previous packing
|
|
||||||
#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.packItem(self.items[itemNum], GuiFrame.GuiFrame.UNDER,
|
self.packItem(self.items[itemNum], GuiFrame.GuiFrame.UNDER,
|
||||||
self.items[itemNum - 1])
|
self.items[itemNum - 1])
|
||||||
self.packItem(self.items[itemNum], GuiFrame.GuiFrame.ALIGNLEFT,
|
self.packItem(self.items[itemNum], GuiFrame.GuiFrame.ALIGNLEFT,
|
||||||
self.items[itemNum - 1])
|
self.items[itemNum - 1])
|
||||||
#print "MakeVert: done packing: t = %.3f" % clock.getRealTime()
|
|
||||||
self.frame.recompute()
|
self.frame.recompute()
|
||||||
#print "MakeVert: done recompute: t = %.3f" % clock.getRealTime()
|
|
||||||
|
|
||||||
def makeHorizontal(self):
|
def makeHorizontal(self):
|
||||||
# remove any previous packing
|
|
||||||
#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.packItem(self.items[itemNum], GuiFrame.GuiFrame.RIGHT,
|
self.packItem(self.items[itemNum], GuiFrame.GuiFrame.RIGHT,
|
||||||
|
@ -5,9 +5,6 @@ import PandaObject
|
|||||||
import Frame
|
import Frame
|
||||||
import Button
|
import Button
|
||||||
|
|
||||||
#import ClockObject
|
|
||||||
#clock = ClockObject.ClockObject.getGlobalClock()
|
|
||||||
|
|
||||||
class PickList(PandaObject.PandaObject):
|
class PickList(PandaObject.PandaObject):
|
||||||
"""PickList class: display a menu of choices and report users
|
"""PickList class: display a menu of choices and report users
|
||||||
choice (via mouse or keyboard) as an event with the choice as
|
choice (via mouse or keyboard) as an event with the choice as
|
||||||
@ -70,7 +67,6 @@ class PickList(PandaObject.PandaObject):
|
|||||||
"""__displayChoices(self, string[])
|
"""__displayChoices(self, string[])
|
||||||
Display the list of choices
|
Display the list of choices
|
||||||
"""
|
"""
|
||||||
#print "starting choiceList: t = %.3f" % clock.getRealTime()
|
|
||||||
for choice in choiceList:
|
for choice in choiceList:
|
||||||
# create a button for each choice
|
# create a button for each choice
|
||||||
button = Button.Button(choice)
|
button = Button.Button(choice)
|
||||||
@ -89,18 +85,12 @@ class PickList(PandaObject.PandaObject):
|
|||||||
button.button.setUpEvent(eventName)
|
button.button.setUpEvent(eventName)
|
||||||
self.accept(eventName, self.__exitChoice)
|
self.accept(eventName, self.__exitChoice)
|
||||||
# keep a list of the choice buttons
|
# keep a list of the choice buttons
|
||||||
#print "done with button events: t = %.3f" % clock.getRealTime()
|
|
||||||
self.frame.addItem(button)
|
self.frame.addItem(button)
|
||||||
#print "frame add button: t = %.3f" % clock.getRealTime()
|
|
||||||
self.choiceList.append(button)
|
self.choiceList.append(button)
|
||||||
#print "list add button: t = %.3f" % clock.getRealTime()
|
|
||||||
|
|
||||||
#print "done with choiceList: t = %.3f" % clock.getRealTime()
|
|
||||||
# set up the frame
|
# set up the frame
|
||||||
self.frame.makeWideAsWidest()
|
self.frame.makeWideAsWidest()
|
||||||
#print "done with makeWideAsWidest: t = %.3f" % clock.getRealTime()
|
|
||||||
self.frame.makeVertical()
|
self.frame.makeVertical()
|
||||||
#print "done with makeVertical: t = %.3f" % clock.getRealTime()
|
|
||||||
|
|
||||||
def manage(self):
|
def manage(self):
|
||||||
self.frame.manage()
|
self.frame.manage()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user