예제 #1
0
파일: qtree.py 프로젝트: cmft/taurus
    def __init__(self, view=None, parent=None, designMode=False):
        BaseToolBar.__init__(self, name="Taurus selection toolbar", view=view,
                             parent=parent, designMode=designMode)

        af = ActionFactory()
        self._expandAllAction = af.createAction(self, "Expand All",
                                                icon=Qt.QIcon(
                                                    "actions:expand.png"),
                                                tip="Expand all items",
                                                triggered=self.onExpandAll)
        self._collapseAllAction = af.createAction(self, "Collapse All",
                                                  icon=Qt.QIcon(
                                                      "actions:collapse.png"),
                                                  tip="Collapse all items",
                                                  triggered=self.onCollapseAll)
        self._expandSelectionAction = af.createAction(self, "Expand selection",
                                                      icon=Qt.QIcon(
                                                          "actions:expand-selection.png"),
                                                      tip="Expand selection",
                                                      triggered=self.onExpandSelection)
        self._collapseSelectionAction = af.createAction(self, "Collapse All",
                                                        icon=Qt.QIcon(
                                                            "actions:collapse-selection.png"),
                                                        tip="Collapse selection",
                                                        triggered=self.onCollapseSelection)
        self.addAction(self._expandAllAction)
        self.addAction(self._collapseAllAction)
        self.addAction(self._expandSelectionAction)
        self.addAction(self._collapseSelectionAction)
