예제 #1
0
파일: updaters.py 프로젝트: gmat/emzed2
    def script(add_info_line, add_update_info):
        exchange_folder = global_config.get("exchange_folder")
        if exchange_folder:
            yield add_info_line, ("configured exchange folder is %s" % exchange_folder,)
        else:
            yield add_info_line, ("no exchange folder configured. use emzed.config.edit() to "
                                    "configure an exchange folder",)

        for name, updater in registry.updaters.items():

            flag, msg = updater.check_for_newer_version_on_exchange_folder()
            if flag is True:
                flag, msg = updater.fetch_update_from_exchange_folder()
                if flag:
                    yield add_info_line, ("%s: copied update from exchange folder" % name,)
                elif flag is None:
                    pass
                else:
                    yield add_info_line, ("%s: failed to update from exchange folder: %s" % (name,
                        msg),)
            elif flag is False:
                yield add_info_line, ("%s: local version still up to date" % name,)
            elif flag is None:
                if msg is None:
                    pass
                else:
                    yield add_info_line, ("%s: %s" % (name, msg),)

            if updater.offer_update_lookup():
                id_, ts, info, offer_update = updater.query_update_info()
                yield add_update_info, (name, info, offer_update)
            else:
                yield add_update_info, (name, "no update lookup today", False)
예제 #2
0
    def script(add_info_line, add_update_info):
        """
        add_info_line and add_upate_info are two tokens to communicate with the GUI.
        Actually both are methods.
        For calling the methods we yield a pair where the first entry is the method and
        the second is a tuple of arguments.

        This method allows async updating the dialog without blocking the GUI until all
        update info is retrieved.

        add_info_line adds text to the upper text field in the dialog and add_update_info
        adds a row to the table below this text field.
        """

        exchange_folder = global_config.get("exchange_folder")
        if exchange_folder:
            yield add_info_line, ("configured exchange folder is %s" %
                                  exchange_folder, )
        else:
            yield add_info_line, (
                "no exchange folder configured. use emzed.config.edit() to "
                "configure an exchange folder", )

        for name, updater in registry.updaters.items():

            flag, msg = updater.check_for_newer_version_on_exchange_folder()
            if flag is True:
                flag, msg = updater.fetch_update_from_exchange_folder()
                if flag:
                    yield add_info_line, (
                        "%s: copied update from exchange folder" % name, )
                elif flag is None:
                    pass
                else:
                    yield add_info_line, (
                        "%s: failed to update from exchange folder: %s" %
                        (name, msg), )
            elif flag is False:
                yield add_info_line, ("%s: local version still up to date" %
                                      name, )
            elif flag is None:
                if msg is None:
                    pass
                else:
                    yield add_info_line, ("%s: %s" % (name, msg), )

            if updater.offer_update_lookup():
                id_, ts, info, offer_update = updater.query_update_info()
                if "\n" in info:  # multiline info
                    yield add_info_line, ("\n%s" % info, )
                yield add_update_info, (name, info, offer_update)
            else:
                yield add_update_info, (name, "no update lookup today", False)
예제 #3
0
    def script(add_info_line, add_update_info):
        """
        add_info_line and add_upate_info are two tokens to communicate with the GUI.
        Actually both are methods.
        For calling the methods we yield a pair where the first entry is the method and
        the second is a tuple of arguments.

        This method allows async updating the dialog without blocking the GUI until all
        update info is retrieved.

        add_info_line adds text to the upper text field in the dialog and add_update_info
        adds a row to the table below this text field.
        """

        exchange_folder = global_config.get("exchange_folder")
        if exchange_folder:
            yield add_info_line, ("configured exchange folder is %s" % exchange_folder,)
        else:
            yield add_info_line, ("no exchange folder configured. use emzed.config.edit() to "
                                  "configure an exchange folder",)

        for name, updater in registry.updaters.items():

            flag, msg = updater.check_for_newer_version_on_exchange_folder()
            if flag is True:
                flag, msg = updater.fetch_update_from_exchange_folder()
                if flag:
                    yield add_info_line, ("%s: copied update from exchange folder" % name,)
                elif flag is None:
                    pass
                else:
                    yield add_info_line, ("%s: failed to update from exchange folder: %s" % (name,
                                                                                             msg),)
            elif flag is False:
                yield add_info_line, ("%s: local version still up to date" % name,)
            elif flag is None:
                if msg is None:
                    pass
                else:
                    yield add_info_line, ("%s: %s" % (name, msg),)

            if updater.offer_update_lookup():
                id_, ts, info, offer_update = updater.query_update_info()
                if "\n" in info:  # multiline info
                    yield add_info_line, ("\n%s" % info,)
                yield add_update_info, (name, info, offer_update)
            else:
                yield add_update_info, (name, "no update lookup today", False)