1.1.4.2. managers
This module contains classes used for high level management of some GTK widgets.
1.1.4.2.1. Classes
- class ButtonGroupManager(glade_gobject, widget_type, group_name)[source]
Bases:
object
Manage a set of buttons. The buttons should all be of the same type (such as “checkbutton” or “radiobutton”) and include a common group name prefix. The intent is to make managing buttons of similar functionality easier by grouping them together.
- __init__(glade_gobject, widget_type, group_name)[source]
- Parameters
glade_gobject (
GladeGObject
) – The gobject which has the radio buttons set.group_name (str) – The name of the group of buttons.
- class MenuManager(menu=None)[source]
Bases:
object
A class that wraps
Gtk.Menu
objects and facilitates managing their respective items.- __init__(menu=None)[source]
- Parameters
menu (
Gtk.Menu
) – An optional menu to start with. If a menu is specified it is used as is, otherwise a new instance is used and is set to be visible usingshow()
.
- append(label, activate=None, activate_args=())[source]
Create and append a new
Gtk.MenuItem
with the specified label to the menu.- Parameters
label (str) – The label for the new menu item.
activate – An optional callback function to connect to the new menu item’s
activate
signal.
- Returns
Returns the newly created and added menu item.
- Return type
Gtk.MenuItem
- append_item(menu_item, set_show=True)[source]
Append the specified menu item to the menu.
- Parameters
menu_item (
Gtk.MenuItem
) – The item to append to the menu.set_show (bool) – Whether to set the item to being visible or leave it as is.
Create and append a submenu item, then return a new menu manager instance for it.
- Parameters
label (str) – The label for the new menu item.
- Returns
Returns the newly created and added menu item.
- Return type
Gtk.MenuManager
- class RadioButtonGroupManager(glade_gobject, group_name)[source]
Bases:
ButtonGroupManager
Manage a group of
Gtk.RadioButton
objects together to allow the active one to be easily set and identified. The buttons are retrieved from aGladeGObject
instance and must be correctly named in thedependencies
attribute as ‘radiobutton_group_name_button_name’.- __init__(glade_gobject, group_name)[source]
- Parameters
glade_gobject (
GladeGObject
) – The gobject which has the radio buttons set.group_name (str) – The name of the group of buttons.
- class TimeSelectorButtonManager(application, button, value=None)[source]
Bases:
object
A manager class to convert a
ToggleButton
to be used for showing a time selector py:class:~.Gtk.Popover object with inputs for setting the hour and minutes. This then exposes the selected time through thetime
attribute.- __init__(application, button, value=None)[source]
- Parameters
button (
Gtk.ToggleButton
) – The button used for activation.application – The application instance which owns this object.
value (
datetime.time
) – The present datetime value (defaults to 00:00).
- class ToggleButtonGroupManager(glade_gobject, widget_type, group_name)[source]
Bases:
ButtonGroupManager
Manage a mapping of button names to a boolean value indicating whether they are active or not.
- class TreeViewManager(treeview, selection_mode=None, cb_delete=None, cb_refresh=None)[source]
Bases:
object
A class that wraps
Gtk.TreeView
objects that use Gtk.ListStore models with additional functions for conveniently displaying text data.If cb_delete is specified, the callback will be called with the treeview instance, and the selection as the parameters.
If cb_refresh is specified, the callback will be called without any parameters.
- __init__(treeview, selection_mode=None, cb_delete=None, cb_refresh=None)[source]
- Parameters
treeview (
Gtk.TreeView
) – The treeview to wrap and manage.selection_mode (
Gtk.SelectionMode
) – The selection mode to set for the treeview.cb_delete (function) – An optional callback that can be used to delete entries.
- column_titles[source]
An ordered dictionary of storage data columns keyed by their respective column titles.
Create a
Gtk.Menu
with entries for copying cell data from the treeview.- Returns
The populated copy popup menu.
- Return type
Gtk.Menu
Create a
Gtk.Menu
with entries for copying and optionally delete cell data from within the treeview. The delete option will only be available if a delete callback was previously set.- Parameters
handle_button_press (bool) – Whether or not to connect a handler for displaying the popup menu.
- Returns
The populated popup menu.
- Return type
Gtk.Menu
- set_column_color(background=None, foreground=None, column_titles=None)[source]
Set a column in the model to be used as either the background or foreground RGBA color for a cell.
- set_column_titles(column_titles, column_offset=0, renderers=None)[source]
Populate the column names of a GTK TreeView and set their sort IDs. This also populates the
column_titles
attribute.- Parameters
- Returns
A dict of all the
Gtk.TreeViewColumn
objects keyed by their column id.- Return type