class CustomMainWindow(QMainWindow):
    def __init__(self):
        super(CustomMainWindow, self).__init__()

        # Window setup
        # --------------

        # 1. Define the geometry of the main window
        self.setGeometry(300, 300, 800, 400)
        self.setWindowTitle("QScintilla Test")

        # 2. Create frame and layout
        self.__frm = QFrame(self)
        self.__frm.setStyleSheet("QWidget { background-color: #ffeaeaea }")
        self.__lyt = QVBoxLayout()
        self.__frm.setLayout(self.__lyt)
        self.setCentralWidget(self.__frm)
        self.__myFont = QFont()
        self.__myFont.setPointSize(14)

        # 3. Place a button
        self.__btn = QPushButton("Qsci")
        self.__btn.setFixedWidth(50)
        self.__btn.setFixedHeight(50)
        self.__btn.clicked.connect(self.__btn_action)
        self.__btn.setFont(self.__myFont)
        self.__lyt.addWidget(self.__btn)

        # QScintilla editor setup
        # ------------------------

        # ! Make instance of QsciScintilla class!
        self.__editor = QsciScintilla()
        self.__editor.setText("Hello\n")
        self.__editor.append("world \n")
        self.__editor.setLexer(None)
        self.__editor.setUtf8(True)  # Set encoding to UTF-8
        self.__editor.setFont(self.__myFont)  # Will be overridden by lexer!

        #simple editor options

        self.__editor.setEolVisibility(False) #sets the end of each line with an EOL character
        self.__editor.setIndentationsUseTabs(False) #determines whether indent uses tabs or whitespace char.
        self.__editor.setTabWidth(4)
        self.__editor.setIndentationGuides(True)
        self.__editor.setTabIndents(True)
        self.__editor.setAutoIndent(True)
        self.__editor.setCaretForegroundColor(QColor("#ff0000ff"))
        self.__editor.setCaretLineVisible(True)
        self.__editor.setCaretLineBackgroundColor(QColor("#1fff0000"))
        self.__editor.setCaretWidth(5)

        #Margin SetUp.
        self.__editor.setMarginType(3, self.__editor.NumberMargin)
        self.__editor.setMarginsForegroundColor(QColor("#ff888888"))
        # self.__editor.setMarginType(2, QsciScintilla.TextMargin)
        # Symbol Margin
        sym_0 = QImage("icons/sym_0.png").scaled(QSize(16, 16))
        sym_1 = QImage("icons/sym_1.png").scaled(QSize(16, 16))
        sym_2 = QImage("icons/sym_2.png").scaled(QSize(16, 16))
        sym_3 = QImage("icons/sym_3.png").scaled(QSize(16, 16))
        sym_4 = self.__editor.Circle
        self.__editor.markerDefine(sym_0, 0)
        self.__editor.markerDefine(sym_1, 1)
        self.__editor.markerDefine(sym_2, 2)
        self.__editor.markerDefine(sym_3, 3)
        self.__editor.markerDefine(sym_4, 4)
        self.__editor.setMarginType(3, self.__editor.SymbolMargin)
        # self.__editor.setMarginType(2, QsciScintilla.SymbolMarginDefaultBackgroundColor)
        # self.__editor.setMarginType(3, QsciScintilla.SymbolMarginDefaultForegroundColor)
        self.__editor.setMarginWidth(1, '00000')
        self.__editor.setMarginMarkerMask(1, 0b1111)
        self.__editor.setMarginMarkerMask(2, 0b1111)
        self.__editor.markerAdd(3, 2)
        # Display a few symbols, and keep their handles stored
        self.__editor.markerAdd(0, 0)   # Green dot on line 0+1
        self.__editor.markerAdd(4, 0)   # Green dot on line 4+1
        self.__editor.markerAdd(5, 0)   # Green dot on line 5+1
        self.__editor.markerAdd(8, 3)   # Red arrow on line 8+1
        self.__editor.markerAdd(9, 2)   # Red dot on line 9+1

        self.__editor.setFolding(self.__editor.BoxedFoldStyle, 4)
        self.__editor.SendScintilla(self.__editor.SCI_SETMULTIPLESELECTION, True)
        self.__editor.SendScintilla(self.__editor.SCI_SETMULTIPASTE, 1)
        self.__editor.SendScintilla(self.__editor.SCI_SETADDITIONALSELECTIONTYPING, True)
        self.__editor.SendScintilla(self.__editor.SCI_SETINDENTATIONGUIDES, self.__editor.SC_IV_REAL);
        self.__editor.SendScintilla(self.__editor.SCI_SETTABWIDTH, 4)

        # self.__editor.setMarginsBackgroundColor(QColor("#ff0000ff"))
        self.__editor.setWrapMode(QsciScintilla.WrapWord)
        self.__editor.setWrapIndentMode(QsciScintilla.WrapIndentIndented)

        # available wrap modes: 
        # QsciScintilla.WrapNone, WrapWord, WrapCharacter, WrapWhitespace
        self.__editor.setWrapVisualFlags(
            QsciScintilla.WrapFlagByText,
            startFlag=QsciScintilla.WrapFlagByText,
            indent=4)
        # setWrapVisualFlags(endFlag, startFlag, indent)
        # see: readMe
        self.__editor.setWrapIndentMode(QsciScintilla.WrapIndentIndented)
        self.__editor.textChanged.connect(self.text_changed) #signal typing

        # ! Add editor to layout !
        self.__lyt.addWidget(self.__editor)

        self.show()

    ''''''

    def __btn_action(self):
        self.__editor.append('Voila You just clicked the QSci button! \n')
        print("Hello World!")

    def text_changed(self):
        print({self.__editor.text()})
    ''''''
