contextmenu#
The base context menu implementation used across Bookmarks.
All context menus derive from the BaseContextMenu
. The class contains the
definitions of all menu options. See BaseContextMenu.setup()
for menu overrides
and definitions.
Classes:
|
Base class containing the context menu definitions. |
Functions:
|
Utility method used to generate a hexadecimal uuid string. |
|
Private utility method used to implement rounded corners. |
|
Private utility method for manually calculating the width of :class:.`BaseContextMenu`. |
- class bookmarks.contextmenu.BaseContextMenu(index, parent=None)[source]#
Bases:
QMenu
Base class containing the context menu definitions.
The internal menu structure is defined in
BaseContextMenu.menu
, a collections.OrderedDict instance. This data is populated by the *_menu methods and expanded into a UI layout byBaseContextMenu.create_menu()
. The menu is principally designed to work with index-based views and as a result the default constructor takes a QModelIndex, stored inBaseContextMenu.index
.The internal
BaseContextMenu.menu
dict object assumes the following form:1self.menu = collections.OrderedDict({ 2 'uuid1': { 3 'text': 'My Menu Item', 4 'icon': get_icon('my_menu_icon'), # QIcon 5 'shortcut: QtGui.QShortcut('Ctrl+M'), # QtGui.QShortcut 6 'disabled': False, 7 'action': my_menu_function1, # a method to execute 8 }, 9 'uuid2': { 10 'text': 'My Menu Item2', 11 'icon': get_icon('my_menu_icon'), 12 'shortcut: QtGui.QShortcut('Ctrl+N'), 13 'disabled': True, 14 'action': my_menu_function2, 15 } 16})
- Properties:
index (QModelIndex): The index the context menu is associated with.
Methods:
Add asset to bookmark item actions.
Add file actions.
Add file to asset actions.
Asset item URL actions.
Bookmark item properties editor.
Bookmark item URL actions.
File item collapse toggle actions.
Favourite item actions.
FFMpeg convert menu.
List item path copy actions.
create_menu
(menu[, parent])Expands the internal
BaseContextMenu.menu
dict data.Delete file item menu actions.
Selected asset item property menu.
Active bookmark item property menu.
Selected asset item property menu.
Bookmark item properties editor actions.
Selected file item property menu.
Export property
Application launcher menu actions.
List item filter actions.
Note editor actions.
Application preferences actions.
Publish file item menu actions.
Application shutdown options.
List item reload/refresh options.
List item favourite actions.
resizeEvent
(self, event)List item file reveal options.
List item row size actions.
separator
([menu])Adds a menu separator item.
setup
()Creates the context menu.
ShotGrid asset linker menu actions.
ShotGrid batch asset linker menu actions.
ShotGrid bookmark item menu actions.
ShotGrid publish menu actions.
ShotGrid RV menu actions.
ShotGrid thumbnail image menu actions.
ShotGrid URL menu actions.
showEvent
(event)Show event handler.
Add asset menu actions.
List item sorting options.
File item task folder picker menu.
Thumbnail image specific actions.
List item filter flag toggle actions.
General application window specific actions.
- bookmarks.contextmenu.resize_event_override(cls, event)[source]#
Private utility method used to implement rounded corners.
- bookmarks.contextmenu.show_event_override(cls, event)[source]#
Private utility method for manually calculating the width of :class:.`BaseContextMenu`.
I might be misunderstanding how styling menus effect appearance and resulting size. What is certain, that QT doesn’t seem to be able to display the menus with a correct width, and hence we’ll calculate width manually here.