本文整理汇总了Python中ui.back函数的典型用法代码示例。如果您正苦于以下问题:Python back函数的具体用法?Python back怎么用?Python back使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了back函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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
示例2: _finish
def _finish():
if text.label:
graphics.stop_text_input()
finish(text.label)
ui.back(allow_override=False)
else:
_cancel()
示例3: 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)
示例4: pause
def pause():
if client.client:
print "pause occured"
print "saving game"
client.client.chat("/save %s/pause_save.sav.gz" % save.get_save_dir())
with open(pause_file, "w") as f:
f.write("version=1\n")
time.sleep(features.get("app.shutdown"))
if not osutil.is_paused():
remove_pause_file()
return
print "turning off server"
client.client.disconnect()
ui.back(allow_override=False)
osutil.wait_for_resume()
resume()
else:
osutil.wait_for_resume()
示例5: comment_upload
def comment_upload(install_time):
ui.execute_later(lambda: ui.message('Compressing log...'))
content = lzma.compress(open(save.get_save_dir() + '/more.log').read())
ui.execute_later(lambda: ui.back())
request(lambda result: comment_next(install_time), 'upload_log', content, install_time,
banner="Uploading log (%dkB)" % (len(content)/1024))
示例6: pause
def pause():
if client.client:
print 'pause occured'
print 'saving game'
client.client.chat('/save %s/pause_save.sav.gz' % save.get_save_dir())
with open(pause_file, 'w') as f:
f.write('version=1\n')
time.sleep(featues.get('app.shutdown'))
if not osutil.is_paused():
remove_pause_file()
return
print 'turning off server'
client.client.disconnect()
ui.back(allow_override=False)
osutil.wait_for_resume()
resume()
else:
osutil.wait_for_resume()
示例7: comment_upload
def comment_upload(install_time):
with ui.execute_later_lock:
ui.execute_later.append(lambda: ui.message("Compressing log..."))
content = lzma.compress(open(save.get_save_dir() + "/more.log").read())
with ui.execute_later_lock:
ui.execute_later.append(lambda: ui.back())
request(
lambda result: comment_next(install_time),
"upload_log",
content,
install_time,
banner="Uploading log (%dkB)" % (len(content) / 1024),
)
示例8: sync_request
def sync_request(callback, name, args, kwargs):
func = getattr(client(), name)
try:
try:
result = func(*args, **kwargs)
except civsync.LoginError as err:
print 'Login failed:', err
ui.back(anim=False)
self = lambda: request(callback, name, *args, **kwargs)
ui.execute_later(lambda: show_login_form(self, str(err)))
return
except Exception as err:
traceback.print_exc()
ui.back(anim=False)
ui.execute_later(lambda: ui.message('Failed to connect to the internet'))
return
ui.back(anim=False)
ui.execute_later(lambda: callback(result))
示例9: save
def save():
self.chat('/save')
ui.back()
示例10: quit
def quit():
self.disconnect()
ui.back(anim=False) # close dialog
ui.back(allow_override=False) # close game
示例11: focus
def focus(unit):
unit.focus()
ui.back()
示例12: never
def never():
features.set_perm('app.marketnotice', False)
ui.back()
示例13: fcallback
def fcallback(action_ident):
self.client.get_unit_in_focus().perform_activity(action_ident)
ui.back()
示例14: load_game_now
def load_game_now(port, username):
client.client.chat('/take "%s"' % username)
client.client.chat('/%s' % features.get('app.difficulty'))
client.client.chat('/start')
client.client.tick()
ui.back(allow_override=False)
示例15: set_goal
def set_goal(tech):
tech.set_as_goal()
ui.back()