Python gi.repository.Gtk.Menu() Examples

The following are 30 code examples of gi.repository.Gtk.Menu(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module gi.repository.Gtk , or try the search function .
Example #1
Source File: widgets.py    From zim-desktop-wiki with GNU General Public License v2.0 6 votes vote down vote up
def populate_popup_expand_collapse(self, menu, prepend=False):
		'''Adds "Expand _all" and "Co_llapse all" items to a context
		menu. Called automatically by the default implementation of
		L{do_initialize_popup()}.
		@param menu: the C{Gtk.Menu} object for the popup
		@param prepend: if C{False} append, if C{True} prepend
		'''
		expand = Gtk.MenuItem.new_with_mnemonic(_("Expand _All")) # T: menu item in context menu
		expand.connect_object('activate', self.__class__.expand_all, self)
		collapse = Gtk.MenuItem.new_with_mnemonic(_("_Collapse All")) # T: menu item in context menu
		collapse.connect_object('activate', self.__class__.collapse_all, self)

		populate_popup_add_separator(menu, prepend=prepend)
		if prepend:
			menu.prepend(collapse)
			menu.prepend(expand)
		else:
			menu.append(expand)
			menu.append(collapse)

		menu.show_all() 
Example #2
Source File: managers.py    From king-phisher with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def get_popup_copy_submenu(self):
		"""
		Create a :py:class:`Gtk.Menu` with entries for copying cell data from
		the treeview.

		:return: The populated copy popup menu.
		:rtype: :py:class:`Gtk.Menu`
		"""
		copy_menu = Gtk.Menu.new()
		for column_title, store_id in self.column_titles.items():
			menu_item = Gtk.MenuItem.new_with_label(column_title)
			menu_item.connect('activate', self.signal_activate_popup_menu_copy, store_id)
			copy_menu.append(menu_item)
		if len(self.column_titles) > 1:
			menu_item = Gtk.SeparatorMenuItem()
			copy_menu.append(menu_item)
			menu_item = Gtk.MenuItem.new_with_label('All')
			menu_item.connect('activate', self.signal_activate_popup_menu_copy, self.column_titles.values())
			copy_menu.append(menu_item)
		return copy_menu 
Example #3
Source File: gui_utilities.py    From king-phisher with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def gtk_menu_insert_by_path(menu, menu_path, menu_item):
	"""
	Add a new menu item into the existing menu at the path specified in
	*menu_path*.

	:param menu: The existing menu to add the new item to.
	:type menu: :py:class:`Gtk.Menu` :py:class:`Gtk.MenuBar`
	:param list menu_path: The labels of submenus to traverse to insert the new item.
	:param menu_item: The new menu item to insert.
	:type menu_item: :py:class:`Gtk.MenuItem`
	"""
	utilities.assert_arg_type(menu, (Gtk.Menu, Gtk.MenuBar), 1)
	utilities.assert_arg_type(menu_path, list, 2)
	utilities.assert_arg_type(menu_item, Gtk.MenuItem, 3)
	while len(menu_path):
		label = menu_path.pop(0)
		menu_cursor = gtk_menu_get_item_by_label(menu, label)
		if menu_cursor is None:
			raise ValueError('missing node labeled: ' + label)
		menu = menu_cursor.get_submenu()
	menu.append(menu_item) 
Example #4
Source File: modules.py    From gpt with GNU General Public License v3.0 6 votes vote down vote up
def on_treeview_button_release_event(self, widget, event):
        try:
            # define context menu
            popup = Gtk.Menu()
            kd_item = Gtk.MenuItem(_("Open with Kdenlive"))
            # selected row is already caught by on_treeview_selection_changed function
            kd_item.connect("activate", self.on_open_with_kdenlive, self.sel_folder)

            # don"t show menu item if there are no video files
            if self.sel_vid > 0 and cli.kd_supp is True:
                popup.append(kd_item)

            open_item = Gtk.MenuItem(_("Open folder"))
            open_item.connect("activate", self.on_open_folder, self.sel_folder)
            popup.append(open_item)
            popup.show_all()
            # only show on right click
            if event.button == 3:
                popup.popup(None, None, None, None, event.button, event.time)
                return True
        except AttributeError:
            # this error (missing variable self.sel_folder) is returned when clicking on title row
            # ignoring because there is nothing to happen on right click
            pass 
Example #5
Source File: campaign_selection.py    From king-phisher with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def get_popup_filter_menu(self):
		# create filter menu and menuitems
		filter_menu = Gtk.Menu()
		menu_item_expired = Gtk.CheckMenuItem('Expired campaigns')
		menu_item_user = Gtk.CheckMenuItem('Your campaigns')
		menu_item_other = Gtk.CheckMenuItem('Other campaigns')
		self.filter_menu_items = {
			'expired_campaigns': menu_item_expired,
			'your_campaigns': menu_item_user,
			'other_campaigns': menu_item_other
		}
		# set up the menuitems and add it to the menubutton
		for menus in self.filter_menu_items:
			filter_menu.append(self.filter_menu_items[menus])
			self.filter_menu_items[menus].connect('toggled', self.signal_checkbutton_toggled)
			self.filter_menu_items[menus].show()
		self.filter_menu_items['expired_campaigns'].set_active(self.config['filter.campaign.expired'])
		self.filter_menu_items['your_campaigns'].set_active(self.config['filter.campaign.user'])
		self.filter_menu_items['other_campaigns'].set_active(self.config['filter.campaign.other_users'])
		self.gobjects['menubutton_filter'].set_popup(filter_menu)
		filter_menu.connect('destroy', self._save_filter) 
Example #6
Source File: configuration.py    From king-phisher with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def _get_title_box(self):
		menu = Gtk.Menu()
		menu.set_property('valign', Gtk.Align.START)
		menu_item = Gtk.MenuItem.new_with_label('Restore Default Options')
		menu_item.connect('activate', self.signal_activate_plugin_reset, self.plugin_klass)
		menu.append(menu_item)
		menu.show_all()
		self.menu = menu

		plugin_menu_button = Gtk.MenuButton()
		plugin_menu_button.set_property('direction', Gtk.ArrowType.LEFT)
		plugin_menu_button.set_popup(menu)

		title_box = Gtk.Box(Gtk.Orientation.HORIZONTAL, 3)
		title_box.pack_start(Gtk.Label(label=self.plugin_klass.title), False, True, 0)
		title_box.pack_end(plugin_menu_button, False, False, 0)
		return title_box 
Example #7
Source File: HtreePedigreeView.py    From addons-source with GNU General Public License v2.0 6 votes vote down vote up
def cb_build_missing_parent_nav_menu(self, obj, event,
                                         person_handle, family_handle):
        """Builds the menu for a missing parent."""
        self.menu = Gtk.Menu()
        self.menu.set_reserve_toggle_size(False)

        add_item = Gtk.MenuItem.new_with_mnemonic(_('_Add'))
        add_item.connect("activate", self.cb_add_parents, person_handle,
                         family_handle)
        add_item.show()
        self.menu.append(add_item)

        # Add a separator line
        add_item = Gtk.SeparatorMenuItem()
        add_item.show()
        self.menu.append(add_item)

        # Add history-based navigation
        self.add_nav_portion_to_menu(self.menu)
        self.add_settings_to_menu(self.menu)
        self.menu.popup(None, None, None, None, 0, event.time)
        return 1 
Example #8
Source File: graphview.py    From addons-source with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, graph_widget, kind=None, handle=None):
        """
        graph_widget: GraphWidget
        kind: 'person', 'family', 'background'
        handle: person or family handle
        """
        Gtk.Menu.__init__(self)
        self.set_reserve_toggle_size(False)

        self.graph_widget = graph_widget
        self.view = graph_widget.view
        self.dbstate = graph_widget.dbstate

        self.actions = graph_widget.actions

        if kind == 'background':
            self.background_menu()
        elif kind == 'person' and handle is not None:
            self.person_menu(handle)
        elif kind == 'family' and handle is not None:
            self.family_menu(handle) 
