예제 #1
0
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
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
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
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
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))
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()))
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()))