Minor tweaks to use slices instead of lists of items

svn: r12705
This commit is contained in:
Gerald Britton 2009-06-25 13:41:16 +00:00
parent a52bc62be9
commit fdfacd972c
9 changed files with 12 additions and 17 deletions

View File

@ -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()

View File

@ -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):
"""

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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)

View File

@ -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"

View File

@ -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()

View File

@ -208,8 +208,7 @@ class GrampsDbXmlWriter(UpdateCallback):
self.g.write('<database xmlns="http://gramps-project.org/xml/%s/">\n'
% libgrampsxml.GRAMPS_XML_VERSION)
self.g.write(" <header>\n")
self.g.write(' <created date="%04d-%02d-%02d\"' %
(date[0],date[1],date[2]) )
self.g.write(' <created date="%04d-%02d-%02d\"' % date[:3])
self.g.write(" version=\"" + self.version + "\"")
self.g.write("/>\n")
self.g.write(" <researcher>\n")