Python app 模块,App() 实例源码

我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用app.App()

项目:Mk3-Firmware    作者:emfcamp    | 项目源码 | 文件源码
def main_menu():
    while True:
        clear()

        menu_items = [
            {"title": "Browse app library", "function": store},
            {"title": "Update apps and libs", "function": update},
            {"title": "Remove app", "function": remove}
        ]

        option = dialogs.prompt_option(menu_items, none_text="Exit", text="What do you want to do?", title="TiLDA App Library")

        if option:
            option["function"]()
        else:
            return
项目:Mk3-Firmware    作者:emfcamp    | 项目源码 | 文件源码
def update():
    clear()
    connect()

    with dialogs.WaitingMessage(text="Downloading full list of library files", title="TiLDA App Library") as message:
        message.text="Downloading full list of library files"
        master = http_client.get("http://api.badge.emfcamp.org/firmware/master-lib.json").raise_for_status().json()
        libs_to_update = []
        for lib, expected_hash in master.items():
            if expected_hash != filesystem.calculate_hash("lib/" + lib):
                libs_to_update.append({
                    "url": "http://api.badge.emfcamp.org/firmware/master/lib/" + lib,
                    "target": "lib/" + lib,
                    "expected_hash": expected_hash,
                    "title": lib
                })
        download_list(libs_to_update, message)

        apps = get_local_apps()
        for i, app in enumerate(apps):
            message.text = "Updating app %s" % app
            if app.fetch_api_information():
                download_app(app, message)

    dialogs.notice("Everything is up-to-date")
项目:Mk3-Firmware    作者:emfcamp    | 项目源码 | 文件源码
def store():
    global apps_by_category

    while True:
        empty_local_app_cache()
        clear()
        connect()

        with dialogs.WaitingMessage(text="Fetching app library...", title="TiLDA App Library"):
            categories = get_public_app_categories()

        category = dialogs.prompt_option(categories, text="Please select a category", select_text="Browse", none_text="Back")
        if category:
            store_category(category)
        else:
            return
项目:needle    作者:mwrlabs    | 项目源码 | 文件源码
def __init__(self, ip, port, agent_port, username, password, pub_key_auth, tools):
        # Setup params
        self._ip = ip
        self._port = port
        self._agent_port = agent_port
        self._username = username
        self._password = password
        self._pub_key_auth = bool(pub_key_auth)
        self._tools_local = tools
        # Init related objects
        self.app = App(self)
        self.local_op = LocalOperations()
        self.remote_op = RemoteOperations(self)
        self.printer = Printer()
        self.agent = NeedleAgent(self)

    # ==================================================================================================================
    # UTILS - USB
    # ==================================================================================================================
项目:Mk3-Firmware    作者:emfcamp    | 项目源码 | 文件源码
def connect():
    wifi.connect(
        wait=True,
        show_wait_message=True,
        prompt_on_fail=True,
        dialog_title='TiLDA App Library'
    )

### VIEWS ###
项目:Mk3-Firmware    作者:emfcamp    | 项目源码 | 文件源码
def store_details(category, app):
    clear()
    empty_local_app_cache()
    with dialogs.WaitingMessage(text="Fetching app information...", title="TiLDA App Library"):
        app.fetch_api_information()

    clear()
    if dialogs.prompt_boolean(app.description, title = str(app), true_text = "Install", false_text="Back"):
        install(app)
        dialogs.notice("%s has been successfully installed" % app)
项目:Mk3-Firmware    作者:emfcamp    | 项目源码 | 文件源码
def remove():
    clear()

    app = dialogs.prompt_option(get_local_apps(), title="TiLDA App Library", text="Please select an app to remove", select_text="Remove", none_text="Back")

    if app:
        clear()
        with dialogs.WaitingMessage(text="Removing %s\nPlease wait..." % app, title="TiLDA App Library"):
            for file in os.listdir(app.folder_path):
                os.remove(app.folder_path + "/" + file)
            os.remove(app.folder_path)
        remove()
项目:nails    作者:jamrizzi    | 项目源码 | 文件源码
def __init__(self, app):
        self.app = App(app)
项目:Small-2D-App    作者:cprogrammer1994    | 项目源码 | 文件源码
def initializeGL(self):
        self.app = App()