In .:
* src/Makefile.am (gdir_PYTHON): Add new file. * src/SelectRepository.py: Add new file. * src/DisplayTabs/_RepoEmbedList.py: Add share button. In po: * POTFILES.in: Add new file. svn: r6668
This commit is contained in:
parent
04ac1ec3e3
commit
5de297d2d6
@ -1,4 +1,8 @@
|
||||
2006-05-14 Alex Roitman <shura@gramps-project.org>
|
||||
* src/Makefile.am (gdir_PYTHON): Add new file.
|
||||
* src/SelectRepository.py: Add new file.
|
||||
* src/DisplayTabs/_RepoEmbedList.py: Add share button.
|
||||
|
||||
* configure.in: Set up for 2.1.3.
|
||||
* src/GrampsDb/_ReadXML.py (start_url): Parse URL type.
|
||||
* example/gramps/exapmle.gramps: Add repositories, use new XML.
|
||||
|
@ -1,4 +1,5 @@
|
||||
2006-05-14 Alex Roitman <shura@gramps-project.org>
|
||||
* POTFILES.in: Add new file.
|
||||
* gramps.pot: update.
|
||||
|
||||
2006-05-12 Alex Roitman <shura@gramps-project.org>
|
||||
|
@ -44,6 +44,7 @@ src/SelectObject.py
|
||||
src/SelectPerson.py
|
||||
src/SelectFamily.py
|
||||
src/SelectSource.py
|
||||
src/SelectRepository.py
|
||||
src/Sort.py
|
||||
src/soundex.py
|
||||
src/Spell.py
|
||||
|
@ -49,6 +49,13 @@ class RepoEmbedList(EmbeddedList):
|
||||
_DND_TYPE = DdTargets.REPOREF
|
||||
_DND_EXTRA = DdTargets.REPO_LINK
|
||||
|
||||
_MSG = {
|
||||
'add' : _('Create and add a new repository'),
|
||||
'del' : _('Remove the existing repository'),
|
||||
'edit' : _('Edit the selected repository'),
|
||||
'share' : _('Add an existing repository'),
|
||||
}
|
||||
|
||||
_column_names = [
|
||||
(_('ID'), 0, 75),
|
||||
(_('Title'), 1, 200),
|
||||
@ -59,7 +66,7 @@ class RepoEmbedList(EmbeddedList):
|
||||
def __init__(self, dbstate, uistate, track, obj):
|
||||
self.obj = obj
|
||||
EmbeddedList.__init__(self, dbstate, uistate, track,
|
||||
_('Repositories'), RepoRefModel)
|
||||
_('Repositories'), RepoRefModel, True)
|
||||
|
||||
def get_icon_name(self):
|
||||
return 'gramps-repository'
|
||||
@ -94,6 +101,31 @@ class RepoEmbedList(EmbeddedList):
|
||||
except Errors.WindowActiveError:
|
||||
pass
|
||||
|
||||
def share_button_clicked(self, obj):
|
||||
import SelectRepository
|
||||
|
||||
sel = SelectRepository.SelectRepository(
|
||||
self.dbstate,
|
||||
self.uistate,
|
||||
self.track,
|
||||
_("Select repository"))
|
||||
|
||||
repo = sel.run()
|
||||
if repo:
|
||||
try:
|
||||
from Editors import EditRepoRef
|
||||
|
||||
ref = RelLib.RepoRef()
|
||||
EditRepoRef(self.dbstate,
|
||||
self.uistate,
|
||||
self.track,
|
||||
repo,
|
||||
ref,
|
||||
self.add_callback)
|
||||
|
||||
except Errors.WindowActiveError:
|
||||
pass
|
||||
|
||||
def add_callback(self, value):
|
||||
value[0].ref = value[1].handle
|
||||
self.get_data().append(value[0])
|
||||
|
@ -78,6 +78,7 @@ gdir_PYTHON = \
|
||||
ViewManager.py\
|
||||
SelectFamily.py\
|
||||
SelectSource.py\
|
||||
SelectRepository.py\
|
||||
UndoHistory.py\
|
||||
BasicUtils.py
|
||||
|
||||
|
104
src/SelectRepository.py
Normal file
104
src/SelectRepository.py
Normal 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
|
Loading…
Reference in New Issue
Block a user