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()
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()
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))
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 _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)
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()
def okay(): features.set_perm('civsync.allow_sharing', 'true') ui.back() then()
def notokay(): features.set_perm('civsync.allow_sharing', 'false') ui.back() then()
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)
def finish(val): try: features.set_perm(self.feature_key, val) except ValueError as e: ui.message(str(e), type='error') self.make_button()
def set_type(name): features.set_perm('app.joystick', name) ui.back()
def set_ruleset(name): features.set_perm('app.ruleset', name) ui.back()