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


Python ui.set_dialog函数代码示例

本文整理汇总了Python中ui.set_dialog函数的典型用法代码示例。如果您正苦于以下问题:Python set_dialog函数的具体用法?Python set_dialog怎么用?Python set_dialog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: ask_if_sharing_allowed

def ask_if_sharing_allowed(then):
    def notokay():
        features.set_perm("civsync.allow_sharing", "false")
        ui.back()
        then()

    def okay():
        features.set_perm("civsync.allow_sharing", "true")
        ui.back()
        then()

    msg = (
        "civsync.com may put saves you upload to Dropbox on a public list, for others to play."
        "\n\n"
        'By clicking "I agree" you share your saves on CC0 license (public domain) '
        "and allow Freeciv to upload them to civsync.com.".strip()
    )

    dialog = ui.LinearLayoutWidget()
    panel = ui.HorizontalLayoutWidget(spacing=10)
    panel.add(ui.Button("I agree", okay))
    panel.add(ui.Button("I don't agree", notokay))
    dialog.add(help.LongTextWidget(msg, ui.screen_width / 3, ui.smallfont))
    dialog.add(panel)
    ui.set_dialog(dialog)
开发者ID:4nakin,项目名称:freeciv-android,代码行数:25,代码来源:dropbox.py

示例2: player_list

 def player_list(self):
     def meet(player):
         ui.back()
         ui.back()
         player.meet()
     
     def do_break_treaty(player, type):
         player.cancel_pact(type)
         ui.back()
         ui.back()
     
     def break_treaty(player, type, ask):
         ui.ask(ask % dict(name=player.get_name()), lambda: do_break_treaty(player, type))
     
     players = ui.LinearLayoutWidget()
     
     for player in self.client.get_players():
         p = ui.HorizontalLayoutWidget()
         
         if player.can_meet():
             p.add(ui.Button('Meet', functools.partial(meet, player)))
         p.add(ui.Label('    ', image=player.get_flag()))
         p.add(ui.Label('%s (%s)' % (player.get_name(), player.get_nation_adj())))
         
         if player.gives_shared_vision():
             p.add(ui.Button('Withdraw vision', functools.partial(break_treaty, player, CLAUSE_VISION, 'Withdraw vision?')))
         
         if player.get_state() in (DS_CEASEFIRE, DS_PEACE, DS_ALLIANCE, DS_ARMISTICE):
             p.add(ui.Button('Break treaty', functools.partial(break_treaty, player, CLAUSE_CEASEFIRE, 'Break treaty with %(name)s?')))
         
         players.add(p)
     
     ui.set_dialog(players, scroll=True)
开发者ID:MegaMark16,项目名称:freeciv-android,代码行数:33,代码来源:empiredlg.py

示例3: new_game_menu

def new_game_menu():
    menu = ui.Menu(center=0.7)
    
    menu.add('Tutorial', tutorial.start)    
    menu.add('Random', save.new_game)
    menu.add('Scenario', save.load_scenario)
    
    ui.set_dialog(menu, scroll=True)
开发者ID:gcgrant,项目名称:freeciv-android,代码行数:8,代码来源:menus.py

示例4: new_game_menu

def new_game_menu():
    menu = ui.Menu(force_full = False)

    menu.add('Tutorial', tutorial.start)
    menu.add('Random', save.new_game)
    menu.add('Scenario', save.load_scenario)

    ui.set_dialog(menu)
开发者ID:zielmicha,项目名称:freeciv-android,代码行数:8,代码来源:menus.py

示例5: request

def request(callback, name, *args, **kwargs):
    if 'banner' in kwargs:
        banner = kwargs['banner']
        del kwargs['banner']
    else:
        banner = 'Contacting server...'
    loading = ui.Label(banner)
    ui.set_dialog(loading)
    threading.Thread(target=sync_request, args=(callback, name, args, kwargs)).start()
开发者ID:MegaMark16,项目名称:freeciv-android,代码行数:9,代码来源:sync.py

示例6: change_goverment

    def change_goverment(self):
        def commit_government_change(gov):
            gov.change_to()
            ui.back()

        panel = ui.LinearLayoutWidget()
        for gov in self.client.get_governments():
            panel.add(ui.Label(gov.name, functools.partial(commit_government_change, gov)))
        ui.set_dialog(panel, scroll=True)
开发者ID:turbo-codes,项目名称:freeciv-android,代码行数:9,代码来源:gamescreen.py

示例7: open_gold_link

