def get_state_list(state): global states_dict if state == _('To install'): liststore = Gtk.ListStore(object) for name in transaction.to_add: pkg = transaction.get_localpkg(name) if pkg: liststore.append([pkg]) else: pkg = transaction.get_syncpkg(name) if pkg: liststore.append([pkg]) return liststore elif state == _('To remove'): liststore = Gtk.ListStore(object) for name in transaction.to_remove: pkg = transaction.get_localpkg(name) if pkg: liststore.append([pkg]) return liststore elif state in states_dict.keys(): return states_dict[state] else: states_dict[state] = Gtk.ListStore(object) if state == _('Installed'): for pkg in transaction.localdb.pkgcache: states_dict[state].append([pkg]) elif state == _('Uninstalled'): for pkg in get_uninstalled_pkgs(): states_dict[state].append([pkg]) elif state == _('Orphans'): for pkg in get_orphan_pkgs(): states_dict[state].append([pkg]) return states_dict[state]
def get_uninstalled_pkgs(): pkgs_list = [] names_list = [] for repo in transaction.syncdbs: for pkg in repo.pkgcache: if not pkg.name in names_list: names_list.append(pkg.name) if not transaction.get_localpkg(pkg.name): pkgs_list.append(pkg) return pkgs_list
def get_repo_list(repo): global repos_dict if repo in repos_dict.keys(): return repos_dict[repo] else: repos_dict[repo] = Gtk.ListStore(object) if repo == _('local'): for pkg in transaction.localdb.pkgcache: if not transaction.get_syncpkg(pkg.name): repos_dict[repo].append([pkg]) else: for db in transaction.syncdbs: if db.name == repo: for pkg in db.pkgcache: local_pkg = transaction.get_localpkg(pkg.name) if local_pkg: repos_dict[repo].append([local_pkg]) else: repos_dict[repo].append([pkg]) return repos_dict[repo]
def get_repo_list(repo): global repos_dict if repo in repos_dict.keys(): return repos_dict[repo] else: repos_dict[repo] = Gtk.ListStore(object) if repo == _('local'): for pkg in transaction.localdb.pkgcache: if not transaction.get_syncpkg(pkg.name): repos_dict[repo].append([pkg]) else: for db in transaction.syncdbs: if db.name ==repo: for pkg in db.pkgcache: local_pkg = transaction.get_localpkg(pkg.name) if local_pkg: repos_dict[repo].append([local_pkg]) else: repos_dict[repo].append([pkg]) return repos_dict[repo]