Exemplo n.º 1
0
    def __init__(self, app):
        Menu.__init__(self, app)

        self.header = ["Ebenezer personal accounting ver 0.1",\
                       "-----------[ Main menu ]------------"]

        num_acc = len(data.accounts)
        if self.app.active_account is None:
            active_account_name = "No account found!"
        else:
            active_account_name = self.app.active_account.name

        self.contents = ["Found " + str(num_acc) + " data.accounts",\
                         "Current active account : " + active_account_name,\
                         "[A]ccounts",\
                         "[T]ransactions",\
                         "[D]ebts",\
                         "[Q]uit"]

        self.prompt = "What do you want to do ?"

        self.answers = {"a":[self.change_menu, "accountlist"],\
                        "t":[self.change_menu, "accounttrans"],\
                        "d":[self.change_menu, "debts"],\
                        "q":[self.quit, None]}
Exemplo n.º 2
0
    def __init__(self,
                 contents,
                 i,
                 o,
                 rows=3,
                 cols=3,
                 name=None,
                 draw_lines=True,
                 font=None,
                 entry_width=None,
                 **kwargs):

        self.rows = rows
        self.cols = cols
        self.font = font
        Menu.__init__(self,
                      contents,
                      i,
                      o,
                      name=name,
                      override_left=False,
                      scrolling=False,
                      **kwargs)
        self.view.draw_lines = draw_lines
        self.view.entry_width = entry_width
Exemplo n.º 3
0
 def __init__(self):
     background = surface.Surface(SCREEN_SIZE)
     background.fill(YELLOW)
     pygame.draw.rect(
         background, BROWN,
         rect.Rect(SCREEN_SIZE[0] / 4, SCREEN_SIZE[1] / 4,
                   SCREEN_SIZE[0] / 2, SCREEN_SIZE[1] / 2), 6, 6)
     title_font = font.Font(LOGO_FONT, 72)
     title_font = title_font.render("CartograTour", True, BLACK)
     background.blit(title_font,
                     (SCREEN_SIZE[0] / 2 - title_font.get_width() / 2, 64))
     buttons = [
         Button("Play",
                LOGO_FONT,
                36,
                BLACK,
                antialias=True,
                call_function=game,
                button_color=YELLOW,
                location=(SCREEN_SIZE[0] / 2, SCREEN_SIZE[1] / 4 + 36)),
         Button("Quit",
                LOGO_FONT,
                36,
                BLACK,
                antialias=True,
                call_function=end_game,
                button_color=YELLOW,
                location=(SCREEN_SIZE[0] / 2,
                          SCREEN_SIZE[1] * (3 / 4) - 36))
     ]
     Menu.__init__(self, menu_list=buttons, background=background)
Exemplo n.º 4
0
 def __init__(self, game):
     options = [
         "My First Song", "Flute Sonata", "Mega Symphony", "Eternal Sonata",
         "A Flute Song", "Back"
     ]
     Menu.__init__(self, options)
     self.game = game
Exemplo n.º 5
0
    def __init__(self, app):
        Menu.__init__(self, app)

        self.header = ["Ebenezer personal accounting ver 0.1",\
                       "-----------[ Main menu ]------------"]

        num_acc = len(data.accounts)
        if self.app.active_account is None:
            active_account_name = "No account found!"
        else:
            active_account_name = self.app.active_account.name

        self.contents = ["Found " + str(num_acc) + " data.accounts",\
                         "Current active account : " + active_account_name,\
                         "[A]ccounts",\
                         "[T]ransactions",\
                         "[D]ebts",\
                         "[Q]uit"]

        self.prompt = "What do you want to do ?"

        self.answers = {"a":[self.change_menu, "accountlist"],\
                        "t":[self.change_menu, "accounttrans"],\
                        "d":[self.change_menu, "debts"],\
                        "q":[self.quit, None]}
