• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python enquire.AppEnquire类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中softwarecenter.db.enquire.AppEnquire的典型用法代码示例。如果您正苦于以下问题:Python AppEnquire类的具体用法?Python AppEnquire怎么用?Python AppEnquire使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了AppEnquire类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_app_view

    def test_app_view(self):
        from softwarecenter.ui.gtk3.views.appview import get_test_window
        enquirer = AppEnquire(self.cache, self.db)
        enquirer.set_query(xapian.Query(""),
                           sortmode=SortMethods.BY_CATALOGED_TIME,
                           limit=10,
                           nonblocking_load=False)

        # get test window
        win = get_test_window()
        appview = win.get_data("appview")
        # set matches
        appview.clear_model()
        appview.display_matches(enquirer.matches)
        do_events()
        # verify that the order is actually the correct one
        model = appview.tree_view.get_model()
        docs_in_model = [item[0] for item in model]
        docs_from_enquirer = [m.document for m in enquirer.matches]
        self.assertEqual(len(docs_in_model), 
                         len(docs_from_enquirer))
        for i in range(len(docs_in_model)):
            self.assertEqual(self.db.get_pkgname(docs_in_model[i]),
                             self.db.get_pkgname(docs_from_enquirer[i]))
        win.destroy()
开发者ID:feiying,项目名称:AppStream,代码行数:25,代码来源:test_app_view.py


示例2: get_test_window

def get_test_window():
    from softwarecenter.testutils import (
        get_test_db, get_test_pkg_info, get_test_gtk3_icon_cache)
    from softwarecenter.db.enquire import AppEnquire
    from softwarecenter.ui.gtk3.models.appstore2 import AppListStore
    import xapian

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

    # create the view
    appview = AppView(db, cache, icons, show_ratings=True)
    liststore = AppListStore(db, cache, icons)
    appview.set_model(liststore)

    # do a simple query and display that
    enquirer = AppEnquire(cache, db)
    enquirer.set_query(xapian.Query(""),
                       sortmode=SortMethods.BY_CATALOGED_TIME,
                       limit=20,
                       nonblocking_load=False)
    appview.display_matches(enquirer.matches)

    # and put it in the window
    win = Gtk.Window()
    win.add(appview)
    win.set_data("appview", appview)

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

    return win
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:34,代码来源:appview.py


示例3: test_app_enquire

 def test_app_enquire(self):
     db = StoreDatabase(cache=self.cache)
     db.open()
     # test the AppEnquire engine
     enquirer = AppEnquire(self.cache, db)
     enquirer.set_query(xapian.Query("a"), nonblocking_load=False)
     self.assertTrue(len(enquirer.get_docids()) > 0)
开发者ID:pombredanne,项目名称:xmario_center,代码行数:7,代码来源:test_database.py


示例4: test_app_store

    def test_app_store(self):
        # get a enquire object
        enquirer = AppEnquire(self.cache, self.db)
        enquirer.set_query(xapian.Query(""))

        # get a AppListStore and run functions on it
        model = AppListStore(self.db, self.cache, self.icons)

        # test if set from matches works
        self.assertEqual(len(model), 0)
        model.set_from_matches(enquirer.matches)
        self.assertTrue(len(model) > 0)
        # ensure the first row has a xapian doc type
        self.assertEqual(type(model[0][0]), xapian.Document)
        # lazy loading of the docs
        self.assertEqual(model[100][0], None)

        # test the load range stuff
        model.load_range(indices=[100], step=15)
        self.assertEqual(type(model[100][0]), xapian.Document)

        # ensure buffer_icons works and loads stuff into the cache
        model.buffer_icons()
        self.assertEqual(len(model.icon_cache), 0)
        while Gtk.events_pending():
            Gtk.main_iteration()
        self.assertTrue(len(model.icon_cache) > 0)

        # ensure clear works
        model.clear()
        self.assertEqual(model.current_matches, None)
