def __init__(self, parent=None, fontsize=12): super(PPTextEditor, self).__init__(parent) # Do not allow line-wrap; horizontal scrollbar appears when required. self.setLineWrapMode(QPlainTextEdit.NoWrap) # make sure when we jump to a line, it goes to the window center self.setCenterOnScroll(True) # Get a monospaced font as selected by the user with View>Font self.setFont(pqMsgs.getMonoFont(fontsize, True)) # instantiate our "syntax" highlighter object, but link it to an empty # QTextDocument. We will redirect it to our actual document only after # loading a document, as it relies on metadata, and then only when/if # the IMC.*HiliteSwitch es are on. self.nulDoc = QTextDocument() # make a null document self.hiliter = wordHighLighter(self.nulDoc) # all the metadata lists will be initialized when self.clear() is # called from pqMain, shortly. # save a regex for quickly finding if a selection is a single word self.oneWordRE = QRegExp(u'^\W*(\w{2,})\W*$') self.menuWord = QString() # Create and initialize an SHA-1 hash machine self.cuisineart = QCryptographicHash(QCryptographicHash.Sha1)