def get_info(self, pkg_stem, name): api_o = self.parent.get_api_object() local_info = gui_misc.get_pkg_info(self.parent, api_o, pkg_stem, True) remote_info = gui_misc.get_pkg_info(self.parent, api_o, pkg_stem, False) if self.parent.check_exiting(): return False plan_pkg = None installed_only = False if local_info: if gui_misc.same_pkg_versions(local_info, remote_info): installed_only = True if not installed_only: install_update_list = [] stuff_to_do = False install_update_list.append(pkg_stem) for pd in api_o.gen_plan_install(install_update_list, refresh_catalogs=False): continue stuff_to_do = not api_o.planned_nothingtodo() if stuff_to_do: plan_desc = api_o.describe() if plan_desc == None: return plan = plan_desc.get_changes() plan_pkg = None for pkg_plan in plan: if name == pkg_plan[1].pkg_stem: plan_pkg = pkg_plan[1] break if plan_pkg == None: return True gobject.idle_add(self.__after_get_info, local_info, remote_info, plan_pkg, name) return False
def __after_get_info(self, local_info, remote_info, plan_pkg, name): if self.parent.check_exiting(): return self.w_info_name_label.set_text(name) installable_fmt = \ _("%(version)s (Build %(build)s-%(branch)s)") installed_label = "" installable_label = "" installable_prefix_label = _("<b>Installable Version:</b>") if local_info: # Installed installable_prefix_label = _("<b>Upgradeable Version:</b>") yes_text = _("Yes, %(version)s (Build %(build)s-%(branch)s)") installed_label = yes_text % \ {"version": local_info.version, "build": local_info.build_release, "branch": local_info.branch} if gui_misc.same_pkg_versions(local_info, remote_info): # Installed and up to date installable_label = \ _("Installed package is up-to-date") self.__hide_pkg_version_details() else: if plan_pkg == None: # Installed with later version but can't upgrade # Upgradeable Version: None installable_label = _("None") self.__setup_version_info_details( name, remote_info.version, remote_info.build_release, remote_info.branch, False) else: # Installed with later version and can upgrade to # Upgradeable Version: <version> # Upgradeable == Latest Version if gui_misc.same_pkg_versions(plan_pkg, remote_info): installable_label = installable_fmt % \ {"version": plan_pkg.version, "build": plan_pkg.build_release, "branch": plan_pkg.branch} self.__hide_pkg_version_details() else: # Installed with later version and can upgrade # Upgradeable Version: <version> # but NOT to the Latest Version installable_label = installable_fmt % \ {"version": plan_pkg.version, "build": plan_pkg.build_release, "branch": plan_pkg.branch} self.__setup_version_info_details( name, remote_info.version, remote_info.build_release, remote_info.branch, False) else: # Not Installed installed_label = _("No") if plan_pkg: # Not installed with later version available to install # Installable: <version> # Installable == Latest Version if gui_misc.same_pkg_versions(plan_pkg, remote_info): installable_label = installable_fmt % \ {"version": plan_pkg.version, "build": plan_pkg.build_release, "branch": plan_pkg.branch} self.__hide_pkg_version_details() else: # Not installed with later version available # Installable: <version> # but NOT to the Latest Version installable_label = installable_fmt % \ {"version": plan_pkg.version, "build": plan_pkg.build_release, "branch": plan_pkg.branch} self.__setup_version_info_details( name, remote_info.version, remote_info.build_release, remote_info.branch, True) else: # Not Installed with later version and can't install # Installable Version: None installable_label = _("None") self.__setup_version_info_details(name, remote_info.version, remote_info.build_release, remote_info.branch, True) self.w_info_installed_label.set_text(installed_label) self.w_info_installable_label.set_text(installable_label) self.w_info_installable_prefix_label.set_markup( installable_prefix_label) self.w_info_ok_button.grab_focus() self.w_version_info_dialog.show() self.parent.unset_busy_cursor()
def __after_get_info(self, local_info, remote_info, plan_pkg, name): if self.parent.check_exiting(): return self.w_info_name_label.set_text(name) installable_fmt = \ _("%(version)s (Build %(build)s-%(branch)s)") installed_label = "" installable_label = "" installable_prefix_label = _("<b>Installable Version:</b>") if local_info: # Installed installable_prefix_label = _("<b>Upgradeable Version:</b>") yes_text = _("Yes, %(version)s (Build %(build)s-%(branch)s)") installed_label = yes_text % \ {"version": local_info.version, "build": local_info.build_release, "branch": local_info.branch} if gui_misc.same_pkg_versions(local_info, remote_info): # Installed and up to date installable_label = \ _("Installed package is up-to-date") self.__hide_pkg_version_details() else: if plan_pkg == None: # Installed with later version but can't upgrade # Upgradeable Version: None installable_label = _("None") self.__setup_version_info_details(name, remote_info.version, remote_info.build_release, remote_info.branch, False) else: # Installed with later version and can upgrade to # Upgradeable Version: <version> # Upgradeable == Latest Version if gui_misc.same_pkg_versions(plan_pkg, remote_info): installable_label = installable_fmt % \ {"version": plan_pkg.version, "build": plan_pkg.build_release, "branch": plan_pkg.branch} self.__hide_pkg_version_details() else: # Installed with later version and can upgrade # Upgradeable Version: <version> # but NOT to the Latest Version installable_label = installable_fmt % \ {"version": plan_pkg.version, "build": plan_pkg.build_release, "branch": plan_pkg.branch} self.__setup_version_info_details(name, remote_info.version, remote_info.build_release, remote_info.branch, False) else: # Not Installed installed_label = _("No") if plan_pkg: # Not installed with later version available to install # Installable: <version> # Installable == Latest Version if gui_misc.same_pkg_versions(plan_pkg, remote_info): installable_label = installable_fmt % \ {"version": plan_pkg.version, "build": plan_pkg.build_release, "branch": plan_pkg.branch} self.__hide_pkg_version_details() else: # Not installed with later version available # Installable: <version> # but NOT to the Latest Version installable_label = installable_fmt % \ {"version": plan_pkg.version, "build": plan_pkg.build_release, "branch": plan_pkg.branch} self.__setup_version_info_details(name, remote_info.version, remote_info.build_release, remote_info.branch, True) else: # Not Installed with later version and can't install # Installable Version: None installable_label = _("None") self.__setup_version_info_details(name, remote_info.version, remote_info.build_release, remote_info.branch, True) self.w_info_installed_label.set_text(installed_label) self.w_info_installable_label.set_text(installable_label) self.w_info_installable_prefix_label.set_markup(installable_prefix_label) self.w_info_ok_button.grab_focus() self.w_version_info_dialog.show() self.parent.unset_busy_cursor()