开发者ID:gusDuarte,项目名称:software-center-5.2,代码行数:31,代码来源:test_appstore2.py


示例5: get_test_enquirer_matches

def get_test_enquirer_matches(db, query=None, limit=20, sortmode=0):
    if query is None:
        query = xapian.Query("")
    enquirer = AppEnquire(db._aptcache, db)
    enquirer.set_query(query,
                       sortmode=sortmode,
                       limit=limit,
                       nonblocking_load=False)
    return enquirer.matches
开发者ID:pombredanne,项目名称:shop,代码行数:9,代码来源:utils.py


示例6: _update_appcount

    def _update_appcount(self):
        enq = AppEnquire(self.cache, self.db)

        distro = get_distro()
        if get_global_filter().supported_only:
            query = distro.get_supported_query()
        else:
            query = xapian.Query('')

        length = enq.get_estimated_matches_count(query)
        text = gettext.ngettext("%(amount)s item", "%(amount)s items", length
                                ) % {'amount': length}
        self.appcount.set_text(text)
开发者ID:fossasia,项目名称:x-mario-center,代码行数:13,代码来源:catview_gtk.py


示例7: DBSearchTestCase

class DBSearchTestCase(unittest.TestCase):

    APP_INFO_JSON = """
[
 {
    "application_name": "The apt",
    "package_name": "apt",
    "description": "meep"
 }
]
"""

    @classmethod
    def setUpClass(cls):
        cache = get_pkg_info()
        cache.open()
        db = xapian.WritableDatabase(TEST_DB, xapian.DB_CREATE_OR_OVERWRITE)
        update_from_json_string(db, cache, cls.APP_INFO_JSON, origin="local")
        db.close()

    def setUp(self):
        # create a fake database to simualte a run of software-center-agent
        # create a StoreDatabase and add our other db
        self.db = get_test_db()
        self.db.add_database(xapian.Database(TEST_DB))
        self.db.open(use_axi=True)
        self.enquire = AppEnquire(self.db._aptcache, self.db)

    def test_search_app_pkgname_duplication_lp891613(self):
        # simulate a pkg "apt" that is both in the agent and in the x-a-i db
        search_term = "apt"
        search_query = self.db.get_query_list_from_search_entry(search_term)
        self.enquire.set_query(search_query, nonblocking_load=False)
        self.assertTrue(len(self.enquire._matches) > 2)
        for m in self.enquire._matches:
            doc = m.document
            # ensure that all hits are "apps" and do not come from a-x-i
            self.assertNotEqual(doc.get_value(XapianValues.PKGNAME), "")

    def test_search_custom_pkgs_list_lp1043159(self):
        # simulate a pkg "apt" that is both in the agent and in the x-a-i db
        pkgs = ["apt", "gedit"]
        search_query = self.db.get_query_for_pkgnames(pkgs)
        self.enquire.set_query(
            search_query,
            # custom package lists are always in this mode
            nonapps_visible=NonAppVisibility.ALWAYS_VISIBLE,
            nonblocking_load=False,
        )
        self.assertEqual(len(self.enquire._matches), 2)
开发者ID:mortenpi,项目名称:ubuntu-software-center,代码行数:50,代码来源:test_database.py


示例8: get_documents

 def get_documents(self, db):
     """ return the database docids for the given category """
     enq = AppEnquire(db._aptcache, db)
     app_filter = AppFilter(db, db._aptcache)
     if "available-only" in self.flags:
         app_filter.set_available_only(True)
     if "not-installed-only" in self.flags:
         app_filter.set_not_installed_only(True)
     enq.set_query(self.query,
                   limit=self.item_limit,
                   filter=app_filter,
                   sortmode=self.sortmode,
                   nonapps_visible=NonAppVisibility.ALWAYS_VISIBLE,
                   nonblocking_load=False)
     return enq.get_documents()
开发者ID:thnguyn2,项目名称:ECE_527_MP,代码行数:15,代码来源:categories.py


