def string(self, shortlist=False, show_comments=False): if shortlist == False: if self.time == None: timestring = "" else: htime = utility.handy_time(self.time) timestring = "%s (%s)" % (htime, self.time_string) info = [("ID", self.uuid), ("Short name", self.id.user()), ("Severity", self.severity), ("Status", self.status), ("Assigned", self._setting_attr_string("assigned")), ("Reporter", self._setting_attr_string("reporter")), ("Creator", self._setting_attr_string("creator")), ("Created", timestring)] for estr in self.extra_strings: info.append(('Extra string', estr)) longest_key_len = max([len(k) for k,v in info]) infolines = [" %*s : %s\n" %(longest_key_len,k,v) for k,v in info] bugout = "".join(infolines) + "%s" % self.summary.rstrip('\n') else: statuschar = self.status[0] severitychar = self.severity[0] chars = "%c%c" % (statuschar, severitychar) bugout = "%s:%s: %s" % (self.id.user(),chars,self.summary.rstrip('\n')) if show_comments == True: self.comment_root.sort(cmp=libbe.comment.cmp_time, reverse=True) comout = self.comment_root.string_thread(flatten=False) output = bugout + '\n' + comout.rstrip('\n') else : output = bugout return output
def string(self, shortlist=False, show_comments=False): if shortlist == False: if self.time == None: timestring = "" else: htime = utility.handy_time(self.time) timestring = "%s (%s)" % (htime, self.time_string) info = [("ID", self.uuid), ("Short name", self.id.user()), ("Severity", self.severity), ("Status", self.status), ("Assigned", self._setting_attr_string("assigned")), ("Reporter", self._setting_attr_string("reporter")), ("Creator", self._setting_attr_string("creator")), ("Created", timestring)] for estr in self.extra_strings: info.append(('Extra string', estr)) longest_key_len = max([len(k) for k, v in info]) infolines = [ " %*s : %s\n" % (longest_key_len, k, v) for k, v in info ] bugout = "".join(infolines) + "%s" % self.summary.rstrip('\n') else: statuschar = self.status[0] severitychar = self.severity[0] chars = "%c%c" % (statuschar, severitychar) bugout = "%s:%s: %s" % (self.id.user(), chars, self.summary.rstrip('\n')) if show_comments == True: self.comment_root.sort(cmp=libbe.comment.cmp_time, reverse=True) comout = self.comment_root.string_thread(flatten=False) output = bugout + '\n' + comout.rstrip('\n') else: output = bugout return output
def display_bug(self, bug=None): """Display currently selected bug or the bug passed via argument""" if bug: self.current_bug = bug else: bug = self.current_bug self.enable_bug_view() self.bugTitle.setText(bug.summary) self.shortLabel.setText(bug.id.user()) self.idLabel.setText(bug.uuid) self.creatorLabel.setText(bug.creator) self.createdLabel.setText(handy_time(bug.time)) self.reporterLabel.setText(bug.reporter) self.load_combos() self.load_comments()
def comment_html(comment): commenter = '<h4>' + unicode(comment.author) + ' said:</h4>' time = '<h5>on ' + handy_time(comment.time) + '</h5>' return commenter + plaintext2html(comment.body) + time