fix display of shared info warning box

svn: r6384
This commit is contained in:
Don Allingham 2006-04-20 22:32:17 +00:00
parent 5b5cc6f6c7
commit 6fe203dfe2
11 changed files with 57 additions and 28 deletions

View File

@ -1,3 +1,15 @@
2006-04-20 Don Allingham <don@gramps-project.org>
* src/Editors/_EditPlace.py: fix display of shared info warning box
* src/Editors/_EditSourceRef.py: fix display of shared info warning box
* src/Editors/_EditReference.py: fix display of shared info warning box
* src/Editors/_EditSource.py: fix display of shared info warning box
* src/Editors/_EditMediaRef.py: fix display of shared info warning box
* src/Editors/_EditEventRef.py: fix display of shared info warning box
* src/Editors/_EditRepository.py: fix display of shared info warning box
* src/Editors/_EditMedia.py: fix display of shared info warning box
* src/Editors/_EditEvent.py: fix display of shared info warning box
* src/DisplayTabs.py: fix display of shared info warning box
2006-04-20 Alex Roitman <shura@gramps-project.org>
* src/RelLib/_EventRef.py (unserialize): Avoid class constructor.
* src/RelLib/_Person.py (unserialize): Avoid class constructor.

View File

@ -787,21 +787,24 @@ class BackRefList(EmbeddedList):
(_('Name'), 2, 250),
]
def __init__(self, dbstate, uistate, track, obj, refmodel):
def __init__(self, dbstate, uistate, track, obj, refmodel, callback=None):
self.obj = obj
EmbeddedList.__init__(self, dbstate, uistate, track,
_('References'), refmodel)
self._callback = callback
self.model.connect('row-inserted', self.update_label)
def update_label(self, *obj):
if not self.model.empty:
if self.model.count > 0:
self._set_label()
if self._callback and self.model.count > 1:
self._callback()
def close(self):
self.model.close()
def is_empty(self):
return self.model.empty
return self.model.count == 0
def create_buttons(self, share=False):
self.edit_btn = SimpleButton(gtk.STOCK_EDIT, self.edit_button_clicked)
@ -876,36 +879,36 @@ class BackRefList(EmbeddedList):
class SourceBackRefList(BackRefList):
def __init__(self, dbstate, uistate, track, obj):
def __init__(self, dbstate, uistate, track, obj, callback=None):
BackRefList.__init__(self, dbstate, uistate, track, obj,
BackRefModel)
BackRefModel, callback=callback)
def get_icon_name(self):
return 'gramps-source'
class EventBackRefList(BackRefList):
def __init__(self, dbstate, uistate, track, obj):
def __init__(self, dbstate, uistate, track, obj, callback=None):
BackRefList.__init__(self, dbstate, uistate, track, obj,
BackRefModel)
BackRefModel, callback)
def get_icon_name(self):
return 'gramps-event'
class MediaBackRefList(BackRefList):
def __init__(self, dbstate, uistate, track, obj):
def __init__(self, dbstate, uistate, track, obj, callback=None):
BackRefList.__init__(self, dbstate, uistate, track, obj,
BackRefModel)
BackRefModel, callback=callback)
def get_icon_name(self):
return 'gramps-media'
class PlaceBackRefList(BackRefList):
def __init__(self, dbstate, uistate, track, obj):
def __init__(self, dbstate, uistate, track, obj, callback=None):
BackRefList.__init__(self, dbstate, uistate, track, obj,
BackRefModel)
BackRefModel, callback=callback)
def get_icon_name(self):
return 'gramps-place'
@ -2183,16 +2186,16 @@ class BackRefModel(gtk.ListStore):
self.db = db
self.sref_list = sref_list
self.idle = 0
self.empty = True
self.count = 0
self.idle = gobject.idle_add(self.load_model().next)
def close(self):
gobject.source_remove(self.idle)
def load_model(self):
self.empty = True
self.count = 0
for ref in self.sref_list:
self.empty = False
self.count += 1
dtype = ref[0]
if dtype == 'Person':
p = self.db.get_person_from_handle(ref[1])

