* src/DisplayTabs.py: repository reference editor

* src/EditRepository.py: repository reference editor
* src/EditSource.py: repository reference editor
* src/GrampsWidgets.py: more readonly support
* src/RepositoryRefEdit.py: removed
* src/gramps.glade: repository reference editor
* src/EditRepositoryRef.py: added - repository reference editor


svn: r5993
This commit is contained in:
Don Allingham 2006-02-26 04:29:39 +00:00
parent 08b6ca389c
commit c4010b28a4
7 changed files with 679 additions and 1515 deletions

View File

@ -1,3 +1,12 @@
2006-02-25 Don Allingham <don@gramps-project.org>
* src/DisplayTabs.py: repository reference editor
* src/EditRepository.py: repository reference editor
* src/EditSource.py: repository reference editor
* src/GrampsWidgets.py: more readonly support
* src/RepositoryRefEdit.py: removed
* src/gramps.glade: repository reference editor
* src/EditRepositoryRef.py: added - repository reference editor
2006-02-24 Don Allingham <don@gramps-project.org>
* src/DisplayTabs.py: backreference tabs
* src/EditEventRef.py: backreference tabs

View File

@ -1329,24 +1329,28 @@ class RepoEmbedList(EmbeddedList):
return ((1,0),(1,1),(1,2),(1,3))
def add_button_clicked(self,obj):
from RepositoryRefEdit import RepositoryRefEdit
from EditRepositoryRef import EditRepositoryRef
ref = RelLib.RepositoryRef()
RepositoryRefEdit.RepositoryRefEdit(
self.dbstate, self.uistate, self.track, ref, self.add_callback)
ref = RelLib.RepoRef()
repo = RelLib.Repository()
EditRepositoryRef(
self.dbstate, self.uistate, self.track, repo, ref, self.add_callback)
def add_callback(self,obj):
self.get_data().append(obj)
def add_callback(self,value):
value[0].ref = value[1].handle
self.get_data().append(value[0])
self.changed = True
self.rebuild()
def edit_button_clicked(self,obj):
from RepositoryRefEdit import RepositoryRefEdit
from EditRepositoryRef import EditRepositoryRef
ref = self.get_selected()
if ref:
RepositoryRefEdit.RepositoryRefEdit(
self.dbstate, self.uistate, self.track, ref, self.edit_callback)
repo = self.dbstate.db.get_repository_from_handle(ref.ref)
EditRepositoryRef.EditRepositoryRef(
self.dbstate, self.uistate, self.track, repo,
ref, self.edit_callback)
def edit_callback(self,name):
self.changed = True

View File