Example #9
Source File: PhotoTaggingGramplet.py    From addons-source with GNU General Public License v2.0 6 votes vote down vote up
def show_context_menu(self):
        """
        Show popup menu using different functions according to Gtk version.
        'Gtk.Menu.popup' is deprecated since version 3.22, see:
        https://lazka.github.io/pgi-docs/index.html#Gtk-3.0/classes/Menu.html#Gtk.Menu.popup
        """
        self.prepare_context_menu()
        self.context_menu.show_all()
        if (Gtk.MAJOR_VERSION >= 3) and (Gtk.MINOR_VERSION >= 22):
            self.context_menu.popup_at_pointer(None)
        else:
            self.context_menu.popup(None, None, None, None, 0, 0)

    # ======================================================
    # selection event handlers
    # ====================================================== 
Example #10
Source File: state_machines_editor.py    From RAFCON with Eclipse Public License 1.0 6 votes vote down vote up
def on_mouse_right_click(self, event, state_machine_m, result):

        menu = Gtk.Menu()
        for sm_id, sm_m in self.model.state_machines.items():
            menu_item = create_menu_item(sm_m.root_state.state.name, constants.BUTTON_EXCHANGE,
                                         callback=self.change_selected_state_machine_id, callback_args=[sm_id])
            menu.append(menu_item)

        menu_item = create_menu_item("New State Machine", constants.BUTTON_ADD,
                                     callback=new_state_machine)
        menu.append(menu_item)

        if self.model.state_machines:
            menu_item = create_menu_item("Close State Machine", constants.BUTTON_CLOSE,
                                         callback=self.on_close_clicked,
                                         callback_args=[state_machine_m, None])
            menu.append(menu_item)

        menu.show_all()
        menu.popup(None, None, None, None, event.get_button()[1], event.time)
        return True 