def open_gold_link(then, restart):
    features.set_perm('gold.initiated', True)
    osutil.open_url('%s://%s/sync/login?then=%s&sid=%s' % (
        sync.PROTO, sync.HOST, then, sync.get_sid()))

    def callback():
        ui.async(lambda: check_products(force=True))

    if restart:
        ui.set_dialog(ui.Button('Touch after finishing transaction', callback))
开发者ID:4nakin,项目名称:freeciv-android,代码行数:10,代码来源:gold.py

示例8: popup_unit_select_dialog

 def popup_unit_select_dialog(self, units):
     def focus(unit):
         unit.focus()
         ui.back()
     
     panel = ui.LinearLayoutWidget()
     for unit in units:
         name = unit.get_name()
         callback = functools.partial(focus, unit)
         panel.add(ui.Button(name, callback))
     ui.set_dialog(panel, scroll=True)
开发者ID:renatolouro,项目名称:freeciv-android,代码行数:11,代码来源:gamescreen.py

示例9: show_buildings

    def show_buildings(self):
        buildings = self.city.get_built_improvements()

        panel = ui.LinearLayoutWidget()
        for handle, name in buildings:
            callback = functools.partial(lambda info: self.sell_dialog(*info), (name, handle))
            p = ui.HorizontalLayoutWidget()
            p.add(ui.Label(name))
            p.add(ui.Button('Sell', callback))
            panel.add(p)
        ui.set_dialog(panel, scroll=True)
开发者ID:4nakin,项目名称:freeciv-android,代码行数:11,代码来源:citydlg.py

示例10: pick_nation

 def pick_nation(self):
     def set_nation(style, id):
         self.city_style = style
         self.nation_id = id
         self.set_nation_settings()
         ui.back()
     nations = ui.LinearLayoutWidget()
     for name, style, id in client.get_nations():
         nations.add(ui.Button(name, functools.partial(set_nation, style, id)))
     
     ui.set_dialog(nations, scroll=True)
开发者ID:gcgrant,项目名称:freeciv-android,代码行数:11,代码来源:save.py

示例11: change_ruleset

def change_ruleset():
    def set_ruleset(name):
        features.set_perm('app.ruleset', name)
        ui.back()

    rulesets = ['default', 'civ1', 'civ2']
    panel = ui.LinearLayoutWidget()

    for ruleset in rulesets:
        panel.add(ui.Button(ruleset, functools.partial(set_ruleset, ruleset)))

    ui.set_dialog(panel)
开发者ID:bbqchickenrobot,项目名称:freeciv-android,代码行数:12,代码来源:options.py

示例12: change_joystick

def change_joystick():
    def set_type(name):
        features.set_perm('app.joystick', name)
        ui.back()

    types = ['new', 'tile']
    panel = ui.LinearLayoutWidget()

    for type in types:
        panel.add(ui.Button(type.capitalize(), functools.partial(set_type, type)))

    ui.set_dialog(panel)
开发者ID:bbqchickenrobot,项目名称:freeciv-android,代码行数:12,代码来源:options.py

示例13: show_units

    def show_units(self):
        def focus(unit):
            unit.focus()
            ui.back()
            ui.back()

        panel = ui.LinearLayoutWidget()
        for unit in self.city.get_units():
            name = unit.get_name()
            callback = functools.partial(focus, unit)
            panel.add(ui.Button(name, callback))
        ui.set_dialog(panel, scroll=True)
开发者ID:4nakin,项目名称:freeciv-android,代码行数:12,代码来源:citydlg.py

示例14: downloaded

def downloaded(data):
    ui.set_dialog(ui.Label("Loading save..."))
    uncompressed = lzma.decompress(data)
    print "Uncompressed size", len(uncompressed)
    dl_path = save.get_save_dir() + "/downloaded_save"
    try:
        os.remove(dl_path)
    except OSError:
        print "not removed..."
    with open(dl_path, "wb") as f:
        f.write(uncompressed)
    ui.back(anim=False)
    save.load_game(dl_path)
开发者ID:renatolouro,项目名称:freeciv-android,代码行数:13,代码来源:sync.py

示例15: research_list_dialog

 def research_list_dialog(self, func, level):
     def set_goal(tech):
         getattr(tech, func)()
         self.setup_ui()
         ui.back()
     
     techs = ui.LinearLayoutWidget()
     
     techs.add(ui.Label(', '.join(self.client.get_current_tech())))
     for tech in self.client.get_techs(level):
         techs.add(ui.Button(tech.name, functools.partial(set_goal, tech)))
     
     ui.set_dialog(techs, scroll=True)
开发者ID:MegaMark16,项目名称:freeciv-android,代码行数:13,代码来源:empiredlg.py


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