mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
Documented this file
This commit is contained in:
parent
b7e7d35a5a
commit
d14ebd80aa
@ -57,12 +57,17 @@ class DirectWaitBar(DirectFrame):
|
|||||||
DirectFrame.destroy(self)
|
DirectFrame.destroy(self)
|
||||||
|
|
||||||
def setRange(self):
|
def setRange(self):
|
||||||
|
"""Updates the bar range which you can set using bar['range'].
|
||||||
|
This is the value at which the WaitBar indicates 100%."""
|
||||||
self.guiItem.setRange(self['range'])
|
self.guiItem.setRange(self['range'])
|
||||||
|
|
||||||
def setValue(self):
|
def setValue(self):
|
||||||
|
"""Updates the bar value which you can set using bar['value'].
|
||||||
|
The value should range between 0 and bar['range']."""
|
||||||
self.guiItem.setValue(self['value'])
|
self.guiItem.setValue(self['value'])
|
||||||
|
|
||||||
def getPercent(self):
|
def getPercent(self):
|
||||||
|
"""Returns the percentage complete."""
|
||||||
return self.guiItem.getPercent()
|
return self.guiItem.getPercent()
|
||||||
|
|
||||||
def updateBarStyle(self):
|
def updateBarStyle(self):
|
||||||
@ -70,19 +75,23 @@ class DirectWaitBar(DirectFrame):
|
|||||||
self.guiItem.setBarStyle(self.barStyle)
|
self.guiItem.setBarStyle(self.barStyle)
|
||||||
|
|
||||||
def setBarRelief(self):
|
def setBarRelief(self):
|
||||||
|
"""Updates the bar relief, which you can set using bar['barRelief']."""
|
||||||
self.barStyle.setType(self['barRelief'])
|
self.barStyle.setType(self['barRelief'])
|
||||||
self.updateBarStyle()
|
self.updateBarStyle()
|
||||||
|
|
||||||
def setBarBorderWidth(self):
|
def setBarBorderWidth(self):
|
||||||
|
"""Updates the bar's border width, which you can set using bar['barBorderWidth']."""
|
||||||
self.barStyle.setWidth(*self['barBorderWidth'])
|
self.barStyle.setWidth(*self['barBorderWidth'])
|
||||||
self.updateBarStyle()
|
self.updateBarStyle()
|
||||||
|
|
||||||
def setBarColor(self):
|
def setBarColor(self):
|
||||||
|
"""Updates the bar color, which you can set using bar['barColor']."""
|
||||||
color = self['barColor']
|
color = self['barColor']
|
||||||
self.barStyle.setColor(color[0], color[1], color[2], color[3])
|
self.barStyle.setColor(color[0], color[1], color[2], color[3])
|
||||||
self.updateBarStyle()
|
self.updateBarStyle()
|
||||||
|
|
||||||
def setBarTexture(self):
|
def setBarTexture(self):
|
||||||
|
"""Updates the bar texture, which you can set using bar['barTexture']."""
|
||||||
# this must be a single texture (or a string).
|
# this must be a single texture (or a string).
|
||||||
texture = self['barTexture']
|
texture = self['barTexture']
|
||||||
if isinstance(texture, types.StringTypes):
|
if isinstance(texture, types.StringTypes):
|
||||||
@ -94,6 +103,7 @@ class DirectWaitBar(DirectFrame):
|
|||||||
self.updateBarStyle()
|
self.updateBarStyle()
|
||||||
|
|
||||||
def update(self, value):
|
def update(self, value):
|
||||||
|
"""Updates the bar with the given value and renders a frame."""
|
||||||
self['value'] = value
|
self['value'] = value
|
||||||
|
|
||||||
# Render a frame out-of-sync with the igLoop to update the
|
# Render a frame out-of-sync with the igLoop to update the
|
||||||
@ -101,9 +111,8 @@ class DirectWaitBar(DirectFrame):
|
|||||||
# even though we are not normally rendering frames.
|
# even though we are not normally rendering frames.
|
||||||
base.graphicsEngine.renderFrame()
|
base.graphicsEngine.renderFrame()
|
||||||
|
|
||||||
def finish(self):
|
def finish(self, N = 10):
|
||||||
# Fill the bar in N frames
|
"""Fill the bar in N frames. This call is blocking."""
|
||||||
N = 10 # take 10 frames
|
|
||||||
remaining = self['range'] - self['value']
|
remaining = self['range'] - self['value']
|
||||||
if remaining:
|
if remaining:
|
||||||
step = max(1, int(remaining / N))
|
step = max(1, int(remaining / N))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user