示例9: setUp

 def setUp(self):
     # create a fake database to simualte a run of software-center-agent
     # create a StoreDatabase and add our other db
     self.db = get_test_db()
     self.db.add_database(xapian.Database(TEST_DB))
     self.db.open(use_axi=True)
     self.enquire = AppEnquire(self.db._aptcache, self.db)
开发者ID:mortenpi,项目名称:ubuntu-software-center,代码行数:7,代码来源:test_database.py


示例10: _ceibal_get_docs

 def _ceibal_get_docs(self):
     """ return the database docids for the given category """
     enq = AppEnquire(self.db._aptcache, self.db)
     app_filter = AppFilter(self.db, self.db._aptcache)
     
     app_filter.set_available_only(True)
     #app_filter.set_not_installed_only(True)
     p = "http://apt.ceibal.edu.uy/recommendations/list.json"
     data = json.load(urllib2.urlopen(p))
     query = get_query_for_pkgnames(data['packages']) 
     enq.set_query(query,
                   limit=20,
                   filter=app_filter,
                   sortmode=0,
                   nonapps_visible=NonAppVisibility.ALWAYS_VISIBLE,
                   nonblocking_load=False)
     return enq.get_documents()
开发者ID:gusDuarte,项目名称:software-center-5.2,代码行数:17,代码来源:catview_gtk.py


示例11: _update_appcount

    def _update_appcount(self):
        enq = AppEnquire(self.cache, self.db)

        distro = get_distro()
        if get_global_filter().supported_only:
            query = distro.get_supported_query()
        else:
            query = xapian.Query('')

        enq.set_query(query,
                      limit=0,
                      nonapps_visible=NonAppVisibility.ALWAYS_VISIBLE,
                      nonblocking_load=True)

        length = len(enq.matches)
        text = gettext.ngettext("%(amount)s item", "%(amount)s items", length
                                ) % { 'amount' : length, }
        self.appcount.set_text(text)
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:18,代码来源:catview_gtk.py


示例12: test_app_enquire

    def test_app_enquire(self):
        db = get_test_db()
        cache = get_test_pkg_info()

        xfilter = AppFilter(cache, db)
        enquirer = AppEnquire(cache, db)
        terms = [ "app", "this", "the", "that", "foo", "tool", "game", 
                  "graphic", "ubuntu", "debian", "gtk", "this", "bar", 
                  "baz"]

        # run a bunch of the querries in parallel
        for nonblocking in [False, True]:
            for i in range(10):
                for term in terms:
                    enquirer.set_query(
                        search_query=xapian.Query(term),
                        limit=0,
                        filter=xfilter,
                        nonblocking_load=nonblocking)
        # give the threads a bit of time
        time.sleep(5)
开发者ID:armikhael,项目名称:software-center,代码行数:21,代码来源:test_enquire.py


示例13: _get_toprated_category_content

    def _get_toprated_category_content(self):
        toprated_cat = get_category_by_name(self.categories, 
                                            u"Top Rated")  # unstranslated name
        if toprated_cat is None:
            LOG.warn("No 'toprated' category found!!")
            return None, []

        enq = AppEnquire(self.cache, self.db)
        app_filter = AppFilter(self.db, self.cache)
        enq.set_query(toprated_cat.query,
                      limit=TOP_RATED_CAROUSEL_LIMIT,
                      sortmode=toprated_cat.sortmode,
                      filter=app_filter,
                      nonapps_visible=NonAppVisibility.ALWAYS_VISIBLE,
                      nonblocking_load=False)

        if not hasattr(self, "helper"):
            self.helper = AppPropertiesHelper(self.db,
                                              self.cache,
                                              self.icons)

        return toprated_cat, enq.get_documents()
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:22,代码来源:catview_gtk.py


