New Kword interface supporting tables, allow alternate name to be swapped

with primary name


svn: r839
This commit is contained in:
Don Allingham 2002-03-15 14:58:29 +00:00
parent 5268a4e4ac
commit 7afbe304a2
5 changed files with 147 additions and 65 deletions

View File

@ -258,19 +258,12 @@ class EditPerson:
self.get_widget("lds_tab").show() self.get_widget("lds_tab").show()
self.get_widget("lds_page").show() self.get_widget("lds_page").show()
# initial values self.write_primary_name()
self.get_widget("activepersonTitle").set_text(GrampsCfg.nameof(person))
self.suffix.set_text(self.pname.getSuffix())
self.surname_field.set_text(self.pname.getSurname())
self.given.set_text(self.pname.getFirstName())
types = const.NameTypesMap.keys() types = const.NameTypesMap.keys()
types.sort() types.sort()
self.ntype_field.set_popdown_strings(types) self.ntype_field.set_popdown_strings(types)
self.autotype = AutoComp.AutoEntry(self.ntype_field.entry,types) self.autotype = AutoComp.AutoEntry(self.ntype_field.entry,types)
self.ntype_field.entry.set_text(_(self.pname.getType()))
t = self.pname.getType()
if person.getGender() == Person.male: if person.getGender() == Person.male:
self.is_male.set_active(1) self.is_male.set_active(1)
@ -280,7 +273,6 @@ class EditPerson:
self.is_unknown.set_active(1) self.is_unknown.set_active(1)
self.nick.set_text(person.getNickName()) self.nick.set_text(person.getNickName())
self.title.set_text(self.pname.getTitle())
self.update_birth_death() self.update_birth_death()
self.load_person_image() self.load_person_image()
@ -1011,6 +1003,14 @@ class EditPerson:
def aka_double_click(self,obj,event): def aka_double_click(self,obj,event):
if event.button == 1 and event.type == _2BUTTON_PRESS: if event.button == 1 and event.type == _2BUTTON_PRESS:
self.on_aka_update_clicked(obj) self.on_aka_update_clicked(obj)
elif event.button == 3:
menu = gtk.GtkMenu()
item = gtk.GtkTearoffMenuItem()
item.show()
menu.append(item)
Utils.add_menuitem(menu,_("Make the selected name the preferred name"),
None,self.change_name)
menu.popup(None,None,None,0,0)
def on_aka_update_clicked(self,obj): def on_aka_update_clicked(self,obj):
import NameEdit import NameEdit
@ -1342,6 +1342,28 @@ class EditPerson:
self.lds_not_loaded = 0 self.lds_not_loaded = 0
self.draw_lds() self.draw_lds()
def change_name(self,obj):
if len(self.name_list.selection) == 1:
old = self.pname
row = self.name_list.selection[0]
new = self.name_list.get_row_data(row)
self.nlist.remove(new)
self.nlist.append(old)
self.redraw_name_list()
self.pname = Name(new)
self.write_primary_name()
def write_primary_name(self):
# initial values
self.get_widget("activepersonTitle").set_text(GrampsCfg.nameof(self.person))
self.suffix.set_text(self.pname.getSuffix())
self.surname_field.set_text(self.pname.getSurname())
self.given.set_text(self.pname.getFirstName())
self.ntype_field.entry.set_text(_(self.pname.getType()))
self.title.set_text(self.pname.getTitle())
def update_ord(func,ord,date,temple,stat,place): def update_ord(func,ord,date,temple,stat,place):
if not ord: if not ord:
if (date or temple or place): if (date or temple or place):

View File

@ -832,7 +832,10 @@ class ReportDialog:
self.make_document() self.make_document()
# Create the report object and product the report. # Create the report object and product the report.
try:
self.make_report() self.make_report()
except (IOError,OSError),msg:
GnomeErrorDialog(str(msg))
# Clean up the dialog object # Clean up the dialog object
self.window.destroy() self.window.destroy()

View File