Пример #2
0
class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("Untitled")
        icon = os.path.join(BASE_DIR, 'ide/Icon.ico')
        self.setWindowIcon(QIcon(icon))
        self.saveLoad = SaveLoad()
        self.fileName = None
        self.setupUI()

    def setupUI(self):
        centralWidget = QWidget(self)
        layout = QHBoxLayout(centralWidget)
        self.fileSysView = QTreeView(centralWidget)
        self.setupFileSystemViewer()
        self.editor = QsciScintilla(centralWidget)
        self.setupEditor()
        layout.addWidget(self.fileSysView, 1)
        layout.addWidget(self.editor, 3)
        self.setCentralWidget(centralWidget)
        self.setMinimumSize(700, 500)
        self.defaultMenuBar = QMenuBar(self)
        self.setupMenus()
        self.setMenuBar(self.defaultMenuBar)
        self.show()

    def setupEditor(self):
        self.editor.setFont(QFont("Times New Roman", 12))
        self.editor.setMargins(2)
        self.editor.setMarginType(0, QsciScintilla.NumberMargin)
        self.editor.setMarginType(1, QsciScintilla.SymbolMargin)
        self.editor.setMarginWidth(0, "000")
        self.editor.setMarginWidth(1, "00")
        self.editor.markerDefine(QsciScintilla.RightTriangle, 1)
        if system() == "Windows":
            self.editor.setEolMode(QsciScintilla.EolWindows)
        elif system() == "Linux":
            self.editor.setEolMode(QsciScintilla.EolUnix)
        elif system() == "Mac":
            self.editor.setEolMode(QsciScintilla.EolMac)
        else:
            print("Using Windows EOL")
            self.editor.setEolMode(QsciScintilla.EolWindows)
        self.editor.setBraceMatching(QsciScintilla.SloppyBraceMatch)
        self.editor.setIndentationsUseTabs(True)
        self.editor.setTabWidth(4)
        self.editor.setIndentationGuides(True)
        self.editor.setTabIndents(True)
        self.editor.setAutoIndent(True)
        self.editor.setCaretForegroundColor(QColor("#ff11214b"))
        self.editor.setCaretLineVisible(True)
        self.editor.setCaretLineBackgroundColor(QColor("#1f0000ff"))
        self.editor.setUtf8(True)
        self.editor.setMarginSensitivity(1, True)
        self.editor.marginClicked.connect(self.margin_clicked)
        self.editor.marginRightClicked.connect(self.margin_right_clicked)
        self.lexer = QsciLexerPython()
        self.lexer.setFont(QFont("Times New Roman", 12))
        self.editor.setLexer(self.lexer)
        self.editor.textChanged.connect(self.fileChanged)

    def setupFileSystemViewer(self):
        model = QFileSystemModel()
        model.setRootPath("/")
        self.fileSysView.setModel(model)
        self.fileSysView.hideColumn(1)
        self.fileSysView.hideColumn(2)
        self.fileSysView.hideColumn(3)
        self.fileSysView.doubleClicked.connect(self.openFile)

    def setupMenus(self):
        fileMenu = QMenu(self.defaultMenuBar)
        fileMenu.setTitle("File")
        editMenu = QMenu(self.defaultMenuBar)
        editMenu.setTitle("Edit")
        viewMenu = QMenu(self.defaultMenuBar)
        viewMenu.setTitle("View")
        runMenu = QMenu(self.defaultMenuBar)
        runMenu.setTitle("Run")
        settingsMenu = QMenu(self.defaultMenuBar)
        settingsMenu.setTitle("Settings")
        self.actionNew = QAction(self)
        self.actionNew.setText("New")
        self.actionNew.setShortcut("Ctrl+N")
        self.actionOpen = QAction(self)
        self.actionOpen.setText("Open")
        self.actionOpen.setShortcut("Ctrl+O")
        self.actionSave = QAction(self)
        self.actionSave.setText("Save")
        self.actionSave.setShortcut("Ctrl+S")
        self.actionSaveAs = QAction(self)
        self.actionSaveAs.setText("Save As")
        self.actionSaveAs.setShortcut("Ctrl+Shift+S")
        self.actionExit = QAction(self)
        self.actionExit.setText("Exit")
        self.actionExit.setShortcut("Alt+X")
        self.actionUndo = QAction(self)
        self.actionUndo.setText("Undo")
        self.actionUndo.setShortcut("Ctrl+Z")
        self.actionRedo = QAction(self)
        self.actionRedo.setText("Redo")
        self.actionRedo.setShortcut("Ctrl+Shift+Z")
        self.actionSelectAll = QAction(self)
        self.actionSelectAll.setText("Select all")
        self.actionSelectAll.setShortcut("Ctrl+A")
        self.actionCut = QAction(self)
        self.actionCut.setText("Cut")
        self.actionCut.setShortcut("Ctrl+X")
        self.actionCopy = QAction(self)
        self.actionCopy.setText("Copy")
        self.actionCopy.setShortcut("Ctrl+C")
        self.actionPaste = QAction(self)
        self.actionPaste.setText("Paste")
        self.actionPaste.setShortcut("Ctrl+V")
        self.actionFind = QAction(self)
        self.actionFind.setText("Find")
        self.actionFind.setShortcut("Ctrl+F")
        self.actionReplace = QAction(self)
        self.actionReplace.setText("Replace")
        self.actionReplace.setShortcut("Ctrl+H")
        self.actionRun = QAction(self)
        self.actionRun.setText("Run")
        self.actionRun.setShortcut("F5")
        self.actionRunCustom = QAction(self)
        self.actionRunCustom.setText("Run Customized")
        self.actionRunCustom.setShortcut("Shift+F5")
        self.actionShell = QAction(self)
        self.actionShell.setText("Python shell")
        self.actionShell.setShortcut("Alt+S")
        self.actionFont = QAction(self)
        self.actionFont.setText("Font")
        self.actionEncoding = QAction(self)
        self.actionEncoding.setText("Encoding")
        fileMenu.addAction(self.actionNew)
        fileMenu.addAction(self.actionOpen)
        fileMenu.addAction(self.actionSave)
        fileMenu.addAction(self.actionSaveAs)
        fileMenu.addSeparator()
        fileMenu.addAction(self.actionExit)
        editMenu.addAction(self.actionUndo)
        editMenu.addAction(self.actionRedo)
        editMenu.addSeparator()
        editMenu.addAction(self.actionSelectAll)
        editMenu.addSeparator()
        editMenu.addAction(self.actionCut)
        editMenu.addAction(self.actionCopy)
        editMenu.addAction(self.actionPaste)
        viewMenu.addAction(self.actionFind)
        viewMenu.addAction(self.actionReplace)
        runMenu.addAction(self.actionRun)
        runMenu.addAction(self.actionRunCustom)
        runMenu.addAction(self.actionShell)
        settingsMenu.addAction(self.actionFont)
        settingsMenu.addAction(self.actionEncoding)
        self.defaultMenuBar.addAction(fileMenu.menuAction())
        self.defaultMenuBar.addAction(editMenu.menuAction())
        self.defaultMenuBar.addAction(viewMenu.menuAction())
        self.defaultMenuBar.addAction(runMenu.menuAction())
        self.defaultMenuBar.addAction(settingsMenu.menuAction())
        self.actionNew.triggered.connect(self.new)
        self.actionOpen.triggered.connect(self.open)
        self.actionSave.triggered.connect(self.save)
        self.actionSaveAs.triggered.connect(self.saveAs)
        self.actionExit.triggered.connect(self.close)
        self.actionUndo.triggered.connect(self.editor.undo)
        self.actionRedo.triggered.connect(self.editor.redo)
        self.actionSelectAll.triggered.connect(
            lambda: self.editor.selectAll(True))
        self.actionCut.triggered.connect(self.editor.cut)
        self.actionCopy.triggered.connect(self.editor.copy)
        self.actionPaste.triggered.connect(self.editor.paste)
        self.actionFind.triggered.connect(self.find)
        self.actionReplace.triggered.connect(self.replace)
        self.actionRun.triggered.connect(self.run)
        self.actionRunCustom.triggered.connect(self.runCustom)
        self.actionShell.triggered.connect(self.shell)
        self.actionFont.triggered.connect(self.Font)

    def margin_clicked(self, margin_nr, line_nr, state):
        self.editor.markerAdd(line_nr, margin_nr)

    def margin_right_clicked(self, margin_nr, line_nr, state):
        self.editor.markerDelete(line_nr, margin_nr)

    def new(self):
        if self.windowTitle().endswith("*"):
            if (Dialogs().Question(
                    self, "Do you want to save your file?") == "accept"):
                if self.filename is None:
                    self.saveAs()
                else:
                    self.save()
        self.editor.setText("")
        self.setWindowTitle("Untitled")

    def open(self):
        if self.windowTitle().endswith("*"):
            if (Dialogs().Question(
                    self, "Do you want to save your file?") == "accept"):
                if self.filename is None:
                    self.saveAs()
                else:
                    self.save()
        filename = self.saveLoad.OpenDialog()
        data = Open(filename)
        if data is not None:
            self.editor.setText(data)
            self.setWindowTitle(filename)
            self.filename = filename

    def save(self):
        if self.filename is None:
            self.saveAs()
        else:
            returnval = Save(self.editor.text(), self.filename)
            if (returnval):
                Dialogs().Message(self, "File saved successfully")
                self.setWindowTitle(self.filename)
            else:
                Dialogs().Error(self, "File could not be saved")

    def saveAs(self):
        self.filename = self.saveLoad.SaveDialog()
        returnval = Save(self.editor.text(), self.filename)
        if (returnval):
            Dialogs().Message(self, "File saved successfully")
            self.setWindowTitle(self.filename)
        else:
            Dialogs().Error(self, "File could not be saved")

    def run(self):
        if self.filename is None:
            self.saveAs()
        Runfile(self.filename)

    def runCustom(self):
        if self.filename is None:
            self.saveAs()
        if self.filename != "":
            print(len(self.filename))
            option, ok = QInputDialog().getText(
                self, "Customized run", "Enter parameters for sys.argv",
                QLineEdit.Normal, " ")
            if ok:
                Runfile(self.filename, option)

    def shell(self):
        Shell()

    def Font(self):
        font, ok = QFontDialog.getFont()
        if ok:
            self.editor.setFont(font)
            self.lexer.setFont(font)
            self.editor.setLexer(self.lexer)

    def openFile(self, signal):
        fileName = self.fileSysView.model().filePath(signal)
        if fileName.endswith("py") or fileName.endswith("pyw"):
            if self.windowTitle().endswith("*"):
                if Dialogs().Question(
                        self, "Do you want to save your file?") == "accept":
                    if self.filename is None:
                        self.saveAs()
                    else:
                        self.save()
            data = Open(fileName)
            if data is not None:
                self.editor.setText(data)
                self.setWindowTitle(fileName)
                self.filename = fileName

    def fileChanged(self):
        title = self.windowTitle()
        if not (title.endswith("*")):
            self.setWindowTitle(title + " *")

    def replace(self):
        replaceObj = replaceDialog(self, self.editor)

    def find(self):
        findObj = findDialog(self, self.editor)
