From fdfacd972ca5ab370d226998ba4f6a68ab8c81f6 Mon Sep 17 00:00:00 2001 From: Gerald Britton Date: Thu, 25 Jun 2009 13:41:16 +0000 Subject: [PATCH] Minor tweaks to use slices instead of lists of items svn: r12705 --- src/DataViews/PedigreeView.py | 6 +++--- src/ReportBase/_ReportUtils.py | 2 +- src/docgen/ODSDoc.py | 3 +-- src/docgen/ODSTab.py | 3 +-- src/docgen/OpenSpreadSheet.py | 3 +-- src/gen/lib/date.py | 2 +- src/plugins/docgen/ODFDoc.py | 3 +-- src/plugins/drawreport/StatisticsChart.py | 4 ++-- src/plugins/export/ExportXml.py | 3 +-- 9 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/DataViews/PedigreeView.py b/src/DataViews/PedigreeView.py index 3346ba08c..ca9fecefc 100644 --- a/src/DataViews/PedigreeView.py +++ b/src/DataViews/PedigreeView.py @@ -223,7 +223,7 @@ class PersonBoxWidget_cairo( gtk.DrawingArea, _PersonWidget_base): self.context.translate(3,3) self.context.new_path() self.context.append_path( path) - self.context.set_source_rgba( self.bordercolor[0], self.bordercolor[1], self.bordercolor[2],0.4) + self.context.set_source_rgba(*(self.bordercolor[:3] + (0.4,))) self.context.fill_preserve() self.context.set_line_width(0) self.context.stroke() @@ -235,7 +235,7 @@ class PersonBoxWidget_cairo( gtk.DrawingArea, _PersonWidget_base): # background self.context.append_path( path) - self.context.set_source_rgb( self.bgcolor[0], self.bgcolor[1], self.bgcolor[2]) + self.context.set_source_rgb(*self.bgcolor[:3]) self.context.fill_preserve() self.context.stroke() @@ -262,7 +262,7 @@ class PersonBoxWidget_cairo( gtk.DrawingArea, _PersonWidget_base): else: self.context.set_line_width(2) self.context.append_path( path) - self.context.set_source_rgb( self.bordercolor[0], self.bordercolor[1], self.bordercolor[2]) + self.context.set_source_rgb(*self.bordercolor[:3]) self.context.stroke() diff --git a/src/ReportBase/_ReportUtils.py b/src/ReportBase/_ReportUtils.py index b35cd8df5..5561a66b4 100644 --- a/src/ReportBase/_ReportUtils.py +++ b/src/ReportBase/_ReportUtils.py @@ -1664,7 +1664,7 @@ def draw_vertical_bar_graph(doc, format, start_x, start_y, height, width, data): _t = time.localtime(time.time()) -_TODAY = DateHandler.parser.parse("%04d-%02d-%02d" % (_t[0], _t[1], _t[2])) +_TODAY = DateHandler.parser.parse("%04d-%02d-%02d" % _t[:3]) def estimate_age(db, person, end_handle=None, start_handle=None, today=_TODAY): """ diff --git a/src/docgen/ODSDoc.py b/src/docgen/ODSDoc.py index e7585839f..bb6ab537e 100644 --- a/src/docgen/ODSDoc.py +++ b/src/docgen/ODSDoc.py @@ -60,8 +60,7 @@ class ODSDoc(SpreadSheetDoc): import time t = time.localtime(time.time()) - self.time = "%04d-%02d-%02dT%02d:%02d:%02d" % \ - (t[0],t[1],t[2],t[3],t[4],t[5]) + self.time = "%04d-%02d-%02dT%02d:%02d:%02d" % t[:6] if filename[-4:] != ".ods": self.filename = filename + ".ods" diff --git a/src/docgen/ODSTab.py b/src/docgen/ODSTab.py index 7496f32a0..5e497d079 100644 --- a/src/docgen/ODSTab.py +++ b/src/docgen/ODSTab.py @@ -59,8 +59,7 @@ class ODSTab(TabbedDoc): import time t = time.localtime(time.time()) - self.time = "%04d-%02d-%02dT%02d:%02d:%02d" % \ - (t[0],t[1],t[2],t[3],t[4],t[5]) + self.time = "%04d-%02d-%02dT%02d:%02d:%02d" % t[:6] if filename[-4:] != ".ods": self.filename = filename + ".ods" diff --git a/src/docgen/OpenSpreadSheet.py b/src/docgen/OpenSpreadSheet.py index 5c76ee6f3..60f876459 100644 --- a/src/docgen/OpenSpreadSheet.py +++ b/src/docgen/OpenSpreadSheet.py @@ -60,8 +60,7 @@ class OpenSpreadSheet(SpreadSheetDoc): import time t = time.localtime(time.time()) - self.time = "%04d-%02d-%02dT%02d:%02d:%02d" % \ - (t[0],t[1],t[2],t[3],t[4],t[5]) + self.time = "%04d-%02d-%02dT%02d:%02d:%02d" % t[:6] if filename[-4:] != ".sxc": self.filename = filename + ".sxc" diff --git a/src/gen/lib/date.py b/src/gen/lib/date.py index ad2852fb7..6629d923a 100644 --- a/src/gen/lib/date.py +++ b/src/gen/lib/date.py @@ -900,7 +900,7 @@ class Date(object): (year,month,day) in the Gregorian calendar. """ new_date = Date() - new_date.set_yr_mon_day(dateval[0], dateval[1], dateval[2]) + new_date.set_yr_mon_day(*dateval[:3]) return new_date.offset(offset) datecopy = Date(self) diff --git a/src/plugins/docgen/ODFDoc.py b/src/plugins/docgen/ODFDoc.py index 1115b0169..c4b4db9ed 100644 --- a/src/plugins/docgen/ODFDoc.py +++ b/src/plugins/docgen/ODFDoc.py @@ -94,8 +94,7 @@ class ODFDoc(BaseDoc, TextDoc, DrawDoc): def open(self, filename): t = time.localtime(time.time()) - self.time = "%04d-%02d-%02dT%02d:%02d:%02d" % \ - (t[0], t[1], t[2], t[3], t[4], t[5]) + self.time = "%04d-%02d-%02dT%02d:%02d:%02d" % t[:6] if filename[-4:] != ".odt": self.filename = filename + ".odt" diff --git a/src/plugins/drawreport/StatisticsChart.py b/src/plugins/drawreport/StatisticsChart.py index 3b3ce3256..06adeec21 100644 --- a/src/plugins/drawreport/StatisticsChart.py +++ b/src/plugins/drawreport/StatisticsChart.py @@ -555,9 +555,9 @@ class StatisticsChart(Report): for data in self.data: self.doc.start_page() if len(data[2]) < self.bar_items: - self.output_piechart(data[0], data[1], data[2], data[3]) + self.output_piechart(data[:4]) else: - self.output_barchart(data[0], data[1], data[2], data[3]) + self.output_barchart(data[:4]) self.doc.end_page() self.progress.step() self.progress.close() diff --git a/src/plugins/export/ExportXml.py b/src/plugins/export/ExportXml.py index 5ad25a94e..f4ab88bb9 100644 --- a/src/plugins/export/ExportXml.py +++ b/src/plugins/export/ExportXml.py @@ -208,8 +208,7 @@ class GrampsDbXmlWriter(UpdateCallback): self.g.write('\n' % libgrampsxml.GRAMPS_XML_VERSION) self.g.write("
\n") - self.g.write(' \n") self.g.write(" \n")