if role == BG: return QtGui.QBrush(bgcolor) elif role == FG: return QtGui.QBrush(color) else: return text # Start time elif column == 8 and role == TOOL: start = formatDateTime(job.startTime) stop = formatDateTime(job.stopTime) return "Started: {0}\nStopped:{1}".format(start, stop) return super(JobNode, self).data(column, role) if __name__ == "__main__": from plow.gui.util import loadTheme import sys app = QtGui.QApplication(sys.argv) loadTheme() w = JobWranglerWidget({}) w.resize(1024,800) w.show() w.refresh() app.exec_()
expression = QtCore.QRegExp(pattern) index = expression.indexIn(text) while index >= 0: length = expression.matchedLength() self.setFormat(index, length, fmt) index = expression.indexIn(text, index + length) fmt, pattern = self.__foundMatchFormat if pattern.isEmpty(): return expression = QtCore.QRegExp(pattern) index = expression.indexIn(text) while index >= 0: length = expression.matchedLength() self.setFormat(index, length, fmt) index = expression.indexIn(text, index + length) if __name__ == "__main__": app = QtGui.QApplication([]) app.setStyle("plastique") app.setStyleSheet( open(os.path.dirname(__file__) + "/../resources/style.css").read()) l = LogViewerWidget() l.resize(800, 600) l.show() app.exec_()