예제 #2
0
    def __init__(self, view=None, parent=None, designMode=False):
        BaseToolBar.__init__(self,
                             name="Taurus selection toolbar",
                             view=view,
                             parent=parent,
                             designMode=designMode)

        af = ActionFactory()
        self._goIntoAction = af.createAction(
            self,
            "Go Into",
            icon=Qt.QIcon.fromTheme("go-down"),
            tip="Go into the selected item",
            triggered=self.goInto)
        self._goUpAction = af.createAction(self,
                                           "Go Up",
                                           icon=Qt.QIcon.fromTheme("go-up"),
                                           tip="Go up one level",
                                           triggered=self.goUp)
        self._goTopAction = af.createAction(self,
                                            "Go Top",
                                            icon=Qt.QIcon.fromTheme("go-top"),
                                            tip="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)
예제 #3
0
    def createMenuActions(self):
        af = ActionFactory()
        on_save = functools.partial(self.on_save, apply=False)
        on_save_apply = functools.partial(self.on_save, apply=True)

        self.new_action = af.createAction(self, "New...",
                icon='document-new', tip="Create a new macro or controller class",
                triggered=self.on_new, shortcut=Qt.QKeySequence.New)
        self.open_action = af.createAction(self, "Open...",
                icon='document-open', tip="Open macro(s) or controller(s)",
                triggered=self.on_open, shortcut=Qt.QKeySequence.Open)
        self.save_action = af.createAction(self, "Save",
                icon='document-save', tip="Save the current selected item",
                triggered=on_save)
        self.save_and_apply_action = af.createAction(self, "Save && apply",
                triggered=on_save_apply, icon='document-save',
                tip="Save the current selected item and apply the new code",
                shortcut=Qt.QKeySequence.Save)
        self.revert_action = af.createAction(self, "Revert",
                icon='edit-undo', tip="Revert the current selected item code",
                triggered=self.on_revert)

        io_actions = [self.new_action, self.open_action, self.save_action,
                      self.revert_action]
        actions = [self.new_action, self.open_action, self.save_action,
                   self.save_and_apply_action, self.revert_action]
        return actions, io_actions
예제 #4
0
    def createMenuActions(self):
        af = ActionFactory()
        on_save = functools.partial(self.on_save, apply=False)
        on_save_apply = functools.partial(self.on_save, apply=True)

        self.new_action = af.createAction(
            self,
            "New...",
            icon='document-new',
            tip="Create a new macro or controller class",
            triggered=self.on_new,
            shortcut=Qt.QKeySequence.New)
        self.open_action = af.createAction(
            self,
            "Open...",
            icon='document-open',
            tip="Open macro(s) or controller(s)",
            triggered=self.on_open,
            shortcut=Qt.QKeySequence.Open)
        self.save_action = af.createAction(
            self,
            "Save",
            icon='document-save',
            tip="Save the current selected item",
            triggered=on_save)
        self.save_and_apply_action = af.createAction(
            self,
            "Save && apply",
            triggered=on_save_apply,
            icon='document-save',
            tip="Save the current selected item and apply the new code",
            shortcut=Qt.QKeySequence.Save)
        self.revert_action = af.createAction(
            self,
            "Revert",
            icon='edit-undo',
            tip="Revert the current selected item code",
            triggered=self.on_revert)

        io_actions = [
            self.new_action, self.open_action, self.save_action,
            self.revert_action
        ]
        actions = [
            self.new_action, self.open_action, self.save_action,
            self.save_and_apply_action, self.revert_action
        ]
        return actions, io_actions
예제 #5
0
    def __init__(self, view=None, parent=None, designMode=False):
        FilterToolBar.__init__(self,
                               view=view,
                               parent=parent,
                               designMode=designMode)
        self.getFilterLineEdit().setToolTip("Quick filter by log name")

        self._logLevelComboBox = logLevelComboBox = Qt.QComboBox()
        levels = "Trace", "Debug", "Info", "Warning", "Error", "Critical"
        for level in levels:
            logLevelComboBox.addItem(level, Qt.QVariant(getattr(taurus,
                                                                level)))
        logLevelComboBox.setCurrentIndex(0)
        Qt.QObject.connect(logLevelComboBox,
                           Qt.SIGNAL("currentIndexChanged(int)"),
                           self.onLogLevelChanged)
        logLevelComboBox.setToolTip("Filter by log level")

        self._filterLevelAction = self.addWidget(logLevelComboBox)
        self.addSeparator()

        af = ActionFactory()
        self._scrollLockAction = af.createAction(
            self,
            "Refresh",
            icon=getThemeIcon("system-lock-screen"),
            tip="Scroll lock",
            toggled=self.onToggleScrollLock)

        self.addAction(self._scrollLockAction)
예제 #6
0
    def __init__(self, perspective, view=None, parent=None, designMode=False):
        BaseToolBar.__init__(self, name="Taurus refresh toolbar", view=view,
                             parent=parent, designMode=designMode)
        self._perspective = perspective
        view = self.viewWidget()
        b = self._perspective_button = Qt.QToolButton(self)
        b.setToolTip("Perspective selection")
        b.setPopupMode(Qt.QToolButton.InstantPopup)
        b.setToolButtonStyle(Qt.Qt.ToolButtonTextBesideIcon)

        menu = Qt.QMenu("Perspective", b)
        b.setMenu(menu)
        af = ActionFactory()
        for persp, persp_data in view.KnownPerspectives.items():
            label = persp_data["label"]
            icon = getIcon(persp_data["icon"])
            tip = persp_data["tooltip"]
            action = af.createAction(self, label, icon=icon, tip=tip,
                                     triggered=self.onSwitchPerspective)
            action.perspective = persp
            menu.addAction(action)
            if persp == perspective:
                b.setDefaultAction(action)

        self._perspectiveAction = self.addWidget(b)
예제 #7
0
파일: qlogtable.py 프로젝트: cmft/taurus
    def __init__(self, view=None, parent=None, designMode=False):
        FilterToolBar.__init__(self, view=view, parent=parent,
                               designMode=designMode)
        self.getFilterLineEdit().setToolTip("Quick filter by log name")

        self._logLevelComboBox = logLevelComboBox = Qt.QComboBox()
        levels = "Trace", "Debug", "Info", "Warning", "Error", "Critical"
        for level in levels:
            logLevelComboBox.addItem(
                level, Qt.QVariant(getattr(taurus, level)))
        logLevelComboBox.setCurrentIndex(0)
        logLevelComboBox.currentIndexChanged.connect(self.onLogLevelChanged)
        logLevelComboBox.setToolTip("Filter by log level")

        self._filterLevelAction = self.addWidget(logLevelComboBox)
        self.addSeparator()

        af = ActionFactory()
        self._scrollLockAction = af.createAction(self, "Refresh",
                                                 icon=Qt.QIcon.fromTheme(
                                                     "system-lock-screen"),
                                                 tip="Scroll lock",
                                                 toggled=self.onToggleScrollLock)

        self.addAction(self._scrollLockAction)
예제 #8
0
    def __init__(self, view=None, parent=None, designMode=False):
        BaseToolBar.__init__(self, name="Taurus selection toolbar", view=view,
                             parent=parent, designMode=designMode)

        af = ActionFactory()
        self._selectAllAction = af.createAction(self, "Select All",
                                                icon=getThemeIcon(
                                                    "edit-select-all"),
                                                tip="Select all items",
                                                triggered=self.onSelectAll)
        self._clearSelectionAction = af.createAction(self, "Clear selection",
                                                     icon=getThemeIcon(
                                                         "edit-clear"),
                                                     tip="Clears current selection",
                                                     triggered=self.onclearSelection)

        self.addAction(self._selectAllAction)
        self.addAction(self._clearSelectionAction)
예제 #9
0
    def __init__(self, view=None, parent=None, designMode=False):
        BaseToolBar.__init__(self, name="Taurus refresh toolbar", view=view,
                             parent=parent, designMode=designMode)

        af = ActionFactory()
        self._refreshAction = af.createAction(self, "Refresh",
                                              icon=getThemeIcon(
                                                  "view-refresh"),
                                              tip="Refresh view",
                                              triggered=self.onRefresh)
        self.addAction(self._refreshAction)
예제 #10
0
파일: qtree.py 프로젝트: cmft/taurus
    def __init__(self, view=None, parent=None, designMode=False):
        BaseToolBar.__init__(self, name="Taurus selection toolbar", view=view,
                             parent=parent, designMode=designMode)

        af = ActionFactory()
        self._goIntoAction = af.createAction(self, "Go Into",
                                             icon=Qt.QIcon.fromTheme("go-down"),
                                             tip="Go into the selected item",
                                             triggered=self.goInto)
        self._goUpAction = af.createAction(self, "Go Up",
                                           icon=Qt.QIcon.fromTheme("go-up"),
                                           tip="Go up one level",
                                           triggered=self.goUp)
        self._goTopAction = af.createAction(self, "Go Top",
                                            icon=Qt.QIcon.fromTheme("go-top"),
                                            tip="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)
예제 #11
0
    def __init__(self, view=None, parent=None, designMode=False):
        BaseToolBar.__init__(self,
                             name="Taurus selection toolbar",
                             view=view,
                             parent=parent,
                             designMode=designMode)

        af = ActionFactory()
        self._expandAllAction = af.createAction(
            self,
            "Expand All",
            icon=Qt.QIcon("actions:expand.png"),
            tip="Expand all items",
            triggered=self.onExpandAll)
        self._collapseAllAction = af.createAction(
            self,
            "Collapse All",
            icon=Qt.QIcon("actions:collapse.png"),
            tip="Collapse all items",
            triggered=self.onCollapseAll)
        self._expandSelectionAction = af.createAction(
            self,
            "Expand selection",
            icon=Qt.QIcon("actions:expand-selection.png"),
            tip="Expand selection",
            triggered=self.onExpandSelection)
        self._collapseSelectionAction = af.createAction(
            self,
            "Collapse All",
            icon=Qt.QIcon("actions:collapse-selection.png"),
            tip="Collapse selection",
            triggered=self.onCollapseSelection)
        self.addAction(self._expandAllAction)
        self.addAction(self._collapseAllAction)
        self.addAction(self._expandSelectionAction)
        self.addAction(self._collapseSelectionAction)
예제 #12
0
    def __init__(self, view=None, parent=None, designMode=False):
        BaseToolBar.__init__(self,
                             name="Taurus editor toolbar",
                             view=view,
                             parent=parent,
                             designMode=designMode)

        af = ActionFactory()
        self._addAction = af.createAction(self,
                                          "New item",
                                          icon=Qt.QIcon.fromTheme("list-add"),
                                          tip="Add new item",
                                          triggered=self.onAdd)
        self._removeAction = af.createAction(
            self,
            "Remove item",
            icon=Qt.QIcon.fromTheme("list-remove"),
            tip="Remove item",
            triggered=self.onRemove)
        self._moveTopAction = af.createAction(
            self,
            "To top",
            icon=Qt.QIcon.fromTheme("go-top"),
            tip="Move selected item to top",
            triggered=self.onMoveTop)
        self._moveUpAction = af.createAction(
            self,
            "Move up",
            icon=Qt.QIcon.fromTheme("go-up"),
            tip="Move selected item up one level",
            triggered=self.onMoveUp)
        self._moveDownAction = af.createAction(
            self,
            "Move down",
            icon=Qt.QIcon.fromTheme("go-down"),
            tip="Move selected item down one level",
            triggered=self.onMoveDown)
        self._moveBottomAction = af.createAction(
            self,
            "To bottom",
            icon=Qt.QIcon.fromTheme("go-bottom"),
            tip="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)
예제 #13
0
    def __init__(self, view=None, parent=None, designMode=False):
        BaseToolBar.__init__(self, name="Taurus filter toolbar", view=view,
                             parent=parent, designMode=designMode)
        filterLineEdit = self._filterLineEdit = Qt.QLineEdit(self)
        filterLineEdit.setSizePolicy(Qt.QSizePolicy(Qt.QSizePolicy.Preferred,
                                                    Qt.QSizePolicy.Preferred))
        filterLineEdit.setToolTip("Quick filter")
        Qt.QObject.connect(filterLineEdit,
                           Qt.SIGNAL("textChanged(const QString &)"),
                           self.onFilterChanged)
        Qt.QObject.connect(filterLineEdit,
                           Qt.SIGNAL("textEdited(const QString &)"),
                           self.onFilterEdited)
        self.addWidget(filterLineEdit)

        af = ActionFactory()
        self._clearFilterAction = af.createAction(self, "Clear",
                                                  icon=getThemeIcon(
                                                      "edit-clear"),
                                                  tip="Clears the filter",
                                                  triggered=self.onClearFilter)
        self.addAction(self._clearFilterAction)