Exemplo n.º 6
0
 def __init__(self, game):
   Menu.__init__(self, game)
   self.menu_items = [
       BasicItem(self, "Back", register_event(MenuBackEvent)),
       CheckItem(self, "Debug", get_setting('debug'), register_event(ToggleDebugEvent))
   ]
   self.menu_items[0].toggle_selected()
   self.selected = 0
Exemplo n.º 7
0
 def __init__(self, *args, **kwargs):
     self.prepend_numbers = kwargs.pop('prepend_numbers', True)
     self.input_delay = kwargs.pop('input_delay', 1)
     Menu.__init__(self, *args, **kwargs)
     self.__locked_name__ = None
     self.value_lock = Lock()
     self.numeric_keymap = {"KEY_{}".format(i): i for i in range(10)}
     self.last_input_time = 0
     self.current_input = None
Exemplo n.º 8
0
 def __init__(self, game):
   Menu.__init__(self, game)
   self.menu_items = [
       BasicItem(self, "Back", register_event(MenuBackEvent)),
   ]
   for level in filter(lambda x: x.endswith(".dat"), os.listdir(constants.DATA_DIR)):
     self.menu_items.append(BasicItem(self, level, register_event(LoadLevelEvent, level)))
   self.menu_items[0].toggle_selected()
   self.selected = 0
Exemplo n.º 9
0
    def __init__(self, screen, jack_to_gpio):
        Menu.__init__(self, screen)
        self.jack_to_gpio = jack_to_gpio
        for gpio in self.jack_to_gpio.values():
            GPIO.setup(gpio, GPIO.OUT)

        self.light_is_on = False
        self.jacks = sorted(self.jack_number(j) for j in self.jack_to_gpio.keys())
        self.jack_index = 0
Exemplo n.º 10
0
    def __init__(self, screen, jack_to_gpio):
        Menu.__init__(self, screen)
        self.jack_to_gpio = jack_to_gpio
        for gpio in self.jack_to_gpio.values():
            GPIO.setup(gpio, GPIO.OUT)

        self.light_is_on = False
        self.jacks = sorted(
            self.jack_number(j) for j in self.jack_to_gpio.keys())
        self.jack_index = 0
Exemplo n.º 11
0
	def __init__(self, width, height):
		Menu.__init__(self, width, height)

		self.queued_actions_cost_so_far = 0
		self.action_history = []
		self.flagged_exit = False
		self.entity_manager = None
		self.game_state = GameState.TakingInput
		self.current_input_tree = innates_input_tree

		player_hardcoded_libraries = [
			Library(
					'atk',
					'temporary test library',
					[config.game_functions.master_available_functions[0]]
				)
		]


		#try and load a save game. if that fails, initialize a baseline entity manager and try to feed in an action history. If both fail, the game simply ends up in a newgame state
		self.entity_manager = self.try_load_savegame()
		if not self.entity_manager:
			#currently hardcoded to test player movement
			self.entity_manager = EntityManager(self)
			self.entity_manager.add_entity(Entity([
						Attribute(AttributeTag.Player, {'max_actions_per_cycle': max_actions}),
						Attribute(AttributeTag.Visible),
						Attribute(AttributeTag.OwnedMemory, {'segments':[]}),
						Attribute(AttributeTag.WorldPosition, {'value': Vec2d(2, 2)}),
						Attribute(AttributeTag.MaxProgramSize, {'value': 5}),
						Attribute(AttributeTag.ClockRate, {'value': 2}),
						Attribute(AttributeTag.DrawInfo, {'character': 64, 'fore_color': libtcod.Color(157,205,255), 'back_color': libtcod.black, 'draw_type': WorldRenderType.Character, 'z_level': 2}),
						Attribute(AttributeTag.Libraries, {'value': player_hardcoded_libraries})
					])
				)
			#for x in range(10):
			self.entity_manager.add_entity(Entity([
							Attribute(AttributeTag.HostileProgram),
							Attribute(AttributeTag.Visible),
							Attribute(AttributeTag.OwnedMemory, {'segments':[]}),
							Attribute(AttributeTag.WorldPosition, {'value': Vec2d(20, 10)}),  #libtcod.random_get_int(0, 5, 45), libtcod.random_get_int(0, 5, 45))}),
							Attribute(AttributeTag.MaxProgramSize, {'value': 5}),
							Attribute(AttributeTag.ClockRate, {'value': 2}),
							Attribute(AttributeTag.DrawInfo, {'character': 121, 'fore_color': libtcod.Color(255,0,0), 'back_color': libtcod.black, 'draw_type': WorldRenderType.Character, 'z_level': 2})
						])
					)

			self.try_load_action_history()
		else:
			self.entity_manager.parent_menu = self

		self.entity_manager.player_id = 1

		self.init_ui()
