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)
def change_zoom(): menu = ui.LinearLayoutWidget() for size in [None, (320, 240), (480, 320), (640, 480), (1024, 800)]: menu.add( ui.Button(str(size or 'Disabled'), functools.partial(change_screen_size, size))) ui.set_dialog(menu, scroll=True)
def add_condition(self): def ph(type): # pact handler def handler(): ui.back() self.meeting.pact(type) return handler panel = ui.LinearLayoutWidget() c = self.meeting.counterpart state = c.get_state() if state not in (DS_ARMISTICE, DS_CEASEFIRE, DS_PEACE, DS_ALLIANCE): panel.add(ui.Button('Ceasefire', ph(CLAUSE_CEASEFIRE))) if state not in (DS_PEACE, DS_ALLIANCE): panel.add(ui.Button('Peace', ph(CLAUSE_PEACE))) if state not in (DS_ALLIANCE, ): panel.add(ui.Button('Alliance', ph(CLAUSE_ALLIANCE))) if not c.gives_shared_vision(): panel.add(ui.Button('Shared vision', ph(CLAUSE_VISION))) ui.set_dialog(panel)
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)
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)
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)
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()
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)
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))
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))
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)
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)
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)
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)
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)
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)
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)
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)
def change_difficulty(difficulty_button): def set_difficulty(name): features.set_perm('app.difficulty', name) difficulty_button.set_text('Default difficulty for new games: ' + name) ui.back() difficulties = ['handicapped', 'novice', 'easy', 'normal', 'hard', 'cheating'] panel = ui.LinearLayoutWidget() for difficulty in difficulties: panel.add(ui.Button(difficulty, functools.partial(set_difficulty, difficulty))) ui.set_dialog(panel)
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)
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)
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)
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()
def setup_ui(self): self.items = [] self.tech_label = ui.Label('') self.add(self.tech_label) self.tech_goal_label = ui.Label('') self.add(self.tech_goal_label) self.tech_progress_label = ui.Label('', font=ui.consolefont) self.add(self.tech_progress_label) tech_panel = ui.HorizontalLayoutWidget(spacing=10) tech_panel.add(ui.Button('Change tech goal', self.research_goal_dialog)) tech_panel.add( ui.Button('Change current tech', self.research_current_dialog)) tech_panel.add( ui.Button('Technology tree', self.technology_tree_dialog)) self.add(tech_panel) self.add(ui.Label('Players')) self.add(ui.Button('Player list', self.player_list)) self.add( ui.Button( 'Taxes & Government', lambda: ui.set_dialog(gamescreen.TaxesDialog(self.client)))) self.add( ui.Button('More empire informations', self.get_info_label_text_popup)) self.update_layout()
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)
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)
def set_turn_button_enable(self, 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()
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))
def quit(self): def quit(): self.disconnect() ui.back(anim=False) # close dialog ui.back(allow_override=False) # close game def save(): self.chat('/save') ui.back() def save_and_sync(): sync.save_and_sync(self) menu = ui.Menu(center=0.7) menu.add('Quit', quit) menu.add('Save', save) if features.get('civsync.enable'): menu.add('Save & sync', save_and_sync) ui.set_dialog(menu, scroll=True)
def setup_ui(self): self.items = [] self.tech_label = ui.Label('') self.add(self.tech_label) tech_panel = ui.HorizontalLayoutWidget(spacing=10) tech_panel.add(ui.Button('Change tech goal', self.research_goal_dialog)) tech_panel.add(ui.Button('Change current tech', self.research_current_dialog)) self.add(tech_panel) self.add(ui.Label('Players')) self.add(ui.Button('Player list', self.player_list)) self.add(ui.Button('Taxes & Government', lambda: ui.set_dialog(gamescreen.TaxesDialog(self.client)))) self.update_layout()
def unit_select_dialog_popup(self, units): def focus(unit): unit.focus() ui.back() panel = ui.LinearLayoutWidget(spacing=0)#No vertical spacing because Images already contains margins. for unit in units: name = unit.get_name() callback = functools.partial(focus, unit) p = ui.HorizontalLayoutWidget(spacing=10) surf = unit.get_image() w, h = surf.get_size() image = surf.scale((ui.scale_for_device(w), ui.scale_for_device(h))) surf.destroy() p.add(ui.Image(image, callback)) container = ui.LinearLayoutWidget(spacing=0) container.add(ui.Spacing(0, ui.scale_for_device(8))) container.add(ui.Button(name, callback)) p.add(container) panel.add(p) ui.set_dialog(panel, scroll=True)
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, image): c = ui.HorizontalLayoutWidget() c.add(ui.Label(' ', image=image)) c.add( ui.Label('%s %s/%s %s' % (name, stock, cost, ops), functools.partial(change, type, handle))) panel.add(c) for handle, type, name, turns, stock, cost, ops, img in things: add(handle, type, name, turns, stock, cost, ops or '', img) ui.set_dialog(panel, scroll=True)
def setup_ui(self): self.items = [] self.tech_label = ui.Label("") self.add(self.tech_label) tech_panel = ui.HorizontalLayoutWidget(spacing=10) tech_panel.add(ui.Button("Change tech goal", self.research_goal_dialog)) tech_panel.add(ui.Button("Change current tech", self.research_current_dialog)) tech_panel.add(ui.Button("Technology tree", self.technology_tree_dialog)) self.add(tech_panel) self.add(ui.Label("Players")) self.add(ui.Button("Player list", self.player_list)) self.add(ui.Button("Taxes & Government", lambda: ui.set_dialog(gamescreen.TaxesDialog(self.client)))) self.update_layout()
def show_marketnotice(): def never(): features.set_perm('app.marketnotice', False) ui.back() def okay(): osutil.open_market() never() msg = ''' If you enjoy playing Freeciv, please take a moment to rate the app. Thank you for your support!'''.strip() dialog = ui.LinearLayoutWidget() panel = ui.HorizontalLayoutWidget(spacing=10) panel.add(ui.Button('Okay', okay)) panel.add(ui.Button('Not now', ui.back)) panel.add(ui.Button('Never', never)) dialog.add(ui.Label(msg)) dialog.add(panel) ui.set_dialog(dialog)
def quit(self): def quit(): self.disconnect() ui.back(anim=False) # close dialog ui.back(allow_override=False) # close game def save(): self.chat('/save') ui.back() def save_and_sync(): sync.save_and_sync(self) def show_help(): help.show() menu = ui.Menu(center=0.7) menu.add('Quit', quit) menu.add('Save', save) if features.get('civsync.enable'): menu.add('Save & sync', save_and_sync) menu.add('Help', show_help) ui.set_dialog(menu, scroll=True)
def quit(self): def quit(): self.disconnect() ui.back(anim=False) # close dialog ui.back(allow_override=False) # close game def save(): self.chat('/save') ui.back() def save_db(): ui.back() self.save_and_get_name(lambda path: dropbox.save(path)) def show_help(): help.show() menu = ui.Menu(for_dialog=True) menu.add('Quit', quit) menu.add('Save', save) menu.add('Save to Dropbox', save_db, button_class=dropbox.DBButton) menu.add('Help', show_help) ui.set_dialog(menu, scroll=True)
def add_condition(self): def ph(type): # pact handler def handler(): ui.back() self.meeting.pact(type) return handler panel = ui.LinearLayoutWidget() c = self.meeting.counterpart state = c.get_state() if state not in (DS_CEASEFIRE, DS_PEACE, DS_ALLIANCE): panel.add(ui.Button('Ceasefire', ph(CLAUSE_CEASEFIRE))) if state not in (DS_CEASEFIRE, DS_PEACE): panel.add(ui.Button('Peace', ph(CLAUSE_PEACE))) if state not in (DS_ALLIANCE, ): panel.add(ui.Button('Alliance', ph(CLAUSE_ALLIANCE))) if not c.gives_shared_vision(): panel.add(ui.Button('Shared vision', ph(CLAUSE_VISION))) ui.set_dialog(panel)
def unit_select_dialog_popup(self, units): def focus(unit): unit.focus() ui.back() panel = ui.LinearLayoutWidget( spacing=0 ) #No vertical spacing because Images already contains margins. for unit in units: name = unit.get_name() callback = functools.partial(focus, unit) p = ui.HorizontalLayoutWidget(spacing=10) surf = unit.get_image() w, h = surf.get_size() image = surf.scale( (ui.scale_for_device(w), ui.scale_for_device(h))) surf.destroy() p.add(ui.Image(image, callback)) container = ui.LinearLayoutWidget(spacing=0) container.add(ui.Spacing(0, ui.scale_for_device(8))) container.add(ui.Button(name, callback)) p.add(container) panel.add(p) ui.set_dialog(panel, scroll=True)
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)
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(): arg = uidialog.inputbox('name=key') try: features._parse_arg(arg) except Exception as e: traceback.print_exc() ui.message(str(e)) def pernament_feature(): arg = uidialog.inputbox('name=key') try: k, v = arg.split('=', 1) features.set_perm(k, v) except Exception as e: traceback.print_exc() ui.message(str(e)) 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) 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', lambda: uidialog.open_url( 'market://details?id=pl.org.zielinscy.freeciv')) ui.set(ui.ScrollWrapper(menu))
def setup_ui(self): self.items = [] self.tech_label = ui.Label('') self.add(self.tech_label) tech_panel = ui.HorizontalLayoutWidget(spacing=10) tech_panel.add(ui.Button('Change tech goal', self.research_goal_dialog)) tech_panel.add( ui.Button('Change current tech', self.research_current_dialog)) self.add(tech_panel) self.add(ui.Label('Players')) self.add(ui.Button('Player list', self.player_list)) self.add( ui.Button( 'Taxes & Government', lambda: ui.set_dialog(gamescreen.TaxesDialog(self.client)))) self.update_layout()
def setup_ui(self): self.items = [] self.tech_label = ui.Label('') self.add(self.tech_label) self.tech_goal_label = ui.Label('') self.add(self.tech_goal_label) self.tech_progress_label = ui.Label('', font=ui.consolefont) self.add(self.tech_progress_label) tech_panel = ui.HorizontalLayoutWidget(spacing=10) tech_panel.add(ui.Button('Change tech goal', self.research_goal_dialog)) tech_panel.add(ui.Button('Change current tech', self.research_current_dialog)) tech_panel.add(ui.Button('Technology tree', self.technology_tree_dialog)) self.add(tech_panel) self.add(ui.Label('Players')) self.add(ui.Button('Player list', self.player_list)) self.add(ui.Button('Taxes & Government', lambda: ui.set_dialog(gamescreen.TaxesDialog(self.client)))) self.add(ui.Button('More empire informations', self.get_info_label_text_popup)) self.update_layout()
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)]: menu.add(str(size), functools.partial(fake_screen_size, size)) ui.set_dialog(menu, scroll=True) def change_feature(): arg = uidialog.inputbox('name=key') try: features._parse_arg(arg) except Exception as e: traceback.print_exc() ui.message(str(e)) def pernament_feature(): arg = uidialog.inputbox('name=key') try: k, v = arg.split('=', 1) features.set_perm(k, v) except Exception as e: traceback.print_exc() ui.message(str(e)) 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) 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', lambda: uidialog.open_url('market://details?id=pl.org.zielinscy.freeciv')) ui.set(ui.ScrollWrapper(menu))
def callback(self): ui.set_dialog(TaxesDialog(self.client))
def popup_notify(self, text): panel = ui.LinearLayoutWidget() panel.add(ui.Label(text, font=ui.consolefont)) panel.add(ui.Button('Okay', ui.back)) ui.set_dialog(panel)
def uploaded_save(result): ui.set_dialog(ui.Label('Save uploaded.', ui.back))