def __init__(self, view=None, parent=None): BaseToolBar.__init__(self, name="Taurus selection toolbar", view=view, parent=parent) self._expandAllAction = getAction("Expand All", parent=self, icon=getIcon(":/controls/expand.png"), tooltip="Expand all items", triggered=self.onExpandAll) self._collapseAllAction = getAction("Collapse All", parent=self, icon=getIcon(":/controls/collapse.png"), tooltip="Collapse all items", triggered=self.onCollapseAll) self._expandSelectionAction = getAction("Expand selection", parent=self, icon=getIcon(":/controls/expand-selection.png"), tooltip="Expand selection", triggered=self.onExpandSelection) self._collapseSelectionAction = getAction("Collapse All", parent=self, icon=getIcon(":/controls/collapse-selection.png"), tooltip="Collapse selection", triggered=self.onCollapseSelection) self.addAction(self._expandAllAction) self.addAction(self._collapseAllAction) self.addAction(self._expandSelectionAction) self.addAction(self._collapseSelectionAction)
def __init__(self, view=None, parent=None): BaseToolBar.__init__(self, name="Taurus selection toolbar", view=view, parent=parent) self._expandAllAction = getAction( "Expand All", parent=self, icon=getIcon(":/controls/expand.png"), tooltip="Expand all items", triggered=self.onExpandAll) self._collapseAllAction = getAction( "Collapse All", parent=self, icon=getIcon(":/controls/collapse.png"), tooltip="Collapse all items", triggered=self.onCollapseAll) self._expandSelectionAction = getAction( "Expand selection", parent=self, icon=getIcon(":/controls/expand-selection.png"), tooltip="Expand selection", triggered=self.onExpandSelection) self._collapseSelectionAction = getAction( "Collapse All", parent=self, icon=getIcon(":/controls/collapse-selection.png"), tooltip="Collapse selection", triggered=self.onCollapseSelection) self.addAction(self._expandAllAction) self.addAction(self._collapseAllAction) self.addAction(self._expandSelectionAction) self.addAction(self._collapseSelectionAction)
def __init__(self, view=None, parent=None): BaseToolBar.__init__(self, name="Taurus selection toolbar", view=view, parent=parent) self._goIntoAction = getAction("Go Into", parent=self, icon=getIcon("go-down"), tooltip="Go into the selected item", triggered=self.goInto) self._goUpAction = getAction("Go Up", parent=self, icon=getIcon("go-up"), tooltip="Go up one level", triggered=self.goUp) self._goTopAction = getAction("Go Top", parent=self, icon=getIcon("go-top"), tooltip="Go to top level", triggered=self.goTop) self.addAction(self._goIntoAction) self.addAction(self._goUpAction) self.addAction(self._goTopAction) self._navigationWidget = _NavigationWidget(view, self, parent=self) self._navigationAction = self.addWidget(self._navigationWidget)
def test_getIcon(self): icon = getIcon("folder-open") self.assert_(not icon.isNull(), "Got a null icon!") icon = getIcon(":/controls/collapse.png") self.assert_(not icon.isNull(), "Got a null icon!") icon = getIcon(QtGui.QStyle.SP_MessageBoxWarning) self.assert_(not icon.isNull(), "Got a null icon!")
def __init__(self, view=None, parent=None, designMode=False): BaseToolBar.__init__(self, name="Selection toolbar", view=view, parent=parent, designMode=designMode) self._selectAllAction = Action("Select All", parent=self, icon=getIcon("edit-select-all"), tooltip="Select all items", triggered=self.onSelectAll) self._clearSelectionAction = Action("Clear selection", parent=self, icon=getIcon("edit-clear"), tooltip="Clears current selection", triggered=self.onclearSelection) self.addAction(self._selectAllAction) self.addAction(self._clearSelectionAction)
def test_groupBox(self): gb = GroupBox() gb.title = "Test box" self.assertEquals(gb.getTitle(), "Test box", "Title was not properly set!") gb.titleIcon = getIcon("folder-open") self.assert_(not gb.getTitleIcon().isNull(), "Got a null icon!") gb.contentVisible = True self.assert_(gb.isContentVisible(), "Content is not visible!") gb.contentVisible = False self.assert_(not gb.isContentVisible(), "Invisible content is visible!") content = gb.content() self.assert_(content is None, "content is not None!") content = QtGui.QFrame() gb.setContent(content) self.assert_(content == gb.content(), "content is not the given content!") self.assert_(content.layout() is None, "content already has a layout!") size = gb.size() self.assert_(size.width() > 10, "width is suspiciously small!") self.assert_(size.height() > 10, "height is suspiciously small!")
def __init__(self, view=None, parent=None, designMode=False): BaseToolBar.__init__(self, name="Refresh toolbar", view=view, parent=parent, designMode=designMode) self._refreshAction = Action("Refresh", parent=self, icon=getIcon("view-refresh"), tooltip="Refresh view", triggered=self.onRefresh) self.addAction(self._refreshAction)
def __init__(self, view=None, parent=None, designMode=False): BaseToolBar.__init__(self, name="Editor toolbar", view=view, parent=parent, designMode=designMode) self._addAction = Action("New item", parent=self, icon=getIcon("list-add"), tooltip="Add new item", triggered=self.onAdd) self._removeAction = Action("Remove item", parent=self, icon=getIcon("list-remove"), tooltip="Remove item", triggered=self.onRemove) self._moveTopAction = Action("To top", parent=self, icon=getIcon("go-top"), tooltip="Move selected item to top", triggered=self.onMoveTop) self._moveUpAction = Action("Move up", parent=self, icon=getIcon("go-up"), tooltip="Move selected item up one level", triggered=self.onMoveUp) self._moveDownAction = Action("Move down", parent=self, icon=getIcon("go-down"), tooltip="Move selected item down one level", triggered=self.onMoveDown) self._moveBottomAction = Action("To bottom", parent=self, icon=getIcon("go-bottom"), tooltip="Move selected item to bottom", triggered=self.onMoveBottom) self.addAction(self._addAction) self.addAction(self._removeAction) self.addAction(self._moveTopAction) self.addAction(self._moveUpAction) self.addAction(self._moveDownAction) self.addAction(self._moveBottomAction)
def __init__(self, view=None, parent=None, designMode=False): BaseToolBar.__init__(self, name="Filter toolbar", view=view, parent=parent, designMode=designMode) filterLineEdit = self._filterLineEdit = QtGui.QLineEdit(self) filterLineEdit.setSizePolicy(QtGui.QSizePolicy( QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)) filterLineEdit.setToolTip("Quick filter") filterLineEdit.textChanged.connect(self.onFilterChanged) filterLineEdit.textEdited.connect(self.onFilterEdited) self.addWidget(filterLineEdit) self._clearFilterAction = Action("Clear", parent=self, icon=getIcon("edit-clear"), tooltip="Clears the filter", triggered=self.onClearFilter) self.addAction(self._clearFilterAction)
def __init__(self, view=None, parent=None, designMode=False): BaseToolBar.__init__(self, name="Filter toolbar", view=view, parent=parent, designMode=designMode) filterLineEdit = self._filterLineEdit = QtGui.QLineEdit(self) filterLineEdit.setSizePolicy( QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)) filterLineEdit.setToolTip("Quick filter") filterLineEdit.textChanged.connect(self.onFilterChanged) filterLineEdit.textEdited.connect(self.onFilterEdited) self.addWidget(filterLineEdit) self._clearFilterAction = Action("Clear", parent=self, icon=getIcon("edit-clear"), tooltip="Clears the filter", triggered=self.onClearFilter) self.addAction(self._clearFilterAction)
def __init__(self, view=None, parent=None, designMode=False): BaseToolBar.__init__(self, name="Editor toolbar", view=view, parent=parent, designMode=designMode) self._addAction = Action("New item", parent=self, icon=getIcon("list-add"), tooltip="Add new item", triggered=self.onAdd) self._removeAction = Action("Remove item", parent=self, icon=getIcon("list-remove"), tooltip="Remove item", triggered=self.onRemove) self._moveTopAction = Action("To top", parent=self, icon=getIcon("go-top"), tooltip="Move selected item to top", triggered=self.onMoveTop) self._moveUpAction = Action("Move up", parent=self, icon=getIcon("go-up"), tooltip="Move selected item up one level", triggered=self.onMoveUp) self._moveDownAction = Action( "Move down", parent=self, icon=getIcon("go-down"), tooltip="Move selected item down one level", triggered=self.onMoveDown) self._moveBottomAction = Action("To bottom", parent=self, icon=getIcon("go-bottom"), tooltip="Move selected item to bottom", triggered=self.onMoveBottom) self.addAction(self._addAction) self.addAction(self._removeAction) self.addAction(self._moveTopAction) self.addAction(self._moveUpAction) self.addAction(self._moveDownAction) self.addAction(self._moveBottomAction)
def icon(self): return getIcon(self.getIconName())
def main(): from qarbon.qt.gui.icon import getIcon app = Application() app.setStyleSheet(GROUPBOX_NEBULA_STYLESHEET) w = QtGui.QWidget() l = QtGui.QVBoxLayout() w.setLayout(l) panel = GroupBox() panel.title = "Database" content = QtGui.QWidget() contentLayout = QtGui.QFormLayout() content.setLayout(contentLayout) panel.setContent(content) contentLayout.addRow("&Host", QtGui.QLineEdit()) contentLayout.addRow("&Port", QtGui.QLineEdit()) l.addWidget(panel, 0) panel = GroupBox() panel.title = "Hello world" panel.titleIcon = getIcon("video-x-generic") panel.styleMap = { 'title_start_color': 'rgb(255, 60, 60)', 'title_stop_color': 'rgb(200, 0, 0)', 'title_font_color': 'rgb(140, 0, 0)', 'title_border_radius': '10px', 'content_border_radius': '0px', } content = QtGui.QWidget() contentLayout = QtGui.QFormLayout() content.setLayout(contentLayout) panel.setContent(content) contentLayout.addRow("State", QtGui.QPushButton("Press here")) contentLayout.addRow("Status", QtGui.QLineEdit()) contentLayout.addRow("Coment", QtGui.QLineEdit()) contentLayout.addRow("Build", QtGui.QCheckBox()) contentLayout.addRow("Upper limit", QtGui.QSpinBox()) contentLayout.addRow("Lower limit", QtGui.QSpinBox()) l.addWidget(panel, 0) panel = GroupBox() panel.title = "Hello world 2" panel.titleIcon = getIcon("network-server") panel.titleVisible = False content = QtGui.QWidget() contentLayout = QtGui.QFormLayout() content.setLayout(contentLayout) panel.setContent(content) contentLayout.addRow("Something", QtGui.QLineEdit()) contentLayout.addRow("More", QtGui.QLineEdit()) l.addWidget(panel, 0) panel = GroupBox() panel.title = "5" panel.titleIcon = getIcon("folder") content = QtGui.QWidget() contentLayout = QtGui.QVBoxLayout() content.setLayout(contentLayout) panel.setContent(content) panel2 = GroupBox() panel2.title = "5.1" panel2.titleIcon = getIcon("folder") panel2.titleHeight = 48 content2 = QtGui.QWidget() contentLayout2 = QtGui.QFormLayout() content2.setLayout(contentLayout2) panel2.setContent(content2) contentLayout2.addRow("Something", QtGui.QLineEdit()) contentLayout2.addRow("More", QtGui.QLineEdit()) contentLayout.addWidget(panel2, 0) l.addWidget(panel, 0) l.addStretch(1) w.show() w.adjustSize() app.exec_() return w