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 _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 finish(): try: k, v = arg.split('=', 1) features.set_perm(k, v) except Exception as e: traceback.print_exc() ui.message(str(e))
def _callback(self): val = uidialog.inputbox('Value for %s' % self.feature_key) try: features.set_perm(self.feature_key, val) except ValueError as e: ui.message(str(e), type='error') self.make_button()
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 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 _callback(self): val = uidialog.inputbox('Value for %s' % self.feature_key) if val is None: return try: features.set_perm(self.feature_key, val) except ValueError as e: ui.message(str(e), type='error') self.make_button()
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 _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 set_ruleset(name): features.set_perm('app.ruleset', name) ui.back()
def set_difficulty(name): features.set_perm('app.difficulty', name) difficulty_button.set_text('Default difficulty for new games: ' + name) ui.back()
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 set_type(name): features.set_perm('app.joystick', name) ui.back()
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 finish(val): try: features.set_perm(self.feature_key, val) except ValueError as e: ui.message(str(e), type='error') self.make_button()
def get_sid(): sid = features.get('civsync.sid') if not sid: sid = ''.join( hex(ord(ch))[2:] for ch in os.urandom(8) ) features.set_perm('civsync.sid', sid) return sid
def never(): features.set_perm('app.marketnotice', False) ui.back()
def okay(): features.set_perm('civsync.allow_sharing', 'true') ui.back() then()
def notokay(): features.set_perm('civsync.allow_sharing', 'false') ui.back() then()