Example #11
Source File: kano_combobox.py    From kano-toolset with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, image_path):
            Gtk.ImageMenuItem.__init__(self)
            self.get_style_context().add_class("KanoComboBox")
            self.set_use_underline(False)
            self.set_always_show_image(True)

            # set the given image
            pixbuf = GdkPixbuf.Pixbuf.new_from_file(image_path)
            image = Gtk.Image.new_from_pixbuf(pixbuf)

            # put the image inside an alignment container for centering
            self.box = Gtk.Alignment()
            self.box.set_padding(0, 0, 0, pixbuf.get_width())
            self.box.add(image)

            # by default, a MenuItem has an AccelLabel widget as it's one and only child
            self.remove(self.get_child())
            self.add(self.box)

            # By overriding this signal we can stop the Menu
            # containing this item from being popped down
            self.connect("button-release-event", self.do_not_popdown_menu) 
Example #12
Source File: widgets.py    From zim-desktop-wiki with GNU General Public License v2.0 6 votes vote down vote up
def populate_popup_add_separator(menu, prepend=False):
	'''Convenience function that adds a C{Gtk.SeparatorMenuItem}
	to a context menu. Checks if the menu already contains items,
	if it is empty does nothing. Also if the menu already has a
	seperator in the required place this function does nothing.
	This helps with building menus more dynamically.
	@param menu: the C{Gtk.Menu} object for the popup
	@param prepend: if C{False} append, if C{True} prepend
	'''
	items = menu.get_children()
	if not items:
		pass # Nothing to do
	elif prepend:
		if not isinstance(items[0], Gtk.SeparatorMenuItem):
			sep = Gtk.SeparatorMenuItem()
			menu.prepend(sep)
	else:
		if not isinstance(items[-1], Gtk.SeparatorMenuItem):
			sep = Gtk.SeparatorMenuItem()
			menu.append(sep) 
Example #13
Source File: preferences_dialog.py    From ebook-viewer with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, window):
        """
        Provides
        :param window: Main application window reference, serves as communication hub
        """
        super(Gtk.HeaderBar, self).__init__()
        self.set_show_close_button(False)

        try:
            self.set_has_subtitle(True)
        except AttributeError:
            pass # Too bad?

        # Set default window title
        self.props.title = _("Preferences")
        self.__window = window
        self.__menu = Gtk.Menu()
        # Fill it with all the wigets
        self.__populate_headerbar() 
Example #14
Source File: YubiGuard.py    From YubiGuard with GNU General Public License v3.0 6 votes vote down vote up
def build_menu(self):
        menu = Gtk.Menu()

        item_unlock = Gtk.MenuItem('Unlock')
        item_unlock.connect('activate', self.unlock)
        menu.append(item_unlock)
        self.item_unlock = item_unlock
        self.item_unlock.set_sensitive(False)  # default state

        item_help = Gtk.MenuItem('Help')
        item_help.connect('activate', self.open_help)
        menu.append(item_help)

        separator = Gtk.SeparatorMenuItem()
        menu.append(separator)

        item_quit = Gtk.MenuItem('Quit')
        item_quit.connect('activate', self.quit)
        menu.append(item_quit)

        menu.show_all()
        return menu 
