本文整理汇总了Python中softwarecenter.ui.gtk3.session.viewmanager.get_viewmanager函数的典型用法代码示例。如果您正苦于以下问题:Python get_viewmanager函数的具体用法?Python get_viewmanager怎么用?Python get_viewmanager使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_viewmanager函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_viewmanager
def test_get_viewmanager(self):
view_manager = get_viewmanager()
self.assertNotEqual(view_manager, None)
# is a singleton singleton
view_manager2 = get_viewmanager()
self.assertIs(view_manager, view_manager2)
# test creating it twice raises a error
self.assertRaises(ValueError, ViewManager, Gtk.Notebook())
示例2: on_purchase_requested
def on_purchase_requested(self, widget, app, url):
self.appdetails = app.get_details(self.db)
iconname = self.appdetails.icon
self.purchase_view.initiate_purchase(app, iconname, url)
vm = get_viewmanager()
vm.display_page(self, AvailablePane.Pages.PURCHASE, self.state, self.display_purchase)
示例3: on_previous_purchases_activated
def on_previous_purchases_activated(self, query):
""" called to activate the previous purchases view """
# print cat_view, name, query
LOG.debug("on_previous_purchases_activated with query: %s" % query)
self.previous_purchases_query = query
vm = get_viewmanager()
vm.display_page(self, AvailablePane.Pages.LIST, self.state, self.display_previous_purchases)
示例4: get_test_gtk3_viewmanager
def get_test_gtk3_viewmanager():
vm = get_viewmanager()
if not vm:
notebook = Gtk.Notebook()
vm = ViewManager(notebook)
vm.view_to_pane = {None: None}
return vm
示例5: on_purchase_requested
def on_purchase_requested(self, appmanager, app, iconname, url):
self.purchase_view.initiate_purchase(app, iconname, url)
vm = get_viewmanager()
vm.display_page(
self, AvailablePane.Pages.PURCHASE, self.state,
self.display_purchase)
return
示例6: setUp
def setUp(self):
# create it once, it becomes global instance
self.vm = get_viewmanager()
if self.vm is None:
self.vm = ViewManager(Gtk.Notebook())
self.addCleanup(self.vm.destroy)
示例7: on_search_terms_changed
def on_search_terms_changed(self, widget, new_text):
"""callback when the search entry widget changes"""
LOG.debug("on_search_terms_changed: %s" % new_text)
self.state.search_term = new_text
# do not hide technical items for a custom list search
if self._is_custom_list_search(self.state.search_term):
self.nonapps_visible = NonAppVisibility.ALWAYS_VISIBLE
vm = get_viewmanager()
# yeah for special cases - as discussed on irc, mpt
# wants this to return to the category screen *if*
# we are searching but we are not in any category
if not self.state.category and not new_text:
# category activate will clear search etc
self.state.reset()
vm.display_page(self, AvailablePane.Pages.LOBBY, self.state, self.display_lobby_page)
return False
elif self.state.subcategory and not new_text:
vm.display_page(self, AvailablePane.Pages.LIST, self.state, self.display_app_view_page)
return False
elif self.state.category and self.state.category.subcategories and not new_text:
vm.display_page(self, AvailablePane.Pages.SUBCATEGORY, self.state, self.display_subcategory_page)
return False
vm.display_page(self, AvailablePane.Pages.LIST, self.state, self.display_search_page)
示例8: on_search_terms_changed
def on_search_terms_changed(self, widget, new_text):
"""callback when the search entry widget changes"""
LOG.debug("on_search_terms_changed: %s" % new_text)
# reset the flag in the app_view because each new search should
# reset the sort criteria
self.app_view.reset_default_sort_mode()
self.state.search_term = new_text
# do not hide technical items for a custom list search
if self._is_custom_list_search(self.state.search_term):
self.nonapps_visible = NonAppVisibility.ALWAYS_VISIBLE
vm = get_viewmanager()
adj = self.app_view.tree_view_scroll.get_vadjustment()
if adj:
adj.set_value(0.0)
# yeah for special cases - as discussed on irc, mpt
# wants this to return to the category screen *if*
# we are searching but we are not in any category or channel
if not self.state.category and not self.state.channel and not new_text:
# category activate will clear search etc
self.state.reset()
vm.display_page(self, self.Pages.LOBBY, self.state)
elif self.state.subcategory and not new_text:
vm.display_page(self, self.Pages.LIST, self.state)
elif (self.state.category and
self.state.category.subcategories and not new_text):
vm.display_page(self, self.Pages.SUBCATEGORY, self.state)
else:
vm.display_page(self, self.Pages.LIST, self.state)
return False
示例9: on_application_activated
def on_application_activated(self, appview, app):
"""callback when an app is clicked"""
LOG.debug("on_application_activated: '%s'" % app)
self.state.application = app
vm = get_viewmanager()
vm.display_page(self, AvailablePane.Pages.DETAILS, self.state,
self.display_details_page)
示例10: on_subcategory_activated
def on_subcategory_activated(self, subcat_view, category):
LOG.debug("on_subcategory_activated: %s %s" % (category.name, category))
self.state.subcategory = category
self.state.application = None
page = AvailablePane.Pages.LIST
vm = get_viewmanager()
vm.display_page(self, page, self.state, self.display_app_view_page)
示例11: _return_to_appdetails_view
def _return_to_appdetails_view(self):
vm = get_viewmanager()
vm.nav_back()
# don't keep the purchase view in navigation history
# as its contents are no longer valid
vm.clear_forward_history()
window = self.get_window()
if window is not None:
window.set_cursor(None)
示例12: on_previous_purchases_activated
def on_previous_purchases_activated(self, query):
""" called to activate the previous purchases view """
#print cat_view, name, query
LOG.debug("on_previous_purchases_activated with query: %s" % query)
self.state.channel = SoftwareChannel("Previous Purchases",
"software-center-agent",
None, channel_query=query)
vm = get_viewmanager()
vm.display_page(self, self.Pages.PREVIOUS_PURCHASES, self.state)
示例13: on_application_activated
def on_application_activated(self, appview, app):
"""Callback when an app is clicked."""
LOG.debug("%r.on_application_activated: %r",
self.__class__.__name__, app)
self.state.application = app
vm = get_viewmanager()
# self.Pages will access the Page definition of each child correctly
vm.display_page(self, self.Pages.DETAILS, self.state)
示例14: get_test_gtk3_viewmanager
def get_test_gtk3_viewmanager():
from gi.repository import Gtk
from softwarecenter.ui.gtk3.session.viewmanager import (
ViewManager, get_viewmanager)
vm = get_viewmanager()
if not vm:
notebook = Gtk.Notebook()
vm = ViewManager(notebook)
vm.view_to_pane = {None : None}
return vm
示例15: __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