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

Python ui.set函数代码示例

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

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



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

示例1: show_options

def show_options():
    options = OptionsPanel(marginleft=10)
    options.add(ui.Label(("Touch" if osutil.is_android else "Click") + " an option to change"))
    options.add_feature("Shutdown game after %d seconds of pause", "app.shutdown")
    # options.add_feature_bool('New joystick', 'Old joystick', 'app.new_joystick')
    options.add(ui.Button("Change joystick", change_joystick))
    options.add(ui.Button("Change ruleset for new games", change_ruleset))
    st = "Full city label toggle button:"
    options.add_feature_bool(st + " show", st + " hide", "app.full_label_toggle_button")

    if osutil.is_desktop:
        st = "Fullscreen (restart to take effect): "
        options.add_feature_bool(st + "Yes", st + "No", "ui.fullscreen")

    options.add(dropbox.DBButton("Login to Dropbox", lambda: dropbox.login()))

    if features.get("app.debug"):
        options.add(ui.Button("Debug", debug_menu))

    options.add(
        ui.Label(
            "Freeciv for Android is licensed under GNU/GPL. \n"
            "Dropbox and Dropbox logo are trademarks of Dropbox, Inc.\n"
        )
    )
    ui.set(options)
开发者ID:Waqasyounas,项目名称:freeciv-android,代码行数:26,代码来源:options.py


示例2: out_callback

 def out_callback(line):
     if 'Established control over the server. You have command access level' in line:
         ui.back(anim=False)
         start_button = ui.Dialog(ui.screen, ui.Button('Touch to start game', callback))
         start_button.back = callback
         ui.set(start_button, anim=False)
         sc_client.out_window_callback = None
开发者ID:gcgrant,项目名称:freeciv-android,代码行数:7,代码来源:save.py


示例3: new_game

def new_game():
    port = random.randint(2000, 15000)
    args = ('-r', './data/%s.serv' % features.get('app.ruleset'))
    gui = ServerGUI()
    start_server(port, args=args, line_callback=gui.server_line_callback)
    gui.connect(port)
    ui.set(gui.ui)
开发者ID:zielmicha,项目名称:freeciv-android,代码行数:7,代码来源:save.py


示例4: show

def show(client):
    tree = load_techtree('data/techtree.index')

    model = TechtreeClientModel(client)
    widget = TechTreeWidget(model, *tree)
    widget = ui.ScrollWrapper(widget, ways=ui.SCROLL_WIDTH | ui.SCROLL_HEIGHT)
    ui.set(widget)
开发者ID:4nakin,项目名称:freeciv-android,代码行数:7,代码来源:techtree.py


示例5: show_login_form

def show_login_form(callback):
    def logged(result):
        print "Login successful"
        with open(save.get_save_dir() + "/civsync.sessid.txt", "w") as f:
            f.write(session.sessid)
        ui.back(anim=False)
        callback()

    def do_login():
        request(logged, "login", login_field.get_value(), passwd_field.get_value())

    def no_account():
        ui.message("Download Freeciv Sync for Desktop\nfrom freeciv.zielinscy.org.pl")

    panel = ui.LinearLayoutWidget()

    login = ui.HorizontalLayoutWidget()
    login.add(ui.Label("Login:"))
    login_field = ui.EditField()
    login.add(login_field)
    panel.add(login)

    passwd = ui.HorizontalLayoutWidget()
    passwd.add(ui.Label("Password:"))
    passwd_field = ui.EditField()
    passwd.add(passwd_field)
    panel.add(passwd)

    butts = ui.HorizontalLayoutWidget(spacing=10)
    butts.add(ui.Button("Login", do_login))
    butts.add(ui.Button("No account?", no_account))
    butts.add(ui.Button("Cancel", ui.back))
    panel.add(butts)

    ui.set(panel)
开发者ID:renatolouro,项目名称:freeciv-android,代码行数:35,代码来源:sync.py


示例6: inputbox