Пример #3
0
	def markerAdd(self, line, marker):
		"""Add marker with name/id `i` at line `ln`"""
		marker = self._markerToId(marker)
		return QsciScintilla.markerAdd(self, line, marker)
class CustomMainWindow(QMainWindow):
    def __init__(self):
        super(CustomMainWindow, self).__init__()

        # -------------------------------- #
        #           Window setup           #
        # -------------------------------- #

        # 1. Define the geometry of the main window
        # ------------------------------------------
        self.setGeometry(300, 300, 800, 400)
        self.setWindowTitle("QScintilla Test")

        # 2. Create frame and layout
        # ---------------------------
        self.__frm = QFrame(self)
        self.__frm.setStyleSheet("QWidget { background-color: #ffeaeaea }")
        self.__lyt = QVBoxLayout()
        self.__frm.setLayout(self.__lyt)
        self.setCentralWidget(self.__frm)
        self.__myFont = QFont()
        self.__myFont.setPointSize(14)

        # 3. Place a button
        # ------------------
        self.__btn = QPushButton("Qsci")
        self.__btn.setFixedWidth(50)
        self.__btn.setFixedHeight(50)
        self.__btn.clicked.connect(self.__btn_action)
        self.__btn.setFont(self.__myFont)
        self.__lyt.addWidget(self.__btn)

        # -------------------------------- #
        #     QScintilla editor setup      #
        # -------------------------------- #

        # ! Make instance of QSciScintilla class!
        # ----------------------------------------
        self.__editor = QsciScintilla()
        self.__editor.setText("This\n")  # Line 1
        self.__editor.append("is\n")  # Line 2
        self.__editor.append("a\n")  # Line 3
        self.__editor.append("QScintilla\n")  # Line 4
        self.__editor.append("test\n")  # Line 5
        self.__editor.append("program\n")  # Line 6
        self.__editor.append("to\n")  # Line 7
        self.__editor.append("illustrate\n")  # Line 8
        self.__editor.append("some\n")  # Line 9
        self.__editor.append("basic\n")  # Line 10
        self.__editor.append("functions.")  # Line 11
        self.__editor.setLexer(None)
        self.__editor.setUtf8(True)  # Set encoding to UTF-8
        self.__editor.setFont(self.__myFont)

        # 1. Text wrapping
        # -----------------
        self.__editor.setWrapMode(QsciScintilla.WrapWord)
        self.__editor.setWrapVisualFlags(QsciScintilla.WrapFlagByText)
        self.__editor.setWrapIndentMode(QsciScintilla.WrapIndentIndented)

        # 2. End-of-line mode
        # --------------------
        self.__editor.setEolMode(QsciScintilla.EolWindows)
        self.__editor.setEolVisibility(False)

        # 3. Indentation
        # ---------------
        self.__editor.setIndentationsUseTabs(False)
        self.__editor.setTabWidth(4)
        self.__editor.setIndentationGuides(True)
        self.__editor.setTabIndents(True)
        self.__editor.setAutoIndent(True)

        # 4. Caret
        # ---------
        self.__editor.setCaretForegroundColor(QColor("#ff0000ff"))
        self.__editor.setCaretLineVisible(True)
        self.__editor.setCaretLineBackgroundColor(QColor("#1f0000ff"))
        self.__editor.setCaretWidth(2)

        # 5. Margins
        # -----------
        # Margin 0 = Line nr margin
        self.__editor.setMarginType(0, QsciScintilla.NumberMargin)
        self.__editor.setMarginWidth(0, "0000")
        self.__editor.setMarginsForegroundColor(QColor("#ff888888"))

        # Margin 1 = Symbol margin
        self.__editor.setMarginType(1, QsciScintilla.SymbolMargin)
        self.__editor.setMarginWidth(1, "00000")
        sym_0 = QImage("icons/sym_0.png").scaled(QSize(16, 16))
        sym_1 = QImage("icons/sym_1.png").scaled(QSize(16, 16))
        sym_2 = QImage("icons/sym_2.png").scaled(QSize(16, 16))
        sym_3 = QImage("icons/sym_3.png").scaled(QSize(16, 16))

        self.__editor.markerDefine(sym_0, 0)
        self.__editor.markerDefine(sym_1, 1)
        self.__editor.markerDefine(sym_2, 2)
        self.__editor.markerDefine(sym_3, 3)

        self.__editor.setMarginMarkerMask(1, 0b1111)

        # 6. Margin mouse clicks
        # -----------------------
        self.__editor.setMarginSensitivity(1, True)
        self.__editor.marginClicked.connect(self.__margin_left_clicked)
        self.__editor.marginRightClicked.connect(self.__margin_right_clicked)

        # ! Add editor to layout !
        # -------------------------
        self.__lyt.addWidget(self.__editor)
        self.show()

    ''''''

    def __margin_left_clicked(self, margin_nr, line_nr, state):
        print("Margin clicked (left mouse btn)!")
        print(" -> margin_nr: " + str(margin_nr))
        print(" -> line_nr:   " + str(line_nr))
        print("")

        if state == Qt.ControlModifier:
            # Show green dot.
            self.__editor.markerAdd(line_nr, 0)

        elif state == Qt.ShiftModifier:
            # Show green arrow.
            self.__editor.markerAdd(line_nr, 1)

        elif state == Qt.AltModifier:
            # Show red dot.
            self.__editor.markerAdd(line_nr, 2)

        else:
            # Show red arrow.
            self.__editor.markerAdd(line_nr, 3)

    ''''''

    def __margin_right_clicked(self, margin_nr, line_nr, state):
        print("Margin clicked (right mouse btn)!")
        print(" -> margin_nr: " + str(margin_nr))
        print(" -> line_nr:   " + str(line_nr))
        print("")

    ''''''

    def __btn_action(self):
        print("Hello World!")

    ''''''
