2008-01-30 Raphael Ackermann <raphael.ackermann@gmail.com>

* src/FilterEditor/_EditFilter.py: self.space --> self.namespace
	* src/FilterEditor/_FilterEditor.py: self.space --> self.namespace
	* src/FilterEditor/_EditRule.py: self.space --> self.namespace
	* src/FilterEditor/_ShowResults.py: self.space --> self.namespace
	* src/plugins/ExportVCalendar.py: pylint fixes
	* src/PluginUtils/_Tool.py: pylint fixes
	* src/Filters/_FilterParser.py: cleanup
	* src/Filters/_GenericFilter.py: doc fix
	* src/Filters/Rules/Person/_Everyone.py
	* src/ManagedWindow.py: doc fix

svn: r9963
This commit is contained in:
Raphael Ackermann 2008-01-30 09:03:20 +00:00
parent 6dbc6c3348
commit fc1554acaa
11 changed files with 159 additions and 152 deletions

View File

@ -1,3 +1,15 @@
2008-01-30 Raphael Ackermann <raphael.ackermann@gmail.com>
* src/FilterEditor/_EditFilter.py: self.space --> self.namespace
* src/FilterEditor/_FilterEditor.py: self.space --> self.namespace
* src/FilterEditor/_EditRule.py: self.space --> self.namespace
* src/FilterEditor/_ShowResults.py: self.space --> self.namespace
* src/plugins/ExportVCalendar.py: pylint fixes
* src/PluginUtils/_Tool.py: pylint fixes
* src/Filters/_FilterParser.py: cleanup
* src/Filters/_GenericFilter.py: doc fix
* src/Filters/Rules/Person/_Everyone.py
* src/ManagedWindow.py: doc fix
2008-01-29 Brian Matherly <brian@gramps-project.org>
* src/PluginUtils/_GuiOptions.py: Default GuiOptions to use active person.
@ -11,13 +23,13 @@
* src/PluginUtils/_PluginMgr.py: pylint and doc fixes
2008-01-29 Peter Landgren <peter.talken@telia.com>
* src/plugins/ExportVCalendar.py:
* src/plugins/ExportVCard.py:
Encoding according to sys.getfilesystemencoding() in stead of hardcoded
iso-8859-1
* src/plugins/ExportVCalendar.py:
* src/plugins/ExportVCard.py:
Encoding according to sys.getfilesystemencoding() in stead of hardcoded
iso-8859-1
2008-01-29 Raphael Ackermann <raphael.ackermann@gmail.com>
* src/plugins/EventNames.py: doc fixes and removal of self.label
* src/plugins/EventNames.py: doc fixes and removal of self.label
2008-01-29 Gary Burton <gary.burton@zen.co.uk>
* src/plugins/TimeLine.py:
@ -25,44 +37,44 @@
death events are available.
2008-01-29 Peter Landgren <peter.talken@telia.com>
* src/plugins/ChangeNames.py: Improved capitalization rules for names with
one prefix and multiple surnames with or without hyphen(s)
* src/plugins/ChangeNames.py: Improved capitalization rules for names with
one prefix and multiple surnames with or without hyphen(s)
2008-01-28 Duncan Lithgow <dlithgow@gmail.com>
Raphael Ackermann <raphael.ackermann@gmail.com>
* src/plugins/Summary.py
* src/plugins/WebCal.py
* src/plugins/KinshipReport.py
* src/plugins/DescendReport.py
* src/plugins/DetDescendantReport.py
* src/plugins/ExtractCity.py
* src/plugins/EventNames.py
* src/plugins/DumpGenderStats.py
* src/plugins/Desbrowser.py
* src/plugins/Checkpoint.py
* src/plugins/OwnerEditor.py
* src/plugins/ChangeNames.py
* src/plugins/AncestorReport.py
* src/plugins/MarkerReport.py
* src/plugins/DateParserDisplayTest.py
* src/plugins/FindDupes.py
* src/plugins/SoundGen.py
* src/plugins/TestcaseGenerator.py
* src/plugins/Rebuild.py
* src/plugins/DescendChart.py
* src/plugins/EndOfLineReport.py
* src/plugins/AncestorChart.py
* src/plugins/DetAncestralReport.py
* src/plugins/CountAncestors.py
* src/plugins/Check.py
* src/plugins/EventCmp.py
* src/plugins/FamilyGroup.py
* src/plugins/RelCalc.py
* src/plugins/MediaManager.py
* src/plugins/ChangeTypes.py
* src/plugins/StatisticsChart.py
* src/plugins/FamilyLines.py
* src/plugins/PatchNames.py
* src/plugins/Summary.py
* src/plugins/WebCal.py
* src/plugins/KinshipReport.py
* src/plugins/DescendReport.py
* src/plugins/DetDescendantReport.py
* src/plugins/ExtractCity.py
* src/plugins/EventNames.py
* src/plugins/DumpGenderStats.py
* src/plugins/Desbrowser.py
* src/plugins/Checkpoint.py
* src/plugins/OwnerEditor.py
* src/plugins/ChangeNames.py
* src/plugins/AncestorReport.py
* src/plugins/MarkerReport.py
* src/plugins/DateParserDisplayTest.py
* src/plugins/FindDupes.py
* src/plugins/SoundGen.py
* src/plugins/TestcaseGenerator.py
* src/plugins/Rebuild.py
* src/plugins/DescendChart.py
* src/plugins/EndOfLineReport.py
* src/plugins/AncestorChart.py
* src/plugins/DetAncestralReport.py
* src/plugins/CountAncestors.py
* src/plugins/Check.py
* src/plugins/EventCmp.py
* src/plugins/FamilyGroup.py
* src/plugins/RelCalc.py
* src/plugins/MediaManager.py
* src/plugins/ChangeTypes.py
* src/plugins/StatisticsChart.py
* src/plugins/FamilyLines.py
* src/plugins/PatchNames.py
2008-01-28 Duncan Lithgow <dlithgow@gmail.com>
* various: add capitalization fixes according to HIG (plus ellipsis ...)
@ -138,7 +150,7 @@
* src/DataViews.py: rename Family List View to Families View
2008-01-24 Peter landgren <peter.talken@telia.com>
* src/plugin/rel_sv.py: Works also for kinship report now.
* src/plugin/rel_sv.py: Works also for kinship report now.
2008-01-24 Brian Matherly <brian@gramps-project.org>
* src/ReportBase/_CommandLineReport.py:

