madgui.util.menu module¶
Utilities for defining a window menu in a more concice notation than manually
creating the QMenuItem and assigning properties.
Classes
|
Represents a menu item. |
|
(Sub-)menu to be inserted. |
Separator to be inserted in a menu. |
Functions
|
Append menu items to menu. |
-
class
madgui.util.menu.Item(label, shortcut, description, callback, icon=None, enabled=True, checked=None)[source]¶ Bases:
objectRepresents a menu item. Objects of this type will be realized as
QMenuItem.The following properties can be given:
- Variables
shortcut (str) – shortcut, e.g. “Ctrl+S” (optional)
description (str) – tooltip and status bar message
callback (callable) – action to be taken when clicking the menu item
icon – icon, can be QStyle.StandardPixmap, an icon name defined in the theme, or a QIcon
checked (Bool) – whether the item is checked (optional)
Methods
action(parent)Create a
QActionfrom this item.append_to(menu[, parent])Append this item to the given menu.
-
class
madgui.util.menu.Menu(label, items)[source]¶ Bases:
object(Sub-)menu to be inserted.
Methods
append_to(menu, parent)