def startedHandler(self): l = len(self.startedComputations) if l != 1: traceLogger.warning("queue of %d started computations" % l) while self.startedComputations: c = self.startedComputations.pop(0) signalLogger.debug("emitting startComputation %s" % c.command) self.startComputation.emit(c)
def headerData(self,section,orientation,role=Qt.DisplayRole): sup = super(QtReduceModel,self) if orientation == Qt.Horizontal: return sup.headerData(section,orientation,role) if orientation == Qt.Vertical: return sup.headerData(section,orientation,role) traceLogger.warning(orientation) return None
def finishedHandler(self): self.isComputing = False l = len(self.finishedComputations) if l != 1: traceLogger.warning("queue of %d finished computations" % l) while self.finishedComputations: c = self.finishedComputations.pop(0) signalLogger.debug("emitting endComputation %s" % c.command) self.endComputation.emit(c) self.resumeBatch()
def __statusStr(self,status): if int(status) == self.NotEvaluated: return status + ' (NotEvaluated)' elif int(status) == self.Evaluating: return status + ' (Evaluating)' elif int(status) == self.Evaluated: return status + ' (Evaluated)' elif int(status) == self.Error: return status + ' (Error)' elif int(status) == self.Aborted: return status + ' (Aborted)' traceLogger.warning('unkonwn status %s' % s) return status + ' (unknown)'
def __textToToolButtonStyle(self,show): traceLogger.debug("show=%s,('%s', '%s', '%s')" % (show, self.tr("Symbol and Text"), self.tr("Only Symbol"), self.tr("Only Text"))) if show == self.tr("Symbol and Text"): return Qt.ToolButtonTextUnderIcon if show == self.tr("Only Symbol"): return Qt.ToolButtonIconOnly if show == self.tr("Only Text"): return Qt.ToolButtonTextOnly traceLogger.warning("unknown tool button style '%s'" % show) return Qt.ToolButtonTextUnderIcon
def __setOutput(self, row, text, reduceBlockFormat): rows = self.document().rootFrame().childFrames() if row >= len(rows): traceLogger.critical("invalid row %d > %d" % (row, len(rows) - 1)) return rowFrames = rows[row].childFrames() if len(rowFrames) != 2: traceLogger.critical("%d subframes in row %d", len(rowFrames), row) return outputFrame = rowFrames[1] cursor = outputFrame.firstCursorPosition() cursor.setPosition(outputFrame.lastPosition(), QTextCursor.KeepAnchor) cursor.setBlockFormat(reduceBlockFormat.blockFormat) traceLogger.warning("text=%s" % text) cursor.insertText(text.decode('utf-8'), reduceBlockFormat.charFormat)
def __setOutput(self,row,text,reduceBlockFormat): rows = self.document().rootFrame().childFrames() if row >= len(rows): traceLogger.critical("invalid row %d > %d" % (row,len(rows)-1)) return rowFrames = rows[row].childFrames() if len(rowFrames) != 2: traceLogger.critical("%d subframes in row %d", len(rowFrames), row) return outputFrame = rowFrames[1] cursor = outputFrame.firstCursorPosition() cursor.setPosition(outputFrame.lastPosition(),QTextCursor.KeepAnchor) cursor.setBlockFormat(reduceBlockFormat.blockFormat) traceLogger.warning("text=%s" % text) cursor.insertText(text.decode('utf-8'),reduceBlockFormat.charFormat)
def __del__(self): traceLogger.warning("about to delete Reduce process - this is good!") procDelete(self.__process)
def setData(self,index,value,role=Qt.EditRole): if role != QtReduceModel.RawDataRole: traceLogger.warning("role %s not supported" % role) self.model[index.row()] = value self.dataChanged.emit(index,index)
def rowCount(self,index=QModelIndex()): if index == QModelIndex(): return len(self.model) traceLogger.warning("called with valid parent %s" % index) return 0
def computeAndSetData(self,index,value,role=Qt.EditRole): if role != QtReduceModel.RawDataRole: traceLogger.warning("role %s not supported" % role) self.model[index.row()] = value self.compute(index)
def columnCount(self,index): if index == QModelIndex(): return 1 traceLogger.warning("called with valid parent %s" % index) return 0