Пример #1
0
    def __init__(self):
        super(_StatusBar, self).__init__()
        self.current_status = _STATUSBAR_STATE_SEARCH

        self._widgetStatus = QWidget()
        vbox = QVBoxLayout(self._widgetStatus)
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)
        #Search Layout
        self._searchWidget = SearchWidget()
        vbox.addWidget(self._searchWidget)
        #Replace Layout
        self._replaceWidget = ReplaceWidget()
        vbox.addWidget(self._replaceWidget)
        self._replaceWidget.setVisible(False)
        #Code Locator
        self._codeLocator = locator.CodeLocatorWidget()
        vbox.addWidget(self._codeLocator)
        self._codeLocator.setVisible(False)
        #File system completer
        self._fileSystemOpener = FileSystemOpener()
        vbox.addWidget(self._fileSystemOpener)
        self._fileSystemOpener.setVisible(False)

        self.addWidget(self._widgetStatus)
        # Not Configurable Shortcuts
        shortEscStatus = QShortcut(QKeySequence(Qt.Key_Escape), self)

        self.connect(shortEscStatus, SIGNAL("activated()"), self.hide_status)
        self.connect(self._searchWidget._btnClose, SIGNAL("clicked()"),
                     self.hide_status)
        self.connect(self._replaceWidget._btnCloseReplace, SIGNAL("clicked()"),
                     lambda: self._replaceWidget.setVisible(False))
        self.connect(self._fileSystemOpener.btnClose, SIGNAL("clicked()"),
                     self.hide_status)
        self.connect(self._fileSystemOpener, SIGNAL("requestHide()"),
                     self.hide_status)
        self.connect(self._codeLocator, SIGNAL("hidden()"), self.hide_status)

        #Register signals connections
        connections = (
            {
                'target': 'main_container',
                'signal_name': 'currentEditorChanged(QString)',
                'slot': self._handle_tab_changed
            },
            {
                'target': 'main_container',
                'signal_name': 'updateLocator(QString)',
                'slot': self._explore_file_code
            },
            {
                'target': 'projects_explorer',
                'signal_name': 'updateLocator()',
                'slot': self._explore_code
            },
        )

        IDE.register_signals('status_bar', connections)
        IDE.register_service('status_bar', self)
Пример #2
0
    def __init__(self, parent=None):
        QStatusBar.__init__(self, parent)

        self._widgetStatus = QWidget()
        vbox = QVBoxLayout(self._widgetStatus)
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)
        #Search Layout
        self._searchWidget = SearchWidget(self)
        vbox.addWidget(self._searchWidget)
        #Replace Layout
        self._replaceWidget = ReplaceWidget(self)
        vbox.addWidget(self._replaceWidget)
        self._replaceWidget.setVisible(False)
        #Code Locator
        self._codeLocator = locator.CodeLocatorWidget(self)
        vbox.addWidget(self._codeLocator)
        self._codeLocator.setVisible(False)
        #File system completer
        self._fileSystemOpener = FileSystemOpener()
        vbox.addWidget(self._fileSystemOpener)
        self._fileSystemOpener.setVisible(False)

        self.addWidget(self._widgetStatus)

        self._shortEsc = QShortcut(QKeySequence(Qt.Key_Escape), self)

        self.connect(self, SIGNAL("messageChanged(QString)"), self.message_end)
        self.connect(self._replaceWidget._btnCloseReplace, SIGNAL("clicked()"),
                     lambda: self._replaceWidget.setVisible(False))
        self.connect(self._replaceWidget._btnReplace, SIGNAL("clicked()"),
                     self.replace)
        self.connect(self._replaceWidget._btnReplaceAll, SIGNAL("clicked()"),
                     self.replace_all)
        self.connect(self._replaceWidget._btnReplaceSelection,
                     SIGNAL("clicked()"), self.replace_selected)
        self.connect(self._shortEsc, SIGNAL("activated()"), self.hide_status)
        self.connect(self._fileSystemOpener.btnClose, SIGNAL("clicked()"),
                     self.hide_status)
        self.connect(self._fileSystemOpener, SIGNAL("requestHide()"),
                     self.hide_status)