本文整理汇总了Python中menu.Menu.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.__init__方法的具体用法?Python Menu.__init__怎么用?Python Menu.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类menu.Menu
的用法示例。
在下文中一共展示了Menu.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import __init__ [as 别名]
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]}
示例2: __init__
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import __init__ [as 别名]
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
示例3: __init__
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import __init__ [as 别名]
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
示例4: __init__
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import __init__ [as 别名]
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()
示例5: __init__
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import __init__ [as 别名]
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)
示例6: __init__
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import __init__ [as 别名]
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"]
示例7: __init__
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import __init__ [as 别名]
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)
示例8: __init__
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import __init__ [as 别名]
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()
示例9: __init__
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import __init__ [as 别名]
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)}
示例10: __init__
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import __init__ [as 别名]
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)}
示例11: __init__
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import __init__ [as 别名]
def __init__(self, screen, options):
Menu.__init__(self, screen)
self.options = options
self.highlight_index = 0
示例12: __init__
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import __init__ [as 别名]
def __init__(self):
Menu.__init__(self)
示例13: __init__
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import __init__ [as 别名]
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
示例14: __init__
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import __init__ [as 别名]
def __init__(__):
Menu.__init__(__, ['Quitter'], "BUT")
示例15: __init__
# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import __init__ [as 别名]
def __init__(self, gui):
Menu.__init__(self, gui)
# Maak game object aan.
self.game = Game(self.gui.getScreen(), self.gui)