Use new link tag; SimpleTable can now output docgen types other than gtk
svn: r13588
This commit is contained in:
parent
406e46eac9
commit
a96eb41a7f
@ -224,7 +224,7 @@ class SimpleTable(object):
|
|||||||
elif isinstance(item, gen.lib.Source):
|
elif isinstance(item, gen.lib.Source):
|
||||||
retval.append(_('Source'))
|
retval.append(_('Source'))
|
||||||
if (self.__link_col == col or link is None):
|
if (self.__link_col == col or link is None):
|
||||||
link = ('Souce', item.handle)
|
link = ('Source', item.handle)
|
||||||
elif isinstance(item, gen.lib.Event):
|
elif isinstance(item, gen.lib.Event):
|
||||||
name = self.access.event_type(item)
|
name = self.access.event_type(item)
|
||||||
retval.append(name)
|
retval.append(name)
|
||||||
@ -284,7 +284,7 @@ class SimpleTable(object):
|
|||||||
else:
|
else:
|
||||||
self.__rows.sort(lambda a, b: cmp(a[idx],b[idx]))
|
self.__rows.sort(lambda a, b: cmp(a[idx],b[idx]))
|
||||||
|
|
||||||
def write(self, document, link=False):
|
def write(self, document):
|
||||||
self.simpledoc = document # simpledoc; simpledoc.doc = docgen object
|
self.simpledoc = document # simpledoc; simpledoc.doc = docgen object
|
||||||
if self.simpledoc.doc.type == "standard":
|
if self.simpledoc.doc.type == "standard":
|
||||||
doc = self.simpledoc.doc
|
doc = self.simpledoc.doc
|
||||||
@ -308,13 +308,21 @@ class SimpleTable(object):
|
|||||||
doc.write_text(col, 'TableTitle')
|
doc.write_text(col, 'TableTitle')
|
||||||
doc.end_cell()
|
doc.end_cell()
|
||||||
doc.end_row()
|
doc.end_row()
|
||||||
|
index = 0
|
||||||
for row in self.__rows:
|
for row in self.__rows:
|
||||||
doc.start_row()
|
doc.start_row()
|
||||||
for col in row:
|
for col in row:
|
||||||
doc.start_cell('TableDataCell', span=1)
|
doc.start_cell('TableDataCell', span=1)
|
||||||
|
if self.__link[index]:
|
||||||
|
obj_type, handle = self.__link[index]
|
||||||
|
doc.start_link("/%s/%s" %
|
||||||
|
(obj_type.lower(), handle))
|
||||||
doc.write_text(col, 'Normal')
|
doc.write_text(col, 'Normal')
|
||||||
|
if self.__link[index]:
|
||||||
|
doc.stop_link()
|
||||||
doc.end_cell()
|
doc.end_cell()
|
||||||
doc.end_row()
|
doc.end_row()
|
||||||
|
index += 1
|
||||||
doc.end_table()
|
doc.end_table()
|
||||||
doc.start_paragraph("Normal")
|
doc.start_paragraph("Normal")
|
||||||
doc.end_paragraph()
|
doc.end_paragraph()
|
||||||
@ -404,3 +412,4 @@ class SimpleTable(object):
|
|||||||
col_dict = self.__cell_markup.get(x, {})
|
col_dict = self.__cell_markup.get(x, {})
|
||||||
col_dict[y] = data
|
col_dict[y] = data
|
||||||
self.__cell_markup[x] = col_dict
|
self.__cell_markup[x] = col_dict
|
||||||
|
|
||||||
|
@ -323,11 +323,17 @@ table tr td.TableHeaderCell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
table tr td.TableDataCell {
|
table tr td.TableDataCell {
|
||||||
color: #f8eec9;
|
color: #7D5925;
|
||||||
|
background-color: white;
|
||||||
border:solid 2px #7D5925;
|
border:solid 2px #7D5925;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table tr td.TableDataCell a {
|
||||||
|
color: black;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
table.infolist tr th a {
|
table.infolist tr th a {
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,6 @@ class DjangoDb(GrampsDbBase):
|
|||||||
return obj
|
return obj
|
||||||
|
|
||||||
def get_event_from_handle(self, handle):
|
def get_event_from_handle(self, handle):
|
||||||
print "get_event_from_handle:", handle
|
|
||||||
obj = gen.lib.Event()
|
obj = gen.lib.Event()
|
||||||
obj.unserialize(self.dji.get_event(self.dji.Event.get(handle=handle)))
|
obj.unserialize(self.dji.get_event(self.dji.Event.get(handle=handle)))
|
||||||
return obj
|
return obj
|
||||||
|
@ -78,7 +78,7 @@ def events_table(djperson):
|
|||||||
print djevent.description
|
print djevent.description
|
||||||
table.row(
|
table.row(
|
||||||
djevent.description,
|
djevent.description,
|
||||||
str(djevent.event_type),
|
table.db.get_event_from_handle(djevent.handle),
|
||||||
djevent.gramps_id,
|
djevent.gramps_id,
|
||||||
display_date(djevent),
|
display_date(djevent),
|
||||||
get_title(djevent.place),
|
get_title(djevent.place),
|
||||||
|
Loading…
Reference in New Issue
Block a user