Exemplo n.º 12
0
 def __init__(self, game):
   Menu.__init__(self, game)
   self.menu_items = []
   # TODO: fix up the logic for these so they only show when relevant
   self.menu_items.append(BasicItem(self, "Resume", register_event(ResumeEvent)))
   self.menu_items.append(BasicItem(self, "New Level", register_event(NewLevelEvent)))
   self.menu_items.append(BasicItem(self, "Save", register_event(SaveLevelEvent)))
   self.menu_items.append(BasicItem(self, "Load", enter_menu_action(LoadLevelMenu)))
   self.menu_items.append(BasicItem(self, "Settings", enter_menu_action(SettingsMenu)))
   self.menu_items.append(BasicItem(self, "Quit", register_event(QuitEvent)))
   self.menu_items[0].toggle_selected()
   self.selected = 0
Exemplo n.º 13
0
	def __init__(self, gui):
		Menu.__init__(self, gui)

		# Lijst met keuzes.
		self.choices = []
		self.choices.append("New game")
		self.choices.append("Load game")
		self.choices.append("Options")
		self.choices.append("Quit")
		
		# Maak choice list aan.
		self.choiceList = ChoiceList(self.gui.getScreen(), self.choices, (300, 100), self.onSelection)
Exemplo n.º 14
0
	def __init__(self, gui):
		Menu.__init__(self, gui)

		# Lijst met keuzes.
		self.choices = []
		self.choices.append("Game #01")
		self.choices.append("Game #02")
		self.choices.append("Game #03")
		self.choices.append("Back")
		
		# Maak choice list aan.
		self.choiceList = ChoiceList(self.gui.getScreen(), self.choices, (300, 100), self.onSelection)
Exemplo n.º 15
0
    def __init__(self, app, account):
        Menu.__init__(self, app)
        self.header = ["Ebenezer personal accounting ver 0.1",\
                       "-------------[ Debts ]--------------"]

        self.contents = []
        self.account = account
        self.footer = []

        self.prompt = "[G]o back... "
        self.update()

        self.answers['g'] = [self.change_menu, "mainmenu"]
Exemplo n.º 16
0
    def __init__(self, app, account):
        Menu.__init__(self,app)
        self.header = ["Ebenezer personal accounting ver 0.1",\
                       "-------------[ Debts ]--------------"]       

        self.contents = []
        self.account  = account
        self.footer = []

        self.prompt = "[G]o back... "
        self.update()

        self.answers['g'] = [self.change_menu, "mainmenu"]
Exemplo n.º 17
0
	def __init__(__, obj):
		if obj == __.SPHERES:
			__.obj_type = __.SPHERES
			__.obj_text = Joueur.__DOC__
			__.obj_text += [Sphere_score.__doc__]
			__.obj_text += Sphere_bonus.__DOC__
			__.obj_img = [pygame.image.load(K.path_img_sphere + img + ".png").convert(32, pygame.SRCALPHA) for img in Joueur.images]
			__.obj_img += [pygame.image.load(K.path_img_sphere + Sphere_score.image + ".png").convert()]
			__.obj_img += [pygame.image.load(K.path_img_sphere + img + ".png").convert(32, pygame.SRCALPHA) for img in Sphere_bonus.images]
		else:
			__.obj_type = __.BLOCS
			__.obj_text = [i.__doc__ for i in liste_murs]
			__.obj_img = [i.sprite for i in liste_murs]
		__.obj_title = [i.split(" : ")[0] for i in __.obj_text]
		Menu.__init__(__, __.obj_title + ['Quitter'], __.obj_type)
