2007-12-30 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/plugins/OnThisDay.py: i18n changes * src/plugins/Makefile.am: added missing files * src/plugins/DefaultGadgets.py: i18n changes * src/QuickReports.py: allow callers to send obj directly * src/Simple/_SimpleTable.py: added support for objs * po/POTFILES.in: i18n changes svn: r9640
This commit is contained in:
parent
d8304d9cc8
commit
e2cb83448a
@ -1,3 +1,11 @@
|
||||
2007-12-30 Douglas S. Blank <dblank@cs.brynmawr.edu>
|
||||
* src/plugins/OnThisDay.py: i18n changes
|
||||
* src/plugins/Makefile.am: added missing files
|
||||
* src/plugins/DefaultGadgets.py: i18n changes
|
||||
* src/QuickReports.py: allow callers to send obj directly
|
||||
* src/Simple/_SimpleTable.py: added support for objs
|
||||
* po/POTFILES.in: i18n changes
|
||||
|
||||
2007-12-30 Peter Landgren <peter.talken@telia.com>
|
||||
* src/plugins/rel:sv.py: Firts release
|
||||
|
||||
|
@ -73,6 +73,7 @@ src/DataViews/EventView.py
|
||||
src/DataViews/FamilyList.py
|
||||
src/DataViews/__init__.py
|
||||
src/DataViews/MediaView.py
|
||||
src/DataViews/MyGrampsView.py
|
||||
src/DataViews/NoteView.py
|
||||
src/DataViews/PedigreeView.py
|
||||
src/DataViews/PersonView.py
|
||||
@ -287,6 +288,7 @@ src/plugins/OnThisDay.py
|
||||
src/plugins/MarkerReport.py
|
||||
src/plugins/MediaManager.py
|
||||
src/plugins/NarrativeWeb.py
|
||||
src/plugins/OnThisDay.py
|
||||
src/plugins/OwnerEditor.py
|
||||
src/plugins/PatchNames.py
|
||||
src/plugins/ReadPkg.py
|
||||
|
@ -134,6 +134,7 @@ def run_report(dbstate, uistate, category,handle,func):
|
||||
d = TextBufDoc(make_basic_stylesheet(), None, None)
|
||||
d.dbstate = dbstate
|
||||
d.uistate = uistate
|
||||
if type(handle) in [str, unicode]: # a handle
|
||||
if category == CATEGORY_QR_PERSON :
|
||||
obj = dbstate.db.get_person_from_handle(handle)
|
||||
elif category == CATEGORY_QR_FAMILY :
|
||||
@ -148,6 +149,8 @@ def run_report(dbstate, uistate, category,handle,func):
|
||||
obj = dbstate.db.get_repository_from_handle(handle)
|
||||
else:
|
||||
obj = None
|
||||
else: # allow caller to send object directly
|
||||
obj = handle
|
||||
if obj:
|
||||
d.open("")
|
||||
func(dbstate.db, d, obj)
|
||||
|
@ -108,6 +108,7 @@ class SimpleTable:
|
||||
"""
|
||||
Add a row of data.
|
||||
"""
|
||||
# FIXME: add data and/or linkable types for all
|
||||
retval = []
|
||||
link = None
|
||||
for item in data:
|
||||
@ -117,16 +118,22 @@ class SimpleTable:
|
||||
name = self.access.name(item)
|
||||
retval.append(name)
|
||||
link = ('Person', item.handle)
|
||||
elif isinstance(item, gen.lib.Family): pass
|
||||
elif isinstance(item, gen.lib.Source): pass
|
||||
elif isinstance(item, gen.lib.Family):
|
||||
retval.append(_('Family'))
|
||||
elif isinstance(item, gen.lib.Source):
|
||||
retval.append(_('Source'))
|
||||
elif isinstance(item, gen.lib.Event):
|
||||
name = self.access.event_type(item)
|
||||
retval.append(name)
|
||||
link = ('Event', item.handle)
|
||||
elif isinstance(item, gen.lib.MediaObject): pass
|
||||
elif isinstance(item, gen.lib.Place): pass
|
||||
elif isinstance(item, gen.lib.Repository): pass
|
||||
elif isinstance(item, gen.lib.Note): pass
|
||||
elif isinstance(item, gen.lib.MediaObject):
|
||||
retval.append(_('Media'))
|
||||
elif isinstance(item, gen.lib.Place):
|
||||
retval.append(_('Place'))
|
||||
elif isinstance(item, gen.lib.Repository):
|
||||
retval.append(_('Repository'))
|
||||
elif isinstance(item, gen.lib.Note):
|
||||
retval.append(_('Note'))
|
||||
elif isinstance(item, gen.lib.Date):
|
||||
text = DateHandler.displayer.display(item)
|
||||
retval.append(text)
|
||||
|
@ -109,11 +109,12 @@ class CalendarGadget(Gadget):
|
||||
# bring up events on this day
|
||||
year, month, day = self.gui.calendar.get_date()
|
||||
month += 1
|
||||
if (year, month, day) in self.dates:
|
||||
date = gen.lib.Date()
|
||||
date.set_yr_mon_day(year, month, day)
|
||||
run_quick_report_by_name(self.gui.dbstate,
|
||||
self.gui.uistate,
|
||||
'onthisday',
|
||||
self.dates[(year, month, day)])
|
||||
date)
|
||||
|
||||
class LogGadget(Gadget):
|
||||
def db_changed(self):
|
||||
@ -135,7 +136,8 @@ class LogGadget(Gadget):
|
||||
self.log_active_changed(handle)
|
||||
|
||||
def init(self):
|
||||
self.set_text("Log for this Session\n--------------------\n")
|
||||
self.set_text(_("Log for this Session"))
|
||||
self.append_text("\n--------------------\n")
|
||||
self.history = {}
|
||||
|
||||
def log_person_add(self, handles):
|
||||
@ -165,13 +167,13 @@ class LogGadget(Gadget):
|
||||
self.link(name_displayer.display(person), 'Person',
|
||||
person_handle)
|
||||
else:
|
||||
self.link("Unknown", 'Person', person_handle)
|
||||
self.link(_("Unknown"), 'Person', person_handle)
|
||||
self.append_text("\n")
|
||||
|
||||
class TopSurnamesGadget(Gadget):
|
||||
def init(self):
|
||||
self.top_size = 10 # will be overwritten in load
|
||||
self.set_text("No Family Tree loaded.")
|
||||
self.set_text(_("No Family Tree loaded."))
|
||||
|
||||
def db_changed(self):
|
||||
self.dbstate.db.connect('person-add', self.update)
|
||||
@ -186,7 +188,7 @@ class TopSurnamesGadget(Gadget):
|
||||
self.gui.data = [self.top_size]
|
||||
|
||||
def main(self):
|
||||
self.set_text("Processing...\n")
|
||||
self.set_text(_("Processing...") + "\n")
|
||||
people = self.dbstate.db.get_person_handles(sort_handles=False)
|
||||
surnames = {}
|
||||
representative_handle = {}
|
||||
@ -223,8 +225,9 @@ class TopSurnamesGadget(Gadget):
|
||||
line += 1
|
||||
if line >= self.top_size:
|
||||
break
|
||||
self.append_text("\nTotal unique surnames: %d\n" % total_surnames)
|
||||
self.append_text("Total people: %d" % total_people)
|
||||
self.append_text(("\n" + _("Total unique surnames") + ": %d\n") %
|
||||
total_surnames)
|
||||
self.append_text((_("Total people") + ": %d") % total_people)
|
||||
|
||||
class StatsGadget(Gadget):
|
||||
def db_changed(self):
|
||||
@ -234,10 +237,10 @@ class StatsGadget(Gadget):
|
||||
self.dbstate.db.connect('family-delete', self.update)
|
||||
|
||||
def init(self):
|
||||
self.set_text("No Family Tree loaded.")
|
||||
self.set_text(_("No Family Tree loaded."))
|
||||
|
||||
def main(self):
|
||||
self.set_text("Processing...")
|
||||
self.set_text(_("Processing..."))
|
||||
database = self.dbstate.db
|
||||
personList = database.get_person_handles(sort_handles=False)
|
||||
familyList = database.get_family_handles()
|
||||
@ -385,7 +388,7 @@ class TODOGadget(Gadget):
|
||||
def init(self):
|
||||
# GUI setup:
|
||||
self.gui.textview.set_editable(True)
|
||||
self.append_text("Enter your TODO list here.")
|
||||
self.append_text(_("Enter your TODO list here."))
|
||||
|
||||
def on_load(self):
|
||||
self.load_data_to_text()
|
||||
@ -437,7 +440,7 @@ class NewsGadget(Gadget):
|
||||
def process(self, title):
|
||||
#print "processing '%s'..." % title
|
||||
title = title.replace(" ", "_")
|
||||
yield True, "Reading '%s'..." % title
|
||||
yield True, (_("Reading") + " '%s'..." % title)
|
||||
fp = urllib.urlopen(self.URL % title)
|
||||
text = fp.read()
|
||||
#text = text.replace("\n", " ")
|
||||
@ -484,63 +487,63 @@ class NewsGadget(Gadget):
|
||||
yield False, text
|
||||
|
||||
register(type="gadget",
|
||||
name="Top Surnames Gadget",
|
||||
name= _("Top Surnames Gadget"),
|
||||
height=230,
|
||||
content = TopSurnamesGadget,
|
||||
title="Top Surnames",
|
||||
title=_("Top Surnames"),
|
||||
)
|
||||
|
||||
register(type="gadget",
|
||||
name="Stats Gadget",
|
||||
name=_("Statistics Gadget"),
|
||||
height=230,
|
||||
expand=True,
|
||||
content = StatsGadget,
|
||||
title="Stats",
|
||||
title=_("Statistics"),
|
||||
)
|
||||
|
||||
register(type="gadget",
|
||||
name="Log Gadget",
|
||||
name=_("Session Log Gadget"),
|
||||
height=230,
|
||||
data=['no'],
|
||||
content = LogGadget,
|
||||
title="Session Log",
|
||||
title=_("Session Log"),
|
||||
)
|
||||
|
||||
register(type="gadget",
|
||||
name="Python Gadget",
|
||||
name=_("Python Gadget"),
|
||||
height=250,
|
||||
content = PythonGadget,
|
||||
title="Python Shell",
|
||||
title=_("Python Shell"),
|
||||
)
|
||||
|
||||
register(type="gadget",
|
||||
name="TODO Gadget",
|
||||
name=_("TODO Gadget"),
|
||||
height=300,
|
||||
expand=True,
|
||||
content = TODOGadget,
|
||||
title="TODO List",
|
||||
title=_("TODO List"),
|
||||
)
|
||||
|
||||
register(type="gadget",
|
||||
name="Welcome Gadget",
|
||||
name=_("Welcome Gadget"),
|
||||
height=300,
|
||||
expand=True,
|
||||
content = make_welcome_content,
|
||||
title="Welcome to GRAMPS!",
|
||||
title=_("Welcome to GRAMPS!"),
|
||||
)
|
||||
|
||||
register(type="gadget",
|
||||
name="Calendar Gadget",
|
||||
name=_("Calendar Gadget"),
|
||||
height=200,
|
||||
content = CalendarGadget,
|
||||
title="Calendar",
|
||||
title=_("Calendar"),
|
||||
)
|
||||
|
||||
register(type="gadget",
|
||||
name="News Gadget",
|
||||
name=_("News Gadget"),
|
||||
height=300,
|
||||
expand=True,
|
||||
content = NewsGadget,
|
||||
title="News",
|
||||
title=_("News"),
|
||||
)
|
||||
|
||||
|
@ -19,6 +19,7 @@ pkgdata_PYTHON = \
|
||||
Checkpoint.py\
|
||||
CountAncestors.py\
|
||||
CustomBookText.py\
|
||||
DefaultGadgets.py\
|
||||
Desbrowser.py\
|
||||
DescendChart.py\
|
||||
DescendReport.py\
|
||||
@ -50,6 +51,7 @@ pkgdata_PYTHON = \
|
||||
MarkerReport.py\
|
||||
MediaManager.py\
|
||||
NarrativeWeb.py\
|
||||
OnThisDay.py\
|
||||
OwnerEditor.py\
|
||||
PatchNames.py\
|
||||
ReadGrdb.py\
|
||||
@ -74,6 +76,7 @@ pkgdata_PYTHON = \
|
||||
rel_sv.py\
|
||||
RemoveUnused.py\
|
||||
ReorderIds.py\
|
||||
SameSurnames.py\
|
||||
siblings.py\
|
||||
SimpleBookTitle.py\
|
||||
SoundGen.py\
|
||||
|
@ -27,21 +27,39 @@ from Simple import SimpleAccess, SimpleDoc, SimpleTable
|
||||
from gettext import gettext as _
|
||||
from PluginUtils import register_quick_report
|
||||
from ReportBase import CATEGORY_QR_EVENT
|
||||
import gen.lib
|
||||
|
||||
def backlink(database, objclass, handle):
|
||||
def get_ref(db, objclass, handle):
|
||||
"""
|
||||
Looks up object in database
|
||||
"""
|
||||
if objclass == 'Person':
|
||||
ref = database.get_person_from_handle(handle)
|
||||
ref = db.get_person_from_handle(handle)
|
||||
elif objclass == 'Family':
|
||||
ref = db.get_family_from_handle(handle)
|
||||
elif objclass == 'Event':
|
||||
ref = db.get_event_from_handle(handle)
|
||||
elif objclass == 'Source':
|
||||
ref = db.get_source_from_handle(handle)
|
||||
elif objclass == 'Place':
|
||||
ref = db.get_place_from_handle(handle)
|
||||
elif objclass == 'Repository':
|
||||
ref = db.get_repository_from_handle(handle)
|
||||
else:
|
||||
ref = objclass
|
||||
return ref
|
||||
|
||||
def run(database, document, main_event):
|
||||
"""
|
||||
Loops through the families that the person is a child in, and display
|
||||
the information about the other children.
|
||||
Displays events on a specific date of an event (or date)
|
||||
|
||||
Takes an Event handle
|
||||
Takes an Event or Date object
|
||||
"""
|
||||
if isinstance(main_event, gen.lib.Date):
|
||||
main_date = main_event
|
||||
else:
|
||||
main_date = main_event.get_date_object()
|
||||
|
||||
# setup the simple access functions
|
||||
sdb = SimpleAccess(database)
|
||||
sdoc = SimpleDoc(document)
|
||||
@ -49,10 +67,9 @@ def run(database, document, main_event):
|
||||
yeartab = SimpleTable(sdb, sdoc)
|
||||
histab = SimpleTable(sdb, sdoc)
|
||||
|
||||
main_date = main_event.get_date_object()
|
||||
|
||||
# display the title
|
||||
sdoc.title(_("Events of %s") % sdb.date_string(main_date))
|
||||
sdoc.title(_("Events of %(date)s") %
|
||||
{"date": sdb.date_string(main_date)})
|
||||
sdoc.paragraph("")
|
||||
stab.columns(_("Date"), _("Type"), _("Place"), _("Reference"))
|
||||
yeartab.columns(_("Date"), _("Type"), _("Place"), _("Reference"))
|
||||
@ -67,7 +84,7 @@ def run(database, document, main_event):
|
||||
date.get_month() == main_date.get_month() and
|
||||
date.get_day() == main_date.get_day()):
|
||||
for (objclass, handle) in database.find_backlink_handles(event_handle):
|
||||
ref = backlink(database, objclass, handle)
|
||||
ref = get_ref(database, objclass, handle)
|
||||
stab.row(date,
|
||||
sdb.event_type(event),
|
||||
sdb.event_place(event), ref)
|
||||
@ -75,32 +92,46 @@ def run(database, document, main_event):
|
||||
date.get_day() == main_date.get_day() and
|
||||
date.get_month() != 0):
|
||||
for (objclass, handle) in database.find_backlink_handles(event_handle):
|
||||
ref = backlink(database, objclass, handle)
|
||||
ref = get_ref(database, objclass, handle)
|
||||
histab.row(date,
|
||||
sdb.event_type(event),
|
||||
sdb.event_place(event), ref)
|
||||
elif (date.get_year() == main_date.get_year()):
|
||||
for (objclass, handle) in database.find_backlink_handles(event_handle):
|
||||
ref = backlink(database, objclass, handle)
|
||||
ref = get_ref(database, objclass, handle)
|
||||
yeartab.row(date,
|
||||
sdb.event_type(event),
|
||||
sdb.event_place(event), ref)
|
||||
|
||||
if stab.get_row_count() > 0:
|
||||
sdoc.paragraph(_("Events on this exact date"))
|
||||
stab.write()
|
||||
|
||||
else:
|
||||
sdoc.paragraph(_("No events on this exact date"))
|
||||
sdoc.paragraph("")
|
||||
sdoc.paragraph("")
|
||||
|
||||
if histab.get_row_count() > 0:
|
||||
sdoc.paragraph(_("Other events on this day in history"))
|
||||
sdoc.paragraph(_("Other events on this month/day in history"))
|
||||
histab.write()
|
||||
|
||||
else:
|
||||
sdoc.paragraph(_("No other events on this month/day in history"))
|
||||
sdoc.paragraph("")
|
||||
sdoc.paragraph("")
|
||||
|
||||
if yeartab.get_row_count() > 0:
|
||||
sdoc.paragraph(_("Other events in %d") % main_date.get_year())
|
||||
sdoc.paragraph(_("Other events in %(year)d") %
|
||||
{"year":main_date.get_year()})
|
||||
yeartab.write()
|
||||
else:
|
||||
sdoc.paragraph(_("No other events in %(year)d") %
|
||||
{"year":main_date.get_year()})
|
||||
sdoc.paragraph("")
|
||||
sdoc.paragraph("")
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# Register the report
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register_quick_report(
|
||||
|
Loading…
Reference in New Issue
Block a user