示例14: __init__

    def __init__(self, cache, db, distro, icons, datadir, show_ratings=True):

        Gtk.VBox.__init__(self)
        BasePane.__init__(self)

        # other classes we need
        self.enquirer = AppEnquire(cache, db)
        self._query_complete_handler = self.enquirer.connect(
                            "query-complete", self.on_query_complete)

        self.cache = cache
        self.db = db
        self.distro = distro
        self.icons = icons
        self.datadir = datadir
        self.show_ratings = show_ratings
        self.backend = get_install_backend()
        self.nonapps_visible = NonAppVisibility.MAYBE_VISIBLE
        # refreshes can happen out-of-bound so we need to be sure
        # that we only set the new model (when its available) if
        # the refresh_seq_nr of the ready model matches that of the
        # request (e.g. people click on ubuntu channel, get impatient, click
        # on partner channel)
        self.refresh_seq_nr = 0
        # this should be initialized
        self.apps_search_term = ""
        # Create the basic frame for the common view
        self.state = DisplayState()
        vm = get_viewmanager()
        self.searchentry = vm.get_global_searchentry()
        self.back_forward = vm.get_global_backforward()
        # a notebook below
        self.notebook = Gtk.Notebook()
        if not "SOFTWARE_CENTER_DEBUG_TABS" in os.environ:
            self.notebook.set_show_tabs(False)
        self.notebook.set_show_border(False)
        # make a spinner view to display while the applist is loading
        self.spinner_notebook = SpinnerNotebook(self.notebook)
        self.pack_start(self.spinner_notebook, True, True, 0)

        # add a bar at the bottom (hidden by default) for contextual actions
        self.action_bar = ActionBar()
        self.pack_start(self.action_bar, False, True, 0)

        # cursor
        self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH)

        # views to be created in init_view
        self.app_view = None
        self.app_details_view = None
开发者ID:cs2c,项目名称:AppStream,代码行数:50,代码来源:softwarepane.py


示例15: _get_new_category_content

    def _get_new_category_content(self):
        whatsnew_cat = get_category_by_name(self.categories, 
                                            u"What\u2019s New") # unstranslated name
        if whatsnew_cat is None:
            LOG.warn("No 'new' category found!!")
            return None, []

        enq = AppEnquire(self.cache, self.db)
        app_filter = AppFilter(self.db, self.cache)
        app_filter.set_available_only(True)
        app_filter.set_not_installed_only(True)
        enq.set_query(whatsnew_cat.query,
                      limit=8,
                      filter=app_filter,
                      sortmode=SortMethods.BY_CATALOGED_TIME,
                      nonapps_visible=NonAppVisibility.ALWAYS_VISIBLE,
                      nonblocking_load=False)

        if not hasattr(self, "helper"):
            self.helper = AppPropertiesHelper(self.db,
                                              self.cache,
                                              self.icons)

        return whatsnew_cat, enq.get_documents()
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:24,代码来源:catview_gtk.py


示例16: __init__

    def __init__(self, datadir, desktopdir, cache, db, icons,
                 apps_filter, apps_limit=0, root_category=None):
        CategoriesViewGtk.__init__(self, datadir, desktopdir, cache, db, icons,
                                   apps_filter, apps_limit)
        # state
        self._built = False
        # data
        self.root_category = root_category
        self.enquire = AppEnquire(self.cache, self.db)
        self.properties_helper = AppPropertiesHelper(
            self.db, self.cache, self.icons)

        # sections
        self.current_category = None
        self.departments = None
        self.top_rated = None
        self.recommended_for_you_in_cat = None
        self.appcount = None

        # widgetry
        self.vbox.set_margin_left(StockEms.MEDIUM - 2)
        self.vbox.set_margin_right(StockEms.MEDIUM - 2)
        self.vbox.set_margin_top(StockEms.MEDIUM)
        return
开发者ID:fossasia,项目名称:x-mario-center,代码行数:24,代码来源:catview_gtk.py


示例17: SubCategoryViewGtk

