本文整理汇总了Python中clientmenu.Menu.run方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.run方法的具体用法?Python Menu.run怎么用?Python Menu.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clientmenu.Menu
的用法示例。
在下文中一共展示了Menu.run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: replay_menu
# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import run [as 别名]
def replay_menu(self):
menu = Menu([4315])
for n in sorted(os.listdir(REPLAYS_PATH), reverse=True):
if n.endswith(".txt"):
menu.append([time.strftime("%c", time.localtime(int(n[:-4])))], (self.replay, n))
menu.append([4041], None)
menu.run()
示例2: update
# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import run [as 别名]
def update():
menu = Menu([4327])
for p in get_packages():
if p.is_active:
menu.append([p.name], (p.update, voice))
menu.append([4118], None)
menu.run()
示例3: deactivate
# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import run [as 别名]
def deactivate():
menu = Menu([4326])
for p in get_packages():
if p.is_active:
menu.append([p.name], p.deactivate)
menu.append([4118], None)
menu.run()
示例4: add
# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import run [as 别名]
def add():
menu = Menu([4325])
for p in get_packages():
if not p.is_active:
menu.append([p.name], (p.add, voice))
menu.append([4118], None)
menu.run()
示例5: choose_server_ip_in_a_list
# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import run [as 别名]
def choose_server_ip_in_a_list(self):
servers_list = None
try:
f = urllib.urlopen(SERVERS_LIST_URL)
if f.read(len(SERVERS_LIST_HEADER)) == SERVERS_LIST_HEADER:
servers_list = f.readlines()
except:
pass
if servers_list is None:
voice.alert([1029]) # hostile sound
warning("couldn't get the servers list from the metaserver"
" => using the default servers list")
servers_list = DEFAULT_SERVERS
nb = 0
menu = Menu()
for s in servers_list:
try:
ip, version, login, port = s.split()[1:]
# ignore the first parameter (time)
except:
warning("line not recognized from the metaserver: %s", s)
continue
nb += 1
if version == VERSION:
menu.append([login, 4073, login], (connect_and_play, ip, port))
menu.title = nb2msg(len(menu.choices)) + [4078] + nb2msg(nb) + [4079]
menu.append([4075, 4076], None)
menu.run()
示例6: replay_menu
# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import run [as 别名]
def replay_menu():
menu = Menu(mp.OBSERVE_RECORDED_GAME)
for n in sorted(os.listdir(REPLAYS_PATH), reverse=True):
if n.endswith(".txt"):
menu.append([time.strftime("%c", time.localtime(int(n[:-4])))],
(replay, n))
menu.append(mp.QUIT2, None)
menu.run()
示例7: mods_menu
# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import run [as 别名]
def mods_menu():
mods_menu = Menu(mp.MODS)
mods_menu.append([0], (set_and_launch_mod, ""))
for mod in res.available_mods():
mods_menu.append([mod], (set_and_launch_mod, mod))
mods_menu.append(mp.BACK, CLOSE_MENU)
mods_menu.run()
return CLOSE_MENU
示例8: mods_menu
# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import run [as 别名]
def mods_menu():
mods_menu = Menu(["Mods"])
mods_menu.append([0], (set_and_launch_mod, ""))
for mod in res.available_mods():
mods_menu.append([mod], (set_and_launch_mod, mod))
mods_menu.append([4118], END_LOOP)
mods_menu.run()
return END_LOOP
示例9: soundpacks_menu
# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import run [as 别名]
def soundpacks_menu():
soundpacks_menu = Menu(["Soundpacks"])
soundpacks_menu.append([0], (set_and_launch_soundpack, ""))
for soundpack in res.available_soundpacks():
soundpacks_menu.append([soundpack], (set_and_launch_soundpack, soundpack))
soundpacks_menu.append([4118], END_LOOP)
soundpacks_menu.run()
return END_LOOP
示例10: soundpacks_menu
# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import run [as 别名]
def soundpacks_menu():
soundpacks_menu = Menu(mp.SOUNDPACKS)
soundpacks_menu.append(mp.NOTHING, (set_and_launch_soundpack, ""))
for soundpack in res.available_soundpacks():
soundpacks_menu.append([soundpack],
(set_and_launch_soundpack, soundpack))
soundpacks_menu.append(mp.BACK, CLOSE_MENU)
soundpacks_menu.run()
return CLOSE_MENU
示例11: multiplayer_menu
# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import run [as 别名]
def multiplayer_menu():
if config.login == "player":
voice.alert(mp.ENTER_NEW_LOGIN)
modify_login()
menu = Menu(mp.MAKE_A_SELECTION, [
(mp.CHOOSE_SERVER_IN_LIST, choose_server_ip_in_a_list),
(mp.ENTER_SERVER_IP, enter_server_ip),
(mp.CANCEL, None),
])
menu.run()
示例12: multiplayer_menu
# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import run [as 别名]
def multiplayer_menu(self):
revision_checker.start_if_needed()
if config.login == "player":
voice.alert([4235]) # type your new login
self.modify_login()
menu = Menu([4030], [
([4119], self.choose_server_ip_in_a_list),
([4120], self.enter_server_ip),
([4048], None),
])
menu.run()
示例13: select_next_mod
# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import run [as 别名]
def select_next_mod(parent):
def add_mod(mod):
if mod not in mods:
mods.append(mod)
parent.title = mods
menu = Menu([4320] + mods)
for mod in available_mods():
menu.append([mod], (add_mod, mod))
menu.append([4118], None)
menu.run()
示例14: run
# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import run [as 别名]
def run(self):
if self.mods is not None:
res.set_mods(self.mods)
try:
self.load_resources()
menu = Menu(self.title, [])
if len(self._available_chapters()) > 1:
ch = self._available_chapters()[-1]
menu.append([4011] + ch.title, ch) # "continue"
for ch in self._available_chapters():
prefix = nb2msg(ch.id) if ch.id > 0 else []
menu.append(prefix + ch.title, ch)
# menu.append([4113], "restore")
menu.append([4118], None) # "cancel"
menu.run()
finally:
self.unload_resources()
示例15: choose_server_ip_in_a_list
# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import run [as 别名]
def choose_server_ip_in_a_list():
servers = servers_list(voice)
total = 0
compatible = 0
menu = Menu()
for s in servers:
try:
_, ip, version, login, port = s.split()
except ValueError:
warning("line not recognized from the metaserver: %s", s)
else:
total += 1
if version == VERSION:
compatible += 1
menu.append([login], (connect_and_play, ip, port),
mp.SERVER_HOSTED_BY + [login])
menu.title = nb2msg(compatible) + mp.SERVERS_ON + nb2msg(total) + mp.ARE_COMPATIBLE
menu.append(mp.CANCEL2, None, mp.GO_BACK_TO_PREVIOUS_MENU)
menu.run()