Exemplo n.º 1
0
    def __init__(self, text, parent=None):
        super(SldEditorWidget, self).__init__(parent)

        font = QtGui.QFont()
        font.setFamily('Courier')
        font.setFixedPitch(True)
        font.setPointSize(10)
        self.setFont(font)
        self.setMarginsFont(font)

        fontmetrics = QtGui.QFontMetrics(font)
        self.setMarginsFont(font)
        self.setMarginWidth(0, fontmetrics.width("00000") + 6)
        self.setMarginLineNumbers(0, True)
        self.setMarginsBackgroundColor(QtGui.QColor("#cccccc"))

        self.setBraceMatching(QsciScintilla.SloppyBraceMatch)

        self.setCaretLineVisible(True)
        self.setCaretLineBackgroundColor(QtGui.QColor("#ffe4e4"))

        lexer = QsciLexerXML()
        lexer.setDefaultFont(font)
        self.setLexer(lexer)
        self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier')

        self.setText(text)
Exemplo n.º 2
0
    def __init__(self, parent=None):

        QsciLexerXML.__init__(self, parent)
        Lexer.__init__(self)

        self.streamCommentString = {'start': '<!-- ', 'end': ' -->'}
        return
Exemplo n.º 3
0
    def __init__(self, text, parent=None):
        super(SldEditorWidget, self).__init__(parent)

        font = QFont()
        font.setFamily("Courier")
        font.setFixedPitch(True)
        font.setPointSize(10)
        self.setFont(font)
        self.setMarginsFont(font)

        fontmetrics = QFontMetrics(font)
        self.setMarginsFont(font)
        self.setMarginWidth(0, fontmetrics.width("00000") + 6)
        self.setMarginLineNumbers(0, True)
        self.setMarginsBackgroundColor(QColor("#cccccc"))

        self.setBraceMatching(QsciScintilla.SloppyBraceMatch)

        self.setCaretLineVisible(True)
        self.setCaretLineBackgroundColor(QColor("#ffe4e4"))

        lexer = QsciLexerXML()
        lexer.setDefaultFont(font)
        self.setLexer(lexer)
        self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, "Courier")

        self.setText(text)
Exemplo n.º 4
0
    def __init__( self, parent = None ):

        QsciLexerXML.__init__( self, parent )
        Lexer.__init__( self )

        self.streamCommentString = { 'start' : '<!-- ',
                                     'end'   : ' -->' }
        return
Exemplo n.º 5
0
    def __init__(self, parent=None):
        super(MyQTextBrowser, self).__init__(parent)
        # Set the default font
        font = QFont()
        font.setFamily('Courier')
        font.setFixedPitch(True)
        font.setPointSize(10)
        self.setFont(font)
        self.setMarginsFont(font)
        self.setUtf8(True)

        # Margin 0 is used for line numbers
        font_metrics = QFontMetrics(font)
        self.setMarginsFont(font)
        self.setMarginWidth(0, font_metrics.width("000") + 4)
        self.setMarginLineNumbers(0, True)
        self.setMarginsBackgroundColor(QColor("#cccccc"))

        # Clickable margin 1 for showing markers
        self.setMarginSensitivity(1, True)
        self.connect(self,
                     SIGNAL('marginClicked(int, int, Qt::KeyboardModifiers)'),
                     self.on_margin_clicked)
        self.markerDefine(QsciScintilla.RightArrow,
                          self.ARROW_MARKER_NUM)
        self.setMarkerBackgroundColor(QColor("#ee1111"),
                                      self.ARROW_MARKER_NUM)

        # Brace matching: enable for a brace immediately before or after
        # the current position
        #
        self.setBraceMatching(QsciScintilla.SloppyBraceMatch)

        # Current line visible with special background color
        self.setCaretLineVisible(True)
        self.setCaretLineBackgroundColor(QColor("#ffe4e4"))

        # Set Python lexer
        # Set style for Python comments (style number 1) to a fixed-width
        # courier.
        #
        lexer = QsciLexerXML()
        lexer.setDefaultFont(font)
        self.setLexer(lexer)
        self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier')

        # Don't want to see the horizontal scrollbar at all
        # Use raw message to Scintilla here (all messages are documented
        # here: http://www.scintilla.org/ScintillaDoc.html)
        self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)
        self.setHorizontalScrollBar(QScrollBar(self))

        self.fp = None
        self.item = None
        self.html_mapper = dict()
        self.setReadOnly(True)
Exemplo n.º 6
0
 def __init__(self,parent):
     QsciLexerXML.__init__(self, parent)
     self.parent = parent
     self.plainFont = QFont()
     self.plainFont.setFamily(config.fontName())
     self.plainFont.setFixedPitch(True)
     self.plainFont.setPointSize(config.fontSize())
     self.boldFont = QFont(self.plainFont)
     self.boldFont.setBold(True)
     self.setFoldCompact(True)
Exemplo n.º 7
0
    def __init__(self, parent=None):
        QsciLexerXML.__init__(self, parent)
        
        self.lexer = Lexer.Lexer(self.language())

        self.setDefaultPaper(self.lexer.get_globaldefault_paper())
        self.setFont(self.lexer.get_default_font())
        
        self.comment_string = QString("")
        self.stream_comment_string = {
            'start' : QString('<!-- '),
            'end'   : QString(' -->')
        }
Exemplo n.º 8
0
 def __init__(self, parent=None):
     """
     Constructor
     
     @param parent parent widget of this lexer
     """
     QsciLexerXML.__init__(self, parent)
     Lexer.__init__(self)
     
     self.streamCommentString = {
         'start' : QString('<!-- '),
         'end'   : QString(' -->')
     }
Exemplo n.º 9
0
	def uiSettings(self):
		self.dlg.sldText1.setMarginLineNumbers(1, True)
		self.dlg.sldText1.setMarginsBackgroundColor(QColor("#98AFC7"))
		self.dlg.sldText1.setMarginWidth(1,30)
		self.dlg.sldText1.setUtf8(True) #Enabling non-Ascii chars
		self.dlg.sldText1.setLexer(QsciLexerXML())
		
		self.dlg.sldText2.setMarginLineNumbers(1, True)
		self.dlg.sldText2.setMarginsBackgroundColor(QColor("#98AFC7"))
		self.dlg.sldText2.setMarginWidth(1,30)
		self.dlg.sldText2.setUtf8(True) #Enabling non-Ascii chars
		self.dlg.sldText2.setLexer(QsciLexerXML())
		
		self.dlg.setFixedSize(600, 615)
Exemplo n.º 10
0
    def createWidgets(self):
        """
        Create qt widgets
        """
        self.toolbar = QToolBar(self)
        self.toolbar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)

        layout = QVBoxLayout()

        if self.toXml:
            self.txtEdit = QtHelper.RawXmlEditor(parent=self)
            self.txtEdit.setFolding(QsciScintilla.BoxedTreeFoldStyle)
            self.txtEdit.setLexer(QsciLexerXML())
            self.txtEdit.setText(self.__data)
            self.txtEdit.setUtf8(True)
            self.txtEdit.setFont(QFont("Courier", 9))
        else:
            self.txtEdit = QtHelper.RawEditor(parent=self)
            self.txtEdit.setTabStopWidth(10)
            self.txtEdit.setText(self.__data)
            self.txtEdit.setFont(QFont("Courier", 9))

        self.txtEdit.setMinimumWidth(650)
        self.txtEdit.setMinimumHeight(400)

        layout.addWidget(self.toolbar)
        layout.addWidget(self.txtEdit)
        self.setLayout(layout)
Exemplo n.º 11
0
 def defaultKeywords(self, kwSet):
     """
     Public method to get the default keywords.
     
     @param kwSet number of the keyword set (integer)
     @return string giving the keywords (string) or None
     """
     return QsciLexerXML.keywords(self, kwSet)
Exemplo n.º 12
0
 def createWidget(self):
     """
     Create qt widget
     """
     self.setFolding(QsciScintilla.BoxedTreeFoldStyle)
     self.setLexer(QsciLexerXML())
     self.setMarginLineNumbers(0, False)
     self.setMarginWidth(1, 0)
Exemplo n.º 13
0
    def __init__(self, style, paper):
        QsciLexerXML.__init__(self)

        self.lexerPaper = paper

        for key, attrib in style.items():
            value = propertyID[key]
            self.setColor(QtGui.QColor(attrib[1]), value)
            self.setEolFill(True, value)
            self.setPaper(QtGui.QColor(attrib[5]), value)
            if self.lexerPaper[0] == "Plain":
                self.setPaper(QtGui.QColor(attrib[5]), value)
            else:
                self.setPaper(QtGui.QColor(self.lexerPaper[1]), value)

            font = QtGui.QFont(attrib[0], attrib[2])
            font.setBold(attrib[3])
            font.setItalic(attrib[4])
            self.setFont(font, value)

        if self.lexerPaper[0] == "Plain":
            self.setDefaultPaper(QtGui.QColor("#ffffff"))
        else:
            self.setDefaultPaper(QtGui.QColor(self.lexerPaper[1]))
Exemplo n.º 14
0
 def defaultColor(self, style):
     '''Returns the foreground colour of the text for style number style'''
     color = self.lexer.get_default_color(style, self.description(style))
     if color != 'not':
         return color
     return QsciLexerXML.defaultColor(self, style)
Exemplo n.º 15
0
dumpLexer( QsciLexerPython() )
dumpLexer( QsciLexerBash() )
dumpLexer( QsciLexerBatch() )
dumpLexer( QsciLexerCMake() )
dumpLexer( QsciLexerCPP() )
dumpLexer( QsciLexerCSharp() )
dumpLexer( QsciLexerCSS() )
dumpLexer( QsciLexerDiff() )
dumpLexer( QsciLexerD() )
dumpLexer( QsciLexerFortran77() )
dumpLexer( QsciLexerFortran() )
dumpLexer( QsciLexerHTML() )
dumpLexer( QsciLexerIDL() )
dumpLexer( QsciLexerJava() )
dumpLexer( QsciLexerJavaScript() )
dumpLexer( QsciLexerLua() )
dumpLexer( QsciLexerMakefile() )
dumpLexer( QsciLexerPascal() )
dumpLexer( QsciLexerPerl() )
dumpLexer( QsciLexerPostScript() )
dumpLexer( QsciLexerPOV() )
dumpLexer( QsciLexerProperties() )
dumpLexer( QsciLexerRuby() )
dumpLexer( QsciLexerSQL() )
dumpLexer( QsciLexerTCL() )
dumpLexer( QsciLexerTeX() )
dumpLexer( QsciLexerVHDL() )
dumpLexer( QsciLexerXML() )
dumpLexer( QsciLexerYAML() )

Exemplo n.º 16
0
 def defaultEolFill(self, ix):
     for i in self.styles:
       if i.style() == ix:
         return i.eolFill()
     return QsciLexerXML.defaultEolFill(self, ix)
Exemplo n.º 17
0
 def defaultPaper(self, ix):
     for i in self.styles:
       if i.style() == ix:
         return i.paper()
     return QsciLexerXML.defaultPaper(self, ix)
Exemplo n.º 18
0
 def defaultFont(self, ix):
     for i in self.styles:
       if i.style() == ix:
         return i.font()
     return QsciLexerXML.defaultFont(self, ix)
Exemplo n.º 19
0
 def defaultColor(self, ix):
     for i in self.styles:
       if i.style() == ix:
         return i.color()
     return QsciLexerXML.defaultColor(self, ix)
Exemplo n.º 20
0
 def activeXmlLexer(self):
     """
     Active Xml Lexer
     """
     self.setLexer(QsciLexerXML(self))