class SubCategoryViewGtk(CategoriesViewGtk):

    def __init__(self, datadir, desktopdir, cache, db, icons,
                 apps_filter, apps_limit=0, root_category=None):
        CategoriesViewGtk.__init__(self, datadir, desktopdir, cache, db, icons,
                                   apps_filter, apps_limit)
        # state
        self._built = False
        # data
        self.root_category = root_category
        self.enquire = AppEnquire(self.cache, self.db)
        self.properties_helper = AppPropertiesHelper(
            self.db, self.cache, self.icons)

        # sections
        self.current_category = None
        self.departments = None
        self.top_rated = None
        self.recommended_for_you_in_cat = None
        self.appcount = None

        # widgetry
        self.vbox.set_margin_left(StockEms.MEDIUM - 2)
        self.vbox.set_margin_right(StockEms.MEDIUM - 2)
        self.vbox.set_margin_top(StockEms.MEDIUM)
        return

    def _get_sub_top_rated_content(self, category):
        app_filter = AppFilter(self.db, self.cache)
        self.enquire.set_query(category.query,
                               limit=TOP_RATED_CAROUSEL_LIMIT,
                               sortmode=SortMethods.BY_TOP_RATED,
                               filter=app_filter,
                               nonapps_visible=NonAppVisibility.ALWAYS_VISIBLE,
                               nonblocking_load=False)
        return self.enquire.get_documents()

    @wait_for_apt_cache_ready  # be consistent with new apps
    def _update_sub_top_rated_content(self, category):
        self.top_rated.remove_all()
        # FIXME: should this be m = "%s %s" % (_(gettext text), header text) ??
        # TRANSLATORS: %s is a category name, like Internet or Development
        # Tools
        m = _('Top Rated %(category)s') % {
            'category': GObject.markup_escape_text(self.header)}
        self.top_rated_frame.set_header_label(m)
        docs = self._get_sub_top_rated_content(category)
        self._add_tiles_to_flowgrid(docs, self.top_rated,
                                    TOP_RATED_CAROUSEL_LIMIT)
        return

    def _append_sub_top_rated(self):
        self.top_rated = FlowableGrid()
        self.top_rated.set_row_spacing(6)
        self.top_rated.set_column_spacing(6)
        self.top_rated_frame = FramedHeaderBox()
        self.top_rated_frame.pack_start(self.top_rated, True, True, 0)
        self.vbox.pack_start(self.top_rated_frame, False, True, 0)
        return

    def _update_recommended_for_you_in_cat_content(self, category):
        if (self.recommended_for_you_in_cat and
            self.recommended_for_you_in_cat.get_parent()):
            self.vbox.remove(self.recommended_for_you_in_cat)
        self.recommended_for_you_in_cat = RecommendationsPanelCategory(
                                                                    self,
                                                                    category)
        # only show the panel in the categories view when the user
        # is opted in to the recommender service
        # FIXME: this is needed vs. a simple hide() on the widget because
        #        we do a show_all on the view
        if self.recommended_for_you_in_cat.recommender_agent.is_opted_in():
            self.vbox.pack_start(self.recommended_for_you_in_cat,
                                        False, False, 0)

    def _update_subcat_departments(self, category, num_items):
        self.departments.remove_all()

        # set the subcat header
        m = "<b><big>%s</big></b>"
        self.subcat_label.set_markup(m % GObject.markup_escape_text(
            self.header))

        # sort Category.name's alphabetically
        sorted_cats = categories_sorted_by_name(self.categories)
        enquire = xapian.Enquire(self.db.xapiandb)
        app_filter = AppFilter(self.db, self.cache)
        for cat in sorted_cats:
            # add the subcategory if and only if it is non-empty
            enquire.set_query(cat.query)

            if len(enquire.get_mset(0, 1)):
                tile = CategoryTile(cat.name, cat.iconname)
                tile.connect('clicked', self.on_category_clicked, cat)
                self.departments.add_child(tile)

        # partialy work around a (quite rare) corner case
        if num_items == 0:
            enquire.set_query(xapian.Query(xapian.Query.OP_AND,
                                category.query,
#.........这里部分代码省略.........
开发者ID:fossasia,项目名称:x-mario-center,代码行数:101,代码来源:catview_gtk.py


示例18: SoftwarePane

class SoftwarePane(Gtk.VBox, BasePane):
    """ Common base class for AvailablePane and InstalledPane"""

    class Pages:
        NAMES = ('appview', 'details', 'spinner')
        APPVIEW = 0
        DETAILS = 1
        SPINNER = 2

    __gsignals__ = {
        "app-list-changed": (GObject.SignalFlags.RUN_LAST,
                             None,
                             (int,),
                            ),
    }
    PADDING = 6

    def __init__(self, cache, db, distro, icons, datadir, show_ratings=True):

        Gtk.VBox.__init__(self)
        BasePane.__init__(self)

        # other classes we need
        self.enquirer = AppEnquire(cache, db)
        self._query_complete_handler = self.enquirer.connect(
                            "query-complete", self.on_query_complete)

        self.cache = cache
        self.db = db
        self.distro = distro
        self.icons = icons
        self.datadir = datadir
        self.show_ratings = show_ratings
        self.backend = get_install_backend()
        self.nonapps_visible = NonAppVisibility.MAYBE_VISIBLE
        # refreshes can happen out-of-bound so we need to be sure
        # that we only set the new model (when its available) if
        # the refresh_seq_nr of the ready model matches that of the
        # request (e.g. people click on ubuntu channel, get impatient, click
        # on partner channel)
        self.refresh_seq_nr = 0
        # this should be initialized
        self.apps_search_term = ""
        # Create the basic frame for the common view
        self.state = DisplayState()
        vm = get_viewmanager()
        self.searchentry = vm.get_global_searchentry()
        self.back_forward = vm.get_global_backforward()
        # a notebook below
        self.notebook = Gtk.Notebook()
        if not "SOFTWARE_CENTER_DEBUG_TABS" in os.environ:
            self.notebook.set_show_tabs(False)
        self.notebook.set_show_border(False)
        # make a spinner view to display while the applist is loading
        self.spinner_notebook = SpinnerNotebook(self.notebook)
        self.pack_start(self.spinner_notebook, True, True, 0)

        # add a bar at the bottom (hidden by default) for contextual actions
        self.action_bar = ActionBar()
        self.pack_start(self.action_bar, False, True, 0)

        # cursor
        self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH)

        # views to be created in init_view
        self.app_view = None
        self.app_details_view = None

    def init_view(self):
        """
        Initialize those UI components that are common to all subclasses of
        SoftwarePane.  Note that this method is intended to be called by
        the subclass itself at the start of its own init_view() implementation.
        """
        # common UI elements (applist and appdetails)
        # its the job of the Child class to put it into a good location
        # list
        self.box_app_list = Gtk.VBox()

        # search aid
        self.search_aid = SearchAid(self)
        self.box_app_list.pack_start(self.search_aid, False, False, 0)

        self.app_view = AppView(self.db, self.cache,
                                self.icons, self.show_ratings)
        self.app_view.connect("sort-method-changed",
            self.on_app_view_sort_method_changed)

        self.init_atk_name(self.app_view, "app_view")
        self.box_app_list.pack_start(self.app_view, True, True, 0)
        self.app_view.connect("application-selected",
                              self.on_application_selected)
        self.app_view.connect("application-activated",
                              self.on_application_activated)

        # details
        self.scroll_details = Gtk.ScrolledWindow()
        self.scroll_details.set_policy(Gtk.PolicyType.AUTOMATIC,
                                        Gtk.PolicyType.AUTOMATIC)
        self.app_details_view = AppDetailsView(self.db,
#.........这里部分代码省略.........
开发者ID:cs2c,项目名称:AppStream,代码行数:101,代码来源:softwarepane.py


示例19: SoftwarePane

class SoftwarePane(Gtk.VBox, BasePane):
    """ Common base class for AvailablePane and InstalledPane"""

    class Pages:
        NAMES = ('appview', 'details', 'spinner')
        APPVIEW = 0
        DETAILS = 1
        SPINNER = 2

    __gsignals__ = {
        "app-list-changed" : (GObject.SignalFlags.RUN_LAST,
                              None, 
                              (int,),
                             ),
    }
    PADDING = 6

    def __init__(self, cache, db, distro, icons, datadir, show_ratings=True):

        Gtk.VBox.__init__(self)
        BasePane.__init__(self)

        # other classes we need        
        self.enquirer = AppEnquire(cache, db)
        self._query_complete_handler = self.enquirer.connect(
                            "query-complete", self.on_query_complete)

        self.cache = cache
        self.db = db
        self.distro = distro
        self.icons = icons
        self.datadir = datadir
        self.show_ratings = show_ratings
        self.backend = get_install_backend()
        self.nonapps_visible = NonAppVisibility.MAYBE_VISIBLE
        # refreshes can happen out-of-bound so we need to be sure
        # that we only set the new model (when its available) if
        # the refresh_seq_nr of the ready model matches that of the
        # request (e.g. people click on ubuntu channel, get impatient, click
        # on partner channel)
        self.refresh_seq_nr = 0
        # keep track of applications that are candidates to be added
        # to the Unity launcher
        self.unity_launcher_items = {}
        # this should be initialized
        self.apps_search_term = ""
        # Create the basic frame for the common view
        self.state = DisplayState()
        vm = get_viewmanager()
        self.searchentry = vm.get_global_searchentry()
        self.back_forward = vm.get_global_backforward()
        # a notebook below
        self.notebook = Gtk.Notebook()
        if not "SOFTWARE_CENTER_DEBUG_TABS" in os.environ:
            self.notebook.set_show_tabs(False)
        self.notebook.set_show_border(False)
        # an empty notebook, where the details view will eventually go
        self.details_notebook = Gtk.Notebook()
        self.details_notebook.set_show_border(False)
        # make a spinner view to display while the applist is loading
        self.spinner_view = SpinnerView()
        self.spinner_notebook = Gtk.Notebook()
        self.spinner_notebook.set_show_tabs(False)
        self.spinner_notebook.set_show_border(False)
        self.spinner_notebook.append_page(self.notebook, None)
        self.spinner_notebook.append_page(self.details_notebook, None)
        self.spinner_notebook.append_page(self.spinner_view, None)
        
        self.pack_start(self.spinner_notebook, True, True, 0)

        # add a bar at the bottom (hidden by default) for contextual actions
        self.action_bar = ActionBar()
        self.pack_start(self.action_bar, False, True, 0)

        # cursor
        self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH)
        
        # views to be created in init_view
        self.app_view = None
        self.app_details_view = None

    def init_view(self):
        """
        Initialize those UI components that are common to all subclasses of
        SoftwarePane.  Note that this method is intended to be called by
        the subclass itself at the start of its own init_view() implementation.
        """
        # common UI elements (applist and appdetails) 
        # its the job of the Child class to put it into a good location
        # list
        self.box_app_list = Gtk.VBox()

        # search aid
        self.search_aid = SearchAid(self)
        self.box_app_list.pack_start(self.search_aid, False, False, 0)

        self.app_view = AppView(self.db, self.cache,
                                self.icons, self.show_ratings)
        self.app_view.sort_methods_combobox.connect(
                    "changed",
#.........这里部分代码省略.........
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:101,代码来源:softwarepane.py



注:本文中的softwarecenter.db.enquire.AppEnquire类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pkginfo.get_pkg_info函数代码示例发布时间:2022-05-27
下一篇:
Python database.StoreDatabase类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap