Example #1
0
    def __init__(self, parent=None):
        super(TextEditor, self).__init__(parent)
        self.setLineWrapMode(QtGui.QTextEdit.NoWrap)
        self.indentation = "    "
        self.completer = None
        self.name = None

        # Line Number Area from LPy
        self.setViewportMargins(50, 0, 0, 0)
        self.sidebar = Margin(self, self)
        self.sidebar.setGeometry(0, 0, 50, 100)
        self.sidebar.show()
        self.cursorPositionChanged.connect(self.display_line_number)
        # QtCore.QObject.connect(self, QtCore.SIGNAL("cursorPositionChanged()"),self.highlightCurrentLine)

        self.read_settings()
Example #2
0
class TextEditor(QtGui.QTextEdit):

    def __init__(self, parent=None):
        super(TextEditor, self).__init__(parent)
        self.setLineWrapMode(QtGui.QTextEdit.NoWrap)
        self.indentation = "    "
        self.completer = None
        self.name = None

        # Line Number Area from LPy
        self.setViewportMargins(50, 0, 0, 0)
        self.sidebar = Margin(self, self)
        self.sidebar.setGeometry(0, 0, 50, 100)
        self.sidebar.show()
        self.cursorPositionChanged.connect(self.display_line_number)
        # QtCore.QObject.connect(self, QtCore.SIGNAL("cursorPositionChanged()"),self.highlightCurrentLine)

        self.read_settings()

    def check_code(self):
        """
        Check if code follow PEP-8 guide-lines thanks to module flake8.
        """
        if has_flake8:
            txt = self.get_text()
            r = run.check_code(txt)
            return r
        else:
            return

    def read_settings(self):
        config = settings.Settings()

        font = "Courier"
        try:
            font = config.get("Text Editor", "Font")
        except settings.NoSectionError, e:
            config.add_section("Text Editor")
            config.add_option("Text Editor", "Font", str(font))
        except settings.NoOptionError, e:
            config.add_option("Text Editor", "Font", str(font))
Example #3
0
class TextEditor(QtGui.QTextEdit):
    def __init__(self, parent=None):
        super(TextEditor, self).__init__(parent)
        self.setLineWrapMode(QtGui.QTextEdit.NoWrap)
        self.indentation = "    "
        self.completer = None
        self.name = None

        # Line Number Area from LPy
        self.setViewportMargins(50, 0, 0, 0)
        self.sidebar = Margin(self, self)
        self.sidebar.setGeometry(0, 0, 50, 100)
        self.sidebar.show()
        self.cursorPositionChanged.connect(self.display_line_number)
        # QtCore.QObject.connect(self, QtCore.SIGNAL("cursorPositionChanged()"),self.highlightCurrentLine)

        self.read_settings()

    def check_code(self):
        """
        Check if code follow PEP-8 guide-lines thanks to module flake8.
        """
        if has_flake8:
            txt = self.get_text()
            r = run.check_code(txt)
            return r
        else:
            return

    def read_settings(self):
        config = settings.Settings()

        font = "Courier"
        try:
            font = config.get("Text Editor", "Font")
        except settings.NoSectionError, e:
            config.add_section("Text Editor")
            config.add_option("Text Editor", "Font", str(font))
        except settings.NoOptionError, e:
            config.add_option("Text Editor", "Font", str(font))
Example #4
0
    def __init__(self, parent=None):
        super(TextEditor, self).__init__(parent)
        self.setLineWrapMode(QtGui.QTextEdit.NoWrap)
        self.indentation = "    "
        self.completer = None
        self.name = None

        # Line Number Area from LPy
        self.setViewportMargins(50, 0, 0, 0)
        self.sidebar = Margin(self, self)
        self.sidebar.setGeometry(0, 0, 50, 100)
        self.sidebar.show()
        self.cursorPositionChanged.connect(self.display_line_number)
        # QtCore.QObject.connect(self, QtCore.SIGNAL("cursorPositionChanged()"),self.highlightCurrentLine)

        self.read_settings()