当前位置: 首页>>代码示例>>Python>>正文


Python Gtk.Popover方法代码示例

本文整理汇总了Python中gi.repository.Gtk.Popover方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.Popover方法的具体用法?Python Gtk.Popover怎么用?Python Gtk.Popover使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gi.repository.Gtk的用法示例。


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

示例1: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Popover [as 别名]
def __init__(self, dbstate, get_person_image,
                 items_list=None, bookmarks=None):
        """
        Initialise the SearchWidget class.
        """
        GObject.GObject.__init__(self)

        self.dbstate = dbstate
        self.bookmarks = bookmarks

        # 'item' - is GooCanvas.CanvasGroup object
        self.items_list = items_list

        self.get_person_image = get_person_image

        self.search_entry = SearchEntry()
        self.popover_widget = Popover(_('Persons from current graph'),
                                      _('Other persons from database'))
        self.popover_widget.set_relative_to(self.search_entry)

        # connect signals
        self.popover_widget.connect('item-activated', self.activate_item)
        self.search_entry.connect('start-search', self.start_search)
        self.search_entry.connect('empty-search', self.hide_search_popover)
        self.search_entry.connect('focus-to-result', self.focus_results)

        # set default options
        self.search_all_db_option = True
        self.show_images_option = True
        self.show_marked_first = True

        self.search_words = None
        # search status
        self.in_search = False
        # thread for search
        self.thread = Thread()
        self.queue = Queue() 
开发者ID:gramps-project,项目名称:addons-source,代码行数:39,代码来源:search_widget.py

示例2: add_popover

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Popover [as 别名]
def add_popover(self, widget, container):
        """
        Add popover for button.
        """
        popover = Gtk.Popover()
        popover.set_relative_to(widget)
        popover.add(container)
        widget.connect("clicked", self.spinners_popup, popover)
        container.show_all() 
开发者ID:gramps-project,项目名称:addons-source,代码行数:11,代码来源:graphview.py

示例3: spinners_popup

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Popover [as 别名]
def spinners_popup(self, _widget, popover):
        """
        Popover for generations and spacing params.
        Different popup depending on gtk version.
        """
        if gtk_version >= 3.22:
            popover.popup()
        else:
            popover.show() 
开发者ID:gramps-project,项目名称:addons-source,代码行数:11,代码来源:graphview.py

示例4: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Popover [as 别名]
def __init__(self, text=None, position=Gtk.PositionType.BOTTOM, icon_name=None, padding=2):
		Gtk.Button.__init__(self, text)
		if icon_name is not None:
			self.set_image(Gtk.Image(icon_name=icon_name))
		self.connect('clicked', self.on_clicked)
		# popover
		self.popover = Gtk.Popover(relative_to=self, position=position)
		self.popover.set_border_width(padding) 
开发者ID:AXeL-dev,项目名称:Dindo-Bot,代码行数:10,代码来源:custom.py

示例5: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Popover [as 别名]
def __init__(self, screen_stack):
        Gtk.Popover.__init__(self)

        self.screen_stack = screen_stack

        self.set_can_focus(False)
        self.set_can_default(False)
        self.set_vexpand(True)

        self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        # Screen title / position editor
        self.screen_editor = ScreenEditor(self.screen_stack)
        self.screen_editor_expander = Expander('Screen Settings')
        self.screen_editor_expander.add(self.screen_editor)
        self.box.pack_start(self.screen_editor_expander, False, False, 0)

        # Scrolled Window for widgets
        self.scrolled = Gtk.ScrolledWindow()
        self.scrolled.set_propagate_natural_width(True)
        self.scrolled.set_overlay_scrolling(True)
        self.scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)

        self.scrolled.add(self.box)

        self.add(self.scrolled)

        self.image_missing = Gtk.IconTheme.get_default().load_icon('image-missing', 48, 0)
        self.get_widgets()

        self.connect('notify::visible', self.on_popup)

        # FixMe this is needed to keep the popover from showing at start
        # but make it so the children will show when it pops up
        self.show_all()
        self.hide() 
开发者ID:KurtJacobson,项目名称:hazzy,代码行数:38,代码来源:widget_chooser.py

