コード例 #1
0
ファイル: gold.py プロジェクト: mercury199/FreeCivAndroid
def menu():
    layout = ui.LinearLayoutWidget(marginleft=10)
    buttons = ui.HorizontalLayoutWidget(spacing=10)
    text_label = help.LongTextWidget('Loading...', ui.screen_width,
                                     ui.smallfont)

    layout.add(buttons)
    layout.add(text_label)
    layout.add(buttons)

    ui. async (check_products)

    def text_fetched(text):
        data = json.loads(text)
        text_label.set_text(data['text'])
        for btn in data['buttons']:
            button = ui.Button(
                btn['text'],
                functools.partial(open_gold_link, btn['url'],
                                  btn.get('restart')))
            buttons.add(button)

    ui. async (lambda: sync.request_with_sid('/sale/gold_text'),
               then=text_fetched)
    ui.set(ui.ScrollWrapper(layout))
コード例 #2
0
def _impl_save(name, path):
    if not check_auth(): return
    print 'uploading', path, 'as', name
    DropboxHelper.uploadFile(path, name)
    ui. async (lambda: sync.request_with_sid('/sync/uploading',
                                             name=name,
                                             sharing=features.get(
                                                 'civsync.allow_sharing')))
コード例 #3
0
ファイル: dropbox.py プロジェクト: 4nakin/freeciv-android
def tell_civsync():
    ui.async(
        lambda: sync.request_with_sid(
            "/sync/register",
            key=features.get("civsync.key"),
            secret=features.get("civsync.secret"),
            install_time=sync.get_install_time(),
        )
    )
コード例 #4
0
ファイル: dropbox.py プロジェクト: 4nakin/freeciv-android
def save(path):
    if features.get("civsync.allow_sharing") == "none":
        return ask_if_sharing_allowed(lambda: save(path))
    if not check_auth():
        return
    name = make_name(path)
    print "uploading", path, "as", name
    DropboxHelper.uploadFile(path, name)
    ui.async(lambda: sync.request_with_sid("/sync/uploading", name=name, sharing=features.get("civsync.allow_sharing")))
コード例 #5
0
ファイル: dropbox.py プロジェクト: joglomedia/freeciv-android
def save(path):
    if features.get('civsync.allow_sharing') == 'none':
        return ask_if_sharing_allowed(lambda: save(path))
    if not check_auth(): return
    name = make_name(path)
    print 'uploading', path, 'as', name
    DropboxHelper.uploadFile(path, name)
    ui.async(lambda: sync.request_with_sid('/sync/uploading', name=name,
                                           sharing=features.get('civsync.allow_sharing')))
コード例 #6
0
ファイル: gold.py プロジェクト: joglomedia/freeciv-android
def menu():
    layout = ui.LinearLayoutWidget(marginleft=10)
    buttons = ui.HorizontalLayoutWidget(spacing=10)
    text_label = help.LongTextWidget('Loading...', ui.screen_width, ui.smallfont)

    layout.add(buttons)
    layout.add(text_label)
    layout.add(buttons)

    ui.async(check_products)

    def text_fetched(text):
        data = json.loads(text)
        text_label.set_text(data['text'])
        for btn in data['buttons']:
            button = ui.Button(btn['text'],
                               functools.partial(open_gold_link, btn['url'], btn.get('restart')))
            buttons.add(button)

    ui.async(lambda: sync.request_with_sid('/sale/gold_text'), then=text_fetched)
    ui.set(ui.ScrollWrapper(layout))
コード例 #7
0
def tell_civsync():
    ui.async(lambda: sync.request_with_sid('/sync/register',
                                           key=features.get('civsync.key'),
                                           secret=features.get('civsync.secret'),
                                           install_time=sync.get_install_time()))
コード例 #8
0
def _impl_save(name, path):
    if not check_auth(): return
    print 'uploading', path, 'as', name
    DropboxHelper.uploadFile(path, name)
    ui.async(lambda: sync.request_with_sid('/sync/uploading', name=name,
                                           sharing=features.get('civsync.allow_sharing')))
コード例 #9
0
def tell_civsync():
    ui. async (
        lambda: sync.request_with_sid('/sync/register',
                                      key=features.get('civsync.key'),
                                      secret=features.get('civsync.secret'),
                                      install_time=sync.get_install_time()))