当前位置: 首页>>代码示例>>Python>>正文


Python Menu.append方法代码示例

本文整理汇总了Python中clientmenu.Menu.append方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.append方法的具体用法?Python Menu.append怎么用?Python Menu.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在clientmenu.Menu的用法示例。


在下文中一共展示了Menu.append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update

# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import append [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()
开发者ID:Pragmapragma,项目名称:soundrts,代码行数:9,代码来源:clientmain.py

示例2: deactivate

# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import append [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()
开发者ID:Pragmapragma,项目名称:soundrts,代码行数:9,代码来源:clientmain.py

示例3: add

# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import append [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()
开发者ID:Pragmapragma,项目名称:soundrts,代码行数:9,代码来源:clientmain.py

示例4: replay_menu

# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import append [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()
开发者ID:ctoth,项目名称:soundrts,代码行数:9,代码来源:clientmain.py

示例5: choose_server_ip_in_a_list

# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import append [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()
开发者ID:ctoth,项目名称:soundrts,代码行数:30,代码来源:clientmain.py

示例6: replay_menu

# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import append [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()
开发者ID:MatejGolian,项目名称:soundrts,代码行数:10,代码来源:clientmain.py

示例7: select_next_mod

# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import append [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()
开发者ID:Pragmapragma,项目名称:soundrts,代码行数:14,代码来源:clientmain.py

示例8: _build_players_menu

# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import append [as 别名]
 def _build_players_menu(self):
     menu = Menu()
     if len(self._players) < self._map.nb_players_max:
         menu.append(mp.INVITE + mp.QUIET_COMPUTER, (self._add_ai, "easy"))
         menu.append(mp.INVITE + mp.AGGRESSIVE_COMPUTER,
                     (self._add_ai, "aggressive"))
         menu.append(mp.INVITE + mp.AGGRESSIVE_COMPUTER + nb2msg(2),
                     (self._add_ai, "ai2"))
     if len(self._players) >= self._map.nb_players_min:
         menu.append(mp.START, self._run_game)
     if len(self._map.factions) > 1:
         self._add_faction_menus(menu)
     menu.append(mp.CANCEL, CLOSE_MENU, mp.CANCEL_THIS_GAME)
     return menu
开发者ID:MatejGolian,项目名称:soundrts,代码行数:16,代码来源:clientmain.py

示例9: choose_server_ip_in_a_list

# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import append [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()
开发者ID:MatejGolian,项目名称:soundrts,代码行数:21,代码来源:clientmain.py

示例10: build_training_menu_after_map

# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import append [as 别名]
 def build_training_menu_after_map(self):
     menu = Menu()
     if len(self.players) < self.map.nb_players_max:
         menu.append([4058, 4258], (self.training_menu_invite, "easy"))
         menu.append([4058, 4257], (self.training_menu_invite,
                                    "aggressive"))
     if len(self.players) >= self.map.nb_players_min:
         menu.append([4059], self.start_training_game)
     for pn, (p, pr) in enumerate(zip(self.players, self.factions)):
         self._add_faction_menu(menu, pn, p, pr)
     menu.append([4048, 4060], END_LOOP)
     return menu
开发者ID:ctoth,项目名称:soundrts,代码行数:14,代码来源:clientmain.py

示例11: make_menu

# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import append [as 别名]
 def make_menu(self):
     menu = Menu()
     for g in self.invitations:
         menu.append([4053] + g[1:], (self.server.write_line, "register %s" % g[0]))
     menu.append([4055], self._get_creation_submenu())
     menu.append([4041], (self.server.write_line, "quit"))
     return menu
开发者ID:ctoth,项目名称:soundrts,代码行数:9,代码来源:clientservermenu.py

示例12: soundpacks_menu

# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import append [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
开发者ID:ctoth,项目名称:soundrts,代码行数:10,代码来源:clientmain.py

示例13: mods_menu

# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import append [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
开发者ID:ctoth,项目名称:soundrts,代码行数:10,代码来源:clientmain.py

示例14: mods_menu

# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import append [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
开发者ID:MatejGolian,项目名称:soundrts,代码行数:10,代码来源:clientmain.py

示例15: soundpacks_menu

# 需要导入模块: from clientmenu import Menu [as 别名]
# 或者: from clientmenu.Menu import append [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
开发者ID:MatejGolian,项目名称:soundrts,代码行数:11,代码来源:clientmain.py


注:本文中的clientmenu.Menu.append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。