Exemplo n.º 18
0
 def __init__(self, name, options):
     menu_options = menu_options_dict()
     Menu.__init__(self, menu_options["main"][0], menu_options["main"][2:])
     self.qb_menu = QbMenu(menu_options["qb"][0], menu_options["qb"][2:],
                           self)
     self.rb_menu = RbMenu(menu_options["rb"][0], menu_options["rb"][2:],
                           self)
     self.recv_menu = RecvMenu(menu_options["recv"][0],
                               menu_options["recv"][2:], self)
     self.tackles_menu = TacklesSacksMenu(menu_options["tackles_sacks"][0],
                                          menu_options["tackles_sacks"][2:],
                                          self)
     self.interceptions = InterceptionsMenu(
         menu_options["interceptions"][0],
         menu_options["interceptions"][2:], self)
Exemplo n.º 19
0
    def __init__(self,
                 path,
                 i,
                 o,
                 callback=None,
                 name=None,
                 display_hidden=False,
                 dirs_only=False,
                 current_dot=False,
                 prev_dot=True,
                 scrolling=True,
                 **kwargs):
        """Initialises the PathPicker object.

        Args:

            * ``path``: a path to start from.
            * ``i``, ``o``: input&output device objects.

        Kwargs:

            * ``callback``: if set, PathPicker will call the callback with path as first argument upon selecting path, instead of exiting the activate().
            * ``dirs_only``: if True, PathPicker will only show directories.
            * ``current_dot``: if True, PathPicker will show '.' path.
            * ``prev_dot``: if True, PathPicker will show '..' path.
            * ``display_hidden``: if True, PathPicker will display hidden files.

        """
        Menu.__init__(self, [],
                      i,
                      o,
                      entry_height=1,
                      scrolling=True,
                      append_exit=False,
                      catch_exit=False,
                      contents_hook=None,
                      **kwargs)
        if not os.path.isdir(path):
            raise ValueError("PathPicker path has to be a directory!")
        self.base_name = name if name else "PathPicker"
        self.display_hidden = display_hidden
        self.callback = callback
        self.dirs_only = dirs_only
        self.current_dot = current_dot
        self.prev_dot = prev_dot
        self.menu_pointers = {}
        self.set_path(os.path.normpath(path))
        self.update_keymap()
Exemplo n.º 20
0
 def __init__(self, useCallback=False, cmdFile=None):
     Menu.__init__(self, cmdFile, menuSize=80 )
     self.wlan = WlanInterface(useCallback=useCallback)
     self.wlan.updateDesc()
     # add menu items
     self.addMenuItem( MenuItem( 'si', '',                     'Show interfaces' , self._showInterfaces) )
     self.addMenuItem( MenuItem( 'il', '<networks|n>',  'run enumInterfaces() and list' , self._ifList) )
     self.addMenuItem( MenuItem( 'co', 'profile <if=name> <iface=index>',       'Connect to a network' , self._ifConnect) )
     self.addMenuItem( MenuItem( 'di', '<if=name> <iface=index>',              'Disconnect from a network' , self._ifDisconnect) )
     self.addMenuItem( MenuItem( 'gp', 'profile <if=name> <iface=index>',       'Get Profile' , self._ifGetProfile) )
     self.addMenuItem( MenuItem( 'sp', 'profile <ssid=value> <pp=value> <if=name> <iface=index>',       'Set Profile' , self._ifSetProfile) )
     self.addMenuItem( MenuItem( 'cp', 'profile new_profile <if=name> <iface=index> <ssid=ssid> <pp=pass_phrase>',       'Copy Profile' , self._ifCopyProfile) )
     self.addMenuItem( MenuItem( 'dp', 'profile <if=name> <iface=index>',       'Delete a Profile' , self._ifDeleteProfile) )
     self.addMenuItem( MenuItem( 'is', '<if=name> <iface=index>',       'Scan an interface' , self._ifScan) )
     self.addMenuItem( MenuItem( 'cn', '<source=%s> <ignoreDups> <clear>' % WifiMenu._sources,       'Register/Deregister the notification callback' , self._ifRegNotify) )
     self.updateHeader()