@ -20,6 +20,8 @@
from TextDoc import * from TextDoc import *
from latin_utf8 import latin_to_utf8 from latin_utf8 import latin_to_utf8
import Utils
import time import time
import StringIO import StringIO
import os import os
@ -130,8 +132,18 @@ class KwordDoc(TextDoc):
self.f.write('bottom="%d" ' % points(self.height-self.bmargin)) self.f.write('bottom="%d" ' % points(self.height-self.bmargin))
self.f.write('runaround="1" />\n') self.f.write('runaround="1" />\n')
self.cell_row= 0
self.cell_col= 0
self.frameset_flg= 1
self.table_no= 0
self.cell_style= ""
self.cell_span= 1
def close(self): def close(self):
if self.frameset_flg == 1:
self.f.write('</FRAMESET>\n') self.f.write('</FRAMESET>\n')
self.frameset_flg= 0
for p in self.photo_list: for p in self.photo_list:
self.f.write('<FRAMESET frameType="2" frameInfo="0" ') self.f.write('<FRAMESET frameType="2" frameInfo="0" ')
self.f.write('name="%s" visible="1">\n' % p[1]) self.f.write('name="%s" visible="1">\n' % p[1])
@ -194,13 +206,17 @@ class KwordDoc(TextDoc):
self.f.write('<UNDERLINE value="1"/>\n') self.f.write('<UNDERLINE value="1"/>\n')
self.f.write('</FORMAT>\n') self.f.write('</FORMAT>\n')
if p.get_top_border(): if p.get_top_border():
self.f.write('<TOPBORDER red="0" green="0" blue="0" style="0" width="1"/>\n') self.f.write('<TOPBORDER red="0" green="0"')
self.f.write('blue="0" style="0" width="1"/>\n')
if p.get_bottom_border(): if p.get_bottom_border():
self.f.write('<BOTTOMBORDER red="0" green="0" blue="0" style="0" width="1"/>\n') self.f.write('<BOTTOMBORDER red="0" green="0" ')
self.f.write('blue="0" style="0" width="1"/>\n')
if p.get_right_border(): if p.get_right_border():
self.f.write('<RIGHTBORDER red="0" green="0" blue="0" style="0" width="1"/>\n') self.f.write('<RIGHTBORDER red="0" green="0" ')
self.f.write('blue="0" style="0" width="1"/>\n')
if p.get_left_border(): if p.get_left_border():
self.f.write('<LEFTBORDER red="0" green="0" blue="0" style="0" width="1"/>\n') self.f.write('<LEFTBORDER red="0" green="0" ')
self.f.write('blue="0" style="0" width="1"/>\n')
if left != 0: if left != 0:
self.f.write('<TABULATOR ptpos="%d" type="0"/>\n' % points(left)) self.f.write('<TABULATOR ptpos="%d" type="0"/>\n' % points(left))
self.f.write('</STYLE>\n') self.f.write('</STYLE>\n')
@ -246,9 +262,9 @@ class KwordDoc(TextDoc):
self.p = self.style_list[self.style_name] self.p = self.style_list[self.style_name]
self.font = self.p.get_font() self.font = self.p.get_font()
if self.font.get_type_face() == FONT_SERIF: if self.font.get_type_face() == FONT_SERIF:
self.font_face = "times" self.font_face = "Arial"
else: else:
self.font_face = "helvetica" self.font_face = "Times New Roman"
if leader != None: if leader != None:
self.text = leader + '\t' self.text = leader + '\t'
@ -259,6 +275,10 @@ class KwordDoc(TextDoc):
self.bold_stop = len(self.text) self.bold_stop = len(self.text)
def end_paragraph(self): def end_paragraph(self):
if self.frameset_flg == 0:
self.f.write('<FRAMESET>\n')
self.frameset_flg= 1
if self.bold_start != 0 and self.bold_stop != len(self.text): if self.bold_start != 0 and self.bold_stop != len(self.text):
txt = '<FORMAT>\n<FONT name="%s"/>\n</FORMAT>\n' % self.font_face txt = '<FORMAT>\n<FONT name="%s"/>\n</FORMAT>\n' % self.font_face
self.format_list.append(txt) self.format_list.append(txt)
@ -332,39 +352,64 @@ class KwordDoc(TextDoc):
self.format_list.append(txt) self.format_list.append(txt)
def start_table(self,name,style_name): def start_table(self,name,style_name):
pass self.tbl= self.table_styles[style_name]
self.cell_left= (self.lmargin * 72)/ 2.54
self.tbl_width= ((self.width - self.lmargin - self.rmargin) * 72 ) / 2.54
self.f.write(' </FRAMESET> \n')
self.cell_row= 0
self.cell_col= 0
self.frameset_flg= 0
def end_table(self): def end_table(self):
pass self.table_no= self.table_no + 1
def start_row(self): def start_row(self):
pass pass
def end_row(self): def end_row(self):
pass self.cell_row= self.cell_row + 1
self.cell_col= 0
self.cell_left= (self.lmargin * 72)/ 2.54
def start_cell(self,style_name,span=1): def start_cell(self,style_name,span=1):
pass self.cell_span= span
self.cell_style= style_name
self.cell_right = self.cell_left
for i in range(0,span):
col_width = self.tbl.get_column_width(self.cell_col+i)
spc = (self.tbl_width * col_width) / 100
self.cell_right = self.cell_right + spc
self.f.write('<FRAMESET removable="0" cols="%d" rows="1" ' % span)
self.f.write('grpMgr="Table %d" frameType="1" ' % self.table_no)
self.f.write('frameInfo="0" row="%d" col="%d" ' % (self.cell_row,self.cell_col))
self.f.write('name="Table %d Cell %d,%d" visible="1" >\n' % (self.table_no, self.cell_row, self.cell_col))
self.f.write('<FRAME bleftpt="2.83465" ')
self.f.write('copy="0" bbottompt="2.83465" btoppt="2.83465" ')
self.f.write('right="%d" left="%d" ' % (self.cell_right, self.cell_left))
self.f.write('newFrameBehaviour="1" brightpt="2.83465" ')
self.f.write('bottom="%d" runaroundGap="2.83465" ' % (self.cell_row*23+self.table_no*125+117))
self.f.write(' top="%d" autoCreateNewFrame="0" />\n' % (self.cell_row*23+self.table_no*125+95))
self.frameset_flg= 1
self.cell_col = self.cell_col + span - 1
def end_cell(self): def end_cell(self):
pass self.f.write('</FRAMESET>\n')
self.cell_col= self.cell_col + 1
self.frameset_flg= 0
self.cell_left= self.cell_right
def add_photo(self,name,pos,x,y): def add_photo(self,name,pos,x_cm,y_cm):
im = ImgManip.ImgMapip(name) im = ImgManip.ImgManip(name)
nx,ny = im.size() (x,y)= im.size()
ratio = float(x_cm)*float(y)/(float(y_cm)*float(x))
scale = float(nx)/float(ny) if ratio < 1:
x = points(x) act_width = x_cm
y = points(y) act_height = y_cm*ratio
if scale > 1.0:
scale = 1.0/scale
act_width = x
act_height = y * scale
else: else:
act_width = x * scale act_height = y_cm
act_height = y act_width = x_cm/ratio
index = len(self.photo_list)+1 index = len(self.photo_list)+1
tag = 'pictures/picture%d.jpeg' % index tag = 'pictures/picture%d.jpeg' % index
@ -430,4 +475,5 @@ if __name__ == "__main__":
doc.close() doc.close()
Plugins.register_text_doc(_("KWord"),KwordDoc,0,1,1) #Change to support tables (args were: 0,1,1)
Plugins.register_text_doc(_("KWord"),KwordDoc,1,1,1)

