def slot_nextUnfinished(self, arg): ix = self.pupilIx while True: ix += 1 if (ix >= len(self.pupils)): ix = 0 if (ix == self.pupilIx): # None found return pupilId = self.pupils[ix] key = u"%s+%s" % (pupilId, self.subject) revisions = self.revisionDict.get(key) if revisions: report, cursor = revisions[-1] else: report = self.db.getReport(pupilId, self.subject) cursor = (0,0,0) revisions = [(report, cursor)] self.revisionDict[key] = revisions if not getReportVersion(report).endswith(u"$"): break self.gui.setPupil(ix)
def undo(self, level): """Set the text to a different historical version, from the self.revisions list, level being the index (the most recent is level 0). The 'textChanged' signal is suppressed so that the button enabling can work properly. => True if report marked as 'finished' """ version = self.revisions[-1 - level] self.report, self.cursor = version self.setText(getReportText(self.report)) return getReportVersion(self.report).endswith(u"$")
def isFinished(self): return getReportVersion(self.report).endswith(u"$")