Пример #5
0
class CustomMainWindow(QMainWindow):
    def __init__(self):
        super(CustomMainWindow, self).__init__()

        # -------------------------------- #
        #           Window setup           #
        # -------------------------------- #

        # 1. Define the geometry of the main window
        # ------------------------------------------
        self.setGeometry(300, 300, 800, 400)
        self.setWindowTitle("QScintilla Test")

        # 2. Create frame and layout
        # ---------------------------
        self.__frm = QFrame(self)
        self.__frm.setStyleSheet("QWidget { background-color: #ffeaeaea }")
        self.__lyt = QVBoxLayout()
        self.__frm.setLayout(self.__lyt)
        self.setCentralWidget(self.__frm)
        self.__myFont = QFont()
        self.__myFont.setPointSize(14)

        # 3. Place a button
        # ------------------
        self.__btn = QPushButton("Qsci")
        self.__btn.setFixedWidth(50)
        self.__btn.setFixedHeight(50)
        self.__btn.clicked.connect(self.__btn_action)
        self.__btn.setFont(self.__myFont)
        self.__lyt.addWidget(self.__btn)

        # -------------------------------- #
        #     QScintilla editor setup      #
        # -------------------------------- #

        # ! Make instance of QSciScintilla class!
        # ----------------------------------------
        self.__editor = QsciScintilla()
        self.__editor.setText("This\n")         # Line 1
        self.__editor.append("is\n")            # Line 2
        self.__editor.append("a\n")             # Line 3
        self.__editor.append("QScintilla\n")    # Line 4
        self.__editor.append("test\n")          # Line 5
        self.__editor.append("program\n")       # Line 6
        self.__editor.append("to\n")            # Line 7
        self.__editor.append("illustrate\n")    # Line 8
        self.__editor.append("some\n")          # Line 9
        self.__editor.append("basic\n")         # Line 10
        self.__editor.append("functions.")      # Line 11
        self.__editor.setLexer(None)
        self.__editor.setUtf8(True)             # Set encoding to UTF-8
        self.__editor.setFont(self.__myFont)

        # 1. Text wrapping
        # -----------------
        self.__editor.setWrapMode(QsciScintilla.WrapWord)
        self.__editor.setWrapVisualFlags(QsciScintilla.WrapFlagByText)
        self.__editor.setWrapIndentMode(QsciScintilla.WrapIndentIndented)

        # 2. End-of-line mode
        # --------------------
        self.__editor.setEolMode(QsciScintilla.EolWindows)
        self.__editor.setEolVisibility(False)

        # 3. Indentation
        # ---------------
        self.__editor.setIndentationsUseTabs(False)
        self.__editor.setTabWidth(4)
        self.__editor.setIndentationGuides(True)
        self.__editor.setTabIndents(True)
        self.__editor.setAutoIndent(True)

        # 4. Caret
        # ---------
        self.__editor.setCaretForegroundColor(QColor("#ff0000ff"))
        self.__editor.setCaretLineVisible(True)
        self.__editor.setCaretLineBackgroundColor(QColor("#1f0000ff"))
        self.__editor.setCaretWidth(2)

        # 5. Margins
        # -----------
        # Margin 0 = Line nr margin
        self.__editor.setMarginType(0, QsciScintilla.NumberMargin)
        self.__editor.setMarginWidth(0, "0000")
        self.__editor.setMarginsForegroundColor(QColor("#ff888888"))

        # Margin 1 = Symbol margin
        self.__editor.setMarginType(1, QsciScintilla.SymbolMargin)
        self.__editor.setMarginWidth(1, "00000")
        sym_0 = QImage("icons/sym_0.png").scaled(QSize(16, 16))
        sym_1 = QImage("icons/sym_1.png").scaled(QSize(16, 16))
        sym_2 = QImage("icons/sym_2.png").scaled(QSize(16, 16))
        sym_3 = QImage("icons/sym_3.png").scaled(QSize(16, 16))

        self.__editor.markerDefine(sym_0, 0)
        self.__editor.markerDefine(sym_1, 1)
        self.__editor.markerDefine(sym_2, 2)
        self.__editor.markerDefine(sym_3, 3)

        self.__editor.setMarginMarkerMask(1, 0b1111)

        # Display a few symbols, and keep their handles stored
        handle_01 = self.__editor.markerAdd(0, 0)   # Green dot on line 0+1
        handle_02 = self.__editor.markerAdd(4, 0)   # Green dot on line 4+1
        handle_03 = self.__editor.markerAdd(5, 0)   # Green dot on line 5+1
        handle_04 = self.__editor.markerAdd(8, 3)   # Red arrow on line 8+1
        handle_05 = self.__editor.markerAdd(9, 2)   # Red dot on line 9+1


        # ! Add editor to layout !
        # -------------------------
        self.__lyt.addWidget(self.__editor)
        self.show()

    ''''''

    def __btn_action(self):
        print("Hello World!")

    ''''''