本文整理汇总了Python中softwarecenter.ui.gtk3.session.viewmanager.get_viewmanager函数的典型用法代码示例。如果您正苦于以下问题:Python get_viewmanager函数的具体用法?Python get_viewmanager怎么用?Python get_viewmanager使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_viewmanager函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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())
开发者ID:gusDuarte,项目名称:software-center-5.2,代码行数:8,代码来源:test_viewmanager.py
示例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)
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:7,代码来源:availablepane.py
示例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)
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:7,代码来源:availablepane.py
示例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
开发者ID:pombredanne,项目名称:shop,代码行数:7,代码来源:utils.py
示例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
开发者ID:armikhael,项目名称:software-center,代码行数:7,代码来源:availablepane.py
示例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)
开发者ID:gusDuarte,项目名称:software-center-5.2,代码行数:7,代码来源:test_viewmanager.py
示例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)
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:29,代码来源:availablepane.py
示例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
开发者ID:pombredanne,项目名称:shop,代码行数:35,代码来源:availablepane.py
示例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)
开发者ID:feiying,项目名称:AppStream,代码行数:7,代码来源:availablepane.py
示例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)
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:8,代码来源:availablepane.py
示例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)
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:9,代码来源:availablepane.py
示例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)
开发者ID:pombredanne,项目名称:shop,代码行数:9,代码来源:availablepane.py
示例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)
开发者ID:pombredanne,项目名称:shop,代码行数:10,代码来源:softwarepane.py
示例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
开发者ID:armikhael,项目名称:software-center,代码行数:10,代码来源:testutils.py
示例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
开发者ID:cs2c,项目名称:AppStream,代码行数:50,代码来源:softwarepane.py
示例16: __init__
def __init__(self, view_manager, datadir, db, cache, icons):
Gtk.Toolbar.__init__(self)
context = self.get_style_context()
context.add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)
# add nav history back/forward buttons...
# note: this is hacky, would be much nicer to make the custom
# self/right buttons in BackForwardButton to be
# Gtk.Activatable/Gtk.Widgets, then wire in the actions using e.g.
# self.navhistory_back_action.connect_proxy(self.back_forward.left),
# but couldn't seem to get this to work..so just wire things up
# directly
vm = get_viewmanager()
self.back_forward = vm.get_global_backforward()
self.back_forward.set_vexpand(False)
self.back_forward.set_valign(Gtk.Align.CENTER)
if self.get_direction() != Gtk.TextDirection.RTL:
_widget_set_margins(self.back_forward,
left=StockEms.MEDIUM,
right=StockEms.MEDIUM + 2)
else:
_widget_set_margins(self.back_forward,
right=StockEms.MEDIUM,
left=StockEms.MEDIUM + 2)
self._insert_as_tool_item(self.back_forward, 0)
# this is what actually draws the All Software, Installed etc buttons
self.view_switcher = ViewSwitcher(view_manager, datadir, db, cache,
icons)
self._insert_as_tool_item(self.view_switcher, 1)
item = Gtk.ToolItem()
item.set_expand(True)
self.insert(item, -1)
#~ self.init_atk_name(self.searchentry, "searchentry")
self.searchentry = vm.get_global_searchentry()
self._insert_as_tool_item(self.searchentry, -1)
# spinner
self.spinner = vm.get_global_spinner()
self.spinner.set_size_request(StockEms.XLARGE, StockEms.XLARGE)
self._insert_as_tool_item(self.spinner, -1)
if self.get_direction() != Gtk.TextDirection.RTL:
_widget_set_margins(self.searchentry, right=StockEms.MEDIUM)
else:
_widget_set_margins(self.searchentry, left=StockEms.MEDIUM)
开发者ID:cs2c,项目名称:AppStream,代码行数:49,代码来源:globalpane.py
示例17: on_category_activated
def on_category_activated(self, lobby_view, category):
""" callback when a category is selected """
LOG.debug("on_category_activated: %s %s" % (
category.name, category))
if category.subcategories:
page = self.Pages.SUBCATEGORY
else:
page = self.Pages.LIST
self.state.category = category
self.state.subcategory = None
self.state.application = None
vm = get_viewmanager()
vm.display_page(self, page, self.state)
开发者ID:pombredanne,项目名称:shop,代码行数:16,代码来源:availablepane.py
示例18: on_transaction_changed
def on_transaction_changed(self, backend, total_transactions):
LOG.debug("on_transactions_changed '%s'" % total_transactions)
pending = len(total_transactions)
self.notify_icon_of_pending_count(pending)
if pending > 0:
self.start_icon_animation()
pending_btn = self.view_buttons[ViewPages.PENDING]
if not pending_btn.get_visible():
pending_btn.set_visible(True)
else:
self.stop_icon_animation()
pending_btn = self.view_buttons[ViewPages.PENDING]
from softwarecenter.ui.gtk3.session.viewmanager import get_viewmanager
vm = get_viewmanager()
if vm.get_active_view() == 'view-page-pending':
vm.nav_back()
vm.clear_forward_history()
pending_btn.set_visible(False)
return
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:19,代码来源:viewswitcher.py
示例19: on_purchase_requested
def on_purchase_requested(self, appmanager, app, iconname, url):
if self.purchase_view.initiate_purchase(app, iconname, url):
vm = get_viewmanager()
vm.display_page(self, self.Pages.PURCHASE, self.state)
开发者ID:pombredanne,项目名称:shop,代码行数:4,代码来源:availablepane.py
示例20: __init__
def __init__(self, cache, db, distro, icons, datadir):
Gtk.VBox.__init__(self)
self.cache = cache
self.db = db
self.distro = distro
self.icons = icons
self.datadir = datadir
self.apps_filter = None
self.state = DisplayState()
self.pane_name = _("History")
# Icon cache, invalidated upon icon theme changes
self._app_icon_cache = {}
self._reset_icon_cache()
self.icons.connect('changed', self._reset_icon_cache)
self._emblems = {}
self._get_emblems(self.icons)
vm = get_viewmanager()
self.searchentry = vm.get_global_searchentry()
self.toolbar = Gtk.Toolbar()
self.toolbar.show()
self.toolbar.set_style(Gtk.ToolbarStyle.TEXT)
self.pack_start(self.toolbar, False, True, 0)
all_action = Gtk.RadioAction('filter_all', _('All Changes'), None,
None, self.ALL)
all_action.connect('changed', self.change_filter)
all_button = all_action.create_tool_item()
self.toolbar.insert(all_button, 0)
installs_action = Gtk.RadioAction('filter_installs',
_('Installations'), None, None, self.INSTALLED)
installs_action.join_group(all_action)
installs_button = installs_action.create_tool_item()
self.toolbar.insert(installs_button, 1)
upgrades_action = Gtk.RadioAction(
'filter_upgrads', _('Updates'), None, None, self.UPGRADED)
upgrades_action.join_group(all_action)
upgrades_button = upgrades_action.create_tool_item()
self.toolbar.insert(upgrades_button, 2)
removals_action = Gtk.RadioAction(
'filter_removals', _('Removals'), None, None, self.REMOVED)
removals_action.join_group(all_action)
removals_button = removals_action.create_tool_item()
self.toolbar.insert(removals_button, 3)
self.toolbar.connect('draw', self.on_toolbar_draw)
self._actions_list = all_action.get_group()
self._set_actions_sensitive(False)
self.view = Gtk.TreeView()
self.view.set_headers_visible(False)
self.view.show()
self.history_view = Gtk.ScrolledWindow()
self.history_view.set_policy(Gtk.PolicyType.AUTOMATIC,
Gtk.PolicyType.AUTOMATIC)
self.history_view.show()
self.history_view.add(self.view)
# make a spinner to display while history is loading
self.spinner_notebook = SpinnerNotebook(
self.history_view, _('Loading history'))
self.pack_start(self.spinner_notebook, True, True, 0)
self.store = Gtk.TreeStore(*self.COL_TYPES)
self.visible_changes = 0
self.store_filter = self.store.filter_new(None)
self.store_filter.set_visible_func(self.filter_row, None)
self.view.set_model(self.store_filter)
all_action.set_active(True)
self.last = None
# to save (a lot of) time at startup we load history later, only when
# it is selected to be viewed
self.history = None
self.column = Gtk.TreeViewColumn(_('Date'))
self.view.append_column(self.column)
self.cell_icon = Gtk.CellRendererPixbuf()
self.column.pack_start(self.cell_icon, False)
self.column.set_cell_data_func(self.cell_icon, self.render_cell_icon)
self.cell_text = Gtk.CellRendererText()
self.column.pack_start(self.cell_text, True)
self.column.set_cell_data_func(self.cell_text, self.render_cell_text)
# busy cursor
self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH)
开发者ID:fossasia,项目名称:x-mario-center,代码行数:95,代码来源:historypane.py
注:本文中的softwarecenter.ui.gtk3.session.viewmanager.get_viewmanager函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论