MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / add_toolitem

Method add_toolitem

lib/matplotlib/backends/backend_gtk3.py:418–440  ·  view source on GitHub ↗
(self, name, group, position, image_file, description,
                     toggle)

Source from the content-addressed store, hash-verified

416 self._toolitems = {}
417
418 def add_toolitem(self, name, group, position, image_file, description,
419 toggle):
420 if toggle:
421 button = Gtk.ToggleToolButton()
422 else:
423 button = Gtk.ToolButton()
424 button.set_label(name)
425
426 if image_file is not None:
427 image = Gtk.Image.new_from_gicon(
428 Gio.Icon.new_for_string(image_file),
429 Gtk.IconSize.LARGE_TOOLBAR)
430 button.set_icon_widget(image)
431
432 if position is None:
433 position = -1
434
435 self._add_button(button, group, position)
436 signal = button.connect('clicked', self._call_tool, name)
437 button.set_tooltip_text(description)
438 button.show_all()
439 self._toolitems.setdefault(name, [])
440 self._toolitems[name].append((button, signal))
441
442 def _add_button(self, button, group, position):
443 if group not in self._groups:

Callers

nothing calls this directly

Calls 3

_add_buttonMethod · 0.95
set_labelMethod · 0.45
connectMethod · 0.45

Tested by

no test coverage detected