mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
*** empty log message ***
This commit is contained in:
parent
3d3c7f50c5
commit
210349cda8
@ -16,3 +16,4 @@ from DirectEntry import *
|
||||
from DirectLabel import *
|
||||
from DirectScrolledList import *
|
||||
from DirectDialog import *
|
||||
from DirectWaitBar import *
|
||||
|
78
direct/src/gui/DirectWaitBar.py
Normal file
78
direct/src/gui/DirectWaitBar.py
Normal file
@ -0,0 +1,78 @@
|
||||
from DirectFrame import *
|
||||
|
||||
"""
|
||||
import DirectWaitBar
|
||||
d = DirectWaitBar.DirectWaitBar()
|
||||
|
||||
"""
|
||||
|
||||
class DirectWaitBar(DirectFrame):
|
||||
"""
|
||||
DirectEntry(parent) - Create a DirectGuiWidget which responds
|
||||
to keyboard buttons
|
||||
"""
|
||||
def __init__(self, parent = guiTop, **kw):
|
||||
# Inherits from DirectFrame
|
||||
# A Direct Frame can have:
|
||||
# - A background texture (pass in path to image, or Texture Card)
|
||||
# - A midground geometry item (pass in geometry)
|
||||
# - A foreground text Node (pass in text string or Onscreen Text)
|
||||
optiondefs = (
|
||||
# Define type of DirectGuiWidget
|
||||
('pgFunc', PGWaitBar, None),
|
||||
('width', 1.0, self.setup),
|
||||
('height', 0.2, self.setup),
|
||||
('range', 100, self.setup),
|
||||
('value', 50, self.setValue),
|
||||
('barBorderWidth', (0,0), self.setBarBorderWidth),
|
||||
('barColor', (1,0,0,1), self.setBarColor),
|
||||
('barRelief', FLAT, self.setBarRelief),
|
||||
)
|
||||
|
||||
self.barStyle = PGFrameStyle()
|
||||
|
||||
# Merge keyword options with default options
|
||||
self.defineoptions(kw, optiondefs)
|
||||
|
||||
# Initialize superclasses
|
||||
DirectFrame.__init__(self, parent)
|
||||
|
||||
# Call option initialization functions
|
||||
self.initialiseoptions(DirectWaitBar)
|
||||
|
||||
self.setup()
|
||||
self.updateBarStyle()
|
||||
|
||||
|
||||
def setup(self):
|
||||
print self['width'], self['height'], self['range']
|
||||
self.guiItem.setup(self['width'], self['height'], self['range'])
|
||||
|
||||
def setValue(self):
|
||||
self.guiItem.setValue(self['value'])
|
||||
|
||||
def getPercent(self):
|
||||
return self.guiItem.getPercent()
|
||||
|
||||
def updateBarStyle(self):
|
||||
if not self.fInit:
|
||||
print 'updateing'
|
||||
self.guiItem.setBarStyle(self.barStyle)
|
||||
|
||||
def setBarRelief(self):
|
||||
print 1
|
||||
self.barStyle.setType(self['barRelief'])
|
||||
self.updateBarStyle()
|
||||
|
||||
def setBarBorderWidth(self):
|
||||
print 2
|
||||
self.barStyle.setWidth(*self['barBorderWidth'])
|
||||
self.updateBarStyle()
|
||||
|
||||
def setBarColor(self):
|
||||
print 3
|
||||
self.barStyle.setColor(*self['barColor'])
|
||||
self.updateBarStyle()
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user