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

@ -257,20 +257,13 @@ class EditPerson:
if GrampsCfg.uselds or self.lds_baptism or self.lds_endowment or self.lds_sealing:
self.get_widget("lds_tab").show()
self.get_widget("lds_page").show()
# initial values
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())
self.write_primary_name()
types = const.NameTypesMap.keys()
types.sort()
self.ntype_field.set_popdown_strings(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:
self.is_male.set_active(1)
@ -280,7 +273,6 @@ class EditPerson:
self.is_unknown.set_active(1)
self.nick.set_text(person.getNickName())
self.title.set_text(self.pname.getTitle())
self.update_birth_death()
self.load_person_image()
@ -1011,6 +1003,14 @@ class EditPerson:
def aka_double_click(self,obj,event):
if event.button == 1 and event.type == _2BUTTON_PRESS:
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):
import NameEdit
@ -1342,6 +1342,28 @@ class EditPerson:
self.lds_not_loaded = 0
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):
if not ord:
if (date or temple or place):

View File

@ -154,7 +154,7 @@ class NameEditor:
if self.name.getPrivacy() != priv:
self.name.setPrivacy(priv)
self.parent.lists_changed = 1
def src_changed(parent):
parent.lists_changed = 1

View File

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

View File

@ -20,6 +20,8 @@
from TextDoc import *
from latin_utf8 import latin_to_utf8
import Utils
import time
import StringIO
import os
@ -33,17 +35,17 @@ _ = intl.gettext
def points(val):
inch = float(val)/2.54
return (int(inch*72))
#------------------------------------------------------------------------
#
#
#
#
#------------------------------------------------------------------------
class KwordDoc(TextDoc):
def open(self,filename):
self.photo_list = []
if filename[-4:] != ".kwd":
self.filename = filename + ".kwd"
else:
@ -130,8 +132,18 @@ class KwordDoc(TextDoc):
self.f.write('bottom="%d" ' % points(self.height-self.bmargin))
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):
self.f.write('</FRAMESET>\n')
if self.frameset_flg == 1:
self.f.write('</FRAMESET>\n')
self.frameset_flg= 0
for p in self.photo_list:
self.f.write('<FRAMESET frameType="2" frameInfo="0" ')
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('</FORMAT>\n')
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():
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():
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():
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:
self.f.write('<TABULATOR ptpos="%d" type="0"/>\n' % points(left))
self.f.write('</STYLE>\n')
@ -231,7 +247,7 @@ class KwordDoc(TextDoc):
self.f.close()
self.m.close()
def start_page(self,orientation=None):
pass
@ -246,9 +262,9 @@ class KwordDoc(TextDoc):
self.p = self.style_list[self.style_name]
self.font = self.p.get_font()
if self.font.get_type_face() == FONT_SERIF:
self.font_face = "times"
self.font_face = "Arial"
else:
self.font_face = "helvetica"
self.font_face = "Times New Roman"
if leader != None:
self.text = leader + '\t'
@ -259,6 +275,10 @@ class KwordDoc(TextDoc):
self.bold_stop = len(self.text)
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):
txt = '<FORMAT>\n<FONT name="%s"/>\n</FORMAT>\n' % self.font_face
self.format_list.append(txt)
@ -276,7 +296,7 @@ class KwordDoc(TextDoc):
pad = points(self.p.get_padding())/2
self.f.write('<OFFSETS before="%d" after="%d"/>\n' % (pad,pad))
if self.p.get_alignment() == PARA_ALIGN_CENTER:
self.f.write('<FLOW value="center"/>\n')
elif self.p.get_alignment() == PARA_ALIGN_JUSTIFY:
@ -332,39 +352,64 @@ class KwordDoc(TextDoc):
self.format_list.append(txt)
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):
pass
self.table_no= self.table_no + 1
def start_row(self):
pass
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):
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):
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)
nx,ny = im.size()
im = ImgManip.ImgManip(name)
(x,y)= im.size()
ratio = float(x_cm)*float(y)/(float(y_cm)*float(x))
scale = float(nx)/float(ny)
x = points(x)
y = points(y)
if scale > 1.0:
scale = 1.0/scale
act_width = x
act_height = y * scale
if ratio < 1:
act_width = x_cm
act_height = y_cm*ratio
else:
act_width = x * scale
act_height = y
act_height = y_cm
act_width = x_cm/ratio
index = len(self.photo_list)+1
tag = 'pictures/picture%d.jpeg' % index
@ -372,12 +417,12 @@ class KwordDoc(TextDoc):
txt = '<FORMAT id="6" pos="%d" len="1">\n' % len(self.text)
txt = txt + '<ANCHOR type="frameset" instance="%s"/>\n' % tag
txt = txt + '</FORMAT>\n'
self.bold_stop = len(self.text)
self.format_list.append(txt)
self.text = self.text + '#'
def horizontal_line(self):
pass
@ -430,4 +475,5 @@ if __name__ == "__main__":
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 ""
msgstr ""
"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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -24,7 +24,7 @@ msgid "Choose Spouse/Partner of %s"
msgstr ""
#: 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"
msgstr ""
@ -67,7 +67,7 @@ msgstr ""
#: 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_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"
msgstr ""
@ -83,14 +83,14 @@ msgstr ""
#: ChooseParents.py:161 gramps.glade:1866 gramps.glade:5040
#: gramps_main.py:1459 mergedata.glade:518 mergedata.glade:1180
#: 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"
msgstr ""
#: ChooseParents.py:162 gramps.glade:1775 gramps.glade:4842
#: gramps_main.py:1458 mergedata.glade:766 mergedata.glade:1478
#: 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"
msgstr ""
@ -320,6 +320,7 @@ msgid "Edit"
msgstr ""
#: EditPerson.glade:385 plugins/EventCmp.py:474 plugins/FamilyGroup.py:156
#: plugins/test.py:156
msgid "Death"
msgstr ""
@ -341,9 +342,9 @@ msgstr ""
msgid "female"
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/WebPage.py:505
#: plugins/WebPage.py:505 plugins/test.py:379
msgid "unknown"
msgstr ""
@ -747,20 +748,24 @@ msgstr ""
msgid "Internet Address Editor"
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:6617
msgid "None"
msgstr ""
#: EditPerson.py:393 EditSource.py:138
#: EditPerson.py:385 EditSource.py:138
msgid "%(father)s and %(mother)s"
msgstr ""
#: EditPerson.py:730 EditPerson.py:739
#: EditPerson.py:722 EditPerson.py:731
msgid "Are you sure you want to abandon your changes?"
msgstr ""
#: EditPerson.py:1011
msgid "Make the selected name the preferred name"
msgstr ""
#: EditPerson.py:1071 Marriage.py:368
msgid "GRAMPS ID value was not changed."
msgstr ""
@ -1027,7 +1032,7 @@ msgstr ""
msgid "Location Editor"
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
msgid "%s and %s"
msgstr ""
@ -1836,7 +1841,7 @@ msgstr ""
msgid "HTML"
msgstr ""
#: docgen/KwordDoc.py:433
#: docgen/KwordDoc.py:479
msgid "KWord"
msgstr ""
@ -2205,6 +2210,7 @@ msgid "Relationship"
msgstr ""
#: gramps.glade:1598 plugins/FamilyGroup.py:277 plugins/FamilyGroup.py:381
#: plugins/test.py:277 plugins/test.py:381
msgid "Spouse"
msgstr ""
@ -2225,7 +2231,7 @@ msgid "Add/Edit/View"
msgstr ""
#: 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"
msgstr ""
@ -2780,6 +2786,7 @@ msgstr ""
#: plugins/DescendReport.py:276 plugins/DetAncestralReport.py:607
#: plugins/FamilyGroup.py:460 plugins/GraphViz.py:288
#: plugins/IndivSummary.py:431 plugins/Summary.py:133 plugins/WebPage.py:1070
#: plugins/test.py:460
msgid "Beta"
msgstr ""
@ -2875,7 +2882,7 @@ msgstr ""
#: plugins/DescendReport.py:143 plugins/DescendReport.py:275
#: plugins/DetAncestralReport.py:608 plugins/FamilyGroup.py:338
#: 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"
msgstr ""
@ -3181,31 +3188,31 @@ msgid "Aids in the analysis of data by allowing the development of custom filter
msgstr ""
#: 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"
msgstr ""
#: plugins/FamilyGroup.py:118
#: plugins/FamilyGroup.py:118 plugins/test.py:118
msgid "Husband"
msgstr ""
#: plugins/FamilyGroup.py:120
#: plugins/FamilyGroup.py:120 plugins/test.py:120
msgid "Wife"
msgstr ""
#: plugins/FamilyGroup.py:342
#: plugins/FamilyGroup.py:342 plugins/test.py:342
msgid "Family Group Report for %s"
msgstr ""
#: plugins/FamilyGroup.py:347
#: plugins/FamilyGroup.py:347 plugins/test.py:347
msgid "Save Family Group Report"
msgstr ""
#: plugins/FamilyGroup.py:369
#: plugins/FamilyGroup.py:369 plugins/test.py:369
msgid "No known marriages"
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."
msgstr ""
@ -4167,6 +4174,10 @@ msgstr ""
msgid "Database Summary"
msgstr ""
#: plugins/test.py:458
msgid "test"
msgstr ""
#: plugins/verify.glade:18
msgid "Database Verify - GRAMPS"
msgstr ""