Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
def init():
    print 'DropboxHelper init'
    global DropboxHelper
    if not DropboxHelper:
        DropboxHelper = jnius_reflect.autoclass('com.zielm.freeciv.DropboxHelper')
        print 'initializing DropboxHelper tokens'
        tokenKey = features.get('civsync.key')
        tokenSecret = features.get('civsync.secret')
        DropboxHelper.setTokens(tokenKey, tokenSecret)
        DropboxHelper.init()
        ui.execute_later(_message_checker)
Exemplo n.º 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)
Exemplo n.º 4
0
def _check_finish():
    if DropboxHelper.authFinished:
        _auth_finished()
    else:
        ui.execute_later(_check_finish)
Exemplo n.º 5
0
def check_downloaded():
    if DropboxHelper.downloaded:
        if DropboxHelper.downloadedSuccess:
            download_success()
    else:
        ui.execute_later(check_downloaded)