def get_test_window(panel_type="lobby"):
    import softwarecenter.log
    softwarecenter.log.root.setLevel(level=logging.DEBUG)
    fmt = logging.Formatter("%(name)s - %(message)s", None)
    softwarecenter.log.handler.setFormatter(fmt)

    # this is *way* too complicated we should *not* need a CatView
    # here! see FIXME in RecommendationsPanel.__init__()
    from softwarecenter.ui.gtk3.views.catview_gtk import CategoriesViewGtk
    from softwarecenter.testutils import (get_test_db, get_test_pkg_info,
                                          get_test_gtk3_icon_cache,
                                          get_test_categories)
    cache = get_test_pkg_info()
    db = get_test_db()
    icons = get_test_gtk3_icon_cache()
    catview = CategoriesViewGtk(softwarecenter.paths.datadir,
                                softwarecenter.paths.APP_INSTALL_PATH, cache,
                                db, icons)

    if panel_type is "lobby":
        view = RecommendationsPanelLobby(catview)
    elif panel_type is "category":
        cats = get_test_categories(db)
        view = RecommendationsPanelCategory(catview, cats[0])
    else:  # panel_type is "details":
        view = RecommendationsPanelDetails(catview)

    win = Gtk.Window()
    win.connect("destroy", lambda x: Gtk.main_quit())
    win.add(view)
    win.set_data("rec_panel", view)
    win.set_size_request(600, 200)
    win.show_all()

    return win
Esempio n. 2
0
def get_test_window():
    import softwarecenter.log
    softwarecenter.log.root.setLevel(level=logging.DEBUG)
    softwarecenter.log.add_filters_from_string("performance")
    fmt = logging.Formatter("%(name)s - %(message)s", None)
    softwarecenter.log.handler.setFormatter(fmt)

    from softwarecenter.testutils import (get_test_db, get_test_pkg_info,
                                          get_test_gtk3_icon_cache,
                                          get_test_categories)

    cache = get_test_pkg_info()
    db = get_test_db()
    icons = get_test_gtk3_icon_cache()

    # create a filter
    from softwarecenter.db.appfilter import AppFilter
    filter = AppFilter(db, cache)
    filter.set_supported_only(False)
    filter.set_installed_only(True)

    # get the TREEstore
    from softwarecenter.ui.gtk3.models.appstore2 import AppTreeStore
    store = AppTreeStore(db, cache, icons)

    # populate from data
    cats = get_test_categories(db)
    for cat in cats[:3]:
        with ExecutionTime("query cat '%s'" % cat.name):
            docs = db.get_docs_from_query(cat.query)
            store.set_category_documents(cat, docs)

    # ok, this is confusing - the AppView contains the AppTreeView that
    #                         is a tree or list depending on the model
    from softwarecenter.ui.gtk3.views.appview import AppView
    app_view = AppView(db, cache, icons, show_ratings=True)
    app_view.set_model(store)

    box = Gtk.VBox()
    box.pack_start(app_view, True, True, 0)

    win = Gtk.Window()
    win.add(box)
    win.connect("destroy", lambda x: Gtk.main_quit())
    win.set_size_request(600, 400)
    win.show_all()

    return win
Esempio n. 3
0
def get_test_window():
    import softwarecenter.log
    softwarecenter.log.root.setLevel(level=logging.DEBUG)
    softwarecenter.log.add_filters_from_string("performance")
    fmt = logging.Formatter("%(name)s - %(message)s", None)
    softwarecenter.log.handler.setFormatter(fmt)

    from softwarecenter.testutils import (
        get_test_db, get_test_pkg_info, get_test_gtk3_icon_cache,
        get_test_categories)

    cache = get_test_pkg_info()
    db = get_test_db()
    icons = get_test_gtk3_icon_cache()

    # create a filter
    from softwarecenter.db.appfilter import AppFilter
    filter = AppFilter(db, cache)
    filter.set_supported_only(False)
    filter.set_installed_only(True)

    # get the TREEstore
    from softwarecenter.ui.gtk3.models.appstore2 import AppTreeStore
    store = AppTreeStore(db, cache, icons)

    # populate from data
    cats = get_test_categories(db)
    for cat in cats[:3]:
        with ExecutionTime("query cat '%s'" % cat.name):
            docs = db.get_docs_from_query(cat.query)
            store.set_category_documents(cat, docs)

    # ok, this is confusing - the AppView contains the AppTreeView that
    #                         is a tree or list depending on the model
    from softwarecenter.ui.gtk3.views.appview import AppView
    app_view = AppView(db, cache, icons, show_ratings=True)
    app_view.set_model(store)

    box = Gtk.VBox()
    box.pack_start(app_view, True, True, 0)

    win = Gtk.Window()
    win.add(box)
    win.connect("destroy", lambda x: Gtk.main_quit())
    win.set_size_request(600, 400)
    win.show_all()

    return win
Esempio n. 4
0
def get_test_window(panel_type="lobby"):
    import softwarecenter.log
    softwarecenter.log.root.setLevel(level=logging.DEBUG)
    fmt = logging.Formatter("%(name)s - %(message)s", None)
    softwarecenter.log.handler.setFormatter(fmt)

    # this is *way* too complicated we should *not* need a CatView
    # here! see FIXME in RecommendationsPanel.__init__()
    from softwarecenter.ui.gtk3.views.catview_gtk import CategoriesViewGtk
    from softwarecenter.testutils import (
        get_test_db, get_test_pkg_info, get_test_gtk3_icon_cache,
        get_test_categories)
    cache = get_test_pkg_info()
    db = get_test_db()
    icons = get_test_gtk3_icon_cache()
    catview = CategoriesViewGtk(softwarecenter.paths.datadir,
                                softwarecenter.paths.APP_INSTALL_PATH,
                                cache,
                                db,
                                icons)

    if panel_type is "lobby":
        view = RecommendationsPanelLobby(catview)
    elif panel_type is "category":
        cats = get_test_categories(db)
        view = RecommendationsPanelCategory(catview, cats[0])
    else:  # panel_type is "details":
        view = RecommendationsPanelDetails(catview)

    win = Gtk.Window()
    win.connect("destroy", lambda x: Gtk.main_quit())
    win.add(view)
    win.set_data("rec_panel", view)
    win.set_size_request(600, 200)
    win.show_all()

    return win