From fe4427adf8a2e96ebfd9d453959b6bd86cbb2ef0 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Fri, 20 Aug 2004 21:26:51 +0000 Subject: [PATCH] * src/WriteGedcom.py (get_option_box): Make filters inclusive. * src/plugins/merge.glade: Switch button order to comply with HIG. * src/mergedata.glade: Switch button order to comply with HIG. * src/plugins/RelGraph.py (get_default_basename): Add function. * src/plugins/AncestorReport.py (write_report): Translate string properly. * src/EventEdit.py (update_event): Use transtable. * src/EditPerson.py (on_event_add_clicked, on_edit_birth_clicked, on_edit_death_clicked, on_event_update_clicked): Pass TransTable to the event editor. * src/Marriage.py (on_add_clicked, on_event_update_clicked): Pass TransTable to the event editor. * src/plugins/FtmStyleAncestors.py, src/plugins/FtmStyleDescendants.py: Remove extra space between vars in "%(.*_place)s %(.*_notes)s" * src/plugins/verify.glade: Translate button label. * src/plugins/IndivSummary.py: Proper handling of translation. * src/docgen/OpenOfficeDoc.py (pt2cm): Add function; (draw_text): Convert points to cm for the box width; Use self.string_width() method. * src/BaseDoc.py (string_width): Add a method to compute width. * src/docgen/LPRDoc.py (string_width): Override method. * src/docgen/PdfDoc.py: Use self.string_width() method. * src/docgen/SvgDrawDoc.py: Use self.string_width() method. * src/plugins/AncestorChart2.py: Use self.doc.string_width() method. * src/plugins/AncestorChart.py: Use self.doc.string_width() method. * src/plugins/DesGraph.py: Use self.doc.string_width() method. * src/plugins/FanChart.py: Use self.doc.string_width() method. * src/plugins/TimeLine.py: Use self.doc.string_width() method. * src/plugins/eval.glade: HIG compliance. svn: r3453 --- ChangeLog | 31 ++++++++++++++++++++++++++++++ src/BaseDoc.py | 7 ++++++- src/EditPerson.py | 8 ++++---- src/EventEdit.py | 4 ++-- src/Marriage.py | 4 ++-- src/WriteGedcom.py | 4 ++-- src/docgen/LPRDoc.py | 4 ++++ src/docgen/OpenOfficeDoc.py | 10 +++++++++- src/docgen/PdfDoc.py | 3 +-- src/docgen/SvgDrawDoc.py | 9 +++++---- src/mergedata.glade | 26 ++++++++++++------------- src/plugins/AncestorChart.py | 4 ++-- src/plugins/AncestorChart2.py | 4 ++-- src/plugins/AncestorReport.py | 2 +- src/plugins/DesGraph.py | 3 +-- src/plugins/FanChart.py | 3 +-- src/plugins/FtmStyleAncestors.py | 4 ++-- src/plugins/FtmStyleDescendants.py | 8 ++++---- src/plugins/IndivSummary.py | 10 ++++++---- src/plugins/RelGraph.py | 8 +++++++- src/plugins/TimeLine.py | 3 +-- src/plugins/eval.glade | 26 ++++++++++++------------- src/plugins/merge.glade | 28 +++++++++++++-------------- src/plugins/verify.glade | 4 ++-- 24 files changed, 135 insertions(+), 82 deletions(-) diff --git a/ChangeLog b/ChangeLog index 93547af9f..59d752d7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,37 @@ * src/plugins/rel_ru.py (is_spouse): Remove function; (get_relationship): Correctly use apply_filter. + * src/WriteGedcom.py (get_option_box): Make filters inclusive. + * src/plugins/merge.glade: Switch button order to comply with HIG. + * src/mergedata.glade: Switch button order to comply with HIG. + * src/plugins/RelGraph.py (get_default_basename): Add function. + * src/plugins/AncestorReport.py (write_report): Translate + string properly. + * src/EventEdit.py (update_event): Use transtable. + * src/EditPerson.py (on_event_add_clicked, on_edit_birth_clicked, + on_edit_death_clicked, on_event_update_clicked): + Pass TransTable to the event editor. + * src/Marriage.py (on_add_clicked, on_event_update_clicked): + Pass TransTable to the event editor. + * src/plugins/FtmStyleAncestors.py, + src/plugins/FtmStyleDescendants.py: + Remove extra space between vars in "%(.*_place)s %(.*_notes)s" + * src/plugins/verify.glade: Translate button label. + * src/plugins/IndivSummary.py: Proper handling of translation. + * src/docgen/OpenOfficeDoc.py (pt2cm): Add function; + (draw_text): Convert points to cm for the box width; + Use self.string_width() method. + * src/BaseDoc.py (string_width): Add a method to compute width. + * src/docgen/LPRDoc.py (string_width): Override method. + * src/docgen/PdfDoc.py: Use self.string_width() method. + * src/docgen/SvgDrawDoc.py: Use self.string_width() method. + * src/plugins/AncestorChart2.py: Use self.doc.string_width() method. + * src/plugins/AncestorChart.py: Use self.doc.string_width() method. + * src/plugins/DesGraph.py: Use self.doc.string_width() method. + * src/plugins/FanChart.py: Use self.doc.string_width() method. + * src/plugins/TimeLine.py: Use self.doc.string_width() method. + * src/plugins/eval.glade: HIG compliance. + 2004-08-20 Tim Waugh * src/RelLib.py (Event.are_equal): Fixed comparison with None. diff --git a/src/BaseDoc.py b/src/BaseDoc.py index b7f1537cb..ae2fba408 100644 --- a/src/BaseDoc.py +++ b/src/BaseDoc.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2003 Donald N. Allingham +# Copyright (C) 2000-2004 Donald N. Allingham # # Modified September 2002 by Gary Shao # @@ -73,6 +73,7 @@ from math import pi, cos, sin # #------------------------------------------------------------------------- import Utils +import FontScale #------------------------------------------------------------------------- # @@ -1205,6 +1206,10 @@ class BaseDoc: "Closes the document" pass + def string_width(self,fontstyle,text): + "Determine the width need for text in given font" + return FontScale.string_width(fontstyle,text) + def line_break(self): "Forces a line break within a paragraph" pass diff --git a/src/EditPerson.py b/src/EditPerson.py index a1b1ba111..7cc972801 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -966,7 +966,7 @@ class EditPerson: import EventEdit pname = self.person.get_primary_name().get_name() EventEdit.EventEditor(self,pname,const.personalEvents, - const.save_event,None,None,0,self.event_edit_callback) + const.personal_events,None,None,0,self.event_edit_callback) def on_edit_birth_clicked(self,obj): """Brings up the EventEditor for the birth record, event @@ -983,7 +983,7 @@ class EditPerson: if p: event.set_place_handle(p) EventEdit.EventEditor(self,pname,const.personalEvents, - const.save_event,event,def_placename,1, + const.personal_events,event,def_placename,1, self.event_edit_callback) def on_edit_death_clicked(self,obj): @@ -1001,7 +1001,7 @@ class EditPerson: if p: event.set_place_handle(p) EventEdit.EventEditor(self,pname,const.personalEvents, - const.save_event,event,def_placename,1, + const.personal_events,event,def_placename,1, self.event_edit_callback) def on_aka_delete_clicked(self,obj): @@ -1248,7 +1248,7 @@ class EditPerson: pname = self.person.get_primary_name().get_name() event = self.etree.get_object(node) EventEdit.EventEditor(self,pname,const.personalEvents, - const.save_event,event,None,0, + const.personal_events,event,None,0, self.event_edit_callback) def on_event_select_row(self,obj): diff --git a/src/EventEdit.py b/src/EventEdit.py index f6f339e75..31fea290a 100644 --- a/src/EventEdit.py +++ b/src/EventEdit.py @@ -346,8 +346,8 @@ class EventEditor: self.event.set_place_handle("") self.parent.lists_changed = 1 - if self.event.get_name() != self.trans(name): - self.event.set_name(self.trans(name)) + if self.event.get_name() != self.trans.find_key(name): + self.event.set_name(self.trans.find_key(name)) self.parent.lists_changed = 1 if self.event.get_description() != desc: diff --git a/src/Marriage.py b/src/Marriage.py index dbfb8171a..4f80d65dd 100644 --- a/src/Marriage.py +++ b/src/Marriage.py @@ -646,7 +646,7 @@ class Marriage: import EventEdit name = Utils.family_name(self.family,self.db) EventEdit.EventEditor(self,name,const.marriageEvents, - const.display_fevent,None,None, + const.family_events,None,None, 0,self.event_edit_callback, const.defaultMarriageEvent) @@ -658,7 +658,7 @@ class Marriage: event = self.etree.get_object(iter) name = Utils.family_name(self.family,self.db) EventEdit.EventEditor(self,name,const.marriageEvents, - const.display_fevent,event, + const.family_events,event, None,0,self.event_edit_callback) def on_delete_clicked(self,obj): diff --git a/src/WriteGedcom.py b/src/WriteGedcom.py index d6b833876..0c0dfa643 100644 --- a/src/WriteGedcom.py +++ b/src/WriteGedcom.py @@ -397,11 +397,11 @@ class GedcomWriterOptionBox: des = GenericFilter.GenericFilter() des.set_name(_("Descendants of %s") % self.person.get_primary_name().get_name()) - des.add_rule(GenericFilter.IsDescendantOf([self.person.get_handle()])) + des.add_rule(GenericFilter.IsDescendantOf([self.person.get_handle(),1])) ans = GenericFilter.GenericFilter() ans.set_name(_("Ancestors of %s") % self.person.get_primary_name().get_name()) - ans.add_rule(GenericFilter.IsAncestorOf([self.person.get_handle()])) + ans.add_rule(GenericFilter.IsAncestorOf([self.person.get_handle(),1])) com = GenericFilter.GenericFilter() com.set_name(_("People with common ancestor with %s") % diff --git a/src/docgen/LPRDoc.py b/src/docgen/LPRDoc.py index 37fabd727..780b8211f 100644 --- a/src/docgen/LPRDoc.py +++ b/src/docgen/LPRDoc.py @@ -550,6 +550,10 @@ class LPRDoc(BaseDoc.BaseDoc): # #------------------------------------------------------------------------ + def string_width(self,fontstyle,text): + "Override generic Fontscale-based width." + return get_text_width(text,fontstyle) + def line_break(self): "Forces a line break within a paragraph." # Add previously held text to the paragraph, diff --git a/src/docgen/OpenOfficeDoc.py b/src/docgen/OpenOfficeDoc.py index 13e6e04dc..eb68abecb 100644 --- a/src/docgen/OpenOfficeDoc.py +++ b/src/docgen/OpenOfficeDoc.py @@ -876,7 +876,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc): if box_style.get_width(): sw = box_style.get_width() else: - sw = FontScale.string_width(font,text)*1.3 + sw = pt2cm(FontScale.string_width(font,text))*1.3 self.f.write('\n') self.f.write('\n') +#------------------------------------------------------------------------ +# +# point to centimeter convertion +# +#------------------------------------------------------------------------ +def pt2cm(val): + return (float(val)/28.3465) + #-------------------------------------------------------------------------- # # Register plugins diff --git a/src/docgen/PdfDoc.py b/src/docgen/PdfDoc.py index db77afa34..4747f763b 100644 --- a/src/docgen/PdfDoc.py +++ b/src/docgen/PdfDoc.py @@ -29,7 +29,6 @@ import BaseDoc import Plugins import Errors import ImgManip -import FontScale import GrampsMime from gettext import gettext as _ @@ -454,7 +453,7 @@ class PdfDoc(BaseDoc.BaseDoc): fc = make_color(font.get_color()) fnt = self.pdf_set_font(font) if p.get_alignment() == BaseDoc.PARA_ALIGN_CENTER: - twidth = ((FontScale.string_width(font,enc(text)))/2.0)*cm + twidth = ((self.string_width(font,enc(text)))/2.0)*cm xcm = (stype.get_width() - x) - twidth else: xcm = x * cm diff --git a/src/docgen/SvgDrawDoc.py b/src/docgen/SvgDrawDoc.py index 2e9a8b3e4..b57505b4b 100644 --- a/src/docgen/SvgDrawDoc.py +++ b/src/docgen/SvgDrawDoc.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000 Donald N. Allingham +# Copyright (C) 2000-2004 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,6 +18,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + #------------------------------------------------------------------------- # # python modules @@ -35,7 +37,6 @@ import Plugins from gettext import gettext as _ import BaseDoc import Errors -import FontScale #------------------------------------------------------------------------- # @@ -91,14 +92,14 @@ class SvgDrawDoc(BaseDoc.BaseDoc): width = 0 for line in text: - width = max(width,FontScale.string_width(font,line)) + width = max(width,self.string_width(font,line)) # rangle = -((pi/180.0) * angle) centerx,centery = units((x+self.lmargin,y+self.tmargin)) yh = 0 for line in text: - xw = FontScale.string_width(font,line) + xw = self.string_width(font,line) xpos = (centerx - (xw/2.0)) ypos = (centery) diff --git a/src/mergedata.glade b/src/mergedata.glade index 1fa4eab30..35818d6d8 100644 --- a/src/mergedata.glade +++ b/src/mergedata.glade @@ -25,19 +25,6 @@ True GTK_BUTTONBOX_END - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - 0 - - - - True @@ -50,6 +37,19 @@ + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + 0 + + + 0 diff --git a/src/plugins/AncestorChart.py b/src/plugins/AncestorChart.py index 5f818d5b1..dc8665f25 100644 --- a/src/plugins/AncestorChart.py +++ b/src/plugins/AncestorChart.py @@ -45,7 +45,6 @@ import gtk import BaseDoc import Report import Errors -import FontScale from QuestionDialog import ErrorDialog from SubstKeywords import SubstKeywords from gettext import gettext as _ @@ -107,7 +106,8 @@ class AncestorChart: self.font = self.doc.style_list["AC-Normal"].get_font() for line in self.text[index]: - self.box_width = max(self.box_width,FontScale.string_width(self.font,line)) + this_box_width = self.doc.string_width(self.font,line) + self.box_width = max(self.box_width,this_box_width) self.lines = max(self.lines,len(self.text[index])) diff --git a/src/plugins/AncestorChart2.py b/src/plugins/AncestorChart2.py index f673797bb..b3c3b6c7e 100644 --- a/src/plugins/AncestorChart2.py +++ b/src/plugins/AncestorChart2.py @@ -42,7 +42,6 @@ import gtk import BaseDoc import Report import Errors -import FontScale from QuestionDialog import ErrorDialog from SubstKeywords import SubstKeywords from gettext import gettext as _ @@ -221,7 +220,8 @@ class AncestorChart: self.text[index].append(subst.replace(line)) for line in self.text[index]: - self.box_width = max(self.box_width,FontScale.string_width(self.font,line)) + this_box_width = self.doc.string_width(self.font,line) + self.box_width = max(self.box_width,this_box_width) self.lines = max(self.lines,len(self.text[index])) diff --git a/src/plugins/AncestorReport.py b/src/plugins/AncestorReport.py index a451b4cbf..59e8bbd65 100644 --- a/src/plugins/AncestorReport.py +++ b/src/plugins/AncestorReport.py @@ -226,7 +226,7 @@ class AncestorReport(Report.Report): t = _(", and was buried in the year %s.") % \ date.get_date() else: - t = _(" and was buried in %s." % place) + t = _(" and was buried in %s.") % place self.doc.write_text(t) else: self.doc.write_text(".") diff --git a/src/plugins/DesGraph.py b/src/plugins/DesGraph.py index a5ee15a30..adba97346 100644 --- a/src/plugins/DesGraph.py +++ b/src/plugins/DesGraph.py @@ -42,7 +42,6 @@ import gtk # #------------------------------------------------------------------------ import GraphLayout -import FontScale import Report import BaseDoc import Errors @@ -109,7 +108,7 @@ class DescendantReport: self.font = self.doc.style_list["DG-Normal"].get_font() for line in self.text[p_id]: - new_width = FontScale.string_width(self.font,line) + new_width = self.doc.string_width(self.font,line) self.box_width = max(self.box_width,new_width) self.lines = max(self.lines,len(self.text[p_id])) diff --git a/src/plugins/FanChart.py b/src/plugins/FanChart.py index 965e5c2fe..c8148ad4a 100644 --- a/src/plugins/FanChart.py +++ b/src/plugins/FanChart.py @@ -38,7 +38,6 @@ import Errors import Calendar from QuestionDialog import ErrorDialog -from FontScale import string_width from SubstKeywords import SubstKeywords from gettext import gettext as _ @@ -160,7 +159,7 @@ class FanChart: self.font = self.doc.style_list["FC-Normal"].get_font() for line in self.text[index-1]: - self.box_width = max(self.box_width,string_width(self.font,line)) + self.box_width = max(self.box_width,self.doc.string_width(self.font,line)) self.lines = max(self.lines,len(self.text[index-1])) diff --git a/src/plugins/FtmStyleAncestors.py b/src/plugins/FtmStyleAncestors.py index 4db6620ff..0de9dbfe8 100644 --- a/src/plugins/FtmStyleAncestors.py +++ b/src/plugins/FtmStyleAncestors.py @@ -172,7 +172,7 @@ class FtmAncestorReport(Report.Report): else: if dplace: self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s %(birth_endnotes)s, " + "in %(birth_place)s%(birth_endnotes)s, " "and died in %(death_place)s%(death_endnotes)s.") % { 'male_name' : '', 'endnotes' : self.endnotes(pri_name), 'birth_date' : bdate, 'birth_place' : bplace, @@ -321,7 +321,7 @@ class FtmAncestorReport(Report.Report): }) else: self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s %(birth_endnotes)s.") % { + "in %(birth_place)s%(birth_endnotes)s.") % { 'female_name' : '', 'endnotes' : self.endnotes(pri_name), 'birth_endnotes' : self.endnotes(birth), 'birth_date' : bdate, 'birth_place' : bplace, diff --git a/src/plugins/FtmStyleDescendants.py b/src/plugins/FtmStyleDescendants.py index 0b1c1ac95..c5b970000 100644 --- a/src/plugins/FtmStyleDescendants.py +++ b/src/plugins/FtmStyleDescendants.py @@ -196,7 +196,7 @@ class FtmDescendantReport(Report.Report): else: if dplace: self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s %(birth_endnotes)s, " + "in %(birth_place)s%(birth_endnotes)s, " "and died in %(death_place)s%(death_endnotes)s.") % { 'male_name' : '', 'endnotes' : self.endnotes(pri_name), 'birth_date' : bdate, 'birth_place' : bplace, @@ -345,7 +345,7 @@ class FtmDescendantReport(Report.Report): }) else: self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s %(birth_endnotes)s.") % { + "in %(birth_place)s%(birth_endnotes)s.") % { 'female_name' : '', 'endnotes' : self.endnotes(pri_name), 'birth_endnotes' : self.endnotes(birth), 'birth_date' : bdate, 'birth_place' : bplace, @@ -1124,7 +1124,7 @@ class FtmDescendantReport(Report.Report): else: if dplace: self.doc.write_text(_("%(male_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s %(birth_endnotes)s, " + "in %(birth_place)s%(birth_endnotes)s, " "and died in %(death_place)s%(death_endnotes)s.") % { 'male_name' : _('He'), 'endnotes' : '', 'birth_date' : bdate, 'birth_place' : bplace, @@ -1273,7 +1273,7 @@ class FtmDescendantReport(Report.Report): }) else: self.doc.write_text(_("%(female_name)s%(endnotes)s was born %(birth_date)s " - "in %(birth_place)s %(birth_endnotes)s.") % { + "in %(birth_place)s%(birth_endnotes)s.") % { 'female_name' : _('She'), 'endnotes' : '', 'birth_endnotes' : self.endnotes(birth), 'birth_date' : bdate, 'birth_place' : bplace, diff --git a/src/plugins/IndivSummary.py b/src/plugins/IndivSummary.py index a7dd111a8..e0e3f8d9e 100644 --- a/src/plugins/IndivSummary.py +++ b/src/plugins/IndivSummary.py @@ -128,12 +128,14 @@ class IndivSummary(Report.Report): if not place: return else: - val = place + ". " + description + text = '%s. %s' % (place,description) else: if not place: - val = date + ". " + description + text = '%s. %s' % (date,description) else: - val = date + " in " + place + ". " + description + text = _('%(date)s in %(place)s.') % { 'date' : date, + 'place' : place } + text = '%s %s' % (text,description) self.d.start_row() self.d.start_cell("IVS-NormalCell") @@ -144,7 +146,7 @@ class IndivSummary(Report.Report): self.d.start_cell("IVS-NormalCell") self.d.start_paragraph("IVS-Normal") - self.d.write_text(val) + self.d.write_text(text) self.d.end_paragraph() self.d.end_cell() self.d.end_row() diff --git a/src/plugins/RelGraph.py b/src/plugins/RelGraph.py index 46789357f..8ba531e18 100644 --- a/src/plugins/RelGraph.py +++ b/src/plugins/RelGraph.py @@ -111,7 +111,13 @@ class RelGraphDialog(Report.ReportDialog): report_options = {} def __init__(self,database,person): - Report.ReportDialog.__init__(self,database,person,self.report_options) + print "here" + Report.ReportDialog.__init__(self,database,person,self.report_options) + + def get_default_basename(self): + """What should the default name be? + """ + return "relationship_graph.dot" def get_title(self): """The window title for this dialog""" diff --git a/src/plugins/TimeLine.py b/src/plugins/TimeLine.py index 1b3498000..95ee1f12c 100644 --- a/src/plugins/TimeLine.py +++ b/src/plugins/TimeLine.py @@ -49,7 +49,6 @@ import BaseDoc import GenericFilter import Errors import Date -import FontScale import Sort from QuestionDialog import ErrorDialog @@ -323,7 +322,7 @@ class TimeLine: for p_id in self.plist: p = self.db.get_person_from_handle(p_id) n = p.get_primary_name().get_name() - size = max(FontScale.string_width(font,n),size) + size = max(self.d.string_width(font,n),size) return pt2cm(size) diff --git a/src/plugins/eval.glade b/src/plugins/eval.glade index a629550fe..3aef197d1 100644 --- a/src/plugins/eval.glade +++ b/src/plugins/eval.glade @@ -271,19 +271,6 @@ - - - True - True - True - gtk-execute - True - GTK_RELIEF_NORMAL - True - - - - True @@ -296,6 +283,19 @@ + + + + True + True + True + gtk-execute + True + GTK_RELIEF_NORMAL + True + + + 0 diff --git a/src/plugins/merge.glade b/src/plugins/merge.glade index b65214553..9cf180cb2 100644 --- a/src/plugins/merge.glade +++ b/src/plugins/merge.glade @@ -125,20 +125,6 @@ True GTK_BUTTONBOX_END - - - True - True - True - _Merge - True - GTK_RELIEF_NORMAL - True - 0 - - - - True @@ -152,6 +138,20 @@ + + + + True + True + True + _Merge + True + GTK_RELIEF_NORMAL + True + 0 + + + 0 diff --git a/src/plugins/verify.glade b/src/plugins/verify.glade index b2369341f..632a0642d 100644 --- a/src/plugins/verify.glade +++ b/src/plugins/verify.glade @@ -839,8 +839,8 @@ True True True - gtk-ok - True + _Run + True GTK_RELIEF_NORMAL True