Exemplo n.º 21
0
def main():
    game_id = None

    # Initiate api
    #clear_previous_games("joao1")

    pygame.init()
    pygame.display.set_caption("Battleship")

    screen = pygame.display.set_mode((screen_width, screen_height))
    screen.fill(background_color)
    pygame.display.flip()

    menu = Menu(screen)

    running = True
    while running:
        needs_redraw = False
        if game_id is None:
            game_id = menu.get_game_id()
            if game_id is not None:
                game = init_game(game_id, screen, *menu.get_player_info())
                needs_redraw = True
        else:
            game_id = game.get_game_id()
            if game_id is None:
                menu.__init__(screen)

        if game_id is not None:
            needs_redraw = needs_redraw or game.frame_update()

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
            else:
                if game_id is None:
                    menu.react(event)
                else:
                    needs_redraw = needs_redraw or game.handle_events(event)

        if needs_redraw:
            game.draw()
Exemplo n.º 22
0
 def __init__(self):
     background = surface.Surface((SCREEN_SIZE[0] / 2, SCREEN_SIZE[1] / 2))
     background.fill(YELLOW)
     draw.rect(background, BROWN,
               rect.Rect(0, 0, SCREEN_SIZE[0] / 2, SCREEN_SIZE[1] / 2), 6,
               6)
     title_font = font.Font(LOGO_FONT, 48)
     title_font = title_font.render("CartograTour", True, BLACK)
     background.blit(title_font,
                     (SCREEN_SIZE[0] / 4 - title_font.get_width() / 2, 36))
     buttons = [
         Button("Quit To Main Menu",
                LOGO_FONT,
                36,
                BLACK,
                antialias=True,
                call_function="quit",
                button_color=YELLOW,
                location=(SCREEN_SIZE[0] / 2, SCREEN_SIZE[1] / 2 + 32)),
         Button("Save & Quit",
                LOGO_FONT,
                36,
                BLACK,
                antialias=True,
                call_function="save and quit",
                button_color=YELLOW,
                location=(SCREEN_SIZE[0] / 2, SCREEN_SIZE[1] / 2 + 96)),
         Button("Return to Game",
                LOGO_FONT,
                36,
                BLACK,
                antialias=True,
                call_function="continue",
                button_color=YELLOW,
                location=(SCREEN_SIZE[0] / 2,
                          SCREEN_SIZE[1] * (3 / 4) - 36))
     ]
     Menu.__init__(self,
                   menu_list=buttons,
                   background=background,
                   offset=(SCREEN_SIZE[0] / 4, SCREEN_SIZE[1] / 4))
Exemplo n.º 23
0
    def __init__(self, app):
        Menu.__init__(self, app)
        self.header = ["Ebenezer personal accounting ver 0.1",\
                       "---------[ Accounts list ]----------"]

        self.contents = []
        index = 0
        self.footer = []
        for a in data.accounts:
            index += 1
            string = ""
            if a.name == self.app.active_account.name:
                string += "* "
            else:
                string += "  "

            string += str(index) + " " + a.name
            self.contents.append(string)
            self.answers[str(index)] = [self.set_active, index]

        if len(data.accounts) > 1:
            self.footer.append("[1] to [" + str(index) + "] to set active account")
            
        self.footer.append("[N]ew account")
        self.footer.append("[D]elete an account")
        self.footer.append("[G]o back")

        self.prompt = "What do you want to do ?"


        self.answers['g'] = [self.change_menu, "mainmenu"]
        self.answers['n'] = [self.display_prompt, "newaccount"]
        self.answers['d'] = [self.display_prompt, "delaccount"]

        self.submenus = {"newaccount":SubNewAccount(data.accounts),\
                         "delaccount":SubDelAccount(data.accounts)}
