Exemple #1
0
 def setText(self, text):
     line = text.split('\n')[0]
     if 'python' in line:
         self.setLexer(self.pylex)
     else:
         self.setLexer(self.lex)
     QextScintilla.setText(self, text)
Exemple #2
0
 def setText(self, text):
     line = text.split('\n')[0]
     if 'python' in line:
         self.setLexer(self.pylex)
     else:
         self.setLexer(self.lex)
     QextScintilla.setText(self, text)
class ScriptView(QVBox):
    def __init__(self, parent, mainwin, script):
        self.script = script
        QVBox.__init__(self, parent)
        self.resize(500, 300)
        self.setIcon(getimage('script'))

        split = QSplitter(QSplitter.Vertical, self)
        self.editor = QextScintilla(split)
        self.output = QTextBrowser(split)
        self.editor.setText(self.script.text)
        self.connect(self.editor, SIGNAL('textChanged()'), self.on_text_changed)

        lex = QextScintillaLexerPython()
        lex.setDefaultFont(QApplication.font())
        lex.setFont(QApplication.font(), -2)
        self.editor.setLexer(lex)

        self.script.project.connect('remove-item', self.on_project_remove_item)

    def on_run(self):
        self.script.run()

    def on_text_changed(self):
        self.script.text = unicode(self.editor.text())

    def on_project_remove_item(self, item):
        if item == self.script:
            self.close()
Exemple #4
0
 def setText(self, text):
     # ugly hack to highlight python code
     # grab the first line
     line = text.split('\n')[0]
     if 'python' in line:
         self.setLexer(self.pylex)
     else:
         self.setLexer(self.lex)
     QextScintilla.setText(self, text)