Beispiel #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()
Beispiel #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))
Beispiel #3
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)
Beispiel #4
0
def load_from_dropbox():
    if not check_auth(): return

    ui.message("Listing saves from Dropbox...")

    DropboxHelper.listDirectory()

    def wait():
        if DropboxHelper.result:
            jlist = DropboxHelper.result
            print jlist
            DropboxHelper.printList(jlist)
            saves = jlist_to_list(jlist)
            load_dialog(saves)
        else:
            ui.execute_later(wait)

    wait()
Beispiel #5
0
 def callback(entry):
     print 'fetching from Dropbox', entry.path
     ui.message('downloading save from Dropbox...')
     DropboxHelper.downloadFile(entry.path, get_download_path())
     check_downloaded()
Beispiel #6
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()
Beispiel #7
0
 def finish(arg):
     try:
         features._parse_arg(arg)
     except Exception as e:
         traceback.print_exc()
         ui.message(str(e))