def __init__(self): "Sets up the options menu" Menu.__init__(self, "MoleFusion Options Menu", "sprites/back1.jpg") self.parser = make_parser() self.curHandler = Localization() self.parser.setContentHandler(self.curHandler) self.parser.parse(open("languages/OptionsMenu_" + Constants.LANGUAGE + ".xml")) self.title = GW_Label(self.curHandler.getText("title"), (0.5, 0.1), (27, 22, 24)) self.name = GW_Label(self.curHandler.getText("name"), (0.5, 0.2), (255, 255, 255)) self.inputname = GW_TextInput((0.5, 0.3), 24, 0.4, Constants.PLAYERNAME) self.language = GW_Button(self.curHandler.getText("language"), (0.5, 0.5), (255, 255, 255)) self.language.add_eventhandler("onmouseclick", self.language_onmouseclick) self.returnMain = GW_Button(self.curHandler.getText("returnMain"), (0.5, 0.8), (255, 255, 255)) self.returnMain.add_eventhandler("onmouseclick", self.returnMain_onmouseclick) self.widget_man = GuiWidgetManager([self.title, self.name, self.inputname, self.language, self.returnMain]) self.time_speed = pygame.time.Clock() self.exit = False self.on_enter()
def __init__(self): "Sets up the menu" Menu.__init__(self, "MoleFusion Main Menu", "sprites/back1.jpg") self.parser = make_parser() self.curHandler = Localization() self.parser.setContentHandler(self.curHandler) self.parser.parse(open("languages/MainMenu_" + Constants.LANGUAGE + ".xml")) self.title = GW_Label(self.curHandler.getText("title"), (0.5, 0.1), (27, 22, 24)) self.start = GW_Button(self.curHandler.getText("start"), (0.5, 0.3), (255, 255, 255)) self.start.add_eventhandler("onmouseclick", self.start_onmouseclick) self.options = GW_Button(self.curHandler.getText("options"), (0.5, 0.45), (255, 255, 255)) self.options.add_eventhandler("onmouseclick", self.options_onmouseclick) self.highscores = GW_Button(self.curHandler.getText("highscores"), (0.5, 0.6), (255, 255, 255)) self.highscores.add_eventhandler("onmouseclick", self.highscores_onmouseclick) self.help = GW_Button(self.curHandler.getText("help"), (0.5, 0.75), (255, 255, 255)) self.help.add_eventhandler("onmouseclick", self.help_onmouseclick) self.quit = GW_Button(self.curHandler.getText("quit"), (0.5, 0.9), (255, 255, 255)) self.quit.add_eventhandler("onmouseclick", self.quit_onmouseclick) self.widget_man = GuiWidgetManager( [self.title, self.start, self.options, self.highscores, self.help, self.quit] ) self.time_speed = pygame.time.Clock() self.on_enter()
def __init__(self,background): "Set up the HighScores menu" Menu.__init__(self,"MoleFusion HighScore Menu",background) self.parser = make_parser() self.curHandler = Localization() self.parser.setContentHandler(self.curHandler) self.parser.parse(open("languages/HighScoresMenu_" + Constants.LANGUAGE + ".xml")) self.title = GW_Label(self.curHandler.getText("title"),(0.5,0.1),(27,22,24)) self.name_column = GW_Label(self.curHandler.getText("name"),(0.25,0.25),(212,224,130)) self.points_column = GW_Label(self.curHandler.getText("points"),(0.75,0.25),(212,224,130)) self.returnMain = GW_Button(self.curHandler.getText("returnMain"),(0.5,0.9),(255,255,255)) self.returnMain.add_eventhandler("onmouseclick",self.returnMain_onmouseclick) h = HighScores() highscorelist = h.get_HighScores() self.widgetlist = [self.title,self.name_column,self.points_column,self.returnMain] for val,i in enumerate(highscorelist[0:5]): self.widgetlist.append(GW_Label(i.get_name(),(0.25,0.35+val/10.0),(250,254,210))) self.widgetlist.append(GW_Label(str(i.get_points()),(0.75,0.35+val/10.0),(250,254,210))) self.widget_man = GuiWidgetManager(self.widgetlist) self.time_speed=pygame.time.Clock() self.exit=False self.on_enter()
def __init__(self, player): Menu.__init__(self, player) room = Engine.RoomEngine.getRoom(player.attributes['roomID']) inventory = room.attributes['inventory'] self.attributes['options'] = { '1' : ('. Players', lambda : self.pushMenu(IteratorMenu(player, lambda p : room.attributes['players'], 'name', 'look', False))), '2' : ('. NPCs', lambda : self.pushMenu(IteratorMenu(player, lambda p : room.attributes['npcs'], 'name', 'look', False))), '3' : ('. Items', lambda : self.pushMenu(IteratorMenu(player, lambda p : inventory.attributes['items'] + inventory.attributes['permanent_items'], 'name', 'look', False))), '4' : ('. Cancel', lambda : self.cancelMenu()) }
def __init__(self, player): Menu.__init__(self, player) self.attributes['options'] = { '1' : ('. Youself', lambda : self.pushMenu(ExamineSelfMenu(player))), '2' : ('. Environment', lambda : self.pushMenu(ExamineEnvironmentMenu(player))), '3' : ('. Cancel', lambda : self.cancelMenu()) }
def __init__(self, player): Menu.__init__(self, player) self.attributes['options'] = { '1' : ('. Equipment and Description', lambda : self.executeCommand('look', [player], False)), '2' : ('. Inventory', lambda : self.pushMenu(ExamineInventoryMenu(player))), '3' : ('. Cancel', lambda : self.cancelMenu()) }
def __init__(self, player): Menu.__init__(self, player) self.attributes['options'] = { '1' : ('. All items', lambda : self.executeCommand('inventory', None, False)), '2' : ('. Specific item', lambda : self.pushMenu(ExamineInventoryItemMenu(player))), '3' : ('. Cancel', lambda : self.cancelMenu()) }
def main(): pygame.init() #Creamos la ventana screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT)) pygame.display.set_caption("VichoPLS") #El reloj clock = pygame.time.Clock() #Ejecutamos el Menu continuar = True miMenu = Menu(load_image,clock,screen) miMenu.ejecutarMenu() jefecitos = dict() jefecitos["Raul"] = Montes jefecitos["Luis"] = Dissett var=True enemigos = [4,8] bosses = ["Raul","Luis"] count = 0 x=100 y=240 etapa = 1 while continuar: #Ejecutamos la Etapa while var and count < len(enemigos): miEtapa = Etapa(load_image,clock,screen,4,3000,0.6,enemigos[count],jefecitos[bosses[count]](load_image),bosses[count],x,y,etapa) var = miEtapa.ejecutarEtapa("leJuego") x = miEtapa.cx y = miEtapa.cy count += 1 etapa+=1 if var: miVic = Victory(load_image,clock,screen) var = miVic.ejecutarMenu() if not(var): break count = 0 else: miGO = GameOver(load_image,clock,screen) var = miGO.ejecutarMenu() if not(var): break count = 0 pygame.mixer.quit() pygame.display.quit() print "GG"
class TestMenu(unittest.TestCase): def setUp(self): self.m = Menu() def testCheckSystemEnvironment(self): self.m.checkWindowsVersion = lambda: "3.1" self.assertEquals(self.m.checkSystemEnvironment(), False) self.m.checkWindowsVersion = lambda: "6.1" self.m.checkFilePath = lambda x: None self.assertEquals(self.m.checkSystemEnvironment(), False) self.m.checkWindowsVersion = lambda: "6.1" self.m.checkFilePath = lambda x: "taskkill.exe" self.assertEquals(self.m.checkSystemEnvironment(), True) def testWriteInfoLine(self): self.assertRaises(ValueError, self.m.writeInfoLine, "ok2", "") self.assertEquals(self.m.writeInfoLine("ok", "ok`y info."), None) self.assertEquals(self.m.writeInfoLine("warning", "warning info."), None) self.assertEquals(self.m.writeInfoLine("error", "error info."), None) self.assertEquals(self.m.writeInfoLine("fatal", "fatal error info."), None) self.assertEquals(self.m.writeInfoLine("info", "only info."), None) self.assertEquals(self.m.writeInfoLine("warning", "custom info.", u"ОПИСАНИЕ"), None)
def __init__(self, window, player, room): self.window = window self.menu = Menu(self.window) self.player = player self.enemy = None self.room = room self.run = True self.state = "main" self.game_objects = [] self.font_name = 'Fonts/8-BIT WONDER.TTF' self.inventory_click = False
def __init__(self, player): Menu.__init__(self, player) self.attributes['options'] = { '1' : ('. Move', lambda : self.pushMenu(IteratorMenu(player, lambda p : Engine.RoomEngine.getRoom(p.attributes['roomID']).attributes['exits'], 'name', 'go', True))), '2' : ('. Examine', lambda : self.pushMenu(ExamineMenu(player))) }
def run(): os.system("clear") option = Menu() words = readWords() while option != "9": if option == "1": game(choice(words)) elif option == "2": Instructions() os.system("clear") if option != "9": option = Menu()
def main(): myMenu = Menu() diff_lvl = 3 while diff_lvl == 3: menu_choice = myMenu.main_menu() if menu_choice == 0: diff_lvl = myMenu.diff_menu() elif menu_choice == 2: break myGame = Game(diff_lvl) myGame.run()
def __init__(self, ui, lcd, eq): Menu.__init__(self, ui, lcd, eq) self.things.append(MenuThing("Back", self.Back, "")) self.things.append(MenuThing("Ethernet", self.Ethernet, "")) s = "wpa_supplicant-" e = ".conf" files = os.listdir("/etc/wpa_supplicant") files.sort() for f in files: if f[0:len(s)] == s and f[-len(e):len(f)] == e: self.things.append(MenuThing(f[len(s):-len(e)], self.WiFi, f))
def jump_with_parachute(self): parachute ='' for i in Player.inventory.collection_of_items: if i.name=='Parachute': parachute = i break if Player.inventory.check_if_has_item(parachute): return True Menu.action() print("You cannot jump because you will die! You need a parachute!") return
def __init__(self, ui, lcd, eq): Menu.__init__(self, ui, lcd, eq) self.things.append(MenuThing("Back", self.Back, "")) self.things.append(MenuThing("Clear playlist", self.ClearPlaylist, "")) self.things.append(MenuThing("Add to playlist", self.EnterBrowser, "")) self.things.append(MenuThing("Internet radio", self.SelectStation, "")) self.things.append(MenuThing("Mount external", self.MountExternal, "")) self.things.append( MenuThing("Umount external", self.UmountExternal, "")) self.things.append(MenuThing("Network menu", self.EnterNetMenu, "")) self.things.append(MenuThing("System menu", self.EnterSysMenu, "")) self.things.append( MenuThing("Manage playlist", self.ManagePlaylist, ""))
def __init__(self, master=None): Frame.__init__(self, master) self.master = master graphe = Graphe(self) dessin = Dessin(self, graphe) menu = Menu(self, dessin) dessin.grid(row=1, column=1, rowspan=2) graphe.grid(row=1, column=2, rowspan=2) menu.grid(row=4, column=1) self.pack(fill=BOTH, expand=1)
def load(): m = Menu() save0path = variables.savepath if not devoptions.args.restart and ( os.path.isfile(save0path)) and os.path.getsize(save0path) > 0: devoptions.devprint("loading save") with open(save0path, "rb") as f: loadedlist = pickle.load(f) tempplayer = None mapsdict, tempcname, tempplayer, classvar.battle, maps.current_map_name, floatingtemp = loadedlist if not devoptions.dontloadplayer: classvar.player = tempplayer else: classvar.player.xpos = tempplayer.xpos classvar.player.ypos = tempplayer.ypos for x in range(50): classvar.player.addstoryevent("bed") if devoptions.lvcheat != 0: classvar.player.exp = lvexp( explv(classvar.player.exp) + devoptions.lvcheat) if devoptions.addallrewards: for k in soundpackkeys: classvar.player.addreward(k) for k in scales.keys(): classvar.player.addreward(k) if not devoptions.dontloadmapsdict: conversations.floatingconversations = floatingtemp loadmaps(mapsdict) if tempcname in conversations.floatingconversations.keys(): conversations.currentconversation = conversations.floatingconversations[ tempckey] else: if tempcname != None: conversations.currentconversation = maps.map_dict[ maps.current_map_name].getconversation(tempcname) maps.change_map_nonteleporting(maps.current_map_name) # don't start at beginning m.firstbootup = False if (not isinstance(classvar.battle, str)): classvar.battle.reset_enemy() if variables.settings.state == "game": initiategame(variables.settings.currentgame) return m
def __init__(self, terminal, posts): """ Creates an instance of PostMenuScreen Parameters: terminal: A Terminal object allowing the module to interface with the OS terminal Returns: An instance of Tag """ self.__menu__ = Menu(terminal) for post in posts: self.__menu__.addMenuItem(post)
def __init__(self): load_prc_file_data("", "textures-power-2 none") load_prc_file_data("", "win-size 1600 900") # load_prc_file_data("", "fullscreen #t") load_prc_file_data("", "window-title cuboid") load_prc_file_data("", "icon-filename res/icon.ico") # I found openal works better for me load_prc_file_data("", "audio-library-name p3openal_audio") # ------ Begin of render pipeline code ------ # Insert the pipeline path to the system path, this is required to be # able to import the pipeline classes pipeline_path = "../../" # Just a special case for my development setup, so I don't accidentally # commit a wrong path. You can remove this in your own programs. if not os.path.isfile(os.path.join(pipeline_path, "setup.py")): pipeline_path = "../../RenderPipeline/" sys.path.insert(0, pipeline_path) # Use the utility script to import the render pipeline classes from rpcore import RenderPipeline self.render_pipeline = RenderPipeline() self.render_pipeline.mount_mgr.mount() self.render_pipeline.load_settings("/$$rpconfig/pipeline.yaml") self.render_pipeline.settings["pipeline.display_debugger"] = False self.render_pipeline.set_empty_loading_screen() self.render_pipeline.create(self) # [Optional] use the default skybox, you can use your own skybox as well # self.render_pipeline.create_default_skybox() # ------ End of render pipeline code, thats it! ------ # Set time of day self.render_pipeline.daytime_mgr.time = 0.812 self.menu = Menu(self) self.level = Level(self) self.cube = Cube(self.level) self.camControl = CamControl(self.cube) self.gui = GUI(self) self.menu.showMenu() base.accept("i", self.camControl.zoomIn) base.accept("o", self.camControl.zoomOut)
def __init__(self, engine, items, selected=None, prompt=""): self.prompt = prompt self.engine = engine self.accepted = False self.selectedItem = None self.time = 0.0 self.menu = Menu(self.engine, choices=[(c, self._callbackForItem(c)) for c in items], onClose=self.close, onCancel=self.cancel) if selected and selected in items: self.menu.selectItem(items.index(selected)) self.engine.loadSvgDrawing(self, "background", "editor.svg")
def build_menu(): menu = Menu('Menu') menu.add_item(Item('1 - Show timeline', show_timeline)) menu.add_item(Item('2 - Follow username', follow_user)) menu.add_item(Item('3 - Send message', send_msg)) menu.add_item(Item('0 - Exit', exit_loop)) return menu
def __init__(self, stdscreen): self.screen = stdscreen curses.curs_set(0) title = "Network Monitor - Dion Bosschieter, Timo Dekker - Version: 0.1" debug_console = DebugConsole(self.screen, "Debugging information") main_window = Window(title, self.screen) info_container = InfoContainer(self.screen, "Netwerk info", debug_console) gather_information = GatherInformation(info_container, debug_console, "10.3.37.50") main_menu_items = [ ('Connect/Disconnect', gather_information.toggleconnect), ('Gather packets', gather_information.getPackets), ('Exit', exit) ] main_menu = Menu(main_menu_items, self.screen, "Main menu", debug_console, info_container) main_window.display() info_container.display() debug_console.display() debug_console.log("Logging initialized") debug_console.log("Network Monitor has started") debug_console.log("") debug_console.log("Usage:") debug_console.log("Press 'q' to quit, 'h' for the menu, 'p' to import newest packets, 'c' to connect and 'd' to disconnect") self.threadstop = 0 #create refresh deamon update_screens = Thread(target=self.updateScreens, args=(debug_console,info_container, main_menu)) update_screens.daemon = True update_screens.start() #listen for keypressess while(True): c = terminal.getch() if c == 'q': break elif c == 'h': self.threadstop = 1 main_menu.display() self.threadstop = 0 update_screens = Thread(target=self.updateScreens, args=(debug_console,info_container, main_menu)) update_screens.daemon = True update_screens.start() elif c == 'p': gather_information.getPackets() elif c == 'c': gather_information.connect() elif c == 'd': gather_information.disconnect()
def __init__(self): super().__init__() self.w, self.h = self.screen.get_size() self.sound_queue.append(sounds['menu']) bg = Animation(frames_path['play-background'], (0, 0), self.screen) tree1 = Animation(frames_path['tree'], (150, self.h/2), self.screen) tree1.reduce_scale(4) tree1.centralize() tree1.flip() tree2 = Animation(frames_path['tree'], (self.w-150, self.h/2), self.screen) tree2.reduce_scale(4) tree2.centralize() title = Animation(frames_path['title'], (self.w/2,200), self.screen) title.reduce_scale(3) title.centralize() self.ship = Animation(frames_path['ship'], ((self.w/16)*2, 200), self.screen) self.ship.reduce_scale(4) self.ship.centralize() self.ship_speed = -1 self.next_state self.menu = Menu(self.screen) ''' O botao criado no menu inicial recebe como parametro o nome do proximo estado que sera executado assim que este aqui acabar ''' self.menu.add_button('start', frames_path['start-button'], (self.w/2, self.h/2), 'SELECTCHAR') self.menu.buttons['start'].reduce_scale(1.5) self.menu.buttons['start'].centralize() self.menu.add_button('htp', frames_path['htp-button'], (self.w/2, self.h/2 + 100), 'HOWTOPLAY') self.menu.buttons['htp'].reduce_scale(1.5) self.menu.buttons['htp'].centralize() self.menu.add_button('sound', frames_path['sound'],(int((self.w/16)*15), int((self.h/10)*1)),self.switch_sound) self.menu.buttons['sound'].reduce_scale(5) self.menu.buttons['sound'].centralize() self.elements = [bg, self.ship, self.menu, tree1, tree2, title]
def __init__(self, ui, lcd, eq, m): Menu.__init__(self, ui, lcd, eq) self.things.append(MenuThing(m[0], self.Nix, '')) if len(m) > 1: self.things.append(MenuThing(m[1], self.Nix, '')) else: self.things.append(MenuThing('', self.Nix, '')) self.things.append(MenuThing('Yes', self.Answer, 'ans.yes')) self.things.append(MenuThing('No', self.Answer, 'ans.no')) self.min_current = 2 self.current = 3
def __init__(self, terminal): """ Creates an instance of SearchForPostsScreen Parameters: terminal: A Terminal object which allows this module to interface with the OS terminal Returns: An instance of SearchForPostsScreen """ self.__terminal__ = terminal self.__SearchForPosts__ = SearchForPosts(terminal.getDBName()) self.__menu__ = Menu(terminal) self.__chkinp__ = CheckInput()
def __init__(self, root, state, window_width, window_height): self.root = root self.window_width = window_width self.window_height = window_height self.changing_window = False self.menu = Menu(state, root) self.level_select = LevelSelect(state, root) self.level = Level(state, root) self.menu.place(in_=root, x=0, y=0, relwidth=1, relheight=1) self.level_select.place(in_=root, x=0, y=0, relwidth=1, relheight=1) self.level.place(in_=root, x=0, y=0, relwidth=1, relheight=1) self._show_menu()
class MainMenuScene(Scene): def __init__(self, window, inputManager, playGame): Scene.__init__(self) self.menu = Menu(window) self.menu.rootNode.children[0].function = playGame self.menu.rootNode.children[2].function = pyglet.app.exit def enter(self): inputManager.push_handlers(self.menu) def exit(self): inputManager.pop_handlers(self.menu) def draw(self): self.menu.draw()
def __init__(self, ui, lcd, eq): Menu.__init__(self, ui, lcd, eq) self.things.append(MenuThing('Back', self.Back, '')) sl = open(radiopi_cfg.stationlist, "r") for line in sl: if line[0] != "#": line = string.rstrip( string.lstrip(line) ) # Remove leading and trailing whitespace (incl. newline) if string.find(line, "|") > 0: name, url = string.split(line, "|") self.things.append((MenuThing(name, self.SelectStation, url))) sl.close()
def Validation(self): m = Menu() x = [] x = m.menu() if (x[0] in self.__admin and x[1] in self.__admin): temp = Admin() return temp elif (x[0] in self.__bibliotecario and x[1] in self.__bibliotecario): temp = Bibliotecario() return temp elif (x[0] in self.__guest and x[1] in self.__guest): temp = Guest() return temp return None
def main(): RESTAURANT_NAME = "Wuxi" # TODO 1: add your own restaurant name in the quotes restaurantTime = datetime.datetime(2017, 5, 1, 5, 0) #Create the menu object menu = Menu("menu.csv") # TODO 2: uncomment this once the Menu class is implemented #create the waiter object using the created Menu we just created waiter = Waiter(menu) # TODO 4: uncomment this one the Waiter class is implemented dinerList = [] print("Welcome to " + RESTAURANT_NAME + "!") print(RESTAURANT_NAME + " is now open for dinner.\n") for i in range(21): restaurantTime += datetime.timedelta(minutes=15) potentialDiner = RestaurantHelper.randomDinerGenerator(restaurantTime) if potentialDiner is not None: dinerList.append(potentialDiner) else: dinerList.append(str(restaurantTime)) # create main GUI root = Tk() root.title("Resturant") root.geometry("800x600") myAPP = GUI(root, waiter, dinerList) myAPP.mainloop() print('end of gui') print("Goodbye!")
def __init__(self, engine, songName=None, libraryName=DEFAULT_LIBRARY): self.engine = engine self.time = 0.0 self.guitar = Guitar(self.engine, editorMode=True) self.controls = Player.Controls() self.camera = Camera() self.pos = 0.0 self.snapPos = 0.0 self.scrollPos = 0.0 self.scrollSpeed = 0.0 self.newNotes = None self.newNotePos = 0.0 self.song = None self.engine.loadSvgDrawing(self, "background", "editor.svg") self.modified = False self.songName = songName self.libraryName = libraryName self.heldFrets = set() self.spinnyDisabled = self.engine.config.get("game", "disable_spinny") mainMenu = [ (_("Save Song"), self.save), (_("Set Song Name"), self.setSongName), (_("Set Artist Name"), self.setArtistName), (_("Set Beats per Minute"), self.setBpm), (_("Estimate Beats per Minute"), self.estimateBpm), (_("Set A/V delay"), self.setAVDelay), (_("Set Cassette Color"), self.setCassetteColor), (_("Set Cassette Label"), self.setCassetteLabel), (_("Editing Help"), self.help), (_("Quit to Main Menu"), self.quit), ] self.menu = Menu(self.engine, mainMenu)
def create_task_through_ui(self): task_create_type: Type[Task] = Menu( [ MenuItem('Transient Task', lambda: TransientTask), MenuItem('Recurring Task', lambda: RecurringTask), MenuItem('Cancellation', lambda: AntiTask) ], 'What type of task would you like to create?', ).process() if Task not in type.mro(task_create_type): raise RuntimeError( 'Invalid task type resulting from CreateTaskMenuItem.create_task_through_ui()' ) fields = task_create_type.get_input_fields() CliController.populate_fields(fields) field_values = CliController.fields_as_dict(fields) task = task_create_type(field_values) try: self.model.add_task(task) except PSSValidationError as err: raise PSSInvalidOperationError( f'Could not complete operation: {err}') CliView.display_notification(f'Successfully added {task}')
def main(): RESTAURANT_NAME = "Arby's" # TODO 1: add your own restaurant name in the quotes restaurantTime = datetime.datetime(2017, 5, 1, 5, 0) # Create the menu object menu = Menu("menu.csv") # TODO 2: uncomment this once the Menu class is implemented # create the waiter object using the created Menu we just created waiter = Waiter(menu) # TODO 4: uncomment this one the Waiter class is implemented print("Welcome to " + RESTAURANT_NAME + "!") print(RESTAURANT_NAME + " is now open for dinner.\n") # for i in range(21): print("\n~~~ It is currently", restaurantTime.strftime("%H:%M PM"), "~~~\n") restaurantTime += datetime.timedelta(minutes=15) # TODO 3: uncomment the following 3 lines once the Diner class is implemented potentialDiner = RestaurantHelper.randomDinerGenerator() if potentialDiner is not None: print(potentialDiner.getName() + " welcome, please be seated! \n") # we have a diner to add to the waiter's list of diners # TODO 4: uncomment the following 2 lines once the Waiter class is implemented waiter.addDiner(potentialDiner) waiter.advanceDiners() time.sleep(2) print("\n~~~ ", RESTAURANT_NAME, "is now closed. ~~~") # After the restaurant is closed, progress any diners until everyone has left # TODO 5: uncomment the following 5 lines once the Waiter class is implemented while waiter.getNumDiners(): print("\n~~~ It is currently", restaurantTime.strftime("%H:%M PM"), "~~~") restaurantTime += datetime.timedelta(minutes=15) waiter.advanceDiners() time.sleep(2) print("Goodbye!")
def testMenuNavigation(self): m = Menu(self.e, rootMenu) self.e.view.pushLayer(m) while self.e.view.layers: rootMenu[0][0] = "%.1f FPS" % self.e.timer.fpsEstimate self.e.run()
def initUI(self): widget = QWidget() widgetB = QWidget() widgetBLay = QVBoxLayout() self.layout = QGridLayout() self.setLayout(self.layout) self.layout.addWidget(QPushButton("button"), 0, 0) self.layout.addWidget(QPushButton("button"), 0, 1) self.layout.addWidget(QPushButton("button"), 0, 2) self.layout.addWidget(QPushButton("button"), 1, 0) self.layout.addWidget(QPushButton("button"), 1, 2) menu = Menu() widget.setStyleSheet("background: blue") self.layout.addWidget(menu, 0, 3) widgetB.setLayout(self.layout) widgetB.setStyleSheet("background : red") widgetBLay.addWidget(widgetB) widget.setLayout(widgetBLay) self.setCentralWidget(widget) self.setWindowTitle("POS") FG = self.frameGeometry() cp = QDesktopWidget().availableGeometry().center() FG.moveCenter(cp) self.move(FG.topLeft())
def __call__(self): index = Distro.Index() page = Page_Market(_('Category')) # Parse URL tmp = re.findall('^%s/([\w ]+)$' % (URL_CATEGORY), CTK.request.url) if not tmp: page += CTK.RawHTML('<h2>%s</h2>' % (_("Empty Category"))) return page.Render() self.category_name = tmp[0] # Menu menu = Menu([CTK.Link(URL_MAIN, CTK.RawHTML(_('Market Home')))]) menu += "%s: %s" % (_('Category'), self.category_name) page.mainarea += menu # Add apps pags = CTK.Paginator('category-results', items_per_page=10) box = CTK.Box({'class': 'cherokee-market-category'}) box += pags page.mainarea += box for app_name in index.get('packages'): app = index.get_package(app_name, 'software') cat = app.get('category') if cat == self.category_name: pags += RenderApp(app) # Render return page.Render()
def back_button_click(self): print(self.back_txt) self.destroyWidgets() from Menu import Menu Menu(self.master, self, self.main_bg)
def __init__(self): self.front = 0 self.back = 1 self.left = 2 self.right = 3 self.oldLeft = 0 self.oldTop = 0 self.strips = [] self.starting_pos = True self.rect = pygame.Rect(0,0,0,0) self.list = [] self.graphicChoice = 0 self.itemList = [] self.choice = self.front self.dictLookUp = {} self.count = 0 self.cho = 0 self.clicked = False self.clickedSpot = (0,0) self.rightButton = False self.menu = Menu() self.walking = WalkingGUI() self.menu.addChoice("walking") self.menu.addChoice("back_pack") self.menu.addChoice("testing") self.menu.makeBasicMenu() #self.LTSelectedString = "nothing" self.which = "nothing"
def __init__(self, parent_window, path): Gtk.Window.__init__(self) self.proyecto_path = path self.parent_window = parent_window self.set_title("Constructor de Instaladores de Proyecto") self.set_icon_from_file( os.path.join(BASEPATH, "Iconos", "gandalftux.png")) self.set_transient_for(self.parent_window) self.set_border_width(15) self.vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.menu = Menu() self.vbox.pack_start(self.menu, False, False, 0) self.vbox.pack_start(Gtk.Label("Constructor de Instaladores"), False, False, 0) self.resize(w / 2, h - 40) self.move(w - w / 2, 40) self.add(self.vbox) self.show_all() self.menu.connect("accion-menu", self.__accion_menu) self.menu.connect("help", self.__emit_help)
def cadstatus_opcao(): print('=================================') print("--> 1 - Voltar ao Menu Principal") print("--> 2 - Voltar ao Menu de Cadastro de Status") print("--> 3 - Encerrar Programa") opcao = int(input("Digite a opção desejada: ")) if opcao == 1: from Menu import Menu Menu.menu() if opcao == 2: cadstatus() if opcao == 3: exit() if opcao != 1 and opcao != 2: print("=====Digite uma opção valida=====") cadstatus_opcao()
def __init__(self, archivos=[]): Gtk.Window.__init__(self) self.set_title("JAMediaEditor") self.set_icon_from_file(os.path.join(BASE_PATH, "Iconos", "JAMediaEditor.svg")) self.set_resizable(True) self.set_size_request(640, 480) self.set_border_width(5) self.set_position(Gtk.WindowPosition.CENTER) self._help = False accel_group = Gtk.AccelGroup() self.add_accel_group(accel_group) base_widget = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.menu = Menu(accel_group) self.base_panel = BasePanel() self.toolbar_estado = ToolbarEstado() self.jamediapygihack = JAMediaPyGiHack() base_widget.pack_start(self.menu, False, False, 0) base_widget.pack_start(self.base_panel, True, True, 0) base_widget.pack_start(self.jamediapygihack, True, True, 0) base_widget.pack_start(self.toolbar_estado, False, False, 0) self.add(base_widget) self.show_all() self.maximize() self.jamediapygihack.hide() self.menu.connect("accion_ver", self.__ejecutar_accion_ver) self.menu.connect("accion_codigo", self.__ejecutar_accion_codigo) self.menu.connect("accion_proyecto", self.__ejecutar_accion_proyecto) self.menu.connect("accion_archivo", self.__ejecutar_accion_archivo) self.menu.connect("run_jamediapygihack", self.__run_jamediapygihack) self.menu.connect("help", self.__run_help) self.jamediapygihack.connect("salir", self.__run_editor) self.jamediapygihack.connect("abrir", self.__open_modulo) self.base_panel.connect("update", self.__set_toolbar_archivo_and_menu) self.base_panel.connect("proyecto_abierto", self.__set_toolbar_proyecto_and_menu) self.base_panel.connect("ejecucion", self.__set_toolbars_ejecucion) self.base_panel.connect("help", self.__run_help) self.connect("delete-event", self.__exit) # Cuando se abre el editor con archivo como parámetro. for archivo in archivos: archivo = os.path.realpath(archivo) if os.path.exists(archivo): if os.path.isfile(archivo): extension = os.path.splitext(os.path.split(archivo)[1])[1] if extension == ".ide": GLib.idle_add(self.base_panel.external_open_proyect, archivo) else: GLib.idle_add(self.base_panel.external_open_file, archivo) # FIXME: Agregar informe de utilizacion de recursos print "JAMediaEditor:", os.getpid()
def __init__(self, root=None, log=None): self.log = log self.LIST_LBX_FORMAT = '{0:<6}{1:<69}{2:<10}{3:<15}' self.LIST_LBX_HEIGHT = 20 self.running_state = False self.switch_q_a = True self.actions_on_q_a_state() self.rfid_reader_M301 = False self.actions_on_M301_present() #initialize database self.database = RR_DB(LOG_HANDLE) self.get_students_id() random.seed() self.menu = Menu(self, root, self.database, LOG_HANDLE) #initialize GUI self.root = root self.root_frm = tk.Frame(self.root) self.root_frm.grid() self.init_menu() self.init_widgets() self.actions_on_running_state() #set the minimum size of the window root.winfo_toplevel().title( "Lopers Tijd Registratie {}".format(VERSION)) root.update() root.minsize(root.winfo_width(), root.winfo_height())
def main(): RESTAURANT_NAME = "The Pythonic Pit" restaurantTime = datetime.datetime(2017, 5, 1, 5, 0) # Create the menu object menu = Menu("menu.csv") # create the waiter object using the created Menu we just created waiter = Waiter(menu) print("Welcome to " + RESTAURANT_NAME + "!") print(RESTAURANT_NAME + " is now open for dinner.\n") for i in range(21): print("\n~~~ It is currently", restaurantTime.strftime("%H:%M PM"), "~~~") restaurantTime += datetime.timedelta(minutes=15) potentialDiner = RestaurantHelper.randomDinerGenerator() if potentialDiner is not None: print("\n" + potentialDiner.getName() + " welcome, please be seated!" ) # we have a diner to add to the waiter's list of diners waiter.addDiner(potentialDiner) waiter.advanceDiners() time.sleep(2) print("\n~~~ ", RESTAURANT_NAME, "is now closed. ~~~") # After the restaurant is closed, progress any diners until everyone has left while waiter.getNumDiners(): print("\n~~~ It is currently", restaurantTime.strftime("%H:%M PM"), "~~~") restaurantTime += datetime.timedelta(minutes=15) waiter.advanceDiners() time.sleep(2) print("Goodbye!")
class TddMenu(unittest.TestCase): def setUp(self): self.menu = Menu() def test_menu_empty(self): menu = Menu() self.assertTrue(len(menu.getOpciones()) == 1) def test_menu_invalida(self): self.menu.ejecutar('opcionInvalida') self.failUnlessEqual(self.menu.mensaje.pop(), 'Opcion Invalida') def test_menu_quit(self): self.menu.ejecutar('q') self.assertTrue(not self.menu.debeCorrer)
def __init__(self, player, listGetter, attributeName, command, popMenu): Menu.__init__(self, player) options = {} count = 1 for element in listGetter(player): key = '{}'.format(count) option = '. {}'.format(element.attributes[attributeName]) function = self.createLambda(element, command, popMenu) options[key] = (option, function) count = count + 1 options['{}'.format(count)] = ('. Cancel', self.cancelMenu) self.attributes['options'] = options
def load(): m = Menu() save0path = variables.savepath if (os.path.isfile(save0path)): if os.path.getsize(save0path) > 0: with open(save0path, "rb") as f: loadedlist = pickle.load(f) tempplayer = None mapsdict, tempcname, tempplayer, classvar.battle, maps.current_map_name, floatingtemp = loadedlist if not variables.dontloadplayer: classvar.player = tempplayer else: classvar.player.xpos = tempplayer.xpos classvar.player.ypos = tempplayer.ypos for x in range(50): classvar.player.addstoryevent("bed") if variables.lvcheat != 0: classvar.player.exp = lvexp(explv(classvar.player.exp)+variables.lvcheat) if variables.addallrewards: for k in soundpackkeys: classvar.player.addreward(k) for k in scales.keys(): classvar.player.addreward(k) if not variables.dontloadmapsdict: conversations.floatingconversations = floatingtemp loadmaps(mapsdict) if tempcname in conversations.floatingconversations.keys(): conversations.currentconversation = conversations.floatingconversations[tempckey] else: if tempcname != None: conversations.currentconversation = maps.map_dict[maps.current_map_name].getconversation(tempcname) maps.change_map_nonteleporting(maps.current_map_name) # don't start at beginning m.firstbootup = False if (not isinstance(classvar.battle, str)): classvar.battle.reset_enemy() if variables.settings.state == "game": initiategame(variables.settings.currentgame) return m
def __init__(self): pygame.init() self.font = pygame.font.SysFont('sans-serif', 18, True) self.surface = pygame.display.set_mode(self.SCREEN_SIZE, 0, 32) self.state = 'intro' self.hiscores = Score.read_high_score() self.menu = Menu(("Start game", "Quit")) pygame.mixer.music.load(self.MUSIC_FILE) pygame.mixer.music.play(-1)
def __init__(self, engine, items, selected = None, prompt = ""): self.prompt = prompt self.engine = engine self.accepted = False self.selectedItem = None self.time = 0.0 self.menu = Menu(self.engine, choices = [(c, self._callbackForItem(c)) for c in items], onClose = self.close, onCancel = self.cancel) if selected and selected in items: self.menu.selectItem(items.index(selected)) self.engine.loadSvgDrawing(self, "background", "editor.svg")
class Connexion(QMainWindow, Ui_MainWindow): """ Class documentation goes here. """ def __init__(self, parent=None): """ Constructor @param parent reference to the parent widget (QWidget) """ super().__init__(parent) self.setupUi(self) @pyqtSlot() def on_buttonBox_2_accepted(self): """ Slot documentation goes here. """ # TODO: not implemented yet # acces à la BDD db = GestionBdd('db') login = self.login.text() password = self.password.text() connexion = db.premiere_connexion(login, password) if connexion == True: self.close() self.menu = Menu() self.menu.show() else: # self.emit(SIGNAL("Fermeture(PyQT_PyObject)"), connexion) QMessageBox.information(self, self.trUtf8("Erreur connexion "), self.trUtf8("Erreur sur le login et/ou mot de passe")) @pyqtSlot() def on_buttonBox_2_rejected(self): """ Slot documentation goes here. """ # TODO: not implemented yet self.close()
def __init__(self, player): Menu.__init__(self, player) self.attributes['options'] = { } inventory = player.attributes['inventory'] options = {} count = 1 items = [] equipped = [] for key in inventory.attributes['equipment'].keys(): equippedItem = inventory.attributes['equipment'][key] if key == 'Neck' or key == 'Wrist' or key == 'Finger': for item in equippedItem: if item != None: equipped.append(item) else: if equippedItem != None: equipped.append(equippedItem) for item in equipped: key = '{}'.format(count) itemName = '. {} (Equipped)'.format(item.attributes['name']) function = self.createViewer(item) options[key] = (itemName, function) count = count + 1 for item in inventory.attributes['items']: key = '{}'.format(count) itemName = '. {}'.format(item.attributes['name']) function = self.createViewer(item) options[key] = (itemName, function) count = count + 1 options['{}'.format(count)] = ('. Cancel', self.cancelMenu) self.attributes['options'] = options
def inicializarMenu(self): self.menuGraphics = loader.loadModel("models/MenuGraphics") self.fonts = {"silver" : loader.loadFont("fonts/LuconSilver"), "blue" : loader.loadFont("fonts/LuconBlue"), "orange" : loader.loadFont("fonts/LuconOrange")} self.menu = Menu(self.menuGraphics, self.fonts, self.inputManager) self.menu.initMenu([0, None, ["Nueva Partida", "Salir"], [[self.nuevaPartida], [self.salir]], [[None], [None]]])
def __init__(self): "Set up the Exit menu" Menu.__init__(self,"MoleFusion Exit Menu","sprites/back1.jpg") self.parser = make_parser() self.curHandler = Localization() self.parser.setContentHandler(self.curHandler) self.parser.parse(open("languages/ExitMenu_" + Constants.LANGUAGE + ".xml")) self.title = GW_Label(self.curHandler.getText("title"),(0.5,0.1),(27,22,24)) self.game_by = GW_Label(self.curHandler.getText("game"),(0.5,0.3),(240,255,220)) self.music_by = GW_Label(self.curHandler.getText("music"),(0.5,0.5),(240,255,220)) self.web = GW_Label(self.curHandler.getText("web"),(0.5,0.7),(255,255,255)) self.widget_man = GuiWidgetManager([self.title,self.game_by,self.music_by,self.web]) self.time_speed=pygame.time.Clock() self.exit=False self.on_enter()
def __init__(self, name = 'UnnamedGame', mouse_exists = True, bgcolor = (0, 0, 0), DISP_SIZE = (0,0)): self.Name = name self.BGcolor = bgcolor self.Mouse = mouse_exists if DISP_SIZE == (0, 0): self.DISP_SIZE = Base.DISP_SIZE else: self.DISP_SIZE = DISP_SIZE self.PreInit() self.Menu = Menu() self.Paused = False self.freeze = False
def __init__(self, _engine): """ This function will initialise the main screen of the options and prepare the tabs with the various settings """ Menu.__init__(self) # Engine self.engine = _engine self.initGeneralTab() self.initControlTab() self.currentTab = [0] self.tabGroup = [ DirectRadioButton( text = _("General"), variable = self.currentTab, value = [0], scale = 0.05, pos = (-0.6, 0, 0.65), command = self.showGeneralTab), DirectRadioButton( text = _("Controls"), variable = self.currentTab, value = [1], scale = 0.05, pos = (0.6, 0, 0.65), command = self.showControlTab) ] for tab in self.tabGroup: tab.reparentTo(self.frameMain) tab.setOthers(self.tabGroup) # set the text of all GUI elements self.setText() self.hideBase()
def __init__(self): "Sets up the Help menu" Menu.__init__(self,"MoleFusion Help Menu","sprites/back1.jpg") self.parser = make_parser() self.curHandler = Localization() self.parser.setContentHandler(self.curHandler) self.parser.parse(open("languages/HelpMenu_" + Constants.LANGUAGE + ".xml")) self.title = GW_Label(self.curHandler.getText("title"),(0.5,0.1),(27,22,24)) self.help = GW_Image(self.curHandler.getText("help"),(0.5,0.3)) self.returnMain = GW_Button(self.curHandler.getText("returnMain"),(0.5,0.5),(255,255,255)) self.returnMain.add_eventhandler("onmouseclick",self.returnMain_onmouseclick) self.widget_man = GuiWidgetManager([self.title,self.help,self.returnMain]) self.time_speed=pygame.time.Clock() self.exit=False self.on_enter()
def __init__(self): "Sets up the Language menu" Menu.__init__(self,"Language Main Menu","sprites/back1.jpg") self.title = GW_Label("Choose Language",(0.5,0.15),(27,22,24)) self.english = GW_Image("sprites/language_engl.png",(0.25,0.35)) self.english.add_eventhandler("onmouseclick",self.english_onmouseclick) self.spanish= GW_Image("sprites/language_espn.png",(0.5,0.35)) self.spanish.add_eventhandler("onmouseclick",self.spanish_onmouseclick) self.euskera = GW_Image("sprites/language_eusk.png",(0.75,0.35)) self.euskera.add_eventhandler("onmouseclick",self.euskera_onmouseclick) self.widget_man = GuiWidgetManager([self.title,self.english,self.spanish,self.euskera]) self.time_speed=pygame.time.Clock() self.exit=False self.on_enter()
def __init__(self): load_prc_file_data("", "textures-power-2 none") load_prc_file_data("", "win-size 1600 900") # load_prc_file_data("", "fullscreen #t") load_prc_file_data("", "window-title cuboid") load_prc_file_data("", "icon-filename res/icon.ico") # I found openal works better for me load_prc_file_data("", "audio-library-name p3openal_audio") # ------ Begin of render pipeline code ------ # Insert the pipeline path to the system path, this is required to be # able to import the pipeline classes pipeline_path = "../../" # Just a special case for my development setup, so I don't accidentally # commit a wrong path. You can remove this in your own programs. if not os.path.isfile(os.path.join(pipeline_path, "setup.py")): pipeline_path = "../../RenderPipeline/" sys.path.insert(0, pipeline_path) # Use the utility script to import the render pipeline classes from rpcore import RenderPipeline self.render_pipeline = RenderPipeline() self.render_pipeline.mount_mgr.mount() self.render_pipeline.load_settings("/$$rpconfig/pipeline.yaml") self.render_pipeline.settings["pipeline.display_debugger"] = False self.render_pipeline.set_empty_loading_screen() self.render_pipeline.create(self) # [Optional] use the default skybox, you can use your own skybox as well # self.render_pipeline.create_default_skybox() # ------ End of render pipeline code, thats it! ------ # Set time of day self.render_pipeline.daytime_mgr.time = 0.812 self.menu = Menu(self) self.level = Level(self) self.cube = Cube(self.level) self.camControl = CamControl(self.cube) self.gui = GUI(self) self.menu.showMenu() base.accept("i",self.camControl.zoomIn) base.accept("o",self.camControl.zoomOut)
def __init__(self): self.blend = 1 self.clicked = False self.circles = [] self.initialCircleAddedTF = False self.menu = Menu() self.menu.addChoice("walk") self.menu.addChoice("adjustCircle") self.menu.makeBasicMenu() self.rightButton = False # for displaying the (big)menu itself self.disCirMenu = False #display Circle Menu...for displaying the circle menu on a particular circle self.setTo = False #for showing the circles themselves self.oldTup = () self.displayMenuAtLoc =(0,0) self.tempTupOfPath = []
def on_buttonBox_2_accepted(self): """ Slot documentation goes here. """ # TODO: not implemented yet # acces à la BDD db = GestionBdd('db') login = self.login.text() password = self.password.text() connexion = db.premiere_connexion(login, password) if connexion == True: self.close() self.menu = Menu() self.menu.show() else: # self.emit(SIGNAL("Fermeture(PyQT_PyObject)"), connexion) QMessageBox.information(self, self.trUtf8("Erreur connexion "), self.trUtf8("Erreur sur le login et/ou mot de passe"))