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 8b64f038a1
commit e2330971df
27 changed files with 299 additions and 29 deletions

View File

@ -1,3 +1,20 @@
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.
2006-05-14 Alex Roitman <shura@gramps-project.org> 2006-05-14 Alex Roitman <shura@gramps-project.org>
* src/Makefile.am (gdir_PYTHON): Add new file. * src/Makefile.am (gdir_PYTHON): Add new file.
* src/SelectRepository.py: Add new file. * src/SelectRepository.py: Add new file.

View File

@ -196,6 +196,7 @@ src/Config/Makefile
src/Mime/Makefile src/Mime/Makefile
src/DisplayTabs/Makefile src/DisplayTabs/Makefile
src/ObjectSelector/Makefile src/ObjectSelector/Makefile
src/Selectors/Makefile
src/GrampsLogger/Makefile src/GrampsLogger/Makefile
src/TreeViews/Makefile src/TreeViews/Makefile
src/GrampsDb/Makefile src/GrampsDb/Makefile

View File

@ -1,3 +1,6 @@
2006-05-15 Alex Roitman <shura@gramps-project.org>
* POTFILES.in: Add new files.
2006-05-14 Alex Roitman <shura@gramps-project.org> 2006-05-14 Alex Roitman <shura@gramps-project.org>
* POTFILES.in: Add new file. * POTFILES.in: Add new file.
* gramps.pot: update. * gramps.pot: update.

View File

@ -39,12 +39,6 @@ src/QuestionDialog.py
src/RecentFiles.py src/RecentFiles.py
src/Relationship.py src/Relationship.py
src/ScratchPad.py src/ScratchPad.py
src/SelectEvent.py
src/SelectObject.py
src/SelectPerson.py
src/SelectFamily.py
src/SelectSource.py
src/SelectRepository.py
src/Sort.py src/Sort.py
src/soundex.py src/soundex.py
src/Spell.py src/Spell.py
@ -210,6 +204,16 @@ src/ObjectSelector/_PersonPreviewFrame.py
src/ObjectSelector/_PersonTreeFrame.py src/ObjectSelector/_PersonTreeFrame.py
src/ObjectSelector/_PreviewFrameBase.py src/ObjectSelector/_PreviewFrameBase.py
src/ObjectSelector/_TreeFrameBase.py src/ObjectSelector/_TreeFrameBase.py
src/Selectors/_SelectEvent.py
src/Selectors/_SelectFamily.py
src/Selectors/_SelectObject.py
src/Selectors/_SelectPerson.py
src/Selectors/_SelectPlace.py
src/Selectors/_SelectRepository.py
src/Selectors/_SelectSource.py
src/Selectors/_SelectorExceptions.py
src/Selectors/_SelectorFactory.py
src/Selectors/__init__.py
src/plugins/AncestorChart2.py src/plugins/AncestorChart2.py
src/plugins/AncestorChart.py src/plugins/AncestorChart.py
src/plugins/AncestorReport.py src/plugins/AncestorReport.py

View File

@ -712,7 +712,8 @@ class FamilyView(PageView.PersonNavView):
def select_family(self, obj, event, handle): def select_family(self, obj, event, handle):
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1: if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
from SelectFamily import SelectFamily from Selectors import selector_factory
SelectFamily = selector_factory('Family')
dialog = SelectFamily(self.dbstate, self.uistate) dialog = SelectFamily(self.dbstate, self.uistate)
family = dialog.run() family = dialog.run()

View File

@ -114,9 +114,10 @@ class EventEmbedList(EmbeddedList):
pass pass
def share_button_clicked(self, obj): def share_button_clicked(self, obj):
import SelectEvent from Selectors import selector_factory
SelectEvent = selector_factory('Event')
sel = SelectEvent.SelectEvent(self.dbstate,self.uistate,self.track, sel = SelectEvent(self.dbstate,self.uistate,self.track,
_("Select event")) _("Select event"))
event = sel.run() event = sel.run()
if event: if event:

View File

@ -217,9 +217,10 @@ class GalleryTab(ButtonTab):
Function called with the Add button is clicked. This function Function called with the Add button is clicked. This function
should be overridden by the derived class. should be overridden by the derived class.
""" """
import SelectObject from Selectors import selector_factory
SelectObject = selector_factory('MediaObject')
sel = SelectObject.SelectObject(self.dbstate,self.uistate,self.track, sel = SelectObject(self.dbstate,self.uistate,self.track,
_("Select media")) _("Select media"))
src = sel.run() src = sel.run()
if src: if src:

View File

