def __init__(self, parent):
        DockWidget.__init__(self, parent, "&Search Results",
                            QIcon(":/enkiicons/search.png"), "Alt+S")

        # actions
        self._model = searchresultsmodel.SearchResultsModel(self)
        self.onResultsHandledByReplaceThread.connect(
            self._model.onResultsHandledByReplaceThread)

        self._view = QTreeView(self)
        self._view.setHeaderHidden(True)
        self._view.setUniformRowHeights(True)
        self._view.setModel(self._model)
        self._delegate = HTMLDelegate()
        self._view.setItemDelegate(self._delegate)

        self.setWidget(self._view)
        self.setFocusProxy(self._view)

        # connections
        self._model.firstResultsAvailable.connect(self.show)
        self._view.activated.connect(self._onResultActivated)

        core.actionManager().addAction("mView/aSearchResults",
                                       self.showAction())

        self._expandCollapseAll = ExpandCollapseAllButton(
            self.titleBarWidget(), self._view, self._model)
        self._checkUncheckAll = None
Beispiel #2
0
    def _createUi(self):
        self.setWindowTitle(core.project().path() or 'Locator')

        self.setLayout(QVBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.layout().setSpacing(1)

        biggerFont = self.font()
        biggerFont.setPointSizeF(biggerFont.pointSizeF() * 2)
        self.setFont(biggerFont)

        self._edit = _CompletableLineEdit(self)
        self._edit.updateCurrentCommand.connect(self._updateCurrentCommand)
        self._edit.enterPressed.connect(self._onEnterPressed)
        self._edit.installEventFilter(self)  # catch Up, Down
        self.layout().addWidget(self._edit)
        self.setFocusProxy(self._edit)

        self._table = QTreeView(self)
        self._table.setFont(biggerFont)
        self._model = _CompleterModel()
        self._table.setModel(self._model)
        self._table.setItemDelegate(HTMLDelegate(self._table))
        self._table.setRootIsDecorated(False)
        self._table.setHeaderHidden(True)
        self._table.clicked.connect(self._onItemClicked)
        self._table.setAlternatingRowColors(True)
        self._table.installEventFilter(
            self)  # catch focus and give to the edit
        self.layout().addWidget(self._table)

        width = QFontMetrics(self.font()).width('x' *
                                                64)  # width of 64 'x' letters
        self.resize(width, width * 0.62)
Beispiel #3
0
    def __init__(self, *args):
        QDialog.__init__(self, *args)

        self._commandClasses = []
        self._history = ['']
        self._historyIndex = 0
        self._incompleteCommand = None

        self.setLayout(QVBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.layout().setSpacing(1)

        self._table = QTreeView(self)
        self._model = _CompleterModel()
        self._table.setModel(self._model)
        self._table.setItemDelegate(HTMLDelegate())
        self._table.setRootIsDecorated(False)
        self._table.setHeaderHidden(True)
        self._table.clicked.connect(self._onItemClicked)
        self.layout().addWidget(self._table)

        self._edit = _CompletableLineEdit(self)
        self.layout().addWidget(self._edit)
        self._edit.updateCompletion.connect(self._updateCompletion)
        self._edit.enterPressed.connect(self._onEnterPressed)
        self._edit.historyPrevious.connect(self._onHistoryPrevious)
        self._edit.historyNext.connect(self._onHistoryNext)
        self.setFocusProxy(self._edit)

        width = QFontMetrics(self.font()).width('x' *
                                                64)  # width of 64 'x' letters
        self.resize(width, width * 0.62)

        self._action = core.actionManager().addAction("mNavigation/aLocator",
                                                      "Locator",
                                                      shortcut='Ctrl+L')
        self._action.triggered.connect(self._onAction)
        self._separator = core.actionManager().menu(
            "mNavigation").addSeparator()

        # without it action works only when main window is focused, and user can't move focus, when tree is focused
        self.addAction(self._action)

        self._loadingTimer = QTimer(self)
        self._loadingTimer.setSingleShot(True)
        self._loadingTimer.setInterval(200)
        self._loadingTimer.timeout.connect(self._applyLoadingCompleter)

        self._completerConstructorThread = None