2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2005-02-16 19:19:32 +05:30
|
|
|
# Copyright (C) 2000-2005 Donald N. Allingham
|
2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
2003-11-13 00:15:07 +05:30
|
|
|
# $Id$
|
|
|
|
|
2005-02-16 19:19:32 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
from gettext import gettext as _
|
2005-12-07 01:24:16 +05:30
|
|
|
import gc
|
2005-02-16 19:19:32 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GTK/Gnome modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2005-05-25 10:39:11 +05:30
|
|
|
import gobject
|
2002-10-20 19:55:16 +05:30
|
|
|
import gtk.glade
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import const
|
|
|
|
import Utils
|
|
|
|
import ImageSelect
|
2003-02-24 10:21:57 +05:30
|
|
|
import ListModel
|
2004-08-30 09:20:33 +05:30
|
|
|
import RelLib
|
2005-01-01 09:57:15 +05:30
|
|
|
import NameDisplay
|
2005-05-27 23:13:04 +05:30
|
|
|
import RepositoryRefEdit
|
2005-08-18 11:28:28 +05:30
|
|
|
import Spell
|
2005-12-07 01:24:16 +05:30
|
|
|
import GrampsDisplay
|
|
|
|
from WindowUtils import GladeIf
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Constants
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
2005-05-27 23:13:04 +05:30
|
|
|
class ReposRefListModel(gtk.ListStore):
|
|
|
|
def __init__(self, source=None):
|
|
|
|
gtk.ListStore.__init__(self,
|
|
|
|
object # repostory reference
|
|
|
|
)
|
|
|
|
self.set_source(source)
|
|
|
|
|
|
|
|
def rebuild(self):
|
|
|
|
"""Clear the list and repopulate from the current source record."""
|
|
|
|
self.clear()
|
|
|
|
|
|
|
|
for repos_ref in self._source.get_reporef_list():
|
|
|
|
self.append([repos_ref])
|
|
|
|
|
|
|
|
def update(self,repos_ref):
|
|
|
|
"""Add the record if it is not already in the list otherwise
|
|
|
|
replace the record with the new one."""
|
|
|
|
|
|
|
|
found = False
|
|
|
|
for val in range(0,len(self)):
|
|
|
|
iter = self.get_iter(val)
|
|
|
|
if repos_ref == self.get_value(iter,0):
|
|
|
|
self.row_changed(self.get_path(iter),iter)
|
|
|
|
found = True
|
|
|
|
break
|
|
|
|
|
|
|
|
if not found:
|
|
|
|
self.append([repos_ref])
|
|
|
|
|
|
|
|
def set_source(self, source):
|
|
|
|
self._source = source
|
|
|
|
self.rebuild()
|
|
|
|
|
|
|
|
class ReposRefListView:
|
|
|
|
|
2005-08-17 15:00:10 +05:30
|
|
|
def __init__(self, dbstate, widget):
|
|
|
|
self._dbstate = dbstate
|
|
|
|
self.database_changed(self._dbstate.db)
|
|
|
|
self._db.connect('database-changed', self.database_changed)
|
2005-05-27 23:13:04 +05:30
|
|
|
|
|
|
|
self._widget = widget
|
|
|
|
|
|
|
|
# Create the tree columns
|
|
|
|
self._col1 = gtk.TreeViewColumn(_("Name"))
|
|
|
|
self._col2 = gtk.TreeViewColumn(_("Type"))
|
|
|
|
self._col3 = gtk.TreeViewColumn(_("Note"))
|
|
|
|
|
|
|
|
# Add columns
|
|
|
|
self._widget.append_column(self._col1)
|
|
|
|
self._widget.append_column(self._col2)
|
|
|
|
self._widget.append_column(self._col3)
|
|
|
|
|
|
|
|
# Create cell renders
|
|
|
|
self._col1_cell = gtk.CellRendererText()
|
|
|
|
self._col2_cell = gtk.CellRendererText()
|
|
|
|
self._col3_cell = gtk.CellRendererText()
|
|
|
|
|
|
|
|
# Add cells to view
|
|
|
|
self._col1.pack_start(self._col1_cell, True)
|
|
|
|
self._col2.pack_start(self._col2_cell, True)
|
|
|
|
self._col3.pack_start(self._col3_cell, True)
|
|
|
|
|
|
|
|
# Setup the cell data callback funcs
|
|
|
|
self._col1.set_cell_data_func(self._col1_cell, self.object_name)
|
|
|
|
self._col2.set_cell_data_func(self._col2_cell, self.object_type)
|
|
|
|
self._col3.set_cell_data_func(self._col3_cell, self.object_note)
|
|
|
|
self._widget.set_enable_search(False)
|
|
|
|
|
|
|
|
|
|
|
|
def database_changed(self,db):
|
|
|
|
self._db = db
|
|
|
|
|
|
|
|
# Methods for rendering the cells.
|
|
|
|
|
|
|
|
def object_name(self, column, cell, model, iter, user_data=None):
|
|
|
|
o = model.get_value(iter, 0)
|
|
|
|
repos_hdl = o.get_reference_handle()
|
|
|
|
repos = self._db.get_repository_from_handle(repos_hdl)
|
|
|
|
cell.set_property('text', repos.get_name())
|
|
|
|
|
|
|
|
def object_type(self, column, cell, model, iter, user_data=None):
|
|
|
|
o = model.get_value(iter, 0)
|
|
|
|
repos_hdl = o.get_reference_handle()
|
|
|
|
repos = self._db.get_repository_from_handle(repos_hdl)
|
2005-06-03 19:48:06 +05:30
|
|
|
rtype = repos.get_type()
|
|
|
|
if rtype[0] == RelLib.Event.CUSTOM or rtype[0] not in Utils.repository_types:
|
|
|
|
name = rtype[1]
|
|
|
|
else:
|
|
|
|
name = Utils.repository_types[rtype[0]]
|
|
|
|
cell.set_property('text', name)
|
2005-05-27 23:13:04 +05:30
|
|
|
|
|
|
|
def object_note(self, column, cell, model, iter, user_data=None):
|
|
|
|
o = model.get_value(iter, 0)
|
|
|
|
cell.set_property('text', o.get_note())
|
|
|
|
|
|
|
|
# proxy methods to provide access to the real widget functions.
|
|
|
|
|
|
|
|
def set_model(self,model=None):
|
|
|
|
self._widget.set_model(model)
|
|
|
|
|
|
|
|
def get_model(self):
|
|
|
|
return self._widget.get_model()
|
|
|
|
|
|
|
|
def get_selection(self):
|
|
|
|
return self._widget.get_selection()
|
|
|
|
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
class EditSource:
|
|
|
|
|
2005-08-12 08:05:27 +05:30
|
|
|
def __init__(self,source,dbstate,uistate,readonly=False):
|
|
|
|
self.dbstate = dbstate
|
2004-08-30 09:20:33 +05:30
|
|
|
if source:
|
|
|
|
self.source = source
|
|
|
|
else:
|
|
|
|
self.source = RelLib.Source()
|
2005-06-05 09:31:56 +05:30
|
|
|
if self.source.get_handle():
|
|
|
|
self.ref_not_loaded = 1
|
|
|
|
else:
|
|
|
|
self.ref_not_loaded = 0
|
2005-08-12 08:05:27 +05:30
|
|
|
self.db = dbstate.db
|
2005-12-07 01:24:16 +05:30
|
|
|
self.idle = None
|
2005-01-01 09:57:15 +05:30
|
|
|
self.name_display = NameDisplay.displayer.display
|
2005-08-12 08:05:27 +05:30
|
|
|
# if source:
|
|
|
|
# if parent and self.parent.child_windows.has_key(source.get_handle()):
|
|
|
|
# self.parent.child_windows[source.get_handle()].present(None)
|
|
|
|
# return
|
|
|
|
# else:
|
|
|
|
# self.win_key = source.get_handle()
|
|
|
|
# else:
|
|
|
|
# self.win_key = self
|
|
|
|
# self.child_windows = {}
|
|
|
|
self.path = self.db.get_save_path()
|
2002-10-20 19:55:16 +05:30
|
|
|
self.not_loaded = 1
|
2004-02-07 02:27:01 +05:30
|
|
|
self.lists_changed = 0
|
2004-02-21 12:10:44 +05:30
|
|
|
self.gallery_ok = 0
|
2005-02-20 06:32:15 +05:30
|
|
|
mode = not self.db.readonly
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-08-17 07:44:33 +05:30
|
|
|
self.top_window = gtk.glade.XML(const.gladeFile,"sourceEditor","gramps")
|
2003-03-06 11:42:51 +05:30
|
|
|
self.top = self.top_window.get_widget("sourceEditor")
|
2005-12-07 01:24:16 +05:30
|
|
|
self.gladeif = GladeIf(self.top_window)
|
2003-03-05 11:31:31 +05:30
|
|
|
|
2003-03-06 11:42:51 +05:30
|
|
|
Utils.set_titles(self.top,self.top_window.get_widget('title'),
|
|
|
|
_('Source Editor'))
|
2003-03-05 11:31:31 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
plwidget = self.top_window.get_widget("iconlist")
|
2005-08-12 08:05:27 +05:30
|
|
|
self.gallery = ImageSelect.Gallery(source, self.db.commit_place,
|
|
|
|
self.path,
|
|
|
|
plwidget,
|
|
|
|
self.db, self, self.top)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.author = self.top_window.get_widget("author")
|
|
|
|
self.pubinfo = self.top_window.get_widget("pubinfo")
|
2003-12-08 07:53:53 +05:30
|
|
|
self.abbrev = self.top_window.get_widget("abbrev")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.note = self.top_window.get_widget("source_note")
|
2005-02-20 06:32:15 +05:30
|
|
|
self.note.set_editable(mode)
|
2005-08-18 11:28:28 +05:30
|
|
|
self.spell = Spell.Spell(self.note)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.notes_buffer = self.note.get_buffer()
|
2005-05-26 10:34:36 +05:30
|
|
|
self.gallery_label = self.top_window.get_widget("source_edit_gallery")
|
|
|
|
self.refs_label = self.top_window.get_widget("source_edit_refs")
|
|
|
|
self.notes_label = self.top_window.get_widget("source_edit_notes")
|
|
|
|
self.data_label = self.top_window.get_widget("source_edit_data")
|
2003-12-16 01:30:47 +05:30
|
|
|
self.flowed = self.top_window.get_widget("source_flowed")
|
2005-02-20 06:32:15 +05:30
|
|
|
self.flowed.set_sensitive(mode)
|
2003-12-16 01:30:47 +05:30
|
|
|
self.preform = self.top_window.get_widget("source_preform")
|
2005-02-20 06:32:15 +05:30
|
|
|
self.preform.set_sensitive(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.refinfo = self.top_window.get_widget("refinfo")
|
|
|
|
|
2003-03-06 11:42:51 +05:30
|
|
|
self.title = self.top_window.get_widget("source_title")
|
2004-02-14 11:10:30 +05:30
|
|
|
self.title.set_text(source.get_title())
|
2005-02-20 06:32:15 +05:30
|
|
|
self.title.set_editable(mode)
|
2004-02-14 11:10:30 +05:30
|
|
|
self.author.set_text(source.get_author())
|
2005-02-20 06:32:15 +05:30
|
|
|
self.author.set_editable(mode)
|
2004-02-14 11:10:30 +05:30
|
|
|
self.pubinfo.set_text(source.get_publication_info())
|
2005-02-20 06:32:15 +05:30
|
|
|
self.pubinfo.set_editable(mode)
|
2004-02-14 11:10:30 +05:30
|
|
|
self.abbrev.set_text(source.get_abbreviation())
|
2005-02-20 06:32:15 +05:30
|
|
|
self.abbrev.set_editable(mode)
|
|
|
|
|
|
|
|
self.top_window.get_widget('del_data').set_sensitive(mode)
|
|
|
|
self.top_window.get_widget('add_data').set_sensitive(mode)
|
|
|
|
self.top_window.get_widget('add_photo').set_sensitive(mode)
|
|
|
|
self.top_window.get_widget('sel_photo').set_sensitive(mode)
|
|
|
|
self.top_window.get_widget('delete_photo').set_sensitive(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-08-17 15:00:10 +05:30
|
|
|
self.repos_ref_view = ReposRefListView(self.dbstate,
|
|
|
|
self.top_window.get_widget('repository_ref_list'))
|
|
|
|
self.repos_ref_model = ReposRefListModel(self.source)
|
|
|
|
self.repos_ref_view.set_model(self.repos_ref_model)
|
2005-05-27 23:13:04 +05:30
|
|
|
|
|
|
|
self.top_window.get_widget('add_repos_ref').set_sensitive(mode)
|
|
|
|
self.top_window.get_widget('edit_repos_ref').set_sensitive(mode)
|
|
|
|
self.top_window.get_widget('del_repos_ref').set_sensitive(mode)
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if source.get_note():
|
|
|
|
self.notes_buffer.set_text(source.get_note())
|
2003-12-07 10:34:14 +05:30
|
|
|
Utils.bold_label(self.notes_label)
|
2004-02-14 11:10:30 +05:30
|
|
|
if source.get_note_format() == 1:
|
2004-02-21 12:10:44 +05:30
|
|
|
self.preform.set_active(1)
|
2003-12-16 01:30:47 +05:30
|
|
|
else:
|
|
|
|
self.flowed.set_active(1)
|
2005-05-26 10:34:36 +05:30
|
|
|
else:
|
|
|
|
Utils.unbold_label(self.notes_label)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-21 11:41:59 +05:30
|
|
|
if self.source.get_media_list():
|
2003-12-12 11:06:38 +05:30
|
|
|
Utils.bold_label(self.gallery_label)
|
2005-05-26 10:34:36 +05:30
|
|
|
else:
|
|
|
|
Utils.unbold_label(self.gallery_label)
|
2003-12-12 11:06:38 +05:30
|
|
|
|
2005-12-07 01:24:16 +05:30
|
|
|
self.gladeif.connect('sourceEditor','delete_event',self.on_delete_event)
|
|
|
|
self.gladeif.connect('button90','clicked',self.close)
|
|
|
|
self.gladeif.connect('ok','clicked',self.on_source_apply_clicked)
|
|
|
|
self.gladeif.connect('button166','clicked',self.on_help_clicked)
|
|
|
|
self.gladeif.connect('notebook2','switch_page',self.on_switch_page)
|
|
|
|
self.gladeif.connect('add_data','clicked',self.on_add_data_clicked)
|
|
|
|
self.gladeif.connect('del_data','clicked',self.on_delete_data_clicked)
|
|
|
|
self.gladeif.connect('add_photo','clicked',self.gallery.on_add_media_clicked)
|
|
|
|
self.gladeif.connect('sel_photo','clicked',self.gallery.on_select_media_clicked)
|
|
|
|
self.gladeif.connect('edit_photo','clicked',self.gallery.on_edit_media_clicked)
|
|
|
|
self.gladeif.connect('delete_photo','clicked',self.gallery.on_delete_media_clicked)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-20 06:32:15 +05:30
|
|
|
if self.source.get_handle() == None or self.db.readonly:
|
|
|
|
self.top_window.get_widget("edit_photo").set_sensitive(False)
|
|
|
|
self.top_window.get_widget("delete_photo").set_sensitive(False)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-11-23 10:45:37 +05:30
|
|
|
self.datalist = self.top_window.get_widget('datalist')
|
|
|
|
colno = 0
|
2004-11-24 23:31:49 +05:30
|
|
|
first = True
|
2004-11-23 10:45:37 +05:30
|
|
|
for title in [ (_('Key'),0,175), (_('Value'),1,150)]:
|
|
|
|
renderer = gtk.CellRendererText()
|
|
|
|
renderer.set_property('editable',True)
|
|
|
|
renderer.connect('edited',self.edit_cb, colno)
|
|
|
|
column = gtk.TreeViewColumn(title[0], renderer, text=colno)
|
|
|
|
colno += 1
|
|
|
|
column.set_clickable(True)
|
|
|
|
column.set_resizable(True)
|
|
|
|
column.set_min_width(title[2])
|
|
|
|
column.set_sort_column_id(title[1])
|
|
|
|
self.datalist.append_column(column)
|
2004-11-24 23:31:49 +05:30
|
|
|
if first:
|
|
|
|
first = False
|
|
|
|
self.key_cell = renderer
|
|
|
|
self.key_col = column
|
2004-11-23 10:45:37 +05:30
|
|
|
|
|
|
|
self.data_model = gtk.ListStore(str,str)
|
|
|
|
self.datalist.set_model(self.data_model)
|
|
|
|
dmap = self.source.get_data_map()
|
|
|
|
for item in dmap.keys():
|
|
|
|
self.data_model.append(row=[item,dmap[item]])
|
2004-11-24 23:31:49 +05:30
|
|
|
|
2005-05-26 10:34:36 +05:30
|
|
|
if dmap:
|
|
|
|
Utils.bold_label(self.data_label)
|
|
|
|
else:
|
|
|
|
Utils.unbold_label(self.data_label)
|
|
|
|
|
2005-08-12 08:05:27 +05:30
|
|
|
# if parent_window:
|
|
|
|
# self.top.set_transient_for(parent_window)
|
* src/SourceView.py (button_press,on_add_clicked,on_delete_clicked,
on_edit_clicked): Pass parent window to the child dialog.
* src/Sources.py (add_src_clicked): Likewise.
* src/EditSource.py (__init__): Add optional parent_window argument.
Make dialog modal and transient for its parent.
* src/gramps.glade (sourceEditor dialog): Delete unneeded handlers
for buttons.
* src/QuestionDialog.py (SaveDialog,QuestionDialog,OptionDialog,
ErrorDialog,WarningDialog,MissingMediaDialog): Set transient status
if parent is given.
* src/EventEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/Witness.py: Make WittnessEditor dialog modal and transient for
its parent. Call SelectPerson with itself as a parent.
* src/SelectPerson.py (__init__): Make dialog transient for its parent.
* src/imagesel.glade: Define proper responses and delete unneeded handlers
for buttons. Make gtkFileEntry modal.
* src/dialog.glade (all dialogs): Define proper responses for buttons.
* src/EditPerson.py (on_add_aka_clicked, on_aka_update_clicked):
Call NameEdit with itself as a parent; (on_add_attr_clicked,
on_update_attr_clicked): Call AttributeEditor with itself as a parent;
(on_add_addr_clicked,on_update_addr_clicked): Call AddressEditor with
itself as a parent; (on_add_url_clicked,on_update_url_clicked): Call
UrlEditor with itself as a parent; (on_name_note_clicked,
on_ldsbap_note_clicked,on_ldsendow_note_clicked,
on_ldsseal_note_clicked): Call NoteEditor with itself as a parent.
* src/NameEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/AttrEdit.py (__init__): Likewise.
* src/AddrEdit.py (__init__): Likewise.
* src/UrlEdit.py (__init__): Likewise.
* src/NoteEdit.py (__init__): Likewise.
svn: r2131
2003-09-15 09:41:30 +05:30
|
|
|
|
2005-02-20 06:32:15 +05:30
|
|
|
self.top_window.get_widget('ok').set_sensitive(not self.db.readonly)
|
|
|
|
|
2005-08-12 08:05:27 +05:30
|
|
|
# if parent_window:
|
|
|
|
# self.top.set_transient_for(parent_window)
|
|
|
|
# self.add_itself_to_menu()
|
* src/SourceView.py (button_press,on_add_clicked,on_delete_clicked,
on_edit_clicked): Pass parent window to the child dialog.
* src/Sources.py (add_src_clicked): Likewise.
* src/EditSource.py (__init__): Add optional parent_window argument.
Make dialog modal and transient for its parent.
* src/gramps.glade (sourceEditor dialog): Delete unneeded handlers
for buttons.
* src/QuestionDialog.py (SaveDialog,QuestionDialog,OptionDialog,
ErrorDialog,WarningDialog,MissingMediaDialog): Set transient status
if parent is given.
* src/EventEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/Witness.py: Make WittnessEditor dialog modal and transient for
its parent. Call SelectPerson with itself as a parent.
* src/SelectPerson.py (__init__): Make dialog transient for its parent.
* src/imagesel.glade: Define proper responses and delete unneeded handlers
for buttons. Make gtkFileEntry modal.
* src/dialog.glade (all dialogs): Define proper responses for buttons.
* src/EditPerson.py (on_add_aka_clicked, on_aka_update_clicked):
Call NameEdit with itself as a parent; (on_add_attr_clicked,
on_update_attr_clicked): Call AttributeEditor with itself as a parent;
(on_add_addr_clicked,on_update_addr_clicked): Call AddressEditor with
itself as a parent; (on_add_url_clicked,on_update_url_clicked): Call
UrlEditor with itself as a parent; (on_name_note_clicked,
on_ldsbap_note_clicked,on_ldsendow_note_clicked,
on_ldsseal_note_clicked): Call NoteEditor with itself as a parent.
* src/NameEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/AttrEdit.py (__init__): Likewise.
* src/AddrEdit.py (__init__): Likewise.
* src/UrlEdit.py (__init__): Likewise.
* src/NoteEdit.py (__init__): Likewise.
svn: r2131
2003-09-15 09:41:30 +05:30
|
|
|
self.top.show()
|
2005-06-05 09:31:56 +05:30
|
|
|
if self.ref_not_loaded:
|
|
|
|
self.ref_not_loaded = 0
|
|
|
|
Utils.temp_label(self.refs_label,self.top)
|
2005-12-07 01:24:16 +05:30
|
|
|
self.cursor_type = None
|
|
|
|
self.idle = gobject.idle_add(self.display_references)
|
2004-11-24 23:31:49 +05:30
|
|
|
self.data_sel = self.datalist.get_selection()
|
|
|
|
|
|
|
|
def on_add_data_clicked(self,widget):
|
|
|
|
node = self.data_model.append(row=['',''])
|
|
|
|
self.data_sel.select_iter(node)
|
|
|
|
path = self.data_model.get_path(node)
|
|
|
|
self.datalist.set_cursor_on_cell(path,
|
|
|
|
focus_column=self.key_col,
|
|
|
|
focus_cell=None,
|
|
|
|
start_editing=True)
|
|
|
|
|
2005-02-17 04:19:54 +05:30
|
|
|
|
2004-11-24 23:31:49 +05:30
|
|
|
def on_delete_data_clicked(self,widget):
|
|
|
|
(model,node) = self.data_sel.get_selected()
|
|
|
|
if node:
|
|
|
|
model.remove(node)
|
2004-02-21 12:10:44 +05:30
|
|
|
|
2005-05-27 23:13:04 +05:30
|
|
|
def on_add_repos_ref_clicked(self,widget):
|
2005-08-17 15:00:10 +05:30
|
|
|
RepositoryRefEdit.RepositoryRefEdit(RelLib.RepoRef(),self.dbstate,
|
2005-05-27 23:13:04 +05:30
|
|
|
self.repos_ref_model.update,self)
|
|
|
|
|
|
|
|
def on_delete_repos_ref_clicked(self,widget):
|
|
|
|
selection = self.repos_ref_view.get_selection()
|
|
|
|
model, iter = selection.get_selected()
|
|
|
|
if iter:
|
|
|
|
model.remove(iter)
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
def on_edit_repos_ref_clicked(self,widget,path=None,colm=None,userp=None):
|
|
|
|
selection = self.repos_ref_view.get_selection()
|
|
|
|
model, iter = selection.get_selected()
|
|
|
|
|
|
|
|
if iter:
|
|
|
|
repos_ref = model.get_value(iter,0)
|
|
|
|
|
2005-08-17 15:00:10 +05:30
|
|
|
RepositoryRefEdit.RepositoryRefEdit(repos_ref,self.dbstate,
|
2005-05-27 23:13:04 +05:30
|
|
|
self.repos_ref_model.update,self)
|
|
|
|
|
|
|
|
|
2004-11-23 10:45:37 +05:30
|
|
|
def edit_cb(self, cell, path, new_text, data):
|
2005-01-09 07:48:49 +05:30
|
|
|
node = self.data_model.get_iter(path)
|
|
|
|
self.data_model.set_value(node,data,new_text)
|
2004-11-23 10:45:37 +05:30
|
|
|
|
2004-02-21 12:10:44 +05:30
|
|
|
def on_delete_event(self,obj,b):
|
|
|
|
self.close_child_windows()
|
|
|
|
self.remove_itself_from_menu()
|
2005-12-07 01:24:16 +05:30
|
|
|
self.gladeif.close()
|
|
|
|
gc.collect()
|
2003-11-19 23:30:58 +05:30
|
|
|
|
|
|
|
def on_help_clicked(self,obj):
|
|
|
|
"""Display the relevant portion of GRAMPS manual"""
|
2005-12-07 01:24:16 +05:30
|
|
|
GrampsDisplay.help('adv-src')
|
* src/SourceView.py (button_press,on_add_clicked,on_delete_clicked,
on_edit_clicked): Pass parent window to the child dialog.
* src/Sources.py (add_src_clicked): Likewise.
* src/EditSource.py (__init__): Add optional parent_window argument.
Make dialog modal and transient for its parent.
* src/gramps.glade (sourceEditor dialog): Delete unneeded handlers
for buttons.
* src/QuestionDialog.py (SaveDialog,QuestionDialog,OptionDialog,
ErrorDialog,WarningDialog,MissingMediaDialog): Set transient status
if parent is given.
* src/EventEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/Witness.py: Make WittnessEditor dialog modal and transient for
its parent. Call SelectPerson with itself as a parent.
* src/SelectPerson.py (__init__): Make dialog transient for its parent.
* src/imagesel.glade: Define proper responses and delete unneeded handlers
for buttons. Make gtkFileEntry modal.
* src/dialog.glade (all dialogs): Define proper responses for buttons.
* src/EditPerson.py (on_add_aka_clicked, on_aka_update_clicked):
Call NameEdit with itself as a parent; (on_add_attr_clicked,
on_update_attr_clicked): Call AttributeEditor with itself as a parent;
(on_add_addr_clicked,on_update_addr_clicked): Call AddressEditor with
itself as a parent; (on_add_url_clicked,on_update_url_clicked): Call
UrlEditor with itself as a parent; (on_name_note_clicked,
on_ldsbap_note_clicked,on_ldsendow_note_clicked,
on_ldsseal_note_clicked): Call NoteEditor with itself as a parent.
* src/NameEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/AttrEdit.py (__init__): Likewise.
* src/AddrEdit.py (__init__): Likewise.
* src/UrlEdit.py (__init__): Likewise.
* src/NoteEdit.py (__init__): Likewise.
svn: r2131
2003-09-15 09:41:30 +05:30
|
|
|
|
2002-11-28 11:22:02 +05:30
|
|
|
def close(self,obj):
|
2004-08-07 10:46:57 +05:30
|
|
|
self.gallery.close()
|
2004-02-21 12:10:44 +05:30
|
|
|
self.close_child_windows()
|
|
|
|
self.remove_itself_from_menu()
|
2005-12-07 01:24:16 +05:30
|
|
|
self.gladeif.close()
|
2002-11-28 11:22:02 +05:30
|
|
|
self.top.destroy()
|
2005-12-07 01:24:16 +05:30
|
|
|
if self.idle != None:
|
|
|
|
gobject.source_remove(self.idle)
|
|
|
|
gc.collect()
|
2002-11-28 11:22:02 +05:30
|
|
|
|
2004-02-21 12:10:44 +05:30
|
|
|
def close_child_windows(self):
|
2005-08-12 08:05:27 +05:30
|
|
|
return
|
* src/AddrEdit.py, src/AttrEdit.py, src/EditPerson.py,
src/EditSource.py, src/EventEdit.py, src/ImageSelect.py,
src/Marriage.py, src/NameEdit.py, src/NoteEdit.py,
src/Sources.py, src/UrlEdit.py, src/Witness.py:
Register windows opened for existing objects. Prevent editing
same object twice.
svn: r2905
2004-02-24 11:07:06 +05:30
|
|
|
for child_window in self.child_windows.values():
|
2004-02-21 12:10:44 +05:30
|
|
|
child_window.close(None)
|
* src/AddrEdit.py, src/AttrEdit.py, src/EditPerson.py,
src/EditSource.py, src/EventEdit.py, src/ImageSelect.py,
src/Marriage.py, src/NameEdit.py, src/NoteEdit.py,
src/Sources.py, src/UrlEdit.py, src/Witness.py:
Register windows opened for existing objects. Prevent editing
same object twice.
svn: r2905
2004-02-24 11:07:06 +05:30
|
|
|
self.child_windows = {}
|
2004-02-21 12:10:44 +05:30
|
|
|
|
|
|
|
def add_itself_to_menu(self):
|
2005-08-12 08:05:27 +05:30
|
|
|
return
|
* src/AddrEdit.py, src/AttrEdit.py, src/EditPerson.py,
src/EditSource.py, src/EventEdit.py, src/ImageSelect.py,
src/Marriage.py, src/NameEdit.py, src/NoteEdit.py,
src/Sources.py, src/UrlEdit.py, src/Witness.py:
Register windows opened for existing objects. Prevent editing
same object twice.
svn: r2905
2004-02-24 11:07:06 +05:30
|
|
|
self.parent.child_windows[self.win_key] = self
|
2004-02-21 12:10:44 +05:30
|
|
|
if not self.source:
|
|
|
|
label = _("New Source")
|
|
|
|
else:
|
|
|
|
label = self.source.get_title()
|
|
|
|
if not label.strip():
|
|
|
|
label = _("New Source")
|
|
|
|
label = "%s: %s" % (_('Source'),label)
|
|
|
|
self.parent_menu_item = gtk.MenuItem(label)
|
|
|
|
self.parent_menu_item.set_submenu(gtk.Menu())
|
|
|
|
self.parent_menu_item.show()
|
2004-02-25 08:50:53 +05:30
|
|
|
self.parent.winsmenu.append(self.parent_menu_item)
|
|
|
|
self.winsmenu = self.parent_menu_item.get_submenu()
|
2004-02-21 12:10:44 +05:30
|
|
|
self.menu_item = gtk.MenuItem(_('Source Editor'))
|
|
|
|
self.menu_item.connect("activate",self.present)
|
|
|
|
self.menu_item.show()
|
2004-02-25 08:50:53 +05:30
|
|
|
self.winsmenu.append(self.menu_item)
|
2004-02-21 12:10:44 +05:30
|
|
|
|
|
|
|
def remove_itself_from_menu(self):
|
2005-08-12 08:05:27 +05:30
|
|
|
return
|
* src/AddrEdit.py, src/AttrEdit.py, src/EditPerson.py,
src/EditSource.py, src/EventEdit.py, src/ImageSelect.py,
src/Marriage.py, src/NameEdit.py, src/NoteEdit.py,
src/Sources.py, src/UrlEdit.py, src/Witness.py:
Register windows opened for existing objects. Prevent editing
same object twice.
svn: r2905
2004-02-24 11:07:06 +05:30
|
|
|
del self.parent.child_windows[self.win_key]
|
2004-02-21 12:10:44 +05:30
|
|
|
self.menu_item.destroy()
|
2004-02-25 08:50:53 +05:30
|
|
|
self.winsmenu.destroy()
|
2004-02-21 12:10:44 +05:30
|
|
|
self.parent_menu_item.destroy()
|
|
|
|
|
|
|
|
def present(self,obj):
|
2005-08-12 08:05:27 +05:30
|
|
|
return
|
2004-02-21 12:10:44 +05:30
|
|
|
self.top.present()
|
|
|
|
|
2005-04-14 05:56:38 +05:30
|
|
|
def button_press(self,obj):
|
|
|
|
data = self.model.get_selected_objects()
|
2005-05-24 18:38:06 +05:30
|
|
|
if not data:
|
|
|
|
return
|
|
|
|
(data_type,handle) = data[0]
|
|
|
|
if data_type == 0:
|
2005-04-14 05:56:38 +05:30
|
|
|
import EditPerson
|
|
|
|
person = self.db.get_person_from_handle(handle)
|
|
|
|
EditPerson.EditPerson(self.parent,person,self.db)
|
2005-05-24 18:38:06 +05:30
|
|
|
elif data_type == 1:
|
2005-04-14 05:56:38 +05:30
|
|
|
import Marriage
|
|
|
|
family = self.db.get_family_from_handle(handle)
|
|
|
|
Marriage.Marriage(self.parent,family,self.db)
|
2005-05-24 18:38:06 +05:30
|
|
|
elif data_type == 2:
|
2005-04-14 05:56:38 +05:30
|
|
|
import EventEdit
|
|
|
|
event = self.db.get_event_from_handle(handle)
|
2005-05-24 18:38:06 +05:30
|
|
|
event_name = event.get_name()
|
2005-06-01 01:06:28 +05:30
|
|
|
if Utils.family_events.has_key(event_name):
|
2005-04-14 05:56:38 +05:30
|
|
|
EventEdit.EventEditor(
|
2005-06-01 01:06:28 +05:30
|
|
|
self,", ", const.marriageEvents, Utils.family_events,
|
2005-04-14 05:56:38 +05:30
|
|
|
event, None, 0, None, None, self.db.readonly)
|
2005-06-01 01:06:28 +05:30
|
|
|
elif Utils.personal_events.has_key(event_name):
|
2005-04-14 05:56:38 +05:30
|
|
|
EventEdit.EventEditor(
|
2005-06-01 01:06:28 +05:30
|
|
|
self,", ", const.personalEvents, Utils.personal_events,
|
2005-04-14 05:56:38 +05:30
|
|
|
event, None, 0, None, None, self.db.readonly)
|
2005-05-24 18:38:06 +05:30
|
|
|
elif event_name in ["Birth","Death"]:
|
|
|
|
EventEdit.EventEditor(
|
2005-06-01 01:06:28 +05:30
|
|
|
self,", ", const.personalEvents, Utils.personal_events,
|
2005-05-24 18:38:06 +05:30
|
|
|
event, None, 1, None, None, self.db.readonly)
|
|
|
|
elif data_type == 3:
|
2005-04-14 05:56:38 +05:30
|
|
|
import EditPlace
|
2005-04-26 21:34:21 +05:30
|
|
|
place = self.db.get_place_from_handle(handle)
|
|
|
|
EditPlace.EditPlace(self.parent,place)
|
2005-12-07 01:24:16 +05:30
|
|
|
elif data_type == 4:
|
|
|
|
source = self.db.get_source_from_handle(handle)
|
|
|
|
EditSource(source,self.db,self.parent,None,self.db.readonly)
|
2005-05-24 18:38:06 +05:30
|
|
|
elif data_type == 5:
|
2005-04-14 05:56:38 +05:30
|
|
|
media = self.db.get_object_from_handle(handle)
|
2005-04-26 21:34:21 +05:30
|
|
|
ImageSelect.GlobalMediaProperties(self.db,media,self)
|
2005-04-14 05:56:38 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def display_references(self):
|
2005-12-07 01:24:16 +05:30
|
|
|
source_handle = self.source.get_handle()
|
|
|
|
|
|
|
|
# Initialize things if we're entering this functioin
|
|
|
|
# for the first time
|
|
|
|
if not self.cursor_type:
|
|
|
|
self.cursor_type = 'Person'
|
|
|
|
self.cursor = self.db.get_person_cursor()
|
|
|
|
self.data = self.cursor.first()
|
|
|
|
|
|
|
|
self.any_refs = False
|
|
|
|
slist = self.top_window.get_widget('slist')
|
|
|
|
titles = [(_('Type'),0,150),(_('ID'),1,75),(_('Name'),2,150)]
|
|
|
|
self.model = ListModel.ListModel(slist,
|
|
|
|
titles,
|
|
|
|
event_func=self.button_press)
|
|
|
|
|
|
|
|
if self.cursor_type == 'Person':
|
|
|
|
while self.data:
|
|
|
|
handle,val = self.data
|
|
|
|
person = RelLib.Person()
|
|
|
|
person.unserialize(val)
|
|
|
|
if person.has_source_reference(source_handle):
|
|
|
|
name = self.name_display(person)
|
|
|
|
gramps_id = person.get_gramps_id()
|
|
|
|
self.model.add([_("Person"),gramps_id,name],(0,handle))
|
|
|
|
self.any_refs = True
|
|
|
|
self.data = self.cursor.next()
|
|
|
|
if gtk.events_pending():
|
|
|
|
return True
|
|
|
|
self.cursor.close()
|
|
|
|
|
|
|
|
self.cursor_type = 'Family'
|
|
|
|
self.cursor = self.db.get_family_cursor()
|
|
|
|
self.data = self.cursor.first()
|
|
|
|
|
|
|
|
if self.cursor_type == 'Family':
|
|
|
|
while self.data:
|
|
|
|
handle,val = self.data
|
|
|
|
family = RelLib.Family()
|
|
|
|
family.unserialize(val)
|
|
|
|
if family.has_source_reference(source_handle):
|
|
|
|
name = Utils.family_name(family,self.db)
|
|
|
|
gramps_id = family.get_gramps_id()
|
|
|
|
self.model.add([_("Family"),gramps_id,name],(1,handle))
|
|
|
|
self.any_refs = True
|
|
|
|
self.data = self.cursor.next()
|
|
|
|
if gtk.events_pending():
|
|
|
|
return True
|
|
|
|
self.cursor.close()
|
|
|
|
|
|
|
|
self.cursor_type = 'Event'
|
|
|
|
self.cursor = self.db.get_event_cursor()
|
|
|
|
self.data = self.cursor.first()
|
|
|
|
|
|
|
|
if self.cursor_type == 'Event':
|
|
|
|
while self.data:
|
|
|
|
handle,val = self.data
|
|
|
|
event = RelLib.Event()
|
|
|
|
event.unserialize(val)
|
|
|
|
if event.has_source_reference(source_handle):
|
|
|
|
name = event.get_name()
|
|
|
|
gramps_id = event.get_gramps_id()
|
|
|
|
self.model.add([_("Event"),gramps_id,name],(2,handle))
|
|
|
|
self.any_refs = True
|
|
|
|
self.data = self.cursor.next()
|
|
|
|
if gtk.events_pending():
|
|
|
|
return True
|
|
|
|
self.cursor.close()
|
|
|
|
|
|
|
|
self.cursor_type = 'Place'
|
|
|
|
self.cursor = self.db.get_place_cursor()
|
|
|
|
self.data = self.cursor.first()
|
|
|
|
|
|
|
|
if self.cursor_type == 'Place':
|
|
|
|
while self.data:
|
|
|
|
handle,val = self.data
|
|
|
|
place = RelLib.Place()
|
|
|
|
place.unserialize(val)
|
|
|
|
if place.has_source_reference(source_handle):
|
|
|
|
name = place.get_title()
|
|
|
|
gramps_id = place.get_gramps_id()
|
|
|
|
self.model.add([_("Place"),gramps_id,name],(3,handle))
|
|
|
|
self.any_refs = True
|
|
|
|
self.data = self.cursor.next()
|
|
|
|
if gtk.events_pending():
|
|
|
|
return True
|
|
|
|
self.cursor.close()
|
|
|
|
|
|
|
|
self.cursor_type = 'Source'
|
|
|
|
self.cursor = self.db.get_source_cursor()
|
|
|
|
self.data = self.cursor.first()
|
|
|
|
|
|
|
|
if self.cursor_type == 'Source':
|
|
|
|
while self.data:
|
|
|
|
handle,val = self.data
|
|
|
|
source = RelLib.Source()
|
|
|
|
source.unserialize(val)
|
|
|
|
if source.has_source_reference(source_handle):
|
|
|
|
name = source.get_title()
|
|
|
|
gramps_id = source.get_gramps_id()
|
|
|
|
self.model.add([_("Source"),gramps_id,name],(4,handle))
|
|
|
|
self.any_refs = True
|
|
|
|
self.data = self.cursor.next()
|
|
|
|
if gtk.events_pending():
|
|
|
|
return True
|
|
|
|
self.cursor.close()
|
|
|
|
|
|
|
|
self.cursor_type = 'Media'
|
|
|
|
self.cursor = self.db.get_media_cursor()
|
|
|
|
self.data = self.cursor.first()
|
|
|
|
|
|
|
|
if self.cursor_type == 'Media':
|
|
|
|
while self.data:
|
|
|
|
handle,val = self.data
|
|
|
|
obj = RelLib.MediaObject()
|
|
|
|
obj.unserialize(val)
|
|
|
|
if obj.has_source_reference(source_handle):
|
|
|
|
name = obj.get_description()
|
|
|
|
gramps_id = obj.get_gramps_id()
|
|
|
|
self.model.add([_("Media"),gramps_id,name],(5,handle))
|
|
|
|
self.any_refs = True
|
|
|
|
self.data = self.cursor.next()
|
|
|
|
if gtk.events_pending():
|
|
|
|
return True
|
|
|
|
self.cursor.close()
|
|
|
|
|
|
|
|
if self.any_refs:
|
2005-05-26 10:34:36 +05:30
|
|
|
Utils.bold_label(self.refs_label,self.top)
|
2003-11-13 00:15:07 +05:30
|
|
|
else:
|
2005-05-26 10:34:36 +05:30
|
|
|
Utils.unbold_label(self.refs_label,self.top)
|
2003-11-13 00:15:07 +05:30
|
|
|
|
|
|
|
self.ref_not_loaded = 0
|
2005-12-07 01:24:16 +05:30
|
|
|
self.cursor_type = None
|
|
|
|
return False
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-21 12:10:44 +05:30
|
|
|
def on_source_apply_clicked(self,obj):
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-12-17 10:53:16 +05:30
|
|
|
title = unicode(self.title.get_text())
|
|
|
|
author = unicode(self.author.get_text())
|
|
|
|
pubinfo = unicode(self.pubinfo.get_text())
|
|
|
|
abbrev = unicode(self.abbrev.get_text())
|
2005-12-07 01:24:16 +05:30
|
|
|
note = unicode(
|
|
|
|
self.notes_buffer.get_text(self.notes_buffer.get_start_iter(),
|
|
|
|
self.notes_buffer.get_end_iter(),
|
|
|
|
False))
|
2003-12-16 01:30:47 +05:30
|
|
|
format = self.preform.get_active()
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if author != self.source.get_author():
|
|
|
|
self.source.set_author(author)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if title != self.source.get_title():
|
|
|
|
self.source.set_title(title)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if pubinfo != self.source.get_publication_info():
|
|
|
|
self.source.set_publication_info(pubinfo)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if abbrev != self.source.get_abbreviation():
|
|
|
|
self.source.set_abbreviation(abbrev)
|
2003-12-08 07:53:53 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if note != self.source.get_note():
|
|
|
|
self.source.set_note(note)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if format != self.source.get_note_format():
|
|
|
|
self.source.set_note_format(format)
|
2003-12-16 01:30:47 +05:30
|
|
|
|
2004-11-23 10:45:37 +05:30
|
|
|
new_map = {}
|
2004-11-24 23:31:49 +05:30
|
|
|
for val in range(0,len(self.data_model)):
|
2004-11-23 10:45:37 +05:30
|
|
|
node = self.data_model.get_iter(val)
|
|
|
|
key = self.data_model.get_value(node,0)
|
2004-11-24 23:31:49 +05:30
|
|
|
value = self.data_model.get_value(node,1)
|
|
|
|
if key:
|
|
|
|
new_map[unicode(key)] = unicode(value)
|
2004-11-23 10:45:37 +05:30
|
|
|
if new_map != self.source.get_data_map():
|
|
|
|
self.source.set_data_map(new_map)
|
2005-05-27 23:13:04 +05:30
|
|
|
|
|
|
|
# update repository refs
|
|
|
|
repos_ref_list = []
|
|
|
|
for val in range(0,len(self.repos_ref_model)):
|
|
|
|
iter = self.repos_ref_model.get_iter(val)
|
|
|
|
repos_ref_list.append(self.repos_ref_model.get_value(iter,0))
|
|
|
|
|
|
|
|
self.source.set_reporef_list(repos_ref_list)
|
2004-11-23 10:45:37 +05:30
|
|
|
|
2004-02-21 12:10:44 +05:30
|
|
|
self.gallery_ok = 1
|
2002-11-28 11:22:02 +05:30
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
trans = self.db.transaction_begin()
|
2004-08-30 09:20:33 +05:30
|
|
|
if self.source.get_handle() == None:
|
|
|
|
self.db.add_source(self.source,trans)
|
|
|
|
else:
|
|
|
|
self.db.commit_source(self.source,trans)
|
2004-08-13 10:04:07 +05:30
|
|
|
self.db.transaction_commit(trans,_("Edit Source (%s)") % title)
|
2004-02-21 12:10:44 +05:30
|
|
|
self.close(obj)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_switch_page(self,obj,a,page):
|
|
|
|
if page == 2 and self.not_loaded:
|
|
|
|
self.not_loaded = 0
|
|
|
|
self.gallery.load_images()
|
|
|
|
elif page == 3 and self.ref_not_loaded:
|
|
|
|
self.ref_not_loaded = 0
|
2005-05-26 10:34:36 +05:30
|
|
|
Utils.temp_label(self.refs_label,self.top)
|
2005-12-07 01:24:16 +05:30
|
|
|
self.idle = gobject.idle_add(self.display_references)
|
|
|
|
text = unicode(
|
|
|
|
self.notes_buffer.get_text(self.notes_buffer.get_start_iter(),
|
|
|
|
self.notes_buffer.get_end_iter(),
|
|
|
|
False)
|
|
|
|
)
|
2003-11-13 00:15:07 +05:30
|
|
|
if text:
|
2005-05-26 10:34:36 +05:30
|
|
|
Utils.bold_label(self.notes_label,self.top)
|
2003-11-13 00:15:07 +05:30
|
|
|
else:
|
2005-05-26 10:34:36 +05:30
|
|
|
Utils.unbold_label(self.notes_label,self.top)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-05-27 23:13:04 +05:30
|
|
|
def update_repositories(self, repos_ref):
|
|
|
|
"""Make the repository list reflect the change or addition of repos_ref"""
|
|
|
|
pass
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
class DelSrcQuery:
|
2005-04-04 06:41:50 +05:30
|
|
|
def __init__(self,source,db,the_lists):
|
2002-10-20 19:55:16 +05:30
|
|
|
self.source = source
|
|
|
|
self.db = db
|
2005-03-12 02:35:46 +05:30
|
|
|
self.the_lists = the_lists
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def query_response(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
trans = self.db.transaction_begin()
|
2005-06-05 09:31:56 +05:30
|
|
|
self.db.disable_signals()
|
2004-03-30 10:20:24 +05:30
|
|
|
|
2005-03-12 02:35:46 +05:30
|
|
|
(person_list,family_list,event_list,
|
|
|
|
place_list,source_list,media_list) = self.the_lists
|
|
|
|
|
|
|
|
src_handle_list = [self.source.get_handle()]
|
|
|
|
|
|
|
|
for handle in person_list:
|
|
|
|
person = self.db.get_person_from_handle(handle)
|
|
|
|
person.remove_source_references(src_handle_list)
|
|
|
|
self.db.commit_person(person,trans)
|
|
|
|
|
|
|
|
for handle in family_list:
|
|
|
|
family = self.db.get_family_from_handle(handle)
|
|
|
|
family.remove_source_references(src_handle_list)
|
|
|
|
self.db.commit_family(family,trans)
|
|
|
|
|
|
|
|
for handle in event_list:
|
|
|
|
event = self.db.get_event_from_handle(handle)
|
|
|
|
event.remove_source_references(src_handle_list)
|
|
|
|
self.db.commit_event(event,trans)
|
|
|
|
|
|
|
|
for handle in place_list:
|
|
|
|
place = self.db.get_place_from_handle(handle)
|
|
|
|
place.remove_source_references(src_handle_list)
|
|
|
|
self.db.commit_place(place,trans)
|
|
|
|
|
|
|
|
for handle in source_list:
|
|
|
|
source = self.db.get_source_from_handle(handle)
|
|
|
|
source.remove_source_references(src_handle_list)
|
|
|
|
self.db.commit_source(source,trans)
|
|
|
|
|
|
|
|
for handle in media_list:
|
|
|
|
media = self.db.get_object_from_handle(handle)
|
|
|
|
media.remove_source_references(src_handle_list)
|
|
|
|
self.db.commit_media_object(media,trans)
|
2005-04-04 06:41:50 +05:30
|
|
|
|
2005-06-05 09:31:56 +05:30
|
|
|
self.db.enable_signals()
|
2004-08-13 10:04:07 +05:30
|
|
|
self.db.remove_source(self.source.get_handle(),trans)
|
2005-04-04 06:41:50 +05:30
|
|
|
self.db.transaction_commit(
|
|
|
|
trans,_("Delete Source (%s)") % self.source.get_title())
|