def contextMenu(self, menu, records): if records: icon = studiolibrary.icon(self.plugin().dirname() + "/images/arrow.png") action = studiolibrary.Action(icon, "Console", menu) action.setCallback(self.openConsole) menu.addAction(action) studiolibrary.Record.contextMenu(self, menu, records)
def load(self): """ :rtype: None """ if self.libraryWidget(): self._action = QtGui.QAction(studiolibrary.icon(self.iconPath()), self.name(), self.libraryWidget().ui.newMenu) self.libraryWidget().connect(self._action, QtCore.SIGNAL("triggered(bool)"), self.showCreateWidget) self.libraryWidget().ui.newMenu.addAction(self._action)
def load(self): if self.window(): self._action = QtGui.QAction(studiolibrary.icon(self.icon()), self.name(), self.window().ui.newMenu) self.window().connect(self._action, QtCore.SIGNAL('triggered(bool)'), self.showCreateWidget) self.window().ui.newMenu.addAction(self._action)
def selectContentsAction(self, menu, records=None): """ :type menu: QtGui.QMenu :type records: list[Record] """ icon = studiolibrary.icon(self.dirname() + "/resource/images/arrow.png") action = studiolibrary.Action(icon, "Select content", menu) trigger = partial(self.selectContent, records) action.setCallback(trigger) return action
def addSelectContentsAction(self, menu): """ @type menu: QtGui.QMenu """ records = self.window().selectedRecords() if records: icon = studiolibrary.icon(self.plugin().dirname() + "/images/arrow.png") action = studiolibrary.Action(icon, "Select content", menu) trigger = partial(self.plugin().selectContent, records) action.setCallback(trigger) menu.addAction(action)
def contextMenu(self, menu, records): """ @type menu: QtGui.QMenu @type records: list[Record] """ self.addSelectContentsAction(menu) menu.addSeparator() icon = studiolibrary.icon(self.plugin().dirname() + "/images/set.png") subMenu = studiolibrary.ContextMenu(menu) subMenu.setIcon(icon) subMenu.setTitle("Selection Sets") self.selectionSetsMenu(subMenu, records) menu.addMenu(subMenu) menu.addSeparator() studiolibrary.Record.contextMenu(self, menu, records)
def contextMenu(self, menu, folders): if self.window().isLocked(): return menu.addMenu(self.window().ui.newMenu) if len(folders) == 1: menu.addMenu(self.window().ui.editFolderMenu) separator = QtGui.QAction('Separator1', menu) separator.setSeparator(True) menu.addAction(separator) settingsMenu = QtGui.QMenu(self.parent()) settingsMenu.setIcon(studiolibrary.icon('settings14')) settingsMenu.setTitle('Settings') action = QtGui.QAction('Show icon', settingsMenu) action.setCheckable(True) action.setChecked(self.iconVisibility()) action.connect(action, QtCore.SIGNAL('triggered(bool)'), lambda v, self=self: self.setIconVisibility(v)) settingsMenu.addAction(action) action = QtGui.QAction('Show bold', settingsMenu) action.setCheckable(True) action.setChecked(self.bold()) action.connect(action, QtCore.SIGNAL('triggered(bool)'), lambda v, self=self: self.setBold(v)) settingsMenu.addAction(action) separator = QtGui.QAction('Separator2', settingsMenu) separator.setSeparator(True) settingsMenu.addAction(separator) action = QtGui.QAction('Change icon', settingsMenu) action.triggered.connect(lambda: self.changeIcon()) settingsMenu.addAction(action) action = QtGui.QAction('Change color', settingsMenu) action.triggered.connect(lambda: self.changeColor()) settingsMenu.addAction(action) separator = QtGui.QAction('Separator3', settingsMenu) separator.setSeparator(True) settingsMenu.addAction(separator) action = QtGui.QAction('Reset settings', settingsMenu) action.triggered.connect(lambda: self.reset()) settingsMenu.addAction(action) menu.addMenu(settingsMenu)
def contextMenu(self, menu, folders): if self.window().isLocked(): return menu.addMenu(self.window().ui.newMenu) if len(folders) == 1: menu.addMenu(self.window().ui.editFolderMenu) separator = QtGui.QAction('Separator1', menu) separator.setSeparator(True) menu.addAction(separator) settingsMenu = QtGui.QMenu(self.parent()) settingsMenu.setIcon(studiolibrary.icon('settings14')) settingsMenu.setTitle('Settings') action = QtGui.QAction('Show icon', settingsMenu) action.setCheckable(True) action.setChecked(self.iconVisibility()) action.connect(action, QtCore.SIGNAL('triggered(bool)'), lambda v, self = self: self.setIconVisibility(v)) settingsMenu.addAction(action) action = QtGui.QAction('Show bold', settingsMenu) action.setCheckable(True) action.setChecked(self.bold()) action.connect(action, QtCore.SIGNAL('triggered(bool)'), lambda v, self = self: self.setBold(v)) settingsMenu.addAction(action) separator = QtGui.QAction('Separator2', settingsMenu) separator.setSeparator(True) settingsMenu.addAction(separator) action = QtGui.QAction('Change icon', settingsMenu) action.triggered.connect(lambda : self.changeIcon()) settingsMenu.addAction(action) action = QtGui.QAction('Change color', settingsMenu) action.triggered.connect(lambda : self.changeColor()) settingsMenu.addAction(action) separator = QtGui.QAction('Separator3', settingsMenu) separator.setSeparator(True) settingsMenu.addAction(separator) action = QtGui.QAction('Reset settings', settingsMenu) action.triggered.connect(lambda : self.reset()) settingsMenu.addAction(action) menu.addMenu(settingsMenu)
def recordContextMenu(self, menu, records): """ :type menu: QtGui.QMenu :type records: list[Record] :rtype: None """ if records: record = records[-1] self.addSelectContentsAction(menu, records) menu.addSeparator() path = record.path() icon = studiolibrary.icon(self.dirname() + "/resource/images/set.png") namespaces = record.namespaces() subMenu = self.selectionSetsMenu(menu, path=path, namespaces=namespaces) subMenu.setIcon(icon) subMenu.setTitle("Selection Sets") menu.addMenu(subMenu) menu.addSeparator()