本文整理汇总了Python中ui.set函数的典型用法代码示例。如果您正苦于以下问题:Python set函数的具体用法?Python set怎么用?Python set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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
示例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)
示例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)
示例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)
示例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)
示例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)
示例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))
示例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))
示例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))
示例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
示例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))
示例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))
示例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)
示例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))