Example #15
Source File: macro.py    From autokey with GNU General Public License v3.0 6 votes vote down vote up
def get_menu(self, callback, menu=None):
        if common.USING_QT:
            for macro in self.macros:
                menu.addAction(MacroAction(menu, macro, callback))
        
        else:
            menu = Gtk.Menu()

            for macro in self.macros:
                menuItem = Gtk.MenuItem(macro.TITLE)
                menuItem.connect("activate", callback, macro)
                menu.append(menuItem)

            menu.show_all()

        return menu 
Example #16
Source File: AppIndicator.py    From battery-monitor with GNU General Public License v3.0 6 votes vote down vote up
def __create_menu(self):
        menu = Gtk.Menu()

        item_settings = Gtk.MenuItem('Settings')
        item_settings.connect("activate", self.__settings_window)
        menu.append(item_settings)

        item_about = Gtk.MenuItem('About')
        item_about.connect("activate", self.__about_window)
        menu.append(item_about)

        item_quit = Gtk.MenuItem('Quit')
        item_quit.connect("activate", self.__quit)
        menu.append(item_quit)
        menu.show_all()

        return menu 
Example #17
Source File: ParrentListSection.py    From pychess with GNU General Public License v3.0 6 votes vote down vote up
def createLocalMenu(self, items):
        ITEM_MAP = {
            ACCEPT: (_("Accept"), self.on_accept),
            ASSESS: (_("Assess"), self.on_assess),
            OBSERVE: (_("Observe"), self.on_observe),
            FOLLOW: (_("Follow"), self.on_follow),
            CHAT: (_("Chat"), self.on_chat),
            CHALLENGE: (_("Challenge"), self.on_challenge),
            FINGER: (_("Finger"), self.on_finger),
            ARCHIVED: (_("Archived"), self.on_archived), }

        self.menu = Gtk.Menu()
        for item in items:
            if item == SEPARATOR:
                menu_item = Gtk.SeparatorMenuItem()
            else:
                label, callback = ITEM_MAP[item]
                menu_item = Gtk.MenuItem(label)
                menu_item.connect("activate", callback)
            self.menu.append(menu_item)
        self.menu.attach_to_widget(self.tv, None) 
Example #18
Source File: TimelinePedigreeView.py    From addons-source with GNU General Public License v2.0 6 votes vote down vote up
def family_button_press_cb(self, obj, event, family_handle):
        """
        Call edit family function for mouse left button double click on family
        or submenu for family for mouse right click.
        And setup plug for button press on person widget.
        """
        if event.button == 3 and event.type == Gdk.EventType.BUTTON_PRESS:
            # self.build_full_nav_menu_cb(obj, event, person_handle, family_handle)
            print ("Menu request")
        elif event.button == 1 and event.type == Gdk.EventType._2BUTTON_PRESS:
            family = self.dbstate.db.get_family_from_handle(family_handle)
            if family:
                try:
                    EditFamily(self.dbstate, self.uistate, [], family)
                except WindowActiveError:
                    pass

        return True 
Example #19
Source File: widgets.py    From badKarma with GNU General Public License v3.0 5 votes vote down vote up
def mouse_click(self, tv, event):
		# right click on a note
		try:
			self.rightclickmenu.destroy()
		except: pass

		if event.button == 3:

			# get selected port
			self.rightclickmenu = Gtk.Menu()

			note_selected = []

			(model, pathlist) = tv.get_selection().get_selected_rows()
			for path in pathlist :
				tree_iter = model.get_iter(path)
				
				idz = model.get_value(tree_iter,1)

				note_selected.append(idz)
				
			i1 = Gtk.MenuItem("delete")
			i2 = Gtk.MenuItem("rename")

			i1.connect("activate", self.delete_note, note_selected)
			i2.connect("activate", self.rename_note, note_selected)

				
			self.rightclickmenu.append(i1)
			self.rightclickmenu.append(i2)

			# show all
			self.rightclickmenu.popup(None, None, None, None, 0, Gtk.get_current_event_time())
			self.rightclickmenu.show_all() 
Example #20
Source File: coin.py    From coinprice-indicator with MIT License 5 votes vote down vote up
def _select_plugins(self, widget):
        PluginSelectionWindow(self)

    # Menu item to remove all tickers and quits the application 