@ -102,9 +102,10 @@ class RepoEmbedList(EmbeddedList):
pass pass
def share_button_clicked(self, obj): def share_button_clicked(self, obj):
import SelectRepository from Selectors import selector_factory
SelectRepository = selector_factory('Repository')
sel = SelectRepository.SelectRepository( sel = SelectRepository(
self.dbstate, self.dbstate,
self.uistate, self.uistate,
self.track, self.track,

View File

@ -95,9 +95,10 @@ class SourceEmbedList(EmbeddedList):
pass pass
def share_button_clicked(self, obj): def share_button_clicked(self, obj):
import SelectSource from Selectors import selector_factory
SelectSource = selector_factory('Source')
sel = SelectSource.SelectSource( sel = SelectSource(
self.dbstate, self.dbstate,
self.uistate, self.uistate,
self.track, self.track,

View File

@ -81,7 +81,8 @@ from GrampsWidgets import *
#from ObjectSelector import PersonSelector,PersonFilterSpec #from ObjectSelector import PersonSelector,PersonFilterSpec
from SelectPerson import SelectPerson from Selectors import selector_factory
SelectPerson = selector_factory('Person')
class ChildEmbedList(EmbeddedList): class ChildEmbedList(EmbeddedList):
""" """

View File

@ -217,7 +217,8 @@ class EditLdsOrd(EditSecondary):
self.top.get_widget('vbox').pack_start(notebook,True) self.top.get_widget('vbox').pack_start(notebook,True)
def select_parents_clicked(self, obj): def select_parents_clicked(self, obj):
from SelectFamily import SelectFamily from Selectors import selector_factory
SelectFamily = selector_factory('Family')
dialog = SelectFamily(self.dbstate.db, _('Select Family')) dialog = SelectFamily(self.dbstate.db, _('Select Family'))
family = dialog.run() family = dialog.run()

View File

@ -100,7 +100,8 @@ class EditPersonRef(EditSecondary):
self.top.get_widget('select').connect('clicked',self._select_person) self.top.get_widget('select').connect('clicked',self._select_person)
def _select_person(self, obj): def _select_person(self, obj):
from SelectPerson import SelectPerson from Selectors import selector_factory
SelectPerson = selector_factory('Person')
sel = SelectPerson(self.dbstate, self.uistate, "Select Person") sel = SelectPerson(self.dbstate, self.uistate, "Select Person")
person = sel.run() person = sel.run()

View File

@ -12,6 +12,7 @@ SUBDIRS = \
Mime \ Mime \
Models \ Models \
ObjectSelector \ ObjectSelector \
Selectors \
RelLib \ RelLib \
TreeViews \ TreeViews \
data \ data \
@ -62,9 +63,6 @@ gdir_PYTHON = \
RecentFiles.py\ RecentFiles.py\
Relationship.py\ Relationship.py\
ScratchPad.py\ ScratchPad.py\
SelectEvent.py\
SelectObject.py\
SelectPerson.py\
Sort.py\ Sort.py\
soundex.py\ soundex.py\
Spell.py\ Spell.py\
@ -76,9 +74,6 @@ gdir_PYTHON = \
TreeTips.py\ TreeTips.py\
Utils.py\ Utils.py\
ViewManager.py\ ViewManager.py\
SelectFamily.py\
SelectSource.py\
SelectRepository.py\
UndoHistory.py\ UndoHistory.py\
BasicUtils.py BasicUtils.py

View File

@ -2,7 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2001 David R. Hampton # Copyright (C) 2001 David R. Hampton
# Copyright (C) 2001-2005 Donald N. Allingham # Copyright (C) 2001-2006 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -965,8 +965,9 @@ class BareReportDialog:
self.window) self.window)
def on_center_person_change_clicked(self,*obj): def on_center_person_change_clicked(self,*obj):
import SelectPerson from Selectors import selector_factory
sel_person = SelectPerson.SelectPerson(self.db,_('Select Person')) SelectPerson = selector_factory('Person')
sel_person = SelectPerson(self.db,_('Select Person'))
new_person = sel_person.run() new_person = sel_person.run()
if new_person: if new_person:
self.new_person = new_person self.new_person = new_person

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

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

View File

@ -63,7 +63,8 @@ from Filters import GenericFilter, FilterList, Rules, \
import AutoComp import AutoComp
import ListModel import ListModel
import Utils import Utils
import SelectPerson from Selectors import selector_factory
SelectPerson = selector_factory('Person')
import ManagedWindow import ManagedWindow
from PluginUtils import Tool, register_tool from PluginUtils import Tool, register_tool

View File

@ -42,7 +42,8 @@ import gtk
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from PluginUtils import Report, ReportOptions, register_report from PluginUtils import Report, ReportOptions, register_report
import BaseDoc import BaseDoc
import SelectObject from Selectors import selector_factory
SelectObject = selector_factory('MediaObject')
import AddMedia import AddMedia
import ImgManip import ImgManip