* 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
This commit is contained in:
Alex Roitman 2004-08-20 21:26:51 +00:00
parent 0dd92d0a5c
commit fe4427adf8
24 changed files with 135 additions and 82 deletions

View File

@ -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 <twaugh@redhat.com>
* src/RelLib.py (Event.are_equal): Fixed comparison with None.

View File

@ -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

View File

@ -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):

View File

@ -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:

View File

@ -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):

View File

@ -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") %

View File

@ -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,

View File

@ -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('<draw:text-box draw:style-name="%s" ' % style)
@ -963,6 +963,14 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
self.f.write('</text:p>\n')
self.f.write('</draw:text-box>\n')
#------------------------------------------------------------------------
#
# point to centimeter convertion
#
#------------------------------------------------------------------------
def pt2cm(val):
return (float(val)/28.3465)
#--------------------------------------------------------------------------
#
# Register plugins

View File

@ -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

View File

@ -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)

View File

@ -25,19 +25,6 @@
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button7">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_merge_places_clicked" object="merge_places"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button9">
<property name="visible">True</property>
@ -50,6 +37,19 @@
<signal name="clicked" handler="destroy_passed_object" object="merge_places"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button7">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_merge_places_clicked" object="merge_places"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>

View File

@ -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]))

View File

@ -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]))

View File

@ -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(".")

View File

@ -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]))

View File

@ -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]))

View File

@ -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,

View File

@ -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,

View File

@ -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()

View File

@ -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"""

View File

@ -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)

View File

@ -271,19 +271,6 @@
</widget>
</child>
<child>
<widget class="GtkButton" id="button2">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-execute</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_apply_clicked" last_modification_time="Sun, 11 May 2003 21:01:26 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button3">
<property name="visible">True</property>
@ -296,6 +283,19 @@
<signal name="clicked" handler="on_close_clicked" last_modification_time="Sun, 11 May 2003 21:01:38 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button2">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-execute</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_apply_clicked" last_modification_time="Sun, 11 May 2003 21:01:26 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>

View File

@ -125,20 +125,6 @@
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button7">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Merge</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_do_merge_clicked"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button9">
<property name="visible">True</property>
@ -152,6 +138,20 @@
<signal name="clicked" handler="destroy_passed_object" object="mergelist"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button7">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Merge</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_do_merge_clicked"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>

View File

@ -839,8 +839,8 @@
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="label" translatable="yes">_Run</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_verify_ok_clicked" object="verify_settings"/>