def __init__(self, screen, titel, options): self.screen = screen self.title = titel self.options = options self.setFooter(Footer.Footer([],[],(255,255,255))) if("textColor" in self.options): self.textColor = options["textColor"] else: self.textColor = (0,0,0) if("backgroundColor" in self.options): self.backgroundColor = options["backgroundColor"] else: self.backgroundColor = (221,221,221, 160) self.toggleSidebar("useSidebar" in options and options["useSidebar"]) self.initSelection() TaskHandler.addAnimation(self.config["screenHeight"] - self.footer.getHeight(), self.config["screenHeight"], 600, self.updateFooterPos, 2500)
def __init__(self, screen, initialText, callback): self.screen = screen self.initialText = initialText self.currentText = str(initialText) self.callback = callback self.initBackground() self.setFooter(Footer.Footer([],[],(255,255,255))) TaskHandler.addAnimation(self.config["screenHeight"] - self.footer.getHeight(), self.config["screenHeight"], 600, self.updateFooterPos, 1000)
def handleEvents(self, events): if (self.subComponent != None): self.subComponent.handleEvents(events) return if (self.overlay != None): self.overlay.handleEvents(events) return for event in events: if event.type == pygame.KEYDOWN: if event.key == Keys.DINGOO_BUTTON_DOWN: if (self.selection == "band"): self.selection = "power" RenderControl.setDirty() if event.key == Keys.DINGOO_BUTTON_UP: if (self.selection == "power" or self.selection == "settings"): self.selection = "band" RenderControl.setDirty() if event.key == Keys.DINGOO_BUTTON_LEFT or event.key == Keys.DINGOO_BUTTON_L: if (not self.inTransition and self.selection == "band"): TaskHandler.addAnimation(0, 160, 200, self.transitionCallback) self.inTransition = True if (self.selection == "power"): self.selection = "settings" RenderControl.setDirty() if event.key == Keys.DINGOO_BUTTON_RIGHT or event.key == Keys.DINGOO_BUTTON_R: if (not self.inTransition and self.selection == "band"): TaskHandler.addAnimation(0, -160, 200, self.transitionCallback) self.inTransition = True if (self.selection == "settings"): self.selection = "power" RenderControl.setDirty() if event.key == Keys.DINGOO_BUTTON_SELECT: self.openOptions() RenderControl.setDirty() if event.key == Keys.DINGOO_BUTTON_START: if (self.selection == "band" and "useSelection" in self.config["mainMenu"][self.currentIndex] and self.config["mainMenu"][ self.currentIndex]["useSelection"] == False): self.emulatorCallback("", Keys.DINGOO_BUTTON_START, True) RenderControl.setDirty() else: self.select() if event.key == Keys.DINGOO_BUTTON_A: self.select()
def resetAnimation(self): self.menuAlpha = 255 if(self.animationId is not None): TaskHandler.stopAnimation(self.animationId) self.animationId = TaskHandler.addAnimation(255, 20, 600, self.animationCallback, 1500) RenderControl.setDirty()
def __init__(self, screen, titel, options): self.screen = screen self.title = titel self.options = options self.setFooter(Footer.Footer([], [], (255, 255, 255))) if ("textColor" in self.options): self.textColor = options["textColor"] else: self.textColor = (0, 0, 0) if ("backgroundColor" in self.options): self.backgroundColor = options["backgroundColor"] else: self.backgroundColor = (221, 221, 221, 160) if ("sideColor" not in self.options): self.options["sideColor"] = (57, 58, 59, 255) if ("headerColor" not in self.options): self.options["headerColor"] = (57, 58, 59, 255) if ("headerFontColor" not in self.options): self.options["headerFontColor"] = (255, 255, 255) if ("selectionColor" not in self.options): self.options["selectionColor"] = (55, 55, 55, 120) if ("descriptionFontColor" not in self.options): self.options["descriptionFontColor"] = (255, 255, 255) if ("scrollbarColor" not in self.options): self.options["scrollbarColor"] = (0, 105, 105) self.toggleSidebar("useSidebar" in options and options["useSidebar"]) self.initSelection() TaskHandler.addAnimation( self.config["screenHeight"] - self.footer.getHeight(), self.config["screenHeight"], 600, self.updateFooterPos, 2500)