Exemplo n.º 24
0
    def __init__(self, app, account):
        Menu.__init__(self, app)
        self.account = account


        self.header = ["Ebenezer personal accounting ver 0.1",\
                       "-------[ Transactions list ]--------"]

        self.update()

        self.footer = ["[N]ew transaction",\
                       "[D]elete transaction",\
                       "[T]ransfer between accounts",\
                       "[G]o back"]

        self.prompt = "What do you want to do ?"
        self.answers = {"n":[self.display_prompt, "newtransaction"],\
                        "d":[self.display_prompt, "deltransaction"],\
                        "t":[self.display_prompt, "newtransfer"],\
                        "g":[self.change_menu, "mainmenu"]}

        self.submenus = {"newtransaction":SubNewTransaction(app),\
                         "deltransaction":SubDelTransaction(self),\
                         "newtransfer":SubTransfer(app)}
Exemplo n.º 25
0
    def __init__(self, app, account):
        Menu.__init__(self, app)
        self.account = account


        self.header = ["Ebenezer personal accounting ver 0.1",\
                       "-------[ Transactions list ]--------"]

        self.update()

        self.footer = ["[N]ew transaction",\
                       "[D]elete transaction",\
                       "[T]ransfer between accounts",\
                       "[G]o back"]

        self.prompt = "What do you want to do ?"
        self.answers = {"n":[self.display_prompt, "newtransaction"],\
                        "d":[self.display_prompt, "deltransaction"],\
                        "t":[self.display_prompt, "newtransfer"],\
                        "g":[self.change_menu, "mainmenu"]}

        self.submenus = {"newtransaction":SubNewTransaction(app),\
                         "deltransaction":SubDelTransaction(self),\
                         "newtransfer":SubTransfer(app)}
Exemplo n.º 26
0
    def __init__(self, app):
        Menu.__init__(self, app)
        self.header = ["Ebenezer personal accounting ver 0.1",\
                       "---------[ Accounts list ]----------"]

        self.contents = []
        index = 0
        self.footer = []
        for a in data.accounts:
            index += 1
            string = ""
            if a.name == self.app.active_account.name:
                string += "* "
            else:
                string += "  "

            string += str(index) + " " + a.name
            self.contents.append(string)
            self.answers[str(index)] = [self.set_active, index]

        if len(data.accounts) > 1:
            self.footer.append("[1] to [" + str(index) +
                               "] to set active account")

        self.footer.append("[N]ew account")
        self.footer.append("[D]elete an account")
        self.footer.append("[G]o back")

        self.prompt = "What do you want to do ?"

        self.answers['g'] = [self.change_menu, "mainmenu"]
        self.answers['n'] = [self.display_prompt, "newaccount"]
        self.answers['d'] = [self.display_prompt, "delaccount"]

        self.submenus = {"newaccount":SubNewAccount(data.accounts),\
                         "delaccount":SubDelAccount(data.accounts)}
Exemplo n.º 27
0
    def __init__(self):

        Menu.__init__(self)
Exemplo n.º 28
0
	def __init__(__):
		Menu.__init__(__, ["www.freesound.org", "www.grsites.com", "www.sound-fishing.net",
		"www.jamendo.com", "\tBertycoX", "\tMidoriiro", "Quitter"], "Crédits")
 def __init__(self, win):
     """
     initializes the class
     receives the window to blit
     """
     Menu.__init__(self, None, FONT_ADV, win)
Exemplo n.º 30
0
 def __init__(self, screen, tx_to_rx):
     Menu.__init__(self, screen)
     self.tx_to_rx = tx_to_rx
     self.txs = self.tx_to_rx.keys()
     self.uart_index = 0
     self.setup_uarts()
Exemplo n.º 31
0
 def __init__(self, options, surface, player):
     self.player = player
     Menu.__init__(self, options, surface)
	def __init__(self):

		Menu.__init__(self)
