Example #1
0
def _auth_finished():
    print '_auth_finished'
    key = DropboxHelper.tokenKey
    secret = DropboxHelper.tokenSecret
    features.set_perm('civsync.key', key)
    features.set_perm('civsync.secret', secret)
    tell_civsync()
Example #2
0
 def _callback(self):
     try:
         val = features.get(self.feature_key)
         features.set_perm(self.feature_key, not val)
     except ValueError as e:
         ui.message(str(e), type='error')
     self.make_button()
Example #3
0
 def finish(arg):
     try:
         k, v = arg.split('=', 1)
         features.set_perm(k, v)
     except Exception as e:
         traceback.print_exc()
         ui.message(str(e))
Example #4
0
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))
Example #5
0
def _message_checker():
    if DropboxHelper.needAuth:
        print 'Authentication requested by DropboxHelper'
        DropboxHelper.needAuth = False
        features.set_perm('civsync.key', None)
        features.set_perm('civsync.secret', None)
        login()

    msg = DropboxHelper.getMessage()
    if msg:
        print 'showing message from DropboxHelper', msg
        ui.message(msg)
    ui.execute_later(_message_checker)
Example #6
0
def check_products(force=False):
    resp = sync.json_request_with_sid('/sale/products')
    if 'gold0plus' in resp:
        features.set_perm('gold.status', 'gold0plus')
    elif 'gold0' in resp:
        features.set_perm('gold.status', 'gold0')

    if 'session_warning' in resp:
        features.set('gold.session_warning', True)

    if force:
        ui.history = []

    redisplay_menu()
Example #7
0
 def okay():
     features.set_perm('civsync.allow_sharing', 'true')
     ui.back()
     then()
Example #8
0
 def notokay():
     features.set_perm('civsync.allow_sharing', 'false')
     ui.back()
     then()
Example #9
0
def change_screen_size(size):
    features.set_perm('app.forcesize', ('%d,%d' % size) if size else '')
    ui.history = []
    ui.screen = None
    import main
    main.main(init=False)
Example #10
0
 def finish(val):
     try:
         features.set_perm(self.feature_key, val)
     except ValueError as e:
         ui.message(str(e), type='error')
     self.make_button()
Example #11
0
 def set_type(name):
     features.set_perm('app.joystick', name)
     ui.back()
Example #12
0
 def set_ruleset(name):
     features.set_perm('app.ruleset', name)
     ui.back()