예제 #1
0
    def init_features(self):
        """
        Initialise custom Editor features.
        """
        if self._features_initialised:
            return
        self._features_initialised = True

        # QSyntaxHighlighter causes
        # textChanged to be emitted,
        # which we don't want.
        self.emit_text_changed = False
        syntaxhighlighter.Highlight(self.document(), self)

        def set_text_changed_enabled():
            self.emit_text_changed = True

        QTimer.singleShot(0, set_text_changed_enabled)

        CM = contextmenu.ContextMenu
        self.contextmenu = CM(self)

        # TODO: add a new autocompleter
        # that uses DirectConnection.
        self.autocomplete_overriding = True
        AC = autocompletion.AutoCompleter
        self.autocomplete = AC(self)

        if self._handle_shortcuts:
            actions.Actions(editor=self)
            shortcuts.ShortcutHandler(editor=self)
예제 #2
0
    def init_features(self):
        """
        Initialise custom Editor features.
        """
        if self._features_initialised:
            return
        self._features_initialised = True

        # QSyntaxHighlighter causes textChanged to be emitted, which we don't want.
        self.emit_text_changed = False
        syntaxhighlighter.Highlight(self.document())

        def set_text_changed_enabled():
            self.emit_text_changed = True

        QtCore.QTimer.singleShot(0, set_text_changed_enabled)

        # self.emit_text_changed = True
        self.contextmenu = contextmenu.ContextMenu(self)

        # TOOD: add a new autocompleter that uses DirectConnection.
        self.wait_for_autocomplete = True
        self.autocomplete = autocompletion.AutoCompleter(self)

        if self._handle_shortcuts:
            sch = shortcuts.ShortcutHandler(editor=self, use_tabs=False)
            sch.clear_output_signal.connect(self.relay_clear_output_signal)
            self.shortcuteditor = shortcuteditor.ShortcutEditor(sch)

        self.selectionChanged.connect(self.highlight_same_words)
예제 #3
0
 def connect_signals(self):
     """
     Connect child widget slots to shortcuts.
     Loading the AutosaveManager will also load all the
     contents of the autosave into tabs.
     """
     sch = shortcuts.ShortcutHandler(self.tabeditor, use_tabs=True)
     sch.clear_output_signal.connect(self.terminal.clear)
     self.shortcuteditor = shortcuteditor.ShortcutEditor(sch)
     self.preferenceseditor = preferences.PreferencesEditor()
     self.filehandler = autosavexml.AutoSaveManager(self.tabeditor)
예제 #4
0
    def install_features(self):
        """
        Install features and connect required signals.
        """
        sch = shortcuts.ShortcutHandler(self.tabs)
        # sch.clear_output_signal.connect(self.terminal.clear)
        self.shortcuteditor = shortcuteditor.ShortcutEditor(sch)
        self.preferenceseditor = preferences.PreferencesEditor()

        self.filehandler = autosavexml.AutoSaveManager(self.tabs)

        self.browser.path_signal.connect(self.read)
예제 #5
0
    def __init__(self, parent=None):
        super(PythonEditor, self).__init__(parent=parent)
        self.setObjectName('PythonEditor')
        self._parent = parent
        if parent is not None:
            self.setParent(parent)

        layout = QtWidgets.QVBoxLayout(self)
        layout.setObjectName('PythonEditor_MainLayout')
        layout.setContentsMargins(0, 0, 0, 0)

        self.tabeditor = tabs.TabEditor(self)
        self.editor = self.tabeditor.editor
        self.terminal = terminal.Terminal()

        splitter = QtWidgets.QSplitter(QtCore.Qt.Vertical)
        splitter.setObjectName('PythonEditor_MainVerticalSplitter')
        splitter.addWidget(self.terminal)
        splitter.addWidget(self.tabeditor)

        layout.addWidget(splitter)
        self.splitter = splitter

        act = actions.Actions(
            pythoneditor=self,
            editor=self.editor,
            tabeditor=self.tabeditor,
            terminal=self.terminal,
        )

        sch = shortcuts.ShortcutHandler(
            editor=self.editor,
            tabeditor=self.tabeditor,
            terminal=self.terminal,
        )

        self.menubar = menubar.MenuBar(self)

        SE = shortcuteditor.ShortcutEditor
        self.shortcuteditor = SE(editor=self.editor,
                                 tabeditor=self.tabeditor,
                                 terminal=self.terminal)

        PE = preferences.PreferencesEditor
        self.preferenceseditor = PE()

        # Loading the AutosaveManager will also load
        # all the contents of the autosave into tabs.
        AM = autosavexml.AutoSaveManager
        self.filehandler = AM(self.tabeditor)