def showExample(): """ Run a simple example of the widget. :rtype: QtWidgets.QWidget """ with studioqt.app(): def triggered(): print "Triggered" def triggered2(): print "Triggered2" widget = studioqt.MenuBarWidget() icon = studioqt.icon("add") action = widget.addLeftAction("New Item") action.setIcon(icon) action.triggered.connect(triggered) lineedit = QtWidgets.QLineEdit() widget.layout().insertWidget(1, lineedit) widget.setExpandedHeight(50) icon = studioqt.icon("settings") action = widget.addRightAction("Settings") action.setIcon(icon) action.triggered.connect(triggered2) widget.show() return widget
def showExample(): """ Run a simple example of the widget. :rtype: QtWidgets.QWidget """ with studioqt.app(): def triggered(): print 'Triggered' def triggered2(): print 'Triggered2' widget = studioqt.MenuBarWidget() icon = studioqt.icon('add') action = widget.addLeftAction('New Item') action.setIcon(icon) action.triggered.connect(triggered) lineedit = QtWidgets.QLineEdit() widget.layout().insertWidget(1, lineedit) widget.setExpandedHeight(35) icon = studioqt.icon('settings') action = widget.addRightAction('Settings') action.setIcon(icon) action.triggered.connect(triggered2) widget.show() return widget
def settingsMenu(self): """ Return the settings menu for changing the library widget. :rtype: QtGui.QMenu """ icon = studioqt.icon('settings', color=self.iconColor()) menu = QtGui.QMenu('', self) menu.setTitle('Settings') menu.setIcon(icon) libraries = studiolibrary.LibrariesMenu(menu) menu.addMenu(libraries) menu.addSeparator() action = QtGui.QAction('Settings', menu) action.triggered[bool].connect(self.showSettingsDialog) menu.addAction(action) separator = QtGui.QAction('', menu) separator.setSeparator(True) menu.addAction(separator) action = QtGui.QAction('Show menu', menu) action.setCheckable(True) action.setChecked(self.isMenuBarWidgetVisible()) action.triggered[bool].connect(self.setMenuBarWidgetVisible) menu.addAction(action) action = QtGui.QAction('Show folders', menu) action.setCheckable(True) action.setChecked(self.isFoldersWidgetVisible()) action.triggered[bool].connect(self.setFoldersWidgetVisible) menu.addAction(action) action = QtGui.QAction('Show preview', menu) action.setCheckable(True) action.setChecked(self.isPreviewWidgetVisible()) action.triggered[bool].connect(self.setPreviewWidgetVisible) menu.addAction(action) action = QtGui.QAction('Show status', menu) action.setCheckable(True) action.setChecked(self.isStatusBarWidgetVisible()) action.triggered[bool].connect(self.setStatusBarWidgetVisible) menu.addAction(action) menu.addSeparator() viewMenu = self.recordsWidget().settingsMenu(parent=menu) menu.addMenu(viewMenu) if studiolibrary.isMaya(): menu.addSeparator() dockMenu = self.dockMenu() menu.addMenu(dockMenu) menu.addSeparator() action = QtGui.QAction('Debug mode', menu) action.setCheckable(True) action.setChecked(self.isDebug()) action.triggered[bool].connect(self.setDebugMode) menu.addAction(action) action = QtGui.QAction('Help', menu) action.triggered.connect(self.help) menu.addAction(action) return menu
def __init__(self, theme, *args): """ :type theme: Theme :type menu: QtWidgets.QMenu :rtype: QtWidgets.QAction """ QtWidgets.QAction.__init__(self, theme.name(), *args) self._theme = theme color = theme.accentColor() icon = studioqt.icon('radio_button_checked', color=color) self.setIcon(icon)
def __init__(self, *args): QtWidgets.QLineEdit.__init__(self, *args) self._iconPadding = 4 self._iconButton = QtWidgets.QPushButton(self) self._iconButton.clicked.connect(self._iconClicked) self._searchFilter = studioqt.SearchFilter('') icon = studioqt.icon('search') self.setIcon(icon) self.setPlaceholderText(self.DEFAULT_PLACEHOLDER_TEXT) self.textChanged.connect(self._textChanged) self.searchChanged = self.searchFilter().searchChanged self.update()
def __init__(self, *args): QtWidgets.QLineEdit.__init__(self, *args) self._iconPadding = 6 self._iconButton = QtWidgets.QPushButton(self) self._iconButton.clicked.connect(self._iconClicked) self._searchFilter = studioqt.SearchFilter("") icon = studioqt.icon("search") self.setIcon(icon) self._clearButton = QtWidgets.QPushButton(self) self._clearButton.setCursor(QtCore.Qt.ArrowCursor) icon = studioqt.icon("cross") self._clearButton.setIcon(icon) self._clearButton.setToolTip("Clear all search text") self._clearButton.clicked.connect(self._clearClicked) self.setPlaceholderText(self.DEFAULT_PLACEHOLDER_TEXT) self.textChanged.connect(self._textChanged) self.searchChanged = self.searchFilter().searchChanged self.update()