Example #21
Source File: backend_gtk3.py    From matplotlib-4-abaqus with MIT License 5 votes vote down vote up
def _make_axis_menu(self):
        # called by self._update*()

        def toggled(item, data=None):
            if item == self.itemAll:
                for item in items: item.set_active(True)
            elif item == self.itemInvert:
                for item in items:
                    item.set_active(not item.get_active())

            ind = [i for i,item in enumerate(items) if item.get_active()]
            self.set_active(ind)

        menu = Gtk.Menu()

        self.itemAll = Gtk.MenuItem("All")
        menu.append(self.itemAll)
        self.itemAll.connect("activate", toggled)

        self.itemInvert = Gtk.MenuItem("Invert")
        menu.append(self.itemInvert)
        self.itemInvert.connect("activate", toggled)

        items = []
        for i in range(len(self._axes)):
            item = Gtk.CheckMenuItem("Axis %d" % (i+1))
            menu.append(item)
            item.connect("toggled", toggled)
            item.set_active(True)
            items.append(item)

        menu.show_all()
        return menu 
Example #22
Source File: gui_utilities.py    From king-phisher with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def gtk_menu_position(event, *args):
	"""
	Create a menu at the given location for an event. This function is meant to
	be used as the *func* parameter for the :py:meth:`Gtk.Menu.popup` method.
	The *event* object must be passed in as the first parameter, which can be
	accomplished using :py:func:`functools.partial`.

	:param event: The event to retrieve the coordinates for.
	"""
	if not hasattr(event, 'get_root_coords'):
		raise TypeError('event object has no get_root_coords method')
	coords = event.get_root_coords()
	return (coords[0], coords[1], True) 
Example #23
Source File: preview.py    From oomox with GNU General Public License v3.0 5 votes vote down vote up
def create_menu(self, n_items, has_submenus=False):
        menu = Gtk.Menu()
        for i in range(0, n_items):
            sensitive = (i + 1) % 3 != 0
            label = _('Item {id}') if sensitive else _('Insensitive Item {id}')
            item = Gtk.MenuItem(label=label.format(id=i + 1),
                                sensitive=sensitive)
            menu.append(item)
            if has_submenus and (i + 1) % 2 == 0:
                item.set_submenu(self.create_menu(2))
        return menu 
Example #24
Source File: colors_list.py    From oomox with GNU General Public License v3.0 5 votes vote down vote up
def build_dropdown_menu(self):
        self.drop_down = Gtk.Menu()
        menu_items = []
        menu_items.append([
            Gtk.MenuItem(label=_("Replace all instances")), self.replace_all_instances
        ])

        for item in menu_items:
            self.drop_down.append(item[0])
            item[0].connect("activate", item[1])

        self.drop_down.show_all()
        return self.drop_down 
Example #25
Source File: silaty-indicator.py    From Silaty with GNU General Public License v3.0 5 votes vote down vote up
def loop(self):
		global NextPrayerDT
		self.silaty.prayertimes.calculate()# Calculate PrayerTimes

		# Update City menu item
		self.CityItem.set_label(_("Location: %s") % self.silaty.prayertimes.options.city)

		# Update Hijri Date Menu item
		self.HijriDateItem.set_label(self.get_hijri_date())

		# Update Qibla Menu item
		self.QiblaItem.set_label(_("Qibla is %.2f° from True North") % self.silaty.prayertimes.get_qibla())

		# Update Prayer Times items
		self.FajrItem.set_label(_("Fajr\t\t\t\t\t%s") % self.silaty.get_times(self.silaty.prayertimes.fajr_time()))
		#self.ShurukItem.set_label(_("Shuruk\t\t\t\t%s") % self.silaty.get_times(self.silaty.prayertimes.shrouk_time()))
		self.DhuhrItem.set_label(_("Dhuhr\t\t\t\t\t%s") % self.silaty.get_times(self.silaty.prayertimes.zuhr_time()))
		self.AsrItem.set_label(_("Asr\t\t\t\t\t%s") % self.silaty.get_times(self.silaty.prayertimes.asr_time()))
		self.MaghribItem.set_label(_("Maghrib\t\t\t\t%s") % self.silaty.get_times(self.silaty.prayertimes.maghrib_time()))
		self.IshaItem.set_label(_("Isha\t\t\t\t\t%s") % self.silaty.get_times(self.silaty.prayertimes.isha_time()))

		nextprayer = self.silaty.prayertimes.next_prayer()
		tonextprayer = self.silaty.prayertimes.time_to_next_prayer()

		# Update displayed prayer
		if (nextprayer != self.currentprayer) and self.silaty.is_visible():
			self.silaty.homebox.emit("prayers-updated", _(nextprayer))
			self.currentprayer = nextprayer

		self.NextPrayerItem.set_label(_("%s until %s") % (self.secs_to_hrtime(tonextprayer.seconds), _(nextprayer)))
		self.silaty.headerbar.set_title(_("%s until %s") % (self.secs_to_hrtime(tonextprayer.seconds), _(nextprayer)))
		self.Indicator.set_title(_("%s in %s") % (_(nextprayer), (self.secs_to_nrtime(tonextprayer.seconds))))

		if self.silaty.prayertimes.options.iconlabel == True:
			self.Indicator.set_label(_("%s in %s") % (_(nextprayer), (self.secs_to_nrtime(tonextprayer.seconds))),"")
		else:
			self.Indicator.set_label("","")
		return True 
