* src/plugins/EventCmp.py: Remove sorting columns for saving.

svn: r7257
This commit is contained in:
Alex Roitman 2006-08-25 00:19:06 +00:00
parent 29a55e8d7f
commit a8ba84efc7
2 changed files with 30 additions and 15 deletions

View File

@ -1,4 +1,5 @@
2006-08-24 Alex Roitman <shura@gramps-project.org> 2006-08-24 Alex Roitman <shura@gramps-project.org>
* src/plugins/EventCmp.py: Remove sorting columns for saving.
* src/plugins/PHPGedViewConnector.py: Disable registration, until * src/plugins/PHPGedViewConnector.py: Disable registration, until
this plugin is fixed. this plugin is fixed.
* src/glade/gramps.glade (family_editor): Remove Y expansion * src/glade/gramps.glade (family_editor): Remove Y expansion

View File

@ -77,6 +77,7 @@ class TableReport:
t.set_columns(cols) t.set_columns(cols)
for index in range(0,cols): for index in range(0,cols):
t.set_column_width(index,4) t.set_column_width(index,4)
t.set_column_width(1,1)
self.doc.add_table_style("mytbl",t) self.doc.add_table_style("mytbl",t)
f = BaseDoc.FontStyle() f = BaseDoc.FontStyle()
@ -103,9 +104,13 @@ class TableReport:
self.doc.end_page() self.doc.end_page()
self.doc.close() self.doc.close()
def write_table_data(self,data): def write_table_data(self,data,skip_columns=[]):
self.doc.start_row() self.doc.start_row()
index = -1
for item in data: for item in data:
index += 1
if index in skip_columns:
continue
self.doc.start_cell("data") self.doc.start_cell("data")
self.doc.write_text(item) self.doc.write_text(item)
self.doc.end_cell() self.doc.end_cell()
@ -115,8 +120,6 @@ class TableReport:
self.row = val + 2 self.row = val + 2
def write_table_head(self,data): def write_table_head(self,data):
self.prev = 3
self.doc.start_row() self.doc.start_row()
for item in data: for item in data:
self.doc.start_cell("head") self.doc.start_cell("head")
@ -387,15 +390,16 @@ class DisplayChart(ManagedWindow.ManagedWindow):
unsort_list = [ (the_map[item],item) for item in the_map.keys() ] unsort_list = [ (the_map[item],item) for item in the_map.keys() ]
unsort_list.sort(by_value) unsort_list.sort(by_value)
sort_list = [ item[1] for item in unsort_list ] sort_list = [ item[1] for item in unsort_list ]
## Presently there's no Birth and Death. Instead there's Birth Date and
## Birth Place, as well as Death Date and Death Place.
## # Move birth and death to the begining of the list
## if the_map.has_key(_("Death")):
## sort_list.remove(_("Death"))
## sort_list = [_("Death")] + sort_list
# Move birth and death to the begining of the list ## if the_map.has_key(_("Birth")):
if the_map.has_key(_("Death")): ## sort_list.remove(_("Birth"))
sort_list.remove(_("Death")) ## sort_list = [_("Birth")] + sort_list
sort_list = [_("Death")] + sort_list
if the_map.has_key(_("Birth")):
sort_list.remove(_("Birth"))
sort_list = [_("Birth")] + sort_list
return sort_list return sort_list
@ -417,15 +421,25 @@ class DisplayChart(ManagedWindow.ManagedWindow):
doc = ODSDoc.ODSDoc(pstyle,BaseDoc.PAPER_PORTRAIT) doc = ODSDoc.ODSDoc(pstyle,BaseDoc.PAPER_PORTRAIT)
doc.creator(self.db.get_researcher().get_name()) doc.creator(self.db.get_researcher().get_name())
spreadsheet = TableReport(name,doc) spreadsheet = TableReport(name,doc)
spreadsheet.initialize(len(self.table_titles))
spreadsheet.write_table_head(self.table_titles) new_titles = []
skip_columns = []
index = 0
for title in self.table_titles:
if title == 'sort':
skip_columns.append(index)
else:
new_titles.append(title)
index += 1
spreadsheet.initialize(len(new_titles))
spreadsheet.write_table_head(new_titles)
index = 0 index = 0
for top in self.row_data: for top in self.row_data:
spreadsheet.set_row(index%2) spreadsheet.set_row(index%2)
index = index + 1 index += 1
spreadsheet.write_table_data(top) spreadsheet.write_table_data(top,skip_columns)
spreadsheet.finalize() spreadsheet.finalize()