本文整理汇总了Python中direct.gui.DirectFrame.DirectFrame类的典型用法代码示例。如果您正苦于以下问题:Python DirectFrame类的具体用法?Python DirectFrame怎么用?Python DirectFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DirectFrame类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, beanAmount):
if not ScavengerHuntEffect.images:
ScavengerHuntEffect.images = loader.loadModel('phase_4/models/props/tot_jar')
self.npRoot = DirectFrame(parent=aspect2d, relief=None, scale=0.75, pos=(0, 0, 0.6))
if beanAmount > 0:
self.npRoot.setColorScale(VBase4(1, 1, 1, 0))
self.jar = DirectFrame(parent=self.npRoot, relief=None, image=ScavengerHuntEffect.images.find('**/tot_jar'))
self.jar.hide()
self.eventImage = NodePath('EventImage')
self.eventImage.reparentTo(self.npRoot)
self.countLabel = DirectLabel(parent=self.jar, relief=None, text='+0', text_pos=(0.02, -0.2), text_scale=0.25, text_fg=(0.95, 0.0, 0, 1), text_font=ToontownGlobals.getSignFont())
def countUp(t, startVal, endVal):
beanCountStr = startVal + t * (endVal - startVal)
self.countLabel['text'] = '+' + `(int(beanCountStr))`
def setCountColor(color):
self.countLabel['text_fg'] = color
self.track = Sequence(LerpColorScaleInterval(self.npRoot, 1, colorScale=VBase4(1, 1, 1, 1), startColorScale=VBase4(1, 1, 1, 0)), Wait(1), Func(self.jar.show), LerpColorScaleInterval(self.eventImage, 1, colorScale=VBase4(1, 1, 1, 0), startColorScale=VBase4(1, 1, 1, 1)), Parallel(LerpScaleInterval(self.npRoot, 1, scale=0.5, startScale=0.75), LerpPosInterval(self.npRoot, 1, pos=VBase3(-0.9, 0, -0.83))), LerpFunc(countUp, duration=2, extraArgs=[0, beanAmount]), Func(setCountColor, VBase4(0.95, 0.95, 0, 1)), Wait(3), Func(self.destroy))
else:
self.npRoot.setColorScale(VBase4(1, 1, 1, 0))
self.attemptFailedMsg()
self.track = Sequence(LerpColorScaleInterval(self.npRoot, 1, colorScale=VBase4(1, 1, 1, 1), startColorScale=VBase4(1, 1, 1, 0)), Wait(5), LerpColorScaleInterval(self.npRoot, 1, colorScale=VBase4(1, 1, 1, 0), startColorScale=VBase4(1, 1, 1, 1)), Func(self.destroy))
return
示例2: _createComponents
def _createComponents(self):
self.debug("Creating GUI Components")
self.categoryMenu = self.parent.attachNewNode("CategoryMenu")
self.categoryMenu.setPos(-350, 0, -49)
self.sidebar = self.parent.attachNewNode("EditorSidebar")
self.sidebarBackground = DirectFrame(
parent=self.sidebar,
pos=(0, 0, 0),
frameSize=(0, 92, 0, -base.win.getYSize()),
frameColor=(0.05, 0.05, 0.05, 1.0),
)
self.logo = BetterOnscreenImage(
parent=self.sidebar, transparent=False, image="Editor/GUI/logo.png", x=0, y=0, w=92, h=48
)
self.categoriesParent = self.sidebar.attachNewNode("Categories")
self.categoriesParent.setPos(0, 0, -48)
self.categoryIcons = {}
self.animations = {"moveMenuArrow": None, "moveCategoryMenu": None}
for index, category in enumerate(EditorCategories.Categories):
iconDefault = "Editor/GUI/Icon-" + category.name + ".png"
iconHover = "Editor/GUI/Icon-" + category.name + "-Hover.png"
# iconActive = "Editor/GUI/Icon-" + category.name + "-Hover.png"
self.categoryIcons[category.name] = BetterOnscreenImage(
parent=self.categoriesParent, transparent=False, image=iconDefault, x=0, y=94 * index, w=92, h=94
)
# i hate direct gui
hoverCatch = DirectFrame(
parent=self.categoriesParent,
frameSize=(0, 92, 0, -94),
pos=(0, 0, -94 * index),
frameColor=(0, 0, 0, 0),
state=DGG.NORMAL,
)
# Add a hover effect
hoverCatch.bind(DGG.ENTER, partial(self._showCategoryMenu, category.name))
hoverCatch.bind(DGG.EXIT, partial(self._hideCategoryMenu, category.name))
self.currentCategoryMarker = BetterOnscreenImage(
parent=self.categoriesParent, image="Editor/GUI/Arrow-Right.png", x=92, y=0, w=11, h=21
)
self.currentCategoryMarker.hide()
self.categoryMenuBg = DirectFrame(
parent=self.categoryMenu, pos=(15, 0, 0), frameSize=(0, 300, 0, -400), frameColor=(0.2, 0.2, 0.2, 1.0)
)
示例3: __init__
def __init__(self, phaseNames):
self.phaseNames = phaseNames
self.model = loader.loadModel('models/gui/pir_m_gui_gen_loadingBar')
bar = self.model.findTexture('pir_t_gui_gen_loadingBar')
self.model.find('**/loading_bar').hide()
self.topFrame = DirectFrame(parent = base.a2dTopRight, pos = (-0.80000000000000004, 0, -0.10000000000000001), sortOrder = NO_FADE_SORT_INDEX + 1)
self.text = DirectLabel(relief = None, parent = self.topFrame, guiId = 'DownloadWatcherText', pos = (0, 0, 0), text = ' ', text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), text_scale = 0.040000000000000001, textMayChange = 1, text_align = TextNode.ARight, text_pos = (0.17000000000000001, 0), sortOrder = 2)
self.bar = DirectWaitBar(relief = None, parent = self.topFrame, guiId = 'DownloadWatcherBar', pos = (0, 0, 0), frameSize = (-0.40000000000000002, 0.38, -0.044999999999999998, 0.065000000000000002), borderWidth = (0.02, 0.02), range = 100, frameColor = (1, 1, 1, 1), barColor = (0, 0.29999999999999999, 0, 1), barTexture = bar, geom = self.model, geom_scale = 0.089999999999999997, geom_pos = (-0.014, 0, 0.01), text = '0%', text_scale = 0.040000000000000001, text_fg = (1, 1, 1, 1), text_align = TextNode.ALeft, text_pos = (0.19, 0), sortOrder = 1)
self.bgFrame = DirectFrame(relief = DGG.FLAT, parent = self.topFrame, pos = (0, 0, 0), frameColor = (0.5, 0.27000000000000002, 0.35999999999999999, 0.20000000000000001), frameSize = (-0.44, 0.39000000000000001, -0.035999999999999997, 0.056000000000000001), borderWidth = (0.02, 0.02), scale = 0.90000000000000002, sortOrder = 0)
self.accept('launcherPercentPhaseComplete', self.update)
示例4: TrickOrTreatTargetEffect
class TrickOrTreatTargetEffect(ScavengerHuntEffect):
def __init__(self, beanAmount):
ScavengerHuntEffect.__init__(self, beanAmount)
if beanAmount > 0:
self.pumpkin = DirectFrame(parent=self.eventImage, relief=None, image=ScavengerHuntEffect.images.find('**/tot_pumpkin_tall'))
def attemptFailedMsg(self):
pLabel = DirectLabel(parent=self.npRoot, relief=None, pos=(0.0, 0.0, -0.15), text=TTLocalizer.TrickOrTreatMsg, text_fg=(0.95, 0.5, 0.0, 1.0), text_scale=0.12, text_font=ToontownGlobals.getSignFont())
def destroy(self):
if hasattr(self, 'pumpkin') and self.pumpkin:
self.pumpkin.destroy()
ScavengerHuntEffect.destroy(self)
示例5: renderBuffers
def renderBuffers(self):
self.buffersParent.node().removeAllChildren()
posX = 0
posY = 0
for name in self.bufferOrder:
target = self.buffers[name]
for targetType in RenderTargetType.All:
if not target.hasTarget(targetType):
continue
tex = target.getTexture(targetType)
sizeStr = str(tex.getXSize()) + " x " + str(tex.getYSize())
if tex.getZSize() != 1:
sizeStr += " x " + str(tex.getZSize())
sizeStr += " - " + str(self.calculateTexSize(tex)) + " MB"
node = DirectFrame(parent=self.buffersParent, frameColor=(
1, 1, 1, 0.2), frameSize=(-self.innerPadding, self.texWidth + self.innerPadding, -self.texHeight - 30 - self.innerPadding, self.innerPadding + 15),
state=DGG.NORMAL)
node.setPos(
20 + posX * (self.texWidth + self.texPadding), 0, -self.paddingTop - 22 - posY * (self.texHeight + self.texPadding + 44))
node.bind(DGG.ENTER, partial(self.onMouseOver, node))
node.bind(DGG.EXIT, partial(self.onMouseOut, node))
node.bind(DGG.B1RELEASE, partial(self.showDetail, tex))
aspect = tex.getYSize() / float(tex.getXSize())
computedWidth = self.texWidth
computedHeight = self.texWidth * aspect
if computedHeight > self.texHeight:
# have to scale tex width instead
computedHeight = self.texHeight
computedWidth = tex.getXSize() / float(tex.getYSize()) * \
self.texHeight
img = BetterOnscreenImage(
image=tex, parent=node, x=0, y=30, w=computedWidth,
h=computedHeight, transparent=False, nearFilter=False,
anyFilter=False)
txtName = BetterOnscreenText(
text=name, x=0, y=0, size=13, parent=node)
txtSizeFormat = BetterOnscreenText(
text=sizeStr, x=0, y=20, size=13, parent=node,
color=Vec3(0.2))
txtTarget = BetterOnscreenText(
text=str(targetType), align="right", x=self.texWidth,
y=20, size=13, parent=node, color=Vec3(0.2))
posX += 1
if posX > self.pageSize:
posY += 1
posX = 0
示例6: createBugReport
def createBugReport(self):
""" Creates a bug report """
w, h = self.showbase.win.getXSize(), self.showbase.win.getYSize()
overlayBg = DirectFrame(parent=self.showbase.pixel2dp,
frameColor=(0.05, 0.05, 0.05, 0.8),
frameSize=(0, w, -h, 0)) # state=DGG.NORMAL
overlay = BetterOnscreenImage(image="Data/GUI/BugReport.png", parent=self.showbase.pixel2dp, w=757, h=398, x=(w-757)/2, y=(h-398)/2)
for i in xrange(2):
self.showbase.graphicsEngine.renderFrame()
reporter = BugReporter(self)
overlay.remove()
overlayBg.remove()
示例7: WinterCarolingEffect
class WinterCarolingEffect(ScavengerHuntEffect):
def __init__(self, beanAmount):
ScavengerHuntEffect.__init__(self, beanAmount)
if beanAmount > 0:
sm = loader.loadModel('phase_5.5/models/estate/tt_m_prp_ext_snowman_icon')
self.snowman = DirectFrame(parent=self.eventImage, relief=None, image=sm, scale=20.0)
def attemptFailedMsg(self):
pLabel = DirectLabel(parent=self.npRoot, relief=None, pos=(0.0, 0.0, -0.15), text=TTLocalizer.WinterCarolingMsg, text_fg=(0.9, 0.9, 1.0, 1.0), text_scale=0.12, text_font=ToontownGlobals.getSignFont())
def destroy(self):
if hasattr(self, 'snowman') and self.snowman:
self.snowman.destroy()
ScavengerHuntEffect.destroy(self)
示例8: _create_components
def _create_components(self):
""" Creates the window components """
self._node = self._parent.attach_new_node("Window")
self._node.set_pos(self._pos.x, 1, -self._pos.y)
border_px = 1
self._border_frame = DirectFrame(
pos=(0, 1, 0), frameSize=(-border_px, self._width + border_px,
border_px, -self._height - border_px),
frameColor=(24 / 255.0, 131 / 255.0, 215 / 255.0, 1),
parent=self._node, state=DGG.NORMAL)
self._background = DirectFrame(
pos=(0, 1, 0), frameSize=(0, self._width, 0, -self._height),
frameColor=(0.1, 0.1, 0.1, 1.0), parent=self._node)
self._title_bar = DirectFrame(
pos=(0, 1, 0), frameSize=(0, self._width, 0, -25),
# frameColor=(0.058, 0.058, 0.058, 1),
frameColor=(1, 1, 1, 1),
parent=self._node,
state=DGG.NORMAL)
self._window_title = Text(
parent=self._node, x=8, y=17, text=self._title, size=13,
color=Vec3(0.15), may_change=True)
self._btn_close = DirectButton(
relief=DGG.FLAT, pressEffect=1, pos=(self._width - 22, 1, -12),
frameColor=(1.0, 0.2, 0.2, 0.5), parent=self._node,
scale=(45 / 2, 1, 24 / 2),
image="/$$rp/data/gui/close_window.png")
# Init bindings
self._btn_close.set_transparency(TransparencyAttrib.M_alpha)
self._btn_close.bind(DGG.B1CLICK, self._request_close)
self._btn_close.bind(DGG.WITHIN, self._on_close_btn_hover)
self._btn_close.bind(DGG.WITHOUT, self._on_close_btn_out)
self._title_bar.bind(DGG.B1PRESS, self._start_drag)
self._title_bar.bind(DGG.B1RELEASE, self._stop_drag)
示例9: __init__
def __init__(self,
enableMask = True, #NOTE THAT IT IS TRUE BY DEFAULT
autoDestroy = True,
sortType = 0, #0 for horizontal, 1 for vertical
margin = 0.2,
textList = ['OK','Cancel'],
enablesList = None,
command = None,
frameSize = (-0.6,0.6,-0.45,0.45),
buttonSize = BUTTON_SIZE,
text = '',
textPos = (0,0.2),
startPos = (-0.4,0,-0.2),
extraArgs = [],
style = None,
fadeScreen = 0.5,
backgroundColor = None,
**kwargs):
if backgroundColor:
bgColor = backgroundColor
elif fadeScreen is not None:
bgColor = (0,0,0,fadeScreen)
else:
bgColor = None
SogalForm.__init__(self,enableMask = enableMask,backgroundColor=bgColor, **kwargs)
if enableMask:
self.reparentTo(aspect2d, sort = 1000)
if not style:
self.__style = base.getStyle()
else:
self.__style = color_themes.styles[style]
self.__frame = DirectFrame(parent = self,frameSize = frameSize,**self.__style['hardframe'])
self.__buttonList = []#DirectButton(parent = self, s)
self.__text = OnscreenText(parent = self,text = text ,pos = textPos, **self.__style['text'])
self.__command = command
self.__autoDestroy = autoDestroy
self._extraArgs = extraArgs
if sortType == 0:
self.__box = HLayout(margin = margin)
else: self.__box = VLayout(margin = margin)
self.__box.reparentTo(self)
self.__box.setPos(startPos)
for i in range(len(textList)):
btn = DirectButton(text = textList[i], command = self.buttonCommand(i),frameSize = buttonSize, **self.__style['button'])
self.__buttonList.append(btn)
self.__box.append(btn)
if enablesList:
for i in range(len(enablesList)):
if i >= len(self.__buttonList):
break
if enablesList[i]:
self.__buttonList[i]['state'] = DGG.NORMAL
else: self.__buttonList[i]['state'] = DGG.DISABLED
self.show()
示例10: _create_components
def _create_components(self):
""" Creates the window components """
self._node = self._parent.attach_new_node("Window")
self._node.set_pos(self._pos.x, 1, -self._pos.y)
border_px = 1
self._border_frame = DirectFrame(
pos=(0, 1, 0),
frameSize=(-border_px, self._width + border_px, border_px, -self._height - border_px),
frameColor=(0.0, 0.0, 0.0, 1),
parent=self._node,
state=DGG.NORMAL,
)
# self._border_frame.hide()
self._background = DirectFrame(
pos=(0, 1, 0),
frameSize=(0, self._width, 0, -self._height),
frameColor=(0.098, 0.098, 0.098, 1),
parent=self._node,
)
self._title_bar = DirectFrame(
pos=(0, 1, 0),
frameSize=(0, self._width, 0, -45),
frameColor=(0.058, 0.058, 0.058, 1),
parent=self._node,
state=DGG.NORMAL,
)
self._window_title = BetterOnscreenText(
parent=self._node, x=12, y=29, text=self._title, size=19, color=Vec3(0.7), may_change=True
)
self._btn_close = DirectButton(
relief=DGG.FLAT,
pressEffect=1,
pos=(self._width - 22, 1, -22),
frameColor=(0, 0, 0, 0),
scale=(20, 1, 20),
parent=self._node,
image="Data/GUI/CloseWindow.png",
)
# Init bindings
self._btn_close.set_transparency(TransparencyAttrib.M_alpha)
self._btn_close.bind(DGG.B1CLICK, self._request_close)
self._btn_close.bind(DGG.WITHIN, self._on_close_btn_hover)
self._btn_close.bind(DGG.WITHOUT, self._on_close_btn_out)
self._title_bar.bind(DGG.B1PRESS, self._start_drag)
self._title_bar.bind(DGG.B1RELEASE, self._stop_drag)
示例11: load
def load(args):
"""Sets up the GUI for the main menu.
Arguments:
This takes no arguments.
"""
global backFrame
global menuFrame
global pauseText
global backButton
font_digital = loader.loadFont('digital.egg')
backFrame = DirectFrame()
backFrame['frameColor'] = (0, 0, 0, .5)
backFrame['frameSize'] = (2, -2, 2, -2)
backFrame.setPos(0, 0, 0)
menuFrame = DirectFrame()
menuFrame.reparentTo(backFrame)
menuFrame['frameColor'] = (1, 1, 1, .5)
menuFrame['frameSize'] = (.5, -.5, .5, -.5)
menuFrame.setPos(0, 0, 0)
pauseText = OnscreenText()
pauseText['text'] = ('PAUSED')
pauseText['scale'] = (.1)
pauseText['font'] = (font_digital)
pauseText['fg'] = (1, 1, 1, 1)
pauseText.setPos(0, .9)
backButton = DirectButton()
backButton.reparentTo(menuFrame)
backButton['text'] = ('Back')
backButton['text_scale'] = (.1)
backButton['text_pos'] = (0, -0.03)
backButton['frameVisibleScale'] = (2, 0.5, 0)
backButton['frameColor'] = (1, 1, 1, 0)
backButton['command'] = (messenger.send)
backButton['extraArgs'] = ("switch_gui", [gui.menu.pause_options, gui.menu.pause])
backButton.setPos(0, 0, 0)
示例12: render
def render(self):
""" Inits the loading screen, creating the gui """
self.node = self.showbase.pixel2dp.attachNewNode("Loading Screen")
self.node.setBin("fixed", 10)
self.node.setDepthTest(False)
self.showbase.setFrameRateMeter(False)
w, h = base.win.getXSize(), base.win.getYSize()
scaleX = w / 2560.0
scaleY = h / 1440.0
imageScale = max(scaleX, scaleY)
imageW = 2560 * imageScale
imageH = 1440 * imageScale
self.bgFrame = DirectFrame(parent=self.node, frameColor=(0.9, 0.9, 0.9, 1.0), frameSize=(0, w, -h, 0))
self.font = loader.loadFont("Data/Font/Roboto-Light.ttf")
self.fontHighRes = loader.loadFont("Data/Font/Roboto-Thin.ttf")
self.fontHighRes.setPixelsPerUnit(120)
xOffs = (w - imageW) / 2.0
yOffs = (h - imageH) / 2.0
self.bgImage = BetterOnscreenImage(
image="Data/GUI/LoadingScreen.png", parent=self.node, w=imageW, h=imageH, x=xOffs, y=yOffs
)
self.points = []
self.pointAngles = [10, 25, 40, 51, 80, 103, 130, 152, 170, 198, 210, 231, 250, 274, 290, 310, 328, 352]
random.seed(491)
for angle in self.pointAngles:
scale = 180.0
point = BetterOnscreenImage(
image="Data/GUI/LoadingScreenPoint.png",
parent=self.node,
w=scale,
h=scale,
x=(w - scale) / 2,
y=(h - scale) / 2,
nearFilter=False,
)
point._node.setR(angle)
scaleZ = scale * (1.0 + random.random() * 1.2) * (1.0 + 0.6 * abs(math.cos(angle / 180.0 * math.pi)))
point._node.setScale(scaleZ, scale, scale)
sFrom, sTo = 0.7, 1.2
seq = Sequence(
point._node.scaleInterval(
2.0 + random.random(),
Vec3(scaleZ * sFrom, scale, scale),
startScale=Vec3(scaleZ * sTo, scale, scale),
blendType="easeInOut",
),
point._node.scaleInterval(
2.0 + random.random(),
Vec3(scaleZ * sTo, scale, scale),
startScale=Vec3(scaleZ * sFrom, scale, scale),
blendType="easeInOut",
),
)
seq.loop()
self.points.append(point)
cr = 212
ct = 0
self.circlePart1 = BetterOnscreenImage(
image="Data/GUI/LoadingCirclePart.png", parent=self.node, w=cr, h=cr, x=(w - cr) / 2, y=(h - cr) / 2 - ct
)
self.circlePart2 = BetterOnscreenImage(
image="Data/GUI/LoadingCirclePart.png", parent=self.node, w=cr, h=cr, x=(w - cr) / 2, y=(h - cr) / 2 - ct
)
self.circlePart3 = BetterOnscreenImage(
image="Data/GUI/LoadingCirclePart.png", parent=self.node, w=cr, h=cr, x=(w - cr) / 2, y=(h - cr) / 2 - ct
)
self.circlePart4 = BetterOnscreenImage(
image="Data/GUI/LoadingCirclePart.png", parent=self.node, w=cr, h=cr, x=(w - cr) / 2, y=(h - cr) / 2 - ct
)
self.circleBg = BetterOnscreenImage(
image="Data/GUI/LoadingCircleBgBlack.png",
parent=self.node,
w=180,
h=180,
x=(w - 180) / 2,
y=(h - 180) / 2 - ct,
)
self.logoImage = BetterOnscreenImage(
image="Data/GUI/RPIcon.png", parent=self.node, w=316, h=316, x=(w - 316) / 2, y=(h - 316) / 2 - ct
)
self.loadingDescText = BetterOnscreenText(
text="50%".upper(),
#.........这里部分代码省略.........
示例13: PiratesDownloadWatcher
class PiratesDownloadWatcher(DownloadWatcher.DownloadWatcher):
positions = [
(Point3(1, 0, 0.90000000000000002), Point3(1, 0, 0.90000000000000002)),
(Point3(1, 0, 0.90000000000000002), Point3(1, 0, 0.90000000000000002)),
(Point3(1, 0, 0.90000000000000002), Point3(1, 0, 0.90000000000000002))]
def __init__(self, phaseNames):
self.phaseNames = phaseNames
self.model = loader.loadModel('models/gui/pir_m_gui_gen_loadingBar')
bar = self.model.findTexture('pir_t_gui_gen_loadingBar')
self.model.find('**/loading_bar').hide()
self.topFrame = DirectFrame(parent = base.a2dTopRight, pos = (-0.80000000000000004, 0, -0.10000000000000001), sortOrder = NO_FADE_SORT_INDEX + 1)
self.text = DirectLabel(relief = None, parent = self.topFrame, guiId = 'DownloadWatcherText', pos = (0, 0, 0), text = ' ', text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), text_scale = 0.040000000000000001, textMayChange = 1, text_align = TextNode.ARight, text_pos = (0.17000000000000001, 0), sortOrder = 2)
self.bar = DirectWaitBar(relief = None, parent = self.topFrame, guiId = 'DownloadWatcherBar', pos = (0, 0, 0), frameSize = (-0.40000000000000002, 0.38, -0.044999999999999998, 0.065000000000000002), borderWidth = (0.02, 0.02), range = 100, frameColor = (1, 1, 1, 1), barColor = (0, 0.29999999999999999, 0, 1), barTexture = bar, geom = self.model, geom_scale = 0.089999999999999997, geom_pos = (-0.014, 0, 0.01), text = '0%', text_scale = 0.040000000000000001, text_fg = (1, 1, 1, 1), text_align = TextNode.ALeft, text_pos = (0.19, 0), sortOrder = 1)
self.bgFrame = DirectFrame(relief = DGG.FLAT, parent = self.topFrame, pos = (0, 0, 0), frameColor = (0.5, 0.27000000000000002, 0.35999999999999999, 0.20000000000000001), frameSize = (-0.44, 0.39000000000000001, -0.035999999999999997, 0.056000000000000001), borderWidth = (0.02, 0.02), scale = 0.90000000000000002, sortOrder = 0)
self.accept('launcherPercentPhaseComplete', self.update)
def update(self, phase, percent, reqByteRate, actualByteRate):
phaseName = self.phaseNames[phase]
self.text['text'] = OTPLocalizer.DownloadWatcherUpdate % phaseName + ' -'
self.bar['text'] = '%s %%' % percent
self.bar['value'] = percent
def foreground(self):
self.topFrame.reparentTo(base.a2dpTopRight)
self.topFrame.setBin('gui-fixed', 55)
self.topFrame['sortOrder'] = NO_FADE_SORT_INDEX + 1
def background(self):
self.topFrame.reparentTo(base.a2dTopRight)
self.topFrame.setBin('unsorted', 49)
self.topFrame['sortOrder'] = -1
def cleanup(self):
self.text.destroy()
self.bar.destroy()
self.bgFrame.destroy()
self.topFrame.destroy()
self.ignoreAll()
示例14: __init__
def __init__(self):
self.step = 0 #shows how many commands line it had run
self.scrStack = []
self.commandList = []
self.__currentPtr = None
if not runtime_data.RuntimeData.command_ptr:
self.nextPtr = 0
else: self.nextPtr = runtime_data.RuntimeData.command_ptr
if not runtime_data.RuntimeData.command_stack:
runtime_data.RuntimeData.command_stack = self.scrStack
else: self.scrStack = runtime_data.RuntimeData.command_stack
if not runtime_data.RuntimeData.command_list:
runtime_data.RuntimeData.command_list = self.commandList
else: self.commandList = runtime_data.RuntimeData.command_list
self._frame = DirectFrame(parent = aspect2d) # @UndefinedVariable pydev在傲娇而已不用管
self._frame.setTransparency(TransparencyAttrib.MAlpha)
self.storyView = StoryView()
self.audioPlayer = base.audioPlayer # @UndefinedVariable pydev在傲娇而已不用管
self.menu = StoryMenuBar()
self.gameTextBox = GameTextBox()
self.textHistory = TextHistory()
self.button_auto = self.menu.addButton(text = 'Auto',state = DGG.NORMAL,command = self.autoPlayButton)
self.button_history = self.menu.addButton(text = 'History',state = DGG.NORMAL,command = self.showTextHistoryButton)
self.button_skip = self.menu.addButton(text = 'Skip',state = DGG.DISABLED,command = self.startSkippingButton)
self.button_lastchoice = self.menu.addButton(text = 'Last Choice',state = DGG.DISABLED,command = self.lastChoice)
self.button_save = self.menu.addButton(text = 'Save',state = DGG.DISABLED, command = self.saveButton)
self.button_load = self.menu.addButton(text = 'Load',state = DGG.NORMAL,command = self.loadButton)
self.button_quicksave = self.menu.addButton(text = 'Quick Save',state = DGG.DISABLED,command = self.quickSaveButton)
self.button_quickload = self.menu.addButton(text = 'Quick Load',state = DGG.DISABLED,command = self.quickLoadButton)
self.button_config = self.menu.addButton(text = 'Options', state = DGG.NORMAL, command = self._configButton)
self.button_title = self.menu.addButton(text = 'Title',state = DGG.NORMAL,command = self.returnToTitle)
self._inputReady = True
self.__arrow_shown = False
self._choiceReady = True
self._currentMessage = ''
self.__currentSelection = None
self.__finishing = False
self.__lock = Lock()
self.forcejump = False
self.__autoInput = False
self.__focused = False
self.intervals = []
self.__skipping = False
self.__autoplaying = False
self.__autoInterval = None
self.__autoplaystep = None
self.mapScriptSpace()
SogalForm.__init__(self)
self.show()
taskMgr.add(self.loopTask,'story_manager_loop',sort = 2,priority = 1) # @UndefinedVariable 傲娇的pydev……因为panda3D的"黑魔法"……
taskMgr.doMethodLater(runtime_data.game_settings['jump_span'],self.__jumpCheck,'story_jump_check', sort = 5, priority = 1) # @UndefinedVariable