Example #26
Source File: results.py    From runsqlrun with MIT License 5 votes vote down vote up
def __init__(self, results):
        super(DataList, self).__init__()
        self.set_reorderable(False)
        self.set_enable_search(False)
        self.set_fixed_height_mode(True)
        self.set_grid_lines(Gtk.TreeViewGridLines.BOTH)
        # Selection is handled by button-press-event
        self.get_selection().set_mode(Gtk.SelectionMode.NONE)
        self._selection = ResultSelection(self)
        self.results = results
        self.win = results.win
        # The cell menu needs to be created outside the callback for the
        # button-press-event. Otherwise it just don't show or flickers.
        self.cell_menu = Gtk.Menu()
        self.connect('button-press-event', self.on_button_pressed) 
Example #27
Source File: gui_utilities.py    From king-phisher with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def gtk_menu_get_item_by_label(menu, label):
	"""
	Retrieve a menu item from a menu by it's label. If more than one items share
	the same label, only the first is returned.

	:param menu: The menu to search for the item in.
	:type menu: :py:class:`Gtk.Menu`
	:param str label: The label to search for in *menu*.
	:return: The identified menu item if it could be found, otherwise None is returned.
	:rtype: :py:class:`Gtk.MenuItem`
	"""
	for item in menu:
		if item.get_label() == label:
			return item 
Example #28
Source File: coin.py    From coinprice-indicator with MIT License 5 votes vote down vote up
def _menu(self):
        menu = Gtk.Menu()

        self.add_item = Gtk.MenuItem.new_with_label("Add Ticker")
        self.discover_item = Gtk.MenuItem.new_with_label("Discover Assets")
        self.plugin_item = Gtk.MenuItem.new_with_label("Plugins" + u"\u2026")
        self.about_item = Gtk.MenuItem.new_with_label("About")
        self.quit_item = Gtk.MenuItem.new_with_label("Quit")

        self.add_item.connect("activate", self._add_ticker)
        self.discover_item.connect("activate", self._discover_assets)
        self.plugin_item.connect("activate", self._select_plugins)
        self.about_item.connect("activate", self._about)
        self.quit_item.connect("activate", self._quit_all)

        menu.append(self.add_item)
        menu.append(self.discover_item)
        menu.append(self.plugin_item)
        menu.append(self.about_item)
        menu.append(Gtk.SeparatorMenuItem())
        menu.append(self.quit_item)
        menu.show_all()

        return menu

    # Adds a ticker and starts it 
Example #29
Source File: coin.py    From coinprice-indicator with MIT License 5 votes vote down vote up
def _add_many_indicators(self, tickers):
        for ticker in tickers:
            self._add_indicator(ticker)

    # Menu item to add a ticker 
Example #30
Source File: widgets.py    From zim-desktop-wiki with GNU General Public License v2.0 5 votes vote down vote up
def get_popup(self):
		'''Get a popup menu (the context menu) for this widget
		@returns: a C{Gtk.Menu} or C{None}
		@emits: populate-popup
		@implementation: do NOT overload this method, implement
		L{do_initialize_popup} instead
		'''
		menu = Gtk.Menu()
		self.do_initialize_popup(menu)
		self.emit('populate-popup', menu)
		if len(menu.get_children()) > 0:
			return menu
		else:
			return None