@ -45,230 +45,12 @@ import const
import Utils
import RelLib
import NameDisplay
import AutoComp
import RepositoryRefEdit
import GrampsDisplay
from GrampsWidgets import *
from DisplayTabs import *
import DisplayState
#-------------------------------------------------------------------------
#
# Classes to manager the list of Sources that have references to the
# Repository
#
#-------------------------------------------------------------------------
class ReposSrcListModel(gtk.ListStore):
def __init__(self, db, repos=None):
gtk.ListStore.__init__(self,
object, # source
object # repostory reference
)
self.original_item_list = []
self.set_model(db)
self.set_repos(repos)
def rebuild(self):
"""Clear the list and repopulate from the current source record,
remember the original list in case it is useful later"""
self.clear()
# Get the list of sources that reference this repository
repos_handle = self._repos.get_handle()
# find_backlink_handles returns a list of (class_name,handle) tuples
# so src[1] is just the handle of the source.
source_list = [ src[1] for src in self._db.find_backlink_handles(repos_handle,['Source']) ]
# Add each (source,repos_ref) to list. It is possible for
# a source to reference to same repository more than once.
self.original_item_list = []
for source_hdl in source_list:
source = self._db.get_source_from_handle(source_hdl)
repos_ref_list = [ repos_ref for repos_ref in source.get_reporef_list() \
if repos_ref.get_reference_handle() == repos_handle ]
for repos_ref in repos_ref_list:
self.append([self._db.get_source_from_handle(source_hdl),repos_ref])
self.original_item_list.append((source_hdl,repos_ref))
def update(self,source,repos_ref,original_source=None):
"""Add the record if it is not already in the list otherwise
replace the record with the new one."""
if original_source != None and \
source.get_handle() != original_source.get_handle():
# If the source has changed we need to remove the
# original reference
found = False
for val in range(0,len(self)):
iter = self.get_iter(val)
if original_source.get_handle() == self.get_value(iter,0).get_handle() \
and repos_ref == self.get_value(iter,1):
self.remove(iter)
found = True
break
# If the source has not changed but the ref has then just update the row
found = False
for val in range(0,len(self)):
iter = self.get_iter(val)
if source.get_handle() == self.get_value(iter,0).get_handle() and \
repos_ref == self.get_value(iter,1):
self.row_changed(self.get_path(iter),iter)
found = True
break
if not found:
self.append([source,repos_ref])
def set_repos(self, repos):
self._repos = repos
self.rebuild()
def set_model(self, model):
self._model = model
self._db = model
def get_deleted_items(self):
# These are the ones that are in the original sources list
# but no longer in the list model
self.items = []
for val in range(0,len(self)):
iter = self.get_iter(val)
self.items.append((self.get_value(iter,0).get_handle(),self.get_value(iter,1)))
deleted = []
for item in self.original_item_list:
found = False
for cur_item in self.items:
if item[0] == cur_item[0] and \
item[1] == cur_item[1]:
found = True
break
if not found:
deleted.append(item)
return deleted
def get_added_items(self):
# These are the ones that are in the list model but not in the
# original sources list.
self.items = []
for val in range(0,len(self)):
iter = self.get_iter(val)
self.items.append((self.get_value(iter,0).get_handle(),self.get_value(iter,1)))
added = []
for cur_item in self.items:
found = False
for item in self.original_item_list:
if item[0] == cur_item[0] and \
item[1] == cur_item[1]:
found = True
break
if not found:
added.append(cur_item)
return added
def get_update_items(self):
# These are in both lists but the repos_ref has changed in the
# list model.
self.items = []
for val in range(0,len(self)):
iter = self.get_iter(val)
self.items.append((self.get_value(iter,0).get_handle(),self.get_value(iter,1)))
update = []
for cur_item in self.items:
found = False
for item in self.original_item_list:
if item[0] == cur_item[0] and \
item[1] == cur_item[1]:
found = True
break
if found:
update.append(item)
return update
class ReposSrcListView:
def __init__(self, db, widget):
self._db = db
self.database_changed(self._db)
self._db.connect('database-changed', self.database_changed)
self._widget = widget
# Create the tree columns
self._col1 = gtk.TreeViewColumn(_("Title"))
self._col2 = gtk.TreeViewColumn(_("Author"))
self._col3 = gtk.TreeViewColumn(_("Reference 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_title)
self._col2.set_cell_data_func(self._col2_cell, self.object_author)
self._col3.set_cell_data_func(self._col3_cell, self.object_ref_note)
self._widget.set_enable_search(False)
def database_changed(self,db):
self._db = db
# Methods for rendering the cells.
def object_title(self, column, cell, model, iter, user_data=None):
source = model.get_value(iter, 0)
cell.set_property('text', source.get_title())
def object_author(self, column, cell, model, iter, user_data=None):
source = model.get_value(iter, 0)
cell.set_property('text', source.get_author())
def object_ref_note(self, column, cell, model, iter, user_data=None):
o = model.get_value(iter, 1)
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()
class EditRepository(DisplayState.ManagedWindow):
def __init__(self,dbstate,uistate,track,repository):
@ -304,22 +86,24 @@ class EditRepository(DisplayState.ManagedWindow):
self.repository.get_type,
dict(Utils.repository_types),
RelLib.Repository.CUSTOM)
self.notebook = self.glade.get_widget("notebook")
# self.phone = self.glade.get_widget("repository_phone")
# self.email = self.glade.get_widget("repository_email")
# self.search_url = self.glade.get_widget("repository_search_url")
# self.home_url = self.glade.get_widget("repository_home_url")
# self.phone.set_editable(mode)
# self.email.set_editable(mode)
# self.search_url.set_editable(mode)
# self.home_url.set_editable(mode)
self.call_number = MonitoredEntry(
self.glade.get_widget('gid'),
self.repository.set_gramps_id,
self.repository.get_gramps_id,
self.db.readonly)
self.notebook = gtk.Notebook()
self.notebook.show()
self.glade.get_widget("vbox").pack_start(self.notebook,True,True)
self.addr_tab = self._add_page(AddrEmbedList(
self.dbstate, self.uistate, self.track,
repository.get_address_list()))
self.url_tab = self._add_page(WebEmbedList(
self.dbstate, self.uistate, self.track,
repository.get_url_list()))
self.note_tab = self._add_page(NoteTab(
self.dbstate, self.uistate, self.track,

View File

@ -49,7 +49,6 @@ import const
import Utils
import RelLib
import NameDisplay
import RepositoryRefEdit
import Spell
import GrampsDisplay
import DisplayState
@ -63,114 +62,6 @@ from GrampsWidgets import *
# Constants
#
#-------------------------------------------------------------------------
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:
def __init__(self, dbstate, widget):
self._dbstate = dbstate
self.database_changed(self._dbstate.db)
self._db.connect('database-changed', self.database_changed)
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)
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)
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()
class EditSource(DisplayState.ManagedWindow):
def __init__(self,dbstate,uistate,track,source,readonly=False):
@ -296,7 +187,8 @@ class EditSource(DisplayState.ManagedWindow):
self.db.add_source(self.source,trans)
else:
self.db.commit_source(self.source,trans)
self.db.transaction_commit(trans,_("Edit Source (%s)") % title)
self.db.transaction_commit(trans,
_("Edit Source (%s)") % self.source.get_title())
self.close(obj)
class DelSrcQuery:

View File

@ -286,7 +286,7 @@ class MonitoredText:
class MonitoredType:
def __init__(self,obj,set_val,get_val,mapping,custom):
def __init__(self,obj,set_val,get_val,mapping,custom,readonly=False):
self.set_val = set_val
self.get_val = get_val
@ -301,6 +301,7 @@ class MonitoredType:
self.sel = AutoComp.StandardCustomSelector(
mapping, obj, custom, default)
self.obj.set_sensitive(not readonly)
self.obj.connect('changed', self.on_change)
def on_change(self, obj):

View File

@ -1,437 +0,0 @@
#
# 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$
#-------------------------------------------------------------------------
#
# Python modules
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
import gtk
import gtk.glade
from gtk.gdk import ACTION_COPY, BUTTON1_MASK, INTERP_BILINEAR, pixbuf_new_from_file
from gobject import TYPE_PYOBJECT
import cPickle as pickle
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
import const
import Utils
import RelLib
import DateEdit
import DateHandler
import AutoComp
import GrampsDisplay
#-------------------------------------------------------------------------
#
# Repository Reference Editor
#
# This is used by both the RepositoryEditor and the SourceEditor
# the UI is slightly different in each case. The subclasses look after
# the difference and the common parts of the UI managed by the base class
#
#-------------------------------------------------------------------------
class RepositoryRefEditBase:
def __init__(self, reposref, dbstate, update, parent):
self.dbstate = dbstate
self.db = dbstate.db
self.parent = parent
# FIXME: window manangement
# if self.parent.__dict__.has_key('child_windows'):
# self.win_parent = self.parent
# else:
# self.win_parent = self.parent.parent
# if reposref:
# if self.win_parent.child_windows.has_key(reposref):
# self.win_parent.child_windows[reposref].present(None)
# return
# else:
# self.win_key = reposref
# else:
# self.win_key = self
self.update = update
self.repos_ref = reposref
self.child_windows = {}
def init_widget(self,top, title):
self.top = top
Utils.set_titles(self.top,
self.top_window.get_widget('title'),
title)
self.top_window.signal_autoconnect({
"on_help_repos_ref_edit_clicked" : self.on_help_clicked,
"on_ok_repos_ref_edit_clicked" : self.on_ok_clicked,
"on_cancel_repos_ref_edit_clicked" : self.close,
"on_repos_ref_edit_delete_event" : self.on_delete_event,
})
self.media_type = self.get_widget("repos_ref_media_type")
self.media_type_selector = AutoComp.StandardCustomSelector( \
Utils.source_media_types,self.media_type,
RelLib.RepoRef.CUSTOM,RelLib.RepoRef.MANUSCRIPT)
self.call_number = self.get_widget("repos_ref_callnumber")
self.note = self.get_widget("repos_ref_note")
self.ok = self.get_widget("repos_ref_ok_button")
def post_init(self):
self.add_itself_to_menu()
self.top.show()
def on_delete_event(self,obj,b):
self.close_child_windows()
self.remove_itself_from_menu()
def close(self,obj):
self.close_child_windows()
self.remove_itself_from_menu()
self.top.destroy()
def close_child_windows(self):
for child_window in self.child_windows.values():
child_window.close(None)
self.child_windows = {}
def add_itself_to_menu(self):
# FIXME
return
self.win_parent.child_windows[self.win_key] = self
label = _('Repository Reference')
self.parent_menu_item = gtk.MenuItem(label)
self.parent_menu_item.set_submenu(gtk.Menu())
self.parent_menu_item.show()
self.win_parent.winsmenu.append(self.parent_menu_item)
self.winsmenu = self.parent_menu_item.get_submenu()
self.menu_item = gtk.MenuItem(_('Repository Information'))
self.menu_item.connect("activate",self.present)
self.menu_item.show()
self.winsmenu.append(self.menu_item)
def remove_itself_from_menu(self):
#FIXME
return
del self.win_parent.child_windows[self.win_key]
self.menu_item.destroy()
self.winsmenu.destroy()
self.parent_menu_item.destroy()
def present(self,obj):
self.top.present()
def get_widget(self,name):
"""returns the widget associated with the specified name"""
return self.top_window.get_widget(name)
def update_display(self,source):
#self.draw(source,fresh=False)
pass
class RepositoryRefEdit(RepositoryRefEditBase):
def __init__(self, reposref, dbstate, update, parent):
RepositoryRefEditBase.__init__(self, reposref,
dbstate, update,
parent)
self.top_window = gtk.glade.XML(const.gladeFile,"repositoryRefEditor","gramps")
self.top = self.top_window.get_widget("repositoryRefEditor")
self.init_widget(self.top,_('Repository Information'))
# setup menu
self.repos_menu = self.get_widget("rep_sel_repository_list")
cell = gtk.CellRendererText()
self.repos_menu.pack_start(cell,True)
self.repos_menu.add_attribute(cell,'text',0)
self.repos_menu.connect('changed',self.on_source_changed)
self.type = self.get_widget("repos_ref_type")
if self.repos_ref:
handle = self.repos_ref.get_reference_handle()
self.active_repos = self.db.get_repository_from_handle(handle)
else:
self.active_repos = None
self.draw(self.active_repos,fresh=True)
self.set_button()
#if self.parent:
# self.top.set_transient_for(self.parent)
self.db.connect('repository-add', self.rebuild_menu)
self.top_window.signal_autoconnect({
"on_add_repos_clicked" : self.add_repos_clicked
})
self.post_init()
def rebuild_menu(self,handle_list):
self.build_repository_menu(handle_list[0])
def on_help_clicked(self,obj):
"""Display the relevant portion of GRAMPS manual"""
GrampsDisplay.help('adv-si')
def set_button(self):
if self.active_repos:
self.ok.set_sensitive(1)
else:
self.ok.set_sensitive(0)
pass
def draw(self,sel=None,fresh=False):
if self.repos_ref and fresh:
self.call_number.set_text(self.repos_ref.get_call_number())
self.note.get_buffer().set_text(self.repos_ref.get_note())
idval = self.repos_ref.get_reference_handle()
repos = self.db.get_repository_from_handle(idval)
self.active_repos = repos
if repos:
self.type.set_text(repos.get_type()[1])
else:
self.type.set_text("")
self.active_repos = sel
if sel:
self.build_repository_menu(sel.get_handle())
else:
self.build_repository_menu(None)
pass
def build_repository_menu(self,selected_handle):
keys = self.db.get_repository_handles()
keys.sort()
store = gtk.ListStore(str)
sel_child = None
index = 0
sel_index = 0
self.handle_list = []
for repos_id in keys:
repos = self.db.get_repository_from_handle(repos_id)
name = repos.get_name()
gid = repos.get_gramps_id()
store.append(row=["%s [%s]" % (name,gid)])
self.handle_list.append(repos_id)
if selected_handle == repos_id:
sel_index = index
index += 1
self.repos_menu.set_model(store)
if index > 0:
self.repos_menu.set_sensitive(1)
self.repos_menu.set_active(sel_index)
else:
self.repos_menu.set_sensitive(0)
def on_ok_clicked(self,obj):
shandle = self.repos_ref.get_reference_handle()
if self.active_repos != self.db.get_repository_from_handle(shandle):
self.repos_ref.set_reference_handle(self.active_repos.get_handle())
# handle type here.
the_type = self.media_type_selector.get_values()
if the_type != self.repos_ref.get_media_type():
self.repos_ref.set_media_type(the_type)
buf = self.note.get_buffer()
note = unicode(buf.get_text(buf.get_start_iter(),
buf.get_end_iter(),False))
if note != self.repos_ref.get_note():
self.repos_ref.set_note(note)
callnumber = unicode(self.call_number.get_text())
if callnumber != self.repos_ref.get_call_number():
self.repos_ref.set_call_number(callnumber)
self.update(self.repos_ref)
self.close(obj)
def on_source_changed(self,obj):
handle = self.handle_list[obj.get_active()]
self.active_repos = self.db.get_repository_from_handle(handle)
self.type.set_text(self.active_repos.get_type()[1])
self.set_button()
pass
def add_repos_clicked(self,obj):
import EditRepository
EditRepository.EditRepository(RelLib.Repository(),self.dbstate, self)
class RepositoryRefSourceEdit(RepositoryRefEditBase):
"""Edit a Repository Reference from the perspective of the Repository."""
def __init__(self, reposref, source, dbstate, update, parent):
RepositoryRefEditBase.__init__(self, reposref,
dbstate, update,
parent)
self.top_window = gtk.glade.XML(const.gladeFile,"repositoryRefSourceEditor","gramps")
self.top = self.top_window.get_widget("repositoryRefSourceEditor")
self.init_widget(self.top,_('Source Information'))
# setup menu
self.source_menu = self.get_widget("rep_sel_source_list")
cell = gtk.CellRendererText()
self.source_menu.pack_start(cell,True)
self.source_menu.add_attribute(cell,'text',0)
self.source_menu.connect('changed',self.on_source_changed)
self.author = self.get_widget("rep_sel_source_author")
self.pub_info = self.get_widget("rep_sel_source_pub_info")
self.original_source = source
self.active_source = source
self.draw(self.active_source,fresh=True)
self.set_button()
#if self.parent:
# self.top.set_transient_for(self.parent)
self.db.connect('source-add', self.rebuild_menu)
self.top_window.signal_autoconnect({
"on_add_source_clicked" : self.add_source_clicked
})
self.post_init()
def rebuild_menu(self,handle_list):
self.build_source_menu(handle_list[0])
def on_help_clicked(self,obj):
"""Display the relevant portion of GRAMPS manual"""
GrampsDisplay.help('adv-si')
def set_button(self):
if self.active_source:
self.ok.set_sensitive(1)
else:
self.ok.set_sensitive(0)
pass
def draw(self,sel=None,fresh=False):
if self.repos_ref and fresh:
self.call_number.set_text(self.repos_ref.get_call_number())
self.note.get_buffer().set_text(self.repos_ref.get_note())
if self.active_source:
self.author.set_text(self.active_source.get_author())
self.pub_info.set_text(self.active_source.get_publication_info())
else:
self.author.set_text("")
self.pub_info.set_text("")
if sel:
self.active_source = sel
self.build_source_menu(sel.get_handle())
else:
self.build_source_menu(None)
pass
def build_source_menu(self,selected_handle):
keys = self.db.get_source_handles()
keys.sort()
store = gtk.ListStore(str)
sel_child = None
index = 0
sel_index = 0
self.handle_list = []
for source_id in keys:
source = self.db.get_source_from_handle(source_id)
name = source.get_title()
gid = source.get_gramps_id()
store.append(row=["%s [%s]" % (name,gid)])
self.handle_list.append(source_id)
if selected_handle == source_id:
sel_index = index
index += 1
self.source_menu.set_model(store)
if index > 0:
self.source_menu.set_sensitive(1)
self.source_menu.set_active(sel_index)
else:
self.source_menu.set_sensitive(0)
def on_ok_clicked(self,obj):
# handle type here.
buf = self.note.get_buffer()
note = unicode(buf.get_text(buf.get_start_iter(),
buf.get_end_iter(),False))
if note != self.repos_ref.get_note():
self.repos_ref.set_note(note)
callnumber = unicode(self.call_number.get_text())
if callnumber != self.repos_ref.get_call_number():
self.repos_ref.set_call_number(callnumber)
self.update(self.active_source,self.repos_ref,self.original_source)
self.close(obj)
def on_source_changed(self,obj):
source_hdl = self.handle_list[obj.get_active()]
self.active_source = self.db.get_source_from_handle(source_hdl)
self.author.set_text(self.active_source.get_author())
self.pub_info.set_text(self.active_source.get_publication_info())
self.set_button()
def add_source_clicked(self,obj):
import EditSource
EditSource.EditSource(RelLib.Source(),self.dbstate, self.parent)

File diff suppressed because it is too large Load Diff