2006-05-15  Alex Roitman  <shura@gramps-project.org>
	* configure.in: Generate new Makefile.
	* src/Makefile.am: adapt to new module.
	* src/Selectors: separate selectors in their own module.
	* src/Select*.py: move to Selectors.
	* src/DataViews/_FamilyView.py: Use new module.
	* src/Editors/_EditLdsOrd.py: Use new module.
	* src/Editors/_EditPersonRef.py: Use new module.
	* src/Editors/_EditFamily.py: Use new module.
	* src/DisplayTabs/_SourceEmbedList.py: Use new module.
	* src/DisplayTabs/_RepoEmbedList.py: Use new module.
	* src/DisplayTabs/_EventEmbedList.py: Use new module.
	* src/DisplayTabs/_GalleryTab.py: Use new module.
	* src/plugins/FilterEditor.py: Use new module.
	* src/plugins/SimpleBookTitle.py: Use new module.
	* src/PluginUtils/_Report.py: Use new module.

In po:
2006-05-15  Alex Roitman  <shura@gramps-project.org>
	* POTFILES.in: Add new files.



svn: r6669
This commit is contained in:
Alex Roitman
2006-05-15 15:53:42 +00:00
parent 5de297d2d6
commit e0b3dc141d
27 changed files with 299 additions and 29 deletions

30
src/Selectors/Makefile.am Normal file
View File

@@ -0,0 +1,30 @@
# This is the src/Selectors level Makefile for Gramps
# We could use GNU make's ':=' syntax for nice wildcard use,
# but that is not necessarily portable.
# If not using GNU make, then list all .py files individually
pkgdatadir = $(datadir)/@PACKAGE@/Selectors
pkgdata_PYTHON = \
__init__.py \
_SelectEvent.py \
_SelectFamily.py \
_SelectObject.py \
_SelectPerson.py \
_SelectRepository.py \
_SelectSource.py \
_SelectPlace.py \
_SelectorExceptions.py \
_SelectorFactory.py
pkgpyexecdir = @pkgpyexecdir@/Selectors
pkgpythondir = @pkgpythondir@/Selectors
# Clean up all the byte-compiled files
MOSTLYCLEANFILES = *pyc *pyo
GRAMPS_PY_MODPATH = "../"
pycheck:
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
pychecker $(pkgdata_PYTHON));

View File

@@ -0,0 +1,130 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2006 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
__author__ = "Donald N. Allingham"
__revision__ = "$Revision$"
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
import gtk
import gtk.glade
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
import const
import ListModel
import DateHandler
import ManagedWindow
#-------------------------------------------------------------------------
#
# SelectEvent
#
#-------------------------------------------------------------------------
class SelectEvent(ManagedWindow.ManagedWindow):
"""
Selects an event from the list of available events
"""
def __init__(self, dbstate, uistate, track, title):
"""
Create an Event Selector, allowing the user to select on of the
events in the event list.
"""
self.title = title
ManagedWindow.ManagedWindow.__init__(self, uistate, track, self)
self.db = dbstate.db
self.glade = gtk.glade.XML(const.gladeFile, "select_person", "gramps")
window = self.glade.get_widget('select_person')
title_label = self.glade.get_widget('title')
self.elist = self.glade.get_widget('plist')
self.set_window(window, title_label, self.title)
titles = [(_('Description'), 4, 250), (_('ID'), 1, 75),
(_('Type'), 2, 75), (_('Date'), 3, 150), ('', 4, 0) ]
self.ncols = len(titles)
self.model = ListModel.ListModel(self.elist, titles)
self.redraw()
self.show()
def build_menu_names(self,obj):
return (self.title, None)
def redraw(self):
"""
Redraws the event list
"""
self.model.clear()
self.model.new_model()
for handle in self.db.get_event_handles():
event = self.db.get_event_from_handle(handle)
desc = event.get_description()
name = str(event.get_type())
the_id = event.get_gramps_id()
date = DateHandler.get_date(event)
self.model.add([desc, the_id, name, date], handle)
self.model.connect_model()
def run(self):
"""
Runs te dialog, returning None if the event was not selected,
or the event that was selected.
"""
val = self.window.run()
if val == gtk.RESPONSE_OK:
store, node = self.model.get_selected()
if node:
data = self.model.get_data(node, range(self.ncols))
handle = data[4]
return_value = self.db.get_event_from_handle(handle)
else:
return_value = None
self.close()
return return_value
else:
self.close()
return None