View File

@ -57,12 +57,12 @@ import Errors
#-------------------------------------------------------------------------
class EditFilter(ManagedWindow.ManagedWindow):
def __init__(self, space, dbstate, uistate, track, gfilter,
def __init__(self, namespace, dbstate, uistate, track, gfilter,
filterdb, update):
ManagedWindow.ManagedWindow.__init__(self, uistate, track, self)
self.space = space
self.namespace = namespace
self.update = update
self.dbstate = dbstate
self.db = dbstate.db
@ -128,7 +128,7 @@ class EditFilter(ManagedWindow.ManagedWindow):
# Make sure that the name is not empty
# and not in the list of existing filters (excluding this one)
names = [filt.get_name()
for filt in self.filterdb.get_filters(self.space)
for filt in self.filterdb.get_filters(self.namespace)
if filt != self.filter]
self.ok_btn.set_sensitive((len(name) != 0) and (name not in names))
@ -152,12 +152,12 @@ class EditFilter(ManagedWindow.ManagedWindow):
return
if n != self.filter.get_name():
self.uistate.emit('filter-name-changed',
(self.space,unicode(self.filter.get_name()),n))
(self.namespace,unicode(self.filter.get_name()),n))
self.filter.set_name(n)
self.filter.set_comment(unicode(self.comment.get_text()).strip())
for f in self.filterdb.get_filters(self.space)[:]:
for f in self.filterdb.get_filters(self.namespace)[:]:
if n == f.get_name():
self.filterdb.get_filters(self.space).remove(f)
self.filterdb.get_filters(self.namespace).remove(f)
break
val = self.logical.get_active()
if val == 1:
@ -168,7 +168,7 @@ class EditFilter(ManagedWindow.ManagedWindow):
op = 'and'
self.filter.set_logical_op(op)
self.filter.set_invert(self.logical_not.get_active())
self.filterdb.add(self.space,self.filter)
self.filterdb.add(self.namespace,self.filter)
self.update()
self.close()
@ -176,7 +176,7 @@ class EditFilter(ManagedWindow.ManagedWindow):
from _EditRule import EditRule
try:
EditRule(self.space, self.dbstate, self.uistate, self.track,
EditRule(self.namespace, self.dbstate, self.uistate, self.track,
self.filterdb, None, _('Add Rule'), self.update_rule,
self.filter.get_name())
except Errors.WindowActiveError:
@ -190,7 +190,7 @@ class EditFilter(ManagedWindow.ManagedWindow):
d = self.rlist.get_object(node)
try:
EditRule(self.space, self.dbstate, self.uistate, self.track,
EditRule(self.namespace, self.dbstate, self.uistate, self.track,
self.filterdb, d, _('Edit Rule'), self.update_rule,
self.filter.get_name())
except Errors.WindowActiveError:

View File

@ -384,12 +384,12 @@ class MyEntry(gtk.Entry):
#
#-------------------------------------------------------------------------
class EditRule(ManagedWindow.ManagedWindow):
def __init__(self, space, dbstate, uistate, track, filterdb, val,
def __init__(self, namespace, dbstate, uistate, track, filterdb, val,
label, update, filter_name):
ManagedWindow.ManagedWindow.__init__(self, uistate, track, EditRule)
self.space = space
self.namespace = namespace
self.dbstate = dbstate
self.db = dbstate.db
self.filterdb = filterdb
@ -416,21 +416,21 @@ class EditRule(ManagedWindow.ManagedWindow):
self.class2page = {}
the_map = {}
if self.space == "Person":
if self.namespace == 'Person':
class_list = Rules.Person.editor_rule_list
elif self.space == "Family":
elif self.namespace == 'Family':
class_list = Rules.Family.editor_rule_list
elif self.space == "Event":
elif self.namespace == 'Event':
class_list = Rules.Event.editor_rule_list
elif self.space == 'Source':
elif self.namespace == 'Source':
class_list = Rules.Source.editor_rule_list
elif self.space == 'Place':
elif self.namespace == 'Place':
class_list = Rules.Place.editor_rule_list
elif self.space == 'MediaObject':
elif self.namespace == 'MediaObject':
class_list = Rules.MediaObject.editor_rule_list
elif self.space == 'Repository':
elif self.namespace == 'Repository':
class_list = Rules.Repository.editor_rule_list
elif self.space == 'Note':
elif self.namespace == 'Note':
class_list = Rules.Note.editor_rule_list
for class_obj in class_list:
@ -468,11 +468,11 @@ class EditRule(ManagedWindow.ManagedWindow):
elif v == _('Number of generations:'):
t = MyInteger(1,32)
elif v == _('ID:'):
t = MyID(self.dbstate,self.uistate,self.track,self.space)
t = MyID(self.dbstate,self.uistate,self.track,self.namespace)
elif v == _('Source ID:'):
t = MySource(self.db)
elif v == _('Filter name:'):
t = MyFilters(self.filterdb.get_filters(self.space),
t = MyFilters(self.filterdb.get_filters(self.namespace),
self.filter_name)
# filters of another namespace, name may be same as caller!
elif v == _('Person filter name:'):

View File

@ -52,8 +52,8 @@ import GrampsDisplay
#
#-------------------------------------------------------------------------
import const
from Filters import GenericFilterFactory, FilterList, \
reload_custom_filters, reload_system_filters
from Filters import (GenericFilterFactory, FilterList, reload_custom_filters,
reload_system_filters)
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
import ListModel
import ManagedWindow
@ -65,15 +65,14 @@ from QuestionDialog import QuestionDialog
#
#-------------------------------------------------------------------------
class FilterEditor(ManagedWindow.ManagedWindow):
def __init__(self, space, filterdb, dbstate, uistate):
def __init__(self, namespace, filterdb, dbstate, uistate):
ManagedWindow.ManagedWindow.__init__(self, uistate, [],
FilterEditor)
ManagedWindow.ManagedWindow.__init__(self, uistate, [], FilterEditor)
self.dbstate = dbstate
self.db = dbstate.db
self.filterdb = FilterList(filterdb)
self.filterdb.load()
self.space = space
self.namespace = namespace
self.define_glade('filter_list', const.RULE_GLADE)
self.filter_list = self.get_widget('filters')
@ -89,7 +88,7 @@ class FilterEditor(ManagedWindow.ManagedWindow):
self.set_window(self.get_widget('filter_list'),
self.get_widget('title'),
_('%s filters') % _(self.space))
_('%s filters') % _(self.namespace))
self.edit.connect('clicked', self.edit_filter)
self.clone.connect('clicked', self.clone_filter)
@ -134,19 +133,19 @@ class FilterEditor(ManagedWindow.ManagedWindow):
self.filterdb.save()
reload_custom_filters()
reload_system_filters()
self.uistate.emit('filters-changed',(self.space,))
self.uistate.emit('filters-changed',(self.namespace,))
ManagedWindow.ManagedWindow.close(self,*obj)
def draw_filters(self):
self.clist.clear()
for f in self.filterdb.get_filters(self.space):
for f in self.filterdb.get_filters(self.namespace):
self.clist.add([f.get_name(),f.get_comment()],f)
def add_new_filter(self,obj):
from _EditFilter import EditFilter
the_filter = GenericFilterFactory(self.space)()
EditFilter(self.space, self.dbstate, self.uistate, self.track,
the_filter = GenericFilterFactory(self.namespace)()
EditFilter(self.namespace, self.dbstate, self.uistate, self.track,
the_filter, self.filterdb, self.draw_filters)
def edit_filter(self,obj):
@ -155,7 +154,7 @@ class FilterEditor(ManagedWindow.ManagedWindow):
from _EditFilter import EditFilter
gfilter = self.clist.get_object(node)
EditFilter(self.space, self.dbstate, self.uistate, self.track,
EditFilter(self.namespace, self.dbstate, self.uistate, self.track,
gfilter, self.filterdb, self.draw_filters)
def clone_filter(self,obj):
@ -164,9 +163,9 @@ class FilterEditor(ManagedWindow.ManagedWindow):
from _EditFilter import EditFilter
old_filter = self.clist.get_object(node)
the_filter = GenericFilterFactory(self.space)(old_filter)
the_filter = GenericFilterFactory(self.namespace)(old_filter)
the_filter.set_name('')
EditFilter(self.space, self.dbstate, self.uistate, self.track,
EditFilter(self.namespace, self.dbstate, self.uistate, self.track,
the_filter, self.filterdb, self.draw_filters)
def test_clicked(self,obj):
@ -177,14 +176,14 @@ class FilterEditor(ManagedWindow.ManagedWindow):
filt = self.clist.get_object(node)
handle_list = filt.apply(self.db,self.get_all_handles())
ShowResults(self.db, self.uistate, self.track, handle_list,
filt.get_name(),self.space)
filt.get_name(),self.namespace)
def delete_filter(self,obj):
store,node = self.clist.get_selected()
if node:
gfilter = self.clist.get_object(node)
name = gfilter.get_name()
if self.check_recursive_filters(self.space,name):
if self.check_recursive_filters(self.namespace,name):
QuestionDialog( _('Delete Filter?'),
_('This filter is currently being used '
'as the base for other filters. Deleting'
@ -200,7 +199,7 @@ class FilterEditor(ManagedWindow.ManagedWindow):
store,node = self.clist.get_selected()
if node:
gfilter = self.clist.get_object(node)
self._do_delete_filter(self.space,gfilter)
self._do_delete_filter(self.namespace,gfilter)
self.draw_filters()
def _do_delete_filter(self,space,gfilter):
@ -234,21 +233,21 @@ class FilterEditor(ManagedWindow.ManagedWindow):
filter_set.add(gfilter)
def get_all_handles(self):
if self.space == 'Person':
if self.namespace == 'Person':
return self.db.get_person_handles(sort_handles=False)
elif self.space == 'Family':
elif self.namespace == 'Family':
return self.db.get_family_handles()
elif self.space == 'Event':
elif self.namespace == 'Event':
return self.db.get_event_handles()
elif self.space == 'Source':
elif self.namespace == 'Source':
return self.db.get_source_handles()
elif self.space == 'Place':
elif self.namespace == 'Place':
return self.db.get_place_handles()
elif self.space == 'MediaObject':
elif self.namespace == 'MediaObject':
return self.db.get_media_object_handles()
elif self.space == 'Repository':
elif self.namespace == 'Repository':
return self.db.get_repository_handles()
elif self.space == 'Note':
elif self.namespace == 'Note':
return self.db.get_note_handles()
def clean_after_rename(self,space,old_name,new_name):

View File

@ -64,13 +64,13 @@ import Utils
#
#-------------------------------------------------------------------------
class ShowResults(ManagedWindow.ManagedWindow):
def __init__(self, db, uistate, track, handle_list, filtname, space):
def __init__(self, db, uistate, track, handle_list, filtname, namespace):
ManagedWindow.ManagedWindow.__init__(self, uistate, track, self)
self.db = db
self.filtname = filtname
self.space = space
self.namespace = namespace
self.define_glade('test', const.RULE_GLADE,)
self.set_window(
self.get_widget('test'),
@ -102,35 +102,35 @@ class ShowResults(ManagedWindow.ManagedWindow):
self.show()
def get_name_id(self, handle):
if self.space == 'Person':
if self.namespace == 'Person':
person = self.db.get_person_from_handle(handle)
name = _nd.sorted(person)
gid = person.get_gramps_id()
elif self.space == 'Family':
elif self.namespace == 'Family':
family = self.db.get_family_from_handle(handle)
name = Utils.family_name(family, self.db)
gid = family.get_gramps_id()
elif self.space == 'Event':
elif self.namespace == 'Event':
event = self.db.get_event_from_handle(handle)
name = event.get_description()
gid = event.get_gramps_id()
elif self.space == 'Source':
elif self.namespace == 'Source':
source = self.db.get_source_from_handle(handle)
name = source.get_title()
gid = source.get_gramps_id()
elif self.space == 'Place':
elif self.namespace == 'Place':
place = self.db.get_place_from_handle(handle)
name = place.get_title()
gid = place.get_gramps_id()
elif self.space == 'MediaObject':
elif self.namespace == 'MediaObject':
obj = self.db.get_object_from_handle(handle)
name = obj.get_description()
gid = obj.get_gramps_id()
elif self.space == 'Repository':
elif self.namespace == 'Repository':
repo = self.db.get_repository_from_handle(handle)
name = repo.get_name()
gid = repo.get_gramps_id()
elif self.space == 'Note':
elif self.namespace == 'Note':
note = self.db.get_note_from_handle(handle)
name = note.get().replace('\n', ' ')
if len(name) > 80:
@ -139,29 +139,29 @@ class ShowResults(ManagedWindow.ManagedWindow):
return (name, gid)
def sort_val_from_handle(self, handle):
if self.space == 'Person':
if self.namespace == 'Person':
name = self.db.get_person_from_handle(handle).get_primary_name()
sortname = locale.strxfrm(_nd.sort_string(name))
elif self.space == 'Family':
elif self.namespace == 'Family':
name = Utils.family_name(
self.db.get_family_from_handle(handle),self.db)
sortname = locale.strxfrm(name)
elif self.space == 'Event':
elif self.namespace == 'Event':
name = self.db.get_event_from_handle(handle).get_description()
sortname = locale.strxfrm(name)
elif self.space == 'Source':
elif self.namespace == 'Source':
name = self.db.get_source_from_handle(handle).get_title()
sortname = locale.strxfrm(name)
elif self.space == 'Place':
elif self.namespace == 'Place':
name = self.db.get_place_from_handle(handle).get_title()
sortname = locale.strxfrm(name)
elif self.space == 'MediaObject':
elif self.namespace == 'MediaObject':
name = self.db.get_object_from_handle(handle).get_description()
sortname = locale.strxfrm(name)
elif self.space == 'Repository':
elif self.namespace == 'Repository':
name = self.db.get_repository_from_handle(handle).get_name()
sortname = locale.strxfrm(name)
elif self.space == 'Note':
elif self.namespace == 'Note':
gid = self.db.get_note_from_handle(handle).get_gramps_id()
sortname = locale.strxfrm(gid)
return (sortname, handle)

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_Everyone.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -40,7 +40,7 @@ from Filters.Rules._Rule import Rule
#
#-------------------------------------------------------------------------
class Everyone(Rule):
"""Matches Everyone"""
"""Match Everyone."""
name = _('Everyone')
category = _('General filters')

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_FilterParser.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -50,7 +50,7 @@ class FilterParser(handler.ContentHandler):
self.r = None
self.a = []
self.cname = None
self.namespace = "Person"
self.namespace = 'Person'
def setDocumentLocator(self, locator):
self.locator = locator

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_GenericFilter.py 9912 2008-01-22 09:17:46Z acraphae $
"""
Package providing filtering framework for GRAMPS.
@ -31,7 +31,7 @@ import gen.lib
#
#-------------------------------------------------------------------------
class GenericFilter:
"""Filter class that consists of several rules"""
"""Filter class that consists of several rules."""
logical_functions = ['or', 'and', 'xor', 'one']

View File

@ -362,7 +362,7 @@ class ManagedWindow:
self.parent_window = self.uistate.window
def set_window(self, window, title, text, msg=None, isWindow=False):
'''
"""
Set the window that is managed.
@param window if isWindow=False window must be a gtk.Window() object, otherwise None
@ -376,7 +376,7 @@ class ManagedWindow:
and after this method self.window stores it.
}
'''
"""
self.isWindow = isWindow
if self.isWindow :
set_titles(self, title, text, msg)

View File

@ -168,14 +168,9 @@ class CommandLineTool:
self.parse_option_str()
self.show_options()
def init_options(self,noopt):
self.options_dict = {
'id' : ''
}
self.options_help = {
'id' : ["=ID","Gramps ID of a central person."],
}
def init_options(self, noopt):
self.options_dict = {'id' : ''}
self.options_help = {'id' : ["=ID","Gramps ID of a central person."], }
if noopt:
return

View File

@ -37,8 +37,8 @@ from gettext import gettext as _
# GNOME/GTK modules
#
#-------------------------------------------------------------------------
from gtk import glade
import gtk
import gtk.glade
#------------------------------------------------------------------------
#
@ -75,22 +75,21 @@ class CalendarWriterOptionBox:
def __init__(self, person):
self.person = person
def get_option_box(self):
glade_file = "%s/vcalendarexport.glade" % os.path.dirname(__file__)
if not os.path.isfile(glade_file):
glade_file = "plugins/vcalendarexport.glade"
self.topDialog = gtk.glade.XML(glade_file, "calendarExport", "gramps")
filter_obj = self.topDialog.get_widget("filter")
self.topDialog = glade.XML(glade_file, "calendarExport", "gramps")
self.copy = 0
self.filter_menu = gtk.Menu()
def get_option_box(self):
filter_obj = self.topDialog.get_widget("filter")
all = GenericFilter()
all.set_name(_("Entire Database"))
all.add_rule(Rules.Person.Everyone([]))
everyone_filter = GenericFilter()
everyone_filter.set_name(_("Entire Database"))
everyone_filter.add_rule(Rules.Person.Everyone([]))
the_filters = [all]
the_filters = [everyone_filter]
if self.person:
des = GenericFilter()
@ -111,7 +110,7 @@ class CalendarWriterOptionBox:
com.add_rule(Rules.Person.HasCommonAncestorWith(
[self.person.get_gramps_id()]))
the_filters += [all, des, ans, com]
the_filters += [everyone_filter, des, ans, com]
from Filters import CustomFilters
the_filters.extend(CustomFilters.get_filters('Person'))
@ -145,6 +144,9 @@ class CalendarWriter:
self.plist = {}
self.flist = {}
self.count = 0
self.oldval = 0
self.persons_details_done = []
self.persons_notes_done = []
self.person_ids = {}
@ -177,7 +179,7 @@ class CalendarWriter:
def update_real(self):
self.count += 1
newval = int(100*self.count/self.total)
newval = int(100 * self.count / self.total)
if newval != self.oldval:
self.callback(newval)
self.oldval = newval
@ -210,12 +212,10 @@ class CalendarWriter:
ErrorDialog(_("Could not create %s") % filename)
return False
self.writeln("BEGIN:VCALENDAR");
self.writeln("PRODID:-//GNU//Gramps//EN");
self.writeln("VERSION:1.0");
self.writeln("BEGIN:VCALENDAR")
self.writeln("PRODID:-//GNU//Gramps//EN")
self.writeln("VERSION:1.0")
self.count = 0
self.oldval = 0
self.total = len(self.plist) + len(self.flist)
for key in self.plist:
self.write_person(key)
@ -225,8 +225,8 @@ class CalendarWriter:
self.write_family(key)
self.update()
self.writeln("");
self.writeln("END:VCALENDAR");
self.writeln("")
self.writeln("END:VCALENDAR")
self.g.close()
return True
@ -260,7 +260,8 @@ class CalendarWriter:
place = self.db.get_place_from_handle(place_handle)
self.write_vevent(_("Birth of %s") % person.get_primary_name().get_name(), b_date, place.get_title())
else:
self.write_vevent(_("Birth of %s") % person.get_primary_name().get_name(), b_date)
self.write_vevent(_("Birth of %s")
% person.get_primary_name().get_name(), b_date)
death_ref = person.get_death_ref()
if death_ref:
@ -318,23 +319,23 @@ class CalendarWriter:
def write_vevent(self, event_text, date, location=""):
date_string = self.format_date(date)
if date_string is not "":
self.writeln("");
self.writeln("BEGIN:VEVENT");
self.writeln("SUMMARY:%s" % event_text);
self.writeln("")
self.writeln("BEGIN:VEVENT")
self.writeln("SUMMARY:%s" % event_text)
if location:
self.writeln("LOCATION:%s" % location);
self.writeln("LOCATION:%s" % location)
self.writeln(date_string)
self.writeln("END:VEVENT");
self.writeln("END:VEVENT")
date_string = self.format_date(date, 1)
self.writeln("");
self.writeln("BEGIN:VEVENT");
self.writeln("SUMMARY:"+_("Anniversary: %s") % event_text);
self.writeln("")
self.writeln("BEGIN:VEVENT")
self.writeln("SUMMARY:"+_("Anniversary: %s") % event_text)
if location:
self.writeln("LOCATION:%s" % location);
self.writeln("LOCATION:%s" % location)
self.writeln("RRULE:YD1 #0")
self.writeln(date_string)
self.writeln("END:VEVENT");
self.writeln("END:VEVENT")
#-------------------------------------------------------------------------
#