View File

@ -160,7 +160,9 @@ class EditEvent(EditPrimary):
self.backref_tab = self._add_tab(
notebook,
EventBackRefList(self.dbstate, self.uistate, self.track,
self.dbstate.db.find_backlink_handles(self.obj.handle)))
self.dbstate.db.find_backlink_handles(self.obj.handle),
self.enable_warnbox
))
notebook.show_all()
self.top.get_widget('vbox').pack_start(notebook,True)

View File

@ -170,7 +170,8 @@ class EditEventRef(EditReference):
self.backref_tab = self._add_tab(
notebook,
EventBackRefList(self.dbstate, self.uistate, self.track,
self.db.find_backlink_handles(self.source.handle)))
self.db.find_backlink_handles(self.source.handle),
self.enable_warnbox))
def build_menu_names(self,eventref):
if self.source:

View File

@ -154,7 +154,9 @@ class EditMedia(EditPrimary):
self.backref_list = self._add_tab(
notebook,
MediaBackRefList(self.dbstate,self.uistate,self.track,
self.db.find_backlink_handles(self.obj.handle)))
self.db.find_backlink_handles(self.obj.handle),
self.enable_warnbox
))
notebook.show_all()
self.glade.get_widget('vbox').pack_start(notebook,True)

View File

@ -144,7 +144,9 @@ class EditMediaRef(EditReference):
self.backref_list = self._add_tab(
notebook_src,
MediaBackRefList(self.dbstate,self.uistate,self.track,
self.db.find_backlink_handles(self.source.handle)))
self.db.find_backlink_handles(self.source.handle),
self.enable_warnbox
))
self.note_ref_tab = self._add_tab(
notebook_ref,

View File

@ -179,7 +179,9 @@ class EditPlace(EditPrimary):
self.backref_list = self._add_tab(
notebook,
PlaceBackRefList(self.dbstate,self.uistate,self.track,
self.db.find_backlink_handles(self.obj.handle)))
self.db.find_backlink_handles(self.obj.handle),
self.enable_warnbox
))
def _cleanup_on_exit(self):
self.backref_list.close()

View File

@ -91,11 +91,10 @@ class EditReference(ManagedWindow.ManagedWindow):
self.warn_box = box
def _setup_warnbox(self):
if self.warn_box:
if self.source.handle:
pass
def enable_warnbox(self):
self.warn_box.show_all()
else:
self.warn_box.hide()
def define_expander(self,expander):
expander.set_expanded(True)

View File

@ -106,7 +106,9 @@ class EditRepository(EditPrimary):
self.backref_tab = self._add_tab(
notebook,
SourceBackRefList(self.dbstate, self.uistate, self.track,
self.db.find_backlink_handles(self.obj.handle)))
self.db.find_backlink_handles(self.obj.handle),
self.enable_warnbox
))
notebook.show_all()
self.glade.get_widget("vbox").pack_start(notebook,True,True)

View File

@ -135,7 +135,9 @@ class EditSource(EditPrimary):
self.backref_tab = self._add_tab(
notebook,
SourceBackRefList(self.dbstate, self.uistate, self.track,
self.db.find_backlink_handles(self.obj.handle)))
self.db.find_backlink_handles(self.obj.handle),
self.enable_warnbox
))
notebook.show_all()
self.glade.get_widget('vbox').pack_start(notebook,True)

View File

@ -150,7 +150,9 @@ class EditSourceRef(EditReference):
self.srcref_list = self._add_tab(
notebook_src,
SourceBackRefList(self.dbstate,self.uistate, self.track,
self.db.find_backlink_handles(self.source.handle)))
self.db.find_backlink_handles(self.source.handle),
self.enable_warnbox
))
self.comment_tab = self._add_tab(
notebook_ref,