Пример #1
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()
Пример #2
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))
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()
Пример #4
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()
Пример #5
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()
Пример #6
0
 def finish():
     try:
         k, v = arg.split('=', 1)
         features.set_perm(k, v)
     except Exception as e:
         traceback.print_exc()
         ui.message(str(e))
Пример #7
0
 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()
Пример #8
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()
Пример #9
0
 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))
Пример #10
0
 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))
Пример #11
0
 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()
Пример #12
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))
Пример #13
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))
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)
Пример #15
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)
Пример #16
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()
Пример #17
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()
Пример #18
0
 def set_ruleset(name):
     features.set_perm('app.ruleset', name)
     ui.back()
Пример #19
0
 def set_difficulty(name):
     features.set_perm('app.difficulty', name)
     difficulty_button.set_text('Default difficulty for new games: ' + name)
     ui.back()
Пример #20
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)
Пример #21
0
 def set_type(name):
     features.set_perm('app.joystick', name)
     ui.back()
Пример #22
0
 def okay():
     features.set_perm("civsync.allow_sharing", "true")
     ui.back()
     then()
Пример #23
0
 def notokay():
     features.set_perm("civsync.allow_sharing", "false")
     ui.back()
     then()
Пример #24
0
 def set_type(name):
     features.set_perm('app.joystick', name)
     ui.back()
Пример #25
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()
Пример #26
0
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
Пример #27
0
 def never():
     features.set_perm('app.marketnotice', False)
     ui.back()
Пример #28
0
 def okay():
     features.set_perm('civsync.allow_sharing', 'true')
     ui.back()
     then()
Пример #29
0
 def set_ruleset(name):
     features.set_perm('app.ruleset', name)
     ui.back()
Пример #30
0
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
Пример #31
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()
Пример #32
0
 def notokay():
     features.set_perm('civsync.allow_sharing', 'false')
     ui.back()
     then()
Пример #33
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)
Пример #34
0
 def okay():
     features.set_perm('civsync.allow_sharing', 'true')
     ui.back()
     then()
Пример #35
0
 def never():
     features.set_perm('app.marketnotice', False)
     ui.back()
Пример #36
0
 def notokay():
     features.set_perm('civsync.allow_sharing', 'false')
     ui.back()
     then()