Exemplo n.º 33
0
        consecFrames=0

        if not kcw.recording:
            timestamp = datetime.datetime.now()
            p = "{}/{}.avi".format('output', timestamp.strftime("%d-%m-%Y-%H:%M:%S"))
            kcw.start(p, cv2.VideoWriter_fourcc(*mn.parametros['codec']),mn.parametros['fps'])
    
    if updateConsecFrames:
        consecFrames += 1

    kcw.update(frame)

    if kcw.recording and consecFrames == mn.parametros['buffer']:
        kcw.finish()

if kcw.recording:
    kcw.finish()

cv2.destroyAllWindows()
vs.stop()

up = upload()
if mn.enviar_drive() and up.internet():
    up.uparVideos('output')
else:
    print("[INFO] O computador não possui internet neste momento, o arquivo será salvo no disco")
    mn.__init__()



Exemplo n.º 34
0
 def __init__(__):
     Menu.__init__(__, [
         "www.freesound.org", "www.grsites.com", "www.sound-fishing.net",
         "www.jamendo.com", "\tBertycoX", "\tMidoriiro", "Quitter"
     ], "Crédits")
Exemplo n.º 35
0
	def __init__(self, width, height):
		Menu.__init__(self, width, height)
		self.menu_frame = FrameMainMenu(width, height)
Exemplo n.º 36
0
    def __init__(self,
                 path,
                 i,
                 o,
                 callback=None,
                 name=None,
                 file=None,
                 display_hidden=False,
                 dirs_only=False,
                 append_current_dir=True,
                 current_dot=False,
                 prev_dot=True,
                 scrolling=True,
                 **kwargs):
        """Initialises the PathPicker object.

        Args:

            * ``path``: a path to start from. If path to a file is passed, will start from that file (unless overridden with ``file`` keyword argument).
            * ``i``, ``o``: input&output device objects.

        Kwargs:

            * ``callback``: if set, PathPicker will call the callback with path as first argument upon selecting path, instead of exiting the activate()
            * ``file``: if set, PathPicker will locate the file in the ``path`` passed and move its pointer to that file (provided it is found).
            * ``dirs_only``: if True, PathPicker will only show directories
            * ``append_current_dir``: if False, PathPicker won't add "Dir: %/current/dir%" first entry when `dirs_only` is enabled
            * ``current_dot``: if True, PathPicker will show '.' path
            * ``prev_dot``: if True, PathPicker will show '..' path
            * ``display_hidden``: if True, PathPicker will display hidden files

        """
        Menu.__init__(self, [],
                      i,
                      o,
                      entry_height=1,
                      scrolling=True,
                      append_exit=False,
                      catch_exit=False,
                      contents_hook=None,
                      **kwargs)
        if not os.path.isdir(path):
            if os.path.exists(path):
                path, filename = os.path.split(path)
                # Picking file if file kwarg wasn't already passed
                file = filename if not file else file
            else:
                logger.warning(
                    "PathPicker path has to be a directory or a file that exists! Received {}, setting path to default path: {}"
                    .format(path, self.default_path))
        self.base_name = name if name else "PathPicker"
        self.display_hidden = display_hidden
        self.callback = callback
        self.dirs_only = dirs_only
        self.append_current_dir = append_current_dir
        self.current_dot = current_dot
        self.prev_dot = prev_dot
        self.menu_pointers = {}
        self.set_path(os.path.normpath(path))
        if file:
            self.move_to_file(file)
        self.update_keymap()
 def __init__(self, win):
     """
     initializes the class
     receives the window to blit
     """
     Menu.__init__(self, ['RESTART', 'QUIT'], FONT_LA_CASA, win)
Exemplo n.º 38
0
	def __init__(__):
		Menu.__init__(__, ['Quitter'], "BUT")
Exemplo n.º 39
0
 def __init__(self, screen, tx_to_rx):
     Menu.__init__(self, screen)
     self.tx_to_rx = tx_to_rx
     self.txs = self.tx_to_rx.keys()
     self.uart_index = 0
     self.setup_uarts()