View File

@@ -0,0 +1,119 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: SelectFamily.py 6183 2006-03-21 02:39:01Z dallingham $
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
import gtk
import gtk.glade
import pango
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
import const
import Utils
import DisplayModels
import ManagedWindow
#-------------------------------------------------------------------------
#
# SelectFamily
#
#-------------------------------------------------------------------------
class SelectFamily(ManagedWindow.ManagedWindow):
def __init__(self, dbstate, uistate, filter=None, skip=[]):
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self)
self.renderer = gtk.CellRendererText()
self.renderer.set_property('ellipsize',pango.ELLIPSIZE_END)
self.db = dbstate.db
self.glade = gtk.glade.XML(const.gladeFile,"select_person","gramps")
self.plist = self.glade.get_widget('plist')
self.notebook = self.glade.get_widget('notebook')
self.set_window(
self.glade.get_widget('select_person'),
self.glade.get_widget('title'),
_('Select Family'))
self.model = DisplayModels.FamilyModel(self.db)
self.add_columns(self.plist)
self.plist.set_model(self.model)
self.show()
def add_columns(self,tree):
column = gtk.TreeViewColumn(_('ID'), self.renderer, text=0)
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
column.set_fixed_width(75)
tree.append_column(column)
tree.set_fixed_height_mode(True)
column = gtk.TreeViewColumn(_('Father'), self.renderer, text=1)
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
column.set_fixed_width(200)
tree.append_column(column)
column = gtk.TreeViewColumn(_('Mother'), self.renderer, text=2)
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
column.set_fixed_width(200)
tree.append_column(column)
def select_function(self,store,path,iter,id_list):
id_list.append(self.model.get_value(iter,5))
def build_menu_names(self,obj):
return (_('Select Family'), None)
def get_selected_ids(self):
mlist = []
self.plist.get_selection().selected_foreach(self.select_function,mlist)
return mlist
def run(self):
val = self.window.run()
if val == gtk.RESPONSE_OK:
idlist = self.get_selected_ids()
self.close()
if idlist and idlist[0]:
return_value = self.db.get_family_from_handle(idlist[0])
else:
return_value = None
return return_value
else:
self.close()
return None

View File

@@ -0,0 +1,133 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2006 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
#
# Written by Alex Roitman,
# largely based on the MediaView and SelectPerson by Don Allingham
#
#-------------------------------------------------------------------------
#
# general modules
#
#-------------------------------------------------------------------------
import gc
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
import gtk
import gtk.glade
import gtk.gdk
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
import const
import ListModel
import ImgManip
import Mime
import ManagedWindow
#-------------------------------------------------------------------------
#
# SelectPerson
#
#-------------------------------------------------------------------------
class SelectObject(ManagedWindow.ManagedWindow):
def __init__(self, dbstate, uistate, track, title):
self.title = title
ManagedWindow.ManagedWindow.__init__(self, uistate, track, self)
self.db = dbstate.db
self.glade = gtk.glade.XML(const.gladeFile,"select_person","gramps")
window = self.glade.get_widget('select_person')
title_label = self.glade.get_widget('object_title')
self.object_tree = self.glade.get_widget('plist')
self.set_window(window,title_label,self.title)
titles = [
(_('Preview'),0,50,ListModel.IMAGE),
(_('Title'),1,150),
(_('ID'),2,50),
(_('Type'),3,70),
('',4,0)
]
self.ncols = len(titles)
self.object_model = ListModel.ListModel(self.object_tree,titles)
self.selection = self.object_tree.get_selection()
self.redraw()
self.show()
def build_menu_names(self,obj):
return (self.title, None)
def redraw(self):
self.object_model.clear()
self.object_model.new_model()
for key in self.db.get_media_object_handles():
obj = self.db.get_object_from_handle(key)
title = obj.get_description()
the_type = Mime.get_description(obj.get_mime_type())
pixbuf = ImgManip.get_thumb_from_obj(obj)
pixbuf = pixbuf.scale_simple(pixbuf.get_width()/2,
pixbuf.get_height()/2,
gtk.gdk.INTERP_BILINEAR)
self.object_model.add([pixbuf,title,obj.get_gramps_id(),the_type],key)
self.object_model.connect_model()
def run(self):
val = self.window.run()
if val == gtk.RESPONSE_OK:
store,node = self.object_model.get_selected()
if node:
data = self.object_model.get_data(node,range(self.ncols))
handle = data[4]
return_value = self.db.get_object_from_handle(handle)
else:
return_value = None
self.close()
gc.collect()
return return_value
else:
self.close()
gc.collect()
return None

