def update_subtasks(self, total=0, on=0): if total != 0: percent = (on * 100) / total else: percent = 0 count = "%d/%d" % (on, total) self.title = REGEX_SUBTASK.sub("[%s]" % (count), self.title) self.title = REGEX_SUBTASK_PERCENT.sub("[%d%%]" % (percent), self.title) d = self._heading.document.write_checkbox(self, including_children=False)
def update_subtasks(self, total=0, on=0): u""" Update subtask information for current heading :total: total # of top level checkboxes :on: # of top level checkboxes which are on """ if total != 0: percent = (on * 100) / total else: percent = 0 count = "%d/%d" % (on, total) self.title = REGEX_SUBTASK.sub("[%s]" % (count), self.title) self.title = REGEX_SUBTASK_PERCENT.sub("[%d%%]" % (percent), self.title) self.document.write_heading(self, including_children=False)