Exemplo n.º 40
0
 def __init__(self, screen, jack_to_pwm):
     Menu.__init__(self, screen)
     self.jack_to_pwm = jack_to_pwm
     self.jacks = self.jack_to_pwm.keys()
     self.pwm_index = 0
Exemplo n.º 41
0
 def __init__(self, game):
     options = ["Play a song", "Options", "Quit"]
     Menu.__init__(self, options)
     self.game = game
Exemplo n.º 42
0
    def __init__(self, width, height):
        Menu.__init__(self, width, height)

        self.queued_actions_cost_so_far = 0
        self.action_history = []
        self.flagged_exit = False
        self.entity_manager = None
        self.game_state = GameState.TakingInput
        self.current_input_tree = innates_input_tree

        player_hardcoded_libraries = [
            Library('atk', 'temporary test library',
                    [config.game_functions.master_available_functions[0]])
        ]

        #try and load a save game. if that fails, initialize a baseline entity manager and try to feed in an action history. If both fail, the game simply ends up in a newgame state
        self.entity_manager = self.try_load_savegame()
        if not self.entity_manager:
            #currently hardcoded to test player movement
            self.entity_manager = EntityManager(self)
            self.entity_manager.add_entity(
                Entity([
                    Attribute(AttributeTag.Player,
                              {'max_actions_per_cycle': max_actions}),
                    Attribute(AttributeTag.Visible),
                    Attribute(AttributeTag.OwnedMemory, {'segments': []}),
                    Attribute(AttributeTag.WorldPosition,
                              {'value': Vec2d(2, 2)}),
                    Attribute(AttributeTag.MaxProgramSize, {'value': 5}),
                    Attribute(AttributeTag.ClockRate, {'value': 2}),
                    Attribute(
                        AttributeTag.DrawInfo, {
                            'character': 64,
                            'fore_color': libtcod.Color(157, 205, 255),
                            'back_color': libtcod.black,
                            'draw_type': WorldRenderType.Character,
                            'z_level': 2
                        }),
                    Attribute(AttributeTag.Libraries,
                              {'value': player_hardcoded_libraries})
                ]))
            #for x in range(10):
            self.entity_manager.add_entity(
                Entity([
                    Attribute(AttributeTag.HostileProgram),
                    Attribute(AttributeTag.Visible),
                    Attribute(AttributeTag.OwnedMemory, {'segments': []}),
                    Attribute(
                        AttributeTag.WorldPosition, {'value': Vec2d(20, 10)}
                    ),  #libtcod.random_get_int(0, 5, 45), libtcod.random_get_int(0, 5, 45))}),
                    Attribute(AttributeTag.MaxProgramSize, {'value': 5}),
                    Attribute(AttributeTag.ClockRate, {'value': 2}),
                    Attribute(
                        AttributeTag.DrawInfo, {
                            'character': 121,
                            'fore_color': libtcod.Color(255, 0, 0),
                            'back_color': libtcod.black,
                            'draw_type': WorldRenderType.Character,
                            'z_level': 2
                        })
                ]))

            self.try_load_action_history()
        else:
            self.entity_manager.parent_menu = self

        self.entity_manager.player_id = 1

        self.init_ui()
Exemplo n.º 43
0
 def __init__(__):
     Menu.__init__(__, ['Quitter'], "BUT")
Exemplo n.º 44
0
	def __init__(self, gui):
		Menu.__init__(self, gui)
		
		# Maak game object aan.
		self.game = Game(self.gui.getScreen(), self.gui)
Exemplo n.º 45
0
 def __init__(self, screen, jack_to_analog):
     Menu.__init__(self, screen)
     self.jack_to_analog = jack_to_analog
     ADC.setup()
Exemplo n.º 46
0
 def __init__(self, screen, options):
     Menu.__init__(self, screen)
     self.options = options
     self.highlight_index = 0
Exemplo n.º 47
0
 def __init__(self, screen, jack_to_analog):
     Menu.__init__(self, screen)
     self.jack_to_analog = jack_to_analog
     ADC.setup()