View File

@@ -0,0 +1,119 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
import gtk
import gtk.glade
import pango
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
import const
import PeopleModel
import ManagedWindow
#-------------------------------------------------------------------------
#
# SelectPerson
#
#-------------------------------------------------------------------------
class SelectPerson(ManagedWindow.ManagedWindow):
def __init__(self, dbstate, uistate, title, filter=None, skip=[]):
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self)
self.renderer = gtk.CellRendererText()
self.renderer.set_property('ellipsize',pango.ELLIPSIZE_END)
self.db = dbstate.db
self.glade = gtk.glade.XML(const.gladeFile,"select_person","gramps")
self.plist = self.glade.get_widget('plist')
self.notebook = self.glade.get_widget('notebook')
self.set_window(
self.glade.get_widget('select_person'),
self.glade.get_widget('title'),
title)
self.model = PeopleModel.PeopleModel(self.db,
data_filter=filter,
skip=skip)
self.add_columns(self.plist)
self.plist.set_model(self.model)
self.show()
def build_menu_names(self,obj):
return (_('Select Person'), None)
def add_columns(self,tree):
tree.set_fixed_height_mode(True)
column = gtk.TreeViewColumn(_('Name'), self.renderer, text=0)
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
column.set_fixed_width(225)
tree.append_column(column)
column = gtk.TreeViewColumn(_('ID'), self.renderer, text=1)
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
column.set_fixed_width(75)
tree.append_column(column)
column = gtk.TreeViewColumn(_('Birth date'), self.renderer, text=3)
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
column.set_fixed_width(160)
tree.append_column(column)
def select_function(self,store,path,iter,id_list):
id_list.append(self.model.get_value(iter,PeopleModel.COLUMN_INT_ID))
def get_selected_ids(self):
mlist = []
self.plist.get_selection().selected_foreach(self.select_function,mlist)
return mlist
def run(self):
val = self.window.run()
if val == gtk.RESPONSE_OK:
idlist = self.get_selected_ids()
self.close()
if idlist and idlist[0]:
return_value = self.db.get_person_from_handle(idlist[0])
else:
return_value = None
return return_value
else:
self.close()
return None

View File

@@ -0,0 +1,104 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2006 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: SelectEvent.py 6155 2006-03-16 20:24:27Z rshura $
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
import gtk
import gtk.glade
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
import const
import ListModel
import ManagedWindow
#-------------------------------------------------------------------------
#
# SelectEvent
#
#-------------------------------------------------------------------------
class SelectPlace(ManagedWindow.ManagedWindow):
def __init__(self, dbstate, uistate, track, title):
self.title = title
ManagedWindow.ManagedWindow.__init__(self, uistate, track, self)
self.db = dbstate.db
self.glade = gtk.glade.XML(const.gladeFile,"select_person","gramps")
window = self.glade.get_widget('select_person')
title_label = self.glade.get_widget('title')
self.elist = self.glade.get_widget('plist')
self.set_window(window,title_label,self.title)
titles = [(_('Title'),4,350), (_('ID'),1,50), ('',0,0)]
self.ncols = len(titles)
self.model = ListModel.ListModel(self.elist,titles)
self.redraw()
self.show()
def build_menu_names(self,obj):
return (self.title, None)
def redraw(self):
self.model.clear()
self.model.new_model()
for handle in self.db.get_place_handles():
place = self.db.get_place_from_handle(handle)
desc = place.get_title()
the_id = place.get_gramps_id()
self.model.add([desc,the_id,handle])
self.model.connect_model()
def run(self):
val = self.window.run()
if val == gtk.RESPONSE_OK:
store,node = self.model.get_selected()
if node:
data = self.model.get_data(node,range(self.ncols))
handle = data[2]
return_value = self.db.get_place_from_handle(handle)
else:
return_value = None
self.close()
return return_value
else:
self.close()
return None

View File