View File

@ -5,7 +5,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: Tue Mar 12 20:00:53 2002\n" "POT-Creation-Date: Fri Mar 15 07:51:16 2002\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -24,7 +24,7 @@ msgid "Choose Spouse/Partner of %s"
msgstr "" msgstr ""
#: AddSpouse.py:110 const.py:391 const.py:399 plugins/FamilyGroup.py:288 #: AddSpouse.py:110 const.py:391 const.py:399 plugins/FamilyGroup.py:288
#: plugins/FamilyGroup.py:290 #: plugins/FamilyGroup.py:290 plugins/test.py:288 plugins/test.py:290
msgid "Married" msgid "Married"
msgstr "" msgstr ""
@ -67,7 +67,7 @@ msgstr ""
#: gramps.glade:5570 gramps.glade:5591 gramps.glade:5635 gramps.glade:5665 #: gramps.glade:5570 gramps.glade:5591 gramps.glade:5635 gramps.glade:5665
#: gramps.glade:6570 gramps.glade:6600 gramps.glade:6617 gramps.glade:6647 #: gramps.glade:6570 gramps.glade:6600 gramps.glade:6617 gramps.glade:6647
#: gramps_main.py:1370 gramps_main.py:1532 plugins/EventCmp.py:474 #: gramps_main.py:1370 gramps_main.py:1532 plugins/EventCmp.py:474
#: plugins/FamilyGroup.py:138 #: plugins/FamilyGroup.py:138 plugins/test.py:138
msgid "Birth" msgid "Birth"
msgstr "" msgstr ""
@ -83,14 +83,14 @@ msgstr ""
#: ChooseParents.py:161 gramps.glade:1866 gramps.glade:5040 #: ChooseParents.py:161 gramps.glade:1866 gramps.glade:5040
#: gramps_main.py:1459 mergedata.glade:518 mergedata.glade:1180 #: gramps_main.py:1459 mergedata.glade:518 mergedata.glade:1180
#: plugins/FamilyGroup.py:197 plugins/IndivSummary.py:283 #: plugins/FamilyGroup.py:197 plugins/IndivSummary.py:283
#: plugins/WebPage.py:245 plugins/WebPage.py:248 #: plugins/WebPage.py:245 plugins/WebPage.py:248 plugins/test.py:197
msgid "Mother" msgid "Mother"
msgstr "" msgstr ""
#: ChooseParents.py:162 gramps.glade:1775 gramps.glade:4842 #: ChooseParents.py:162 gramps.glade:1775 gramps.glade:4842
#: gramps_main.py:1458 mergedata.glade:766 mergedata.glade:1478 #: gramps_main.py:1458 mergedata.glade:766 mergedata.glade:1478
#: plugins/FamilyGroup.py:184 plugins/IndivSummary.py:269 #: plugins/FamilyGroup.py:184 plugins/IndivSummary.py:269
#: plugins/WebPage.py:244 plugins/WebPage.py:247 #: plugins/WebPage.py:244 plugins/WebPage.py:247 plugins/test.py:184
msgid "Father" msgid "Father"
msgstr "" msgstr ""
@ -320,6 +320,7 @@ msgid "Edit"
msgstr "" msgstr ""
#: EditPerson.glade:385 plugins/EventCmp.py:474 plugins/FamilyGroup.py:156 #: EditPerson.glade:385 plugins/EventCmp.py:474 plugins/FamilyGroup.py:156
#: plugins/test.py:156
msgid "Death" msgid "Death"
msgstr "" msgstr ""
@ -341,9 +342,9 @@ msgstr ""
msgid "female" msgid "female"
msgstr "" msgstr ""
#: EditPerson.glade:670 EditPerson.py:401 const.py:105 gramps.glade:6720 #: EditPerson.glade:670 EditPerson.py:393 const.py:105 gramps.glade:6720
#: plugins/FamilyGroup.py:379 plugins/IndivSummary.py:161 #: plugins/FamilyGroup.py:379 plugins/IndivSummary.py:161
#: plugins/WebPage.py:505 #: plugins/WebPage.py:505 plugins/test.py:379
msgid "unknown" msgid "unknown"
msgstr "" msgstr ""
@ -747,20 +748,24 @@ msgstr ""
msgid "Internet Address Editor" msgid "Internet Address Editor"
msgstr "" msgstr ""
#: EditPerson.py:376 GrampsCfg.py:61 const.py:118 gramps.glade:4991 #: EditPerson.py:368 GrampsCfg.py:61 const.py:118 gramps.glade:4991
#: gramps.glade:5186 gramps.glade:5570 gramps.glade:5635 gramps.glade:6570 #: gramps.glade:5186 gramps.glade:5570 gramps.glade:5635 gramps.glade:6570
#: gramps.glade:6617 #: gramps.glade:6617
msgid "None" msgid "None"
msgstr "" msgstr ""
#: EditPerson.py:393 EditSource.py:138 #: EditPerson.py:385 EditSource.py:138
msgid "%(father)s and %(mother)s" msgid "%(father)s and %(mother)s"
msgstr "" msgstr ""
#: EditPerson.py:730 EditPerson.py:739 #: EditPerson.py:722 EditPerson.py:731
msgid "Are you sure you want to abandon your changes?" msgid "Are you sure you want to abandon your changes?"
msgstr "" msgstr ""
#: EditPerson.py:1011
msgid "Make the selected name the preferred name"
msgstr ""
#: EditPerson.py:1071 Marriage.py:368 #: EditPerson.py:1071 Marriage.py:368
msgid "GRAMPS ID value was not changed." msgid "GRAMPS ID value was not changed."
msgstr "" msgstr ""
@ -1027,7 +1032,7 @@ msgstr ""
msgid "Location Editor" msgid "Location Editor"
msgstr "" msgstr ""
#: Marriage.py:102 Marriage.py:479 Marriage.py:497 Utils.py:135 #: Marriage.py:102 Marriage.py:480 Marriage.py:498 Utils.py:135
#: plugins/Check.py:178 #: plugins/Check.py:178
msgid "%s and %s" msgid "%s and %s"
msgstr "" msgstr ""
@ -1836,7 +1841,7 @@ msgstr ""
msgid "HTML" msgid "HTML"
msgstr "" msgstr ""
#: docgen/KwordDoc.py:433 #: docgen/KwordDoc.py:479
msgid "KWord" msgid "KWord"
msgstr "" msgstr ""
@ -2205,6 +2210,7 @@ msgid "Relationship"
msgstr "" msgstr ""
#: gramps.glade:1598 plugins/FamilyGroup.py:277 plugins/FamilyGroup.py:381 #: gramps.glade:1598 plugins/FamilyGroup.py:277 plugins/FamilyGroup.py:381
#: plugins/test.py:277 plugins/test.py:381
msgid "Spouse" msgid "Spouse"
msgstr "" msgstr ""
@ -2225,7 +2231,7 @@ msgid "Add/Edit/View"
msgstr "" msgstr ""
#: gramps.glade:2022 plugins/FamilyGroup.py:311 plugins/IndivSummary.py:174 #: gramps.glade:2022 plugins/FamilyGroup.py:311 plugins/IndivSummary.py:174
#: plugins/WebPage.py:521 #: plugins/WebPage.py:521 plugins/test.py:311
msgid "Children" msgid "Children"
msgstr "" msgstr ""
@ -2780,6 +2786,7 @@ msgstr ""
#: plugins/DescendReport.py:276 plugins/DetAncestralReport.py:607 #: plugins/DescendReport.py:276 plugins/DetAncestralReport.py:607
#: plugins/FamilyGroup.py:460 plugins/GraphViz.py:288 #: plugins/FamilyGroup.py:460 plugins/GraphViz.py:288
#: plugins/IndivSummary.py:431 plugins/Summary.py:133 plugins/WebPage.py:1070 #: plugins/IndivSummary.py:431 plugins/Summary.py:133 plugins/WebPage.py:1070
#: plugins/test.py:460
msgid "Beta" msgid "Beta"
msgstr "" msgstr ""
@ -2875,7 +2882,7 @@ msgstr ""
#: plugins/DescendReport.py:143 plugins/DescendReport.py:275 #: plugins/DescendReport.py:143 plugins/DescendReport.py:275
#: plugins/DetAncestralReport.py:608 plugins/FamilyGroup.py:338 #: plugins/DetAncestralReport.py:608 plugins/FamilyGroup.py:338
#: plugins/FamilyGroup.py:459 plugins/IndivSummary.py:332 #: plugins/FamilyGroup.py:459 plugins/IndivSummary.py:332
#: plugins/IndivSummary.py:432 #: plugins/IndivSummary.py:432 plugins/test.py:338 plugins/test.py:459
msgid "Text Reports" msgid "Text Reports"
msgstr "" msgstr ""
@ -3181,31 +3188,31 @@ msgid "Aids in the analysis of data by allowing the development of custom filter
msgstr "" msgstr ""
#: plugins/FamilyGroup.py:109 plugins/FamilyGroup.py:338 #: plugins/FamilyGroup.py:109 plugins/FamilyGroup.py:338
#: plugins/FamilyGroup.py:458 #: plugins/FamilyGroup.py:458 plugins/test.py:109 plugins/test.py:338
msgid "Family Group Report" msgid "Family Group Report"
msgstr "" msgstr ""
#: plugins/FamilyGroup.py:118 #: plugins/FamilyGroup.py:118 plugins/test.py:118
msgid "Husband" msgid "Husband"
msgstr "" msgstr ""
#: plugins/FamilyGroup.py:120 #: plugins/FamilyGroup.py:120 plugins/test.py:120
msgid "Wife" msgid "Wife"
msgstr "" msgstr ""
#: plugins/FamilyGroup.py:342 #: plugins/FamilyGroup.py:342 plugins/test.py:342
msgid "Family Group Report for %s" msgid "Family Group Report for %s"
msgstr "" msgstr ""
#: plugins/FamilyGroup.py:347 #: plugins/FamilyGroup.py:347 plugins/test.py:347
msgid "Save Family Group Report" msgid "Save Family Group Report"
msgstr "" msgstr ""
#: plugins/FamilyGroup.py:369 #: plugins/FamilyGroup.py:369 plugins/test.py:369
msgid "No known marriages" msgid "No known marriages"
msgstr "" msgstr ""
#: plugins/FamilyGroup.py:461 #: plugins/FamilyGroup.py:461 plugins/test.py:461
msgid "Creates a family group report, showing information on a set of parents and their children." msgid "Creates a family group report, showing information on a set of parents and their children."
msgstr "" msgstr ""
@ -4167,6 +4174,10 @@ msgstr ""
msgid "Database Summary" msgid "Database Summary"
msgstr "" msgstr ""
#: plugins/test.py:458
msgid "test"
msgstr ""
#: plugins/verify.glade:18 #: plugins/verify.glade:18
msgid "Database Verify - GRAMPS" msgid "Database Verify - GRAMPS"
msgstr "" msgstr ""