def inputbox(text, default='', finish=None, cancel=None):
    def _finish():
        if text.label:
            graphics.stop_text_input()
            finish(text.label)
            ui.back(allow_override=False)
        else:
            _cancel()

    def reset():
        text.set_text('')

    def _cancel():
        graphics.stop_text_input()
        if cancel: cancel()
        ui.back(allow_override=False)

    graphics.start_text_input()
    container = ui.LinearLayoutWidget()
    container.back = _cancel
    container.add(ui.Label('%s' % text))
    text = InputBox(default)
    container.add(text)
    container.focus = text
    panel = ui.HorizontalLayoutWidget(spacing=10)
    panel.add(ui.Button('OK', _finish))
    panel.add(ui.Button('Reset', reset))
    container.add(panel)
    ui.set(container)
开发者ID:4nakin,项目名称:freeciv-android,代码行数:29,代码来源:uidialog.py


示例7: show_options

def show_options():
    options = OptionsPanel()
    options.add(ui.Label('Touch an option to change'))
    options.add_feature('Shutdown game after %d seconds of pause', 'app.shutdown')
    options.add(ui.Button('Change ruleset for new games', change_ruleset))
    if features.get('app.debug'):
        options.add(ui.Button('Debug', debug_menu))
    ui.set(options)
开发者ID:renatolouro,项目名称:freeciv-android,代码行数:8,代码来源:options.py


示例8: load_scenario

def load_scenario():
    menu = ui.LinearLayoutWidget()

    for name, path in get_scenarios():
        callback = functools.partial(load_game, path)
        menu.add(ui.Button(name, callback))

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


示例9: 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


示例10: load_dialog

def load_dialog(entries):
    print entries

    menu = ui.LinearLayoutWidget()
    menu.add(ui.Label('Save your games to folder /Applications/Freeciv in your Dropbox.'))
    for entry in entries:
        name = DropboxHelper.getPath(entry).strip('/')
        menu.add(ui.Button(name,
                           functools.partial(load_dropbox_save, name)))
    ui.set(ui.ScrollWrapper(menu))
开发者ID:JKtheSlacker,项目名称:freeciv-android,代码行数:10,代码来源:dropbox_java.py


示例11: set_dialog

def set_dialog(new_screen, scroll=False, no_stack=False):
    if scroll:
        item = ui.ScrollWrapper(new_screen,
                                height=ui.screen_height*0.7,
                                width=ui.screen_width*0.7,
                                ways=ui.SCROLL_HEIGHT|ui.SCROLL_WIDTH)
    else:
        item = new_screen
    dialog = Dialog(ui.get_screen(), item)
    ui.set(dialog, anim=False, no_stack=no_stack)
    return dialog
开发者ID:4nakin,项目名称:freeciv-android,代码行数:11,代码来源:dialog.py


示例12: show_list

def show_list(entries):
    panel = ui.LinearLayoutWidget()
    panel.add(ui.Label('Saves from %s' % civsync.HOST))
    for entry in entries:
        panel.add(ui.Button('%s - %dkB' % (entry.name, entry.size/1024), functools.partial(download_sync, entry.sha1)))
    if not entries:
        panel.add(ui.Label('You have not synced any saves...'))
        panel.add(ui.Label('Install Freeciv Sync for Desktop from %s' % civsync.HOST))
        panel.add(ui.Label('or save game with \'Save & Sync\''))
    panel.add(ui.Button('Logout', logout))
    ui.set(ui.ScrollWrapper(panel))
开发者ID:MegaMark16,项目名称:freeciv-android,代码行数:11,代码来源:sync.py


示例13: load_dialog

def load_dialog():
    menu = ui.LinearLayoutWidget(marginleft=10)
    was_any = False
    menu.add(dropbox.DBButton('Show saves in Dropbox', dropbox.load_from_dropbox))
    for name, path in get_saves():
        callback = functools.partial(load_game, path)
        menu.add(ui.Button(name, callback))
        was_any = True
    if not was_any:
        menu.add(ui.Label('No saved games yet...'))
    ui.set(ui.ScrollWrapper(menu))
开发者ID:zielmicha,项目名称:freeciv-android,代码行数:11,代码来源:save.py


示例14: show_options

def show_options():
    options = OptionsPanel()
    options.add(ui.Label('Touch an option to change'))
    options.add_feature('Shutdown game after %d seconds of pause', 'app.shutdown')
    #options.add_feature_bool('New joystick', 'Old joystick', 'app.new_joystick')
    options.add(ui.Button('Change joystick', change_joystick))
    options.add(ui.Button('Change ruleset for new games', change_ruleset))
    st = 'Full city label toggle button:'
    options.add_feature_bool(st + ' show', st + ' hide', 'app.full_label_toggle_button')
    if features.get('app.debug'):
        options.add(ui.Button('Debug', debug_menu))
    ui.set(options)
开发者ID:gcgrant,项目名称:freeciv-android,代码行数:12,代码来源:options.py


示例15: research_dialog

 def research_dialog(self):
     def set_goal(tech):
         tech.set_as_goal()
         ui.back()
     
     techs = ui.LinearLayoutWidget()
     
     techs.add(ui.Label(', '.join(self.client.get_current_tech())))
     for tech in self.client.get_techs():
         techs.add(ui.Button(tech.name, functools.partial(set_goal, tech)))
     
     ui.set(ui.ScrollWrapper(techs))
开发者ID:renatolouro,项目名称:freeciv-android,代码行数:12,代码来源:gamescreen.py


示例16: client_main

def client_main():
    if try_resume():
        ui.main()
        return

    ui.set(ui.Label('loading...'))
    ui.execute_later(app_main)

    if features.get('app.profile'):
        profile_main()
    else:
        ui.main()
开发者ID:at13,项目名称:freeciv-android,代码行数:12,代码来源:main.py


示例17: show_main_menu

def show_main_menu():
    global main_menu
    main_menu = menu = ui.Menu()
    
    menu.add('New game', new_game)
    menu.add('Load game', save.load_dialog)
    menu.add('Feedback', feedback)
    menu.add('Options', options.show_options)
    if features.get('app.multiplayer'):
        menu.add('Connect', save.connect_dialog)
    
    ui.set(menu)
开发者ID:renatolouro,项目名称:freeciv-android,代码行数:12,代码来源:main.py


示例18: load_dialog

def load_dialog():
    menu = ui.LinearLayoutWidget()
    was_any = False
    if features.get('civsync.enable'):
        menu.add(ui.Button('Show CivSync saves', sync.show_load))
    for name, path in get_saves():
        callback = functools.partial(load_game, path)
        menu.add(ui.Button(name, callback))
        was_any = True
    if not was_any:
        menu.add(ui.Label('No saved games yet...'))
    ui.set(ui.ScrollWrapper(menu))
开发者ID:gcgrant,项目名称:freeciv-android,代码行数:12,代码来源:save.py


示例19: show_list

def show_list(entries):
    panel = ui.LinearLayoutWidget()
    panel.add(ui.Label("Saves from %s" % civsync.HOST))
    for entry in entries:
        panel.add(
            ui.Button("%s - %dkB" % (entry.name, entry.size / 1024), functools.partial(download_sync, entry.sha1))
        )
    if not entries:
        panel.add(ui.Label("You have not synced any saves..."))
        panel.add(ui.Label("Install Freeciv Sync for Desktop"))
        panel.add(ui.Label("from %s" % civsync.HOST))
    panel.add(ui.Button("Logout", logout))
    ui.set(ui.ScrollWrapper(panel))
开发者ID:renatolouro,项目名称:freeciv-android,代码行数:13,代码来源:sync.py


示例20: resume

def resume():
    name = get_resume_data()
    if name:
        remove_pause_file()
        try:
            menus.main_menu()
            ui.set(ui.Label('dummy'))
            save.load_game(name)
        except IOError:
            # loading save failed
            return False
        return True
    else:
        return False
开发者ID:at13,项目名称:freeciv-android,代码行数:14,代码来源:main.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python ui.set_dialog函数代码示例发布时间:2022-05-27
下一篇:
Python ui.message函数代码示例发布时间: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