@@ -0,0 +1,104 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2006 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: SelectEvent.py 6155 2006-03-16 20:24:27Z rshura $
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
import gtk
import gtk.glade
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
import const
import ListModel
import ManagedWindow
#-------------------------------------------------------------------------
#
# SelectRepository
#
#-------------------------------------------------------------------------
class SelectRepository(ManagedWindow.ManagedWindow):
def __init__(self, dbstate, uistate, track, title):
self.title = title
ManagedWindow.ManagedWindow.__init__(self, uistate, track, self)
self.db = dbstate.db
self.glade = gtk.glade.XML(const.gladeFile,"select_person","gramps")
window = self.glade.get_widget('select_person')
title_label = self.glade.get_widget('title')
self.elist = self.glade.get_widget('plist')
self.set_window(window,title_label,self.title)
titles = [(_('Title'),4,350), (_('ID'),1,50), ('',0,0)]
self.ncols = len(titles)
self.model = ListModel.ListModel(self.elist,titles)
self.redraw()
self.show()
def build_menu_names(self,obj):
return (self.title, None)
def redraw(self):
self.model.clear()
self.model.new_model()
for handle in self.db.get_repository_handles():
repository = self.db.get_repository_from_handle(handle)
desc = repository.get_name()
the_id = repository.get_gramps_id()
self.model.add([desc,the_id,handle])
self.model.connect_model()
def run(self):
val = self.window.run()
if val == gtk.RESPONSE_OK:
store,node = self.model.get_selected()
if node:
data = self.model.get_data(node,range(self.ncols))
handle = data[2]
return_value = self.db.get_repository_from_handle(handle)
else:
return_value = None
self.close()
return return_value
else:
self.close()
return None

View File

@@ -0,0 +1,104 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2006 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: SelectEvent.py 6155 2006-03-16 20:24:27Z rshura $
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
import gtk
import gtk.glade
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
import const
import ListModel
import ManagedWindow
#-------------------------------------------------------------------------
#
# SelectEvent
#
#-------------------------------------------------------------------------
class SelectSource(ManagedWindow.ManagedWindow):
def __init__(self, dbstate, uistate, track, title):
self.title = title
ManagedWindow.ManagedWindow.__init__(self, uistate, track, self)
self.db = dbstate.db
self.glade = gtk.glade.XML(const.gladeFile,"select_person","gramps")
window = self.glade.get_widget('select_person')
title_label = self.glade.get_widget('title')
self.elist = self.glade.get_widget('plist')
self.set_window(window,title_label,self.title)
titles = [(_('Title'),4,350), (_('ID'),1,50), ('',0,0)]
self.ncols = len(titles)
self.model = ListModel.ListModel(self.elist,titles)
self.redraw()
self.show()
def build_menu_names(self,obj):
return (self.title, None)
def redraw(self):
self.model.clear()
self.model.new_model()
for handle in self.db.get_source_handles():
source = self.db.get_source_from_handle(handle)
desc = source.get_title()
the_id = source.get_gramps_id()
self.model.add([desc,the_id,handle])
self.model.connect_model()
def run(self):
val = self.window.run()
if val == gtk.RESPONSE_OK:
store,node = self.model.get_selected()
if node:
data = self.model.get_data(node,range(self.ncols))
handle = data[2]
return_value = self.db.get_source_from_handle(handle)
else:
return_value = None
self.close()
return return_value
else:
self.close()
return None

View File

@@ -0,0 +1,29 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: __init__.py 6392 2006-04-21 18:15:23Z dallingham $
class SelectorException(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)

View File

@@ -0,0 +1,52 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: __init__.py 6392 2006-04-21 18:15:23Z dallingham $
from _SelectorExceptions import SelectorException
def selector_factory(classname):
if classname == 'Person':
from _SelectPerson import SelectPerson
cls = SelectPerson
elif classname == 'Family':
from _SelectFamily import SelectFamily
cls = SelectFamily
elif classname == 'Event':
from _SelectEvent import SelectEvent
cls = SelectEvent
elif classname == 'Place':
from _SelectPlace import SelectPlace
cls = SelectPlace
elif classname == 'Source':
from _SelectSource import SelectSource
cls = SelectSource
elif classname == 'MediaObject':
from _SelectObject import SelectObject
cls = SelectObject
elif classname == 'Repository':
from _SelectRepository import SelectRepository
cls = SelectRepository
else:
raise SelectorException("Attempt to create unknown "
"selector class: "
"classname = %s" % (str(classname),))
return cls

24
src/Selectors/__init__.py Normal file
View File

@@ -0,0 +1,24 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: __init__.py 6392 2006-04-21 18:15:23Z dallingham $
from _SelectorFactory import selector_factory