def get_test_window_catview(db=None, selected_category="Internet"): ''' Note that selected_category must specify a category that includes subcategories, else a ValueError will be raised. ''' def on_category_selected(view, cat): print("on_category_selected view: ", view) print("on_category_selected cat: ", cat) if db is None: cache = pkginfo.get_pkg_info() cache.open() xapian_base_path = "/var/cache/software-center" pathname = os.path.join(xapian_base_path, "xapian") db = database.StoreDatabase(pathname, cache) db.open() else: cache = db._aptcache icons = get_sc_icon_theme() distro = softwarecenter.distro.get_distro() apps_filter = appfilter.AppFilter(db, cache) # gui notebook = Gtk.Notebook() lobby_view = lobbyview.LobbyView(cache, db, icons, distro, apps_filter) scroll = Gtk.ScrolledWindow() scroll.add(lobby_view) notebook.append_page(scroll, Gtk.Label.new("Lobby")) subcat_cat = None for cat in lobby_view.categories: if cat.name == selected_category: if not cat.subcategories: raise ValueError('The value specified for selected_category ' '*must* specify a ' 'category that contains subcategories!!') subcat_cat = cat break subcat_view = catview.SubCategoryView(cache, db, icons, apps_filter) subcat_view.connect("category-selected", on_category_selected) subcat_view.set_subcategory(subcat_cat) scroll = Gtk.ScrolledWindow() scroll.add(subcat_view) notebook.append_page(scroll, Gtk.Label.new("Subcats")) win = get_test_window(child=notebook, width=800, height=800) win.set_data("subcat", subcat_view) win.set_data("lobby", lobby_view) return win
def get_test_window_pkgnamesview(): cache = pkginfo.get_pkg_info() cache.open() xapian_base_path = "/var/cache/software-center" pathname = os.path.join(xapian_base_path, "xapian") db = database.StoreDatabase(pathname, cache) db.open() icons = get_sc_icon_theme() pkgs = ["apt", "software-center"] view = pkgnamesview.PackageNamesView("header", cache, pkgs, icons, 32, db) view.show() win = get_test_window(child=view) return win
def get_test_catview(): def on_category_selected(view, cat): print("on_category_selected %s %s" % (view, cat)) cache = pkginfo.get_pkg_info() cache.open() xapian_base_path = "/var/cache/software-center" pathname = os.path.join(xapian_base_path, "xapian") db = database.StoreDatabase(pathname, cache) db.open() icons = get_sc_icon_theme() distro = softwarecenter.distro.get_distro() apps_filter = appfilter.AppFilter(db, cache) cat_view = lobbyview.LobbyView(cache, db, icons, distro, apps_filter) return cat_view
def get_test_window_appdetails(pkgname=None): cache = pkginfo.get_pkg_info() cache.open() xapian_base_path = "/var/cache/software-center" pathname = os.path.join(xapian_base_path, "xapian") db = database.StoreDatabase(pathname, cache) db.open() icons = get_sc_icon_theme() distro = softwarecenter.distro.get_distro() # gui scroll = Gtk.ScrolledWindow() view = appdetailsview.AppDetailsView(db, distro, icons, cache) if pkgname is None: pkgname = "totem" view.show_app(application.Application("", pkgname)) #view.show_app(application.Application("Pay App Example", "pay-app")) #view.show_app(application.Application("3D Chess", "3dchess")) #view.show_app(application.Application("Movie Player", "totem")) #view.show_app(application.Application("ACE", "unace")) #~ view.show_app(application.Application("", "apt")) #view.show_app("AMOR") #view.show_app("Configuration Editor") #view.show_app("Artha") #view.show_app("cournol") #view.show_app("Qlix") scroll.add(view) scroll.show() win = get_test_window(child=scroll, width=800, height=800) win.set_data("view", view) return win