Exemplo n.º 1
0
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))
Exemplo n.º 2
0
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))
Exemplo n.º 3
0
def comment_next(install_time):
    ui.back()
    uidialog.open_url(
        'http://%s/comment?install_time=%s&sid=%s&ua=%s' %
        (civsync.HOST, install_time, client()._sessid, civsync.USER_AGENT))
Exemplo n.º 4
0
 def callback():
     button.set_text('Loading...')
     button.callback = None
     with ui.execute_later_lock:
         ui.execute_later.append(lambda: uidialog.open_url(url))
Exemplo n.º 5
0
 def callback():
     button.set_text('Loading...')
     button.callback = None
     ui.execute_later(lambda: uidialog.open_url(url))
Exemplo n.º 6
0
 def callback():
     button.set_text('Loading...')
     button.callback = None
     ui.execute_later(lambda: uidialog.open_url(url))
Exemplo n.º 7
0
def comment_next(install_time):
    ui.back()
    uidialog.open_url('http://%s/comment?install_time=%s&sid=%s&ua=%s'
                      % (civsync.HOST, install_time, client()._sessid, civsync.USER_AGENT))
Exemplo n.º 8
0
 def callback():
     button.set_text('Loading...')
     button.callback = None
     with ui.execute_later_lock:
         ui.execute_later.append(lambda: uidialog.open_url(url))