示例6: signal_eventbox_button_press

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Popover [as 别名]
def signal_eventbox_button_press(self, widget, event):
		if not (event.type == Gdk.EventType.BUTTON_PRESS and event.button == Gdk.BUTTON_PRIMARY):
			return
		if not self._last_plugin_selected:
			return
		named_plugin = _ModelNamedRow(*self._last_plugin_selected)
		plugin_id = named_plugin.id
		if plugin_id is None:
			return
		if plugin_id in self.application.plugin_manager:
			klass = self.application.plugin_manager[plugin_id]
			compatibility_details = list(klass.compatibility)
		else:
			repo_model, catalog_model = self._get_plugin_model_parents(self._last_plugin_selected)
			compatibility_details = list(self.catalog_plugins.compatibility(catalog_model.id, repo_model.id, named_plugin.id))

		popover = Gtk.Popover()
		popover.set_relative_to(self.gobjects['label_plugin_info_for_compatible'])
		grid = Gtk.Grid()
		popover.add(grid)
		grid.insert_column(0)
		grid.insert_column(0)
		grid.insert_column(0)
		grid.set_column_spacing(3)

		compatibility_details.insert(0, ('Type', 'Value', 'Met'))
		row = 0
		for row, req in enumerate(compatibility_details):
			grid.insert_row(row)
			label = Gtk.Label(req[0])
			label.set_property('halign', Gtk.Align.START)
			grid.attach(label, 0, row, 1, 1)
			label = Gtk.Label(req[1])
			label.set_property('halign', Gtk.Align.START)
			grid.attach(label, 1, row, 1, 1)
			label = Gtk.Label(('Yes' if req[2] else 'No') if row else req[2])
			label.set_property('halign', Gtk.Align.END)
			grid.attach(label, 2, row, 1, 1)
		if not row:
			popover.destroy()
			return
		popover.show_all() 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:44,代码来源:plugin_manager.py

示例7: create_header_bar

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Popover [as 别名]
def create_header_bar(self, title):
		### Header Bar
		hb = Gtk.HeaderBar(title=title)
		logo = GdkPixbuf.Pixbuf.new_from_file_at_size(tools.get_full_path('icons/logo.png'), 24, 24)
		hb.pack_start(Gtk.Image(pixbuf=logo))
		hb.set_show_close_button(True)
		self.set_titlebar(hb)
		## Settings button
		self.settings_button = Gtk.Button()
		self.settings_button.set_image(Gtk.Image(icon_name='open-menu-symbolic'))
		self.settings_button.connect('clicked', lambda button: self.popover.show_all())
		hb.pack_end(self.settings_button)
		self.popover = Gtk.Popover(relative_to=self.settings_button, position=Gtk.PositionType.BOTTOM)
		self.popover.set_border_width(2)
		box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=5)
		self.popover.add(box)
		# Preferences button
		preferences_button = Gtk.ModelButton(' Preferences')
		preferences_button.set_alignment(0, 0.5)
		preferences_button.set_image(Gtk.Image(icon_name='preferences-desktop'))
		preferences_button.connect('clicked', self.on_preferences_button_clicked)
		box.add(preferences_button)
		# Accounts button
		accounts_button = Gtk.ModelButton(' Accounts')
		accounts_button.set_alignment(0, 0.5)
		accounts_button.set_image(Gtk.Image(icon_name='dialog-password'))
		accounts_button.connect('clicked', self.on_accounts_button_clicked)
		box.add(accounts_button)
		# Take Game Screenshot button
		self.take_screenshot_button = Gtk.ModelButton(' Take Game Screenshot')
		self.take_screenshot_button.set_alignment(0, 0.5)
		self.take_screenshot_button.set_image(Gtk.Image(icon_name='camera-photo'))
		self.take_screenshot_button.set_sensitive(False)
		self.take_screenshot_button.connect('clicked', self.on_take_screenshot_button_clicked)
		box.add(self.take_screenshot_button)
		# Open Log File button
		open_log_button = Gtk.ModelButton(' Open Log File')
		open_log_button.set_alignment(0, 0.5)
		open_log_button.set_image(Gtk.Image(icon_name='text-x-generic'))
		open_log_button.connect('clicked', lambda button: tools.open_file_in_editor(logger.get_filename()))
		box.add(open_log_button)
		# About button
		about_button = Gtk.ModelButton(' About')
		about_button.set_alignment(0, 0.5)
		about_button.set_image(Gtk.Image(icon_name='help-about'))
		about_button.connect('clicked', self.on_about_button_clicked)
		box.add(about_button) 
开发者ID:AXeL-dev,项目名称:Dindo-Bot,代码行数:49,代码来源:main.py


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