• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python ui.set_dialog函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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)
            p = ui.HorizontalLayoutWidget()
            p.add(ui.Image(unit.get_image(), callback)) # Label(' ' * 10, callback, image=
            p.add(ui.Button(name, callback))
            panel.add(p)
        ui.set_dialog(panel, scroll=True)
开发者ID:turbo-codes,项目名称:freeciv-android,代码行数:14,代码来源:gamescreen.py


示例17: show_action_list

    def show_action_list(self, unit):
        def fcallback(action_ident):
            self.client.get_unit_in_focus().perform_activity(action_ident)
            ui.back()

        panel = ui.LinearLayoutWidget()

        for action_ident, action_name, action_length in unit.get_actions():
            callback = functools.partial(fcallback, action_ident)
            hor = ui.HorizontalLayoutWidget()
            hor.add(ui.Image(get_order_sprite(action_name), callback))
            hor.add(ui.Label('%s' % (action_name, ), callback))
            panel.add(hor)

        ui.set_dialog(panel, scroll=True)
开发者ID:turbo-codes,项目名称:freeciv-android,代码行数:15,代码来源:gamemenu.py


示例18: set_turn_button_enable

 def set_turn_button_enable(self, enabled):
     print 'set_turn_button_state+', enabled
     dialog_state = self.turn_loading_dialog.is_opened() if self.turn_loading_dialog else False
     if not enabled and not dialog_state:
         self.turn_loading_dialog = ui.set_dialog(ui.Label('ending turn...'))
     elif dialog_state and enabled:
         self.turn_loading_dialog.close()
开发者ID:renatolouro,项目名称:freeciv-android,代码行数:7,代码来源:gamescreen.py


示例19: change_prod

 def change_prod(self, add=True):
     panel = ui.LinearLayoutWidget()
     
     things = self.city.get_buildable_improvements() + \
                 self.city.get_buildable_units()
     
     def change(type, handle):
         self.city.set_production(type, handle)
         ui.back()
     
     def add(handle, type, name, turns, stock, cost, ops):
         panel.add(ui.Label('%s %s/%s %s' % (name, stock, cost, ops), functools.partial(change, type, handle)))
     
     for handle, type, name, turns, stock, cost, ops in things:
         add(handle, type, name, turns, stock, cost, ops or '')
     
     ui.set_dialog(panel, scroll=True)
开发者ID:renatolouro,项目名称:freeciv-android,代码行数:17,代码来源:citydlg.py


示例20: debug_menu

def debug_menu():
    def fake_screen_size(size):
        import main
        main.main(size, init=False)

    def fake_screen_size_menu():
        menu = ui.Menu(center=False)
        for size in [(320, 240), (480, 320), (640, 480), (1024, 800), (1280, 800)]:
            menu.add(str(size), functools.partial(fake_screen_size, size))
        ui.set_dialog(menu, scroll=True)

    def change_feature():
        def finish(arg):
            try:
                features._parse_arg(arg)
            except Exception as e:
                traceback.print_exc()
                ui.message(str(e))

        uidialog.inputbox('name=key', finish=finish)

    def pernament_feature():
        def finish():
            try:
                k, v = arg.split('=', 1)
                features.set_perm(k, v)
            except Exception as e:
                traceback.print_exc()
                ui.message(str(e))

        uidialog.inputbox('name=key', finish=finish)

    def show_features():
        s = '\n'.join( '%s=%s' % (k,v) for k, v in sorted(features.features.items()) )
        ui.set_dialog(ui.Label(s), scroll=True)

    def test_inputbox():
        import uidialog
        def finish(text):
            print 'got', text

        def cancel():
            print 'cancel'

        uidialog.inputbox('Query?', 'defaultval', finish=finish, cancel=cancel)

    menu = ui.Menu()

    menu.add('Fake screen size', fake_screen_size_menu)
    menu.add('Get screen size', lambda: ui.set_dialog(ui.Label(str(ui.screen_size))))
    menu.add('Change feature', change_feature)
    menu.add('Pernament feature', pernament_feature)
    menu.add('Show features', show_features)
    menu.add('Cause exception', lambda: 1/0)
    menu.add('Test Market URL', osutil.open_market)
    menu.add('Test inputbox', test_inputbox)

    ui.set(ui.ScrollWrapper(menu))
开发者ID:bbqchickenrobot,项目名称:freeciv-android,代码行数:58,代码来源:options.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ui.UI类代码示例发布时间:2022-05-27
下一篇:
Python ui.set函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap