def on_styleActionGroup_triggered(self, action): """ Change current editor style """ self.ui.genericEditor.currentStyle = styles.getStyle(action.text()) stylesheet = "" if action.text() == "Dark": try: import qdarkstyle stylesheet = qdarkstyle.load_stylesheet() except ImportError: print "Failed to use the qdarkstyle. Please execute <pip install qdarkstyle> to fully use this theme." QApplication.instance().setStyleSheet(stylesheet)
def __init__(self, parent, lexer=None): super(QPygmentsHighlighter, self).__init__(parent) self._document = QtGui.QTextDocument() self._formatter = HtmlFormatter(nowrap=True) self._lexer = lexer if lexer else PythonLexer() self.style = styles.getStyle("Default").pygmentsStyle self.enabled = True