fix display of shared info warning box
svn: r6384
This commit is contained in:
parent
5b5cc6f6c7
commit
6fe203dfe2
@ -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>
|
2006-04-20 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/RelLib/_EventRef.py (unserialize): Avoid class constructor.
|
* src/RelLib/_EventRef.py (unserialize): Avoid class constructor.
|
||||||
* src/RelLib/_Person.py (unserialize): Avoid class constructor.
|
* src/RelLib/_Person.py (unserialize): Avoid class constructor.
|
||||||
|
@ -787,21 +787,24 @@ class BackRefList(EmbeddedList):
|
|||||||
(_('Name'), 2, 250),
|
(_('Name'), 2, 250),
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, track, obj, refmodel):
|
def __init__(self, dbstate, uistate, track, obj, refmodel, callback=None):
|
||||||
self.obj = obj
|
self.obj = obj
|
||||||
EmbeddedList.__init__(self, dbstate, uistate, track,
|
EmbeddedList.__init__(self, dbstate, uistate, track,
|
||||||
_('References'), refmodel)
|
_('References'), refmodel)
|
||||||
|
self._callback = callback
|
||||||
self.model.connect('row-inserted', self.update_label)
|
self.model.connect('row-inserted', self.update_label)
|
||||||
|
|
||||||
def update_label(self, *obj):
|
def update_label(self, *obj):
|
||||||
if not self.model.empty:
|
if self.model.count > 0:
|
||||||
self._set_label()
|
self._set_label()
|
||||||
|
if self._callback and self.model.count > 1:
|
||||||
|
self._callback()
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.model.close()
|
self.model.close()
|
||||||
|
|
||||||
def is_empty(self):
|
def is_empty(self):
|
||||||
return self.model.empty
|
return self.model.count == 0
|
||||||
|
|
||||||
def create_buttons(self, share=False):
|
def create_buttons(self, share=False):
|
||||||
self.edit_btn = SimpleButton(gtk.STOCK_EDIT, self.edit_button_clicked)
|
self.edit_btn = SimpleButton(gtk.STOCK_EDIT, self.edit_button_clicked)
|
||||||
@ -876,36 +879,36 @@ class BackRefList(EmbeddedList):
|
|||||||
|
|
||||||
class SourceBackRefList(BackRefList):
|
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,
|
BackRefList.__init__(self, dbstate, uistate, track, obj,
|
||||||
BackRefModel)
|
BackRefModel, callback=callback)
|
||||||
|
|
||||||
def get_icon_name(self):
|
def get_icon_name(self):
|
||||||
return 'gramps-source'
|
return 'gramps-source'
|
||||||
|
|
||||||
class EventBackRefList(BackRefList):
|
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,
|
BackRefList.__init__(self, dbstate, uistate, track, obj,
|
||||||
BackRefModel)
|
BackRefModel, callback)
|
||||||
|
|
||||||
def get_icon_name(self):
|
def get_icon_name(self):
|
||||||
return 'gramps-event'
|
return 'gramps-event'
|
||||||
|
|
||||||
class MediaBackRefList(BackRefList):
|
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,
|
BackRefList.__init__(self, dbstate, uistate, track, obj,
|
||||||
BackRefModel)
|
BackRefModel, callback=callback)
|
||||||
|
|
||||||
def get_icon_name(self):
|
def get_icon_name(self):
|
||||||
return 'gramps-media'
|
return 'gramps-media'
|
||||||
|
|
||||||
class PlaceBackRefList(BackRefList):
|
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,
|
BackRefList.__init__(self, dbstate, uistate, track, obj,
|
||||||
BackRefModel)
|
BackRefModel, callback=callback)
|
||||||
|
|
||||||
def get_icon_name(self):
|
def get_icon_name(self):
|
||||||
return 'gramps-place'
|
return 'gramps-place'
|
||||||
@ -2183,16 +2186,16 @@ class BackRefModel(gtk.ListStore):
|
|||||||
self.db = db
|
self.db = db
|
||||||
self.sref_list = sref_list
|
self.sref_list = sref_list
|
||||||
self.idle = 0
|
self.idle = 0
|
||||||
self.empty = True
|
self.count = 0
|
||||||
self.idle = gobject.idle_add(self.load_model().next)
|
self.idle = gobject.idle_add(self.load_model().next)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
gobject.source_remove(self.idle)
|
gobject.source_remove(self.idle)
|
||||||
|
|
||||||
def load_model(self):
|
def load_model(self):
|
||||||
self.empty = True
|
self.count = 0
|
||||||
for ref in self.sref_list:
|
for ref in self.sref_list:
|
||||||
self.empty = False
|
self.count += 1
|
||||||
dtype = ref[0]
|
dtype = ref[0]
|
||||||
if dtype == 'Person':
|
if dtype == 'Person':
|
||||||
p = self.db.get_person_from_handle(ref[1])
|
p = self.db.get_person_from_handle(ref[1])
|
||||||
|
@ -160,7 +160,9 @@ class EditEvent(EditPrimary):
|
|||||||
self.backref_tab = self._add_tab(
|
self.backref_tab = self._add_tab(
|
||||||
notebook,
|
notebook,
|
||||||
EventBackRefList(self.dbstate, self.uistate, self.track,
|
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()
|
notebook.show_all()
|
||||||
self.top.get_widget('vbox').pack_start(notebook,True)
|
self.top.get_widget('vbox').pack_start(notebook,True)
|
||||||
|
@ -170,7 +170,8 @@ class EditEventRef(EditReference):
|
|||||||
self.backref_tab = self._add_tab(
|
self.backref_tab = self._add_tab(
|
||||||
notebook,
|
notebook,
|
||||||
EventBackRefList(self.dbstate, self.uistate, self.track,
|
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):
|
def build_menu_names(self,eventref):
|
||||||
if self.source:
|
if self.source:
|
||||||
|
@ -154,7 +154,9 @@ class EditMedia(EditPrimary):
|
|||||||
self.backref_list = self._add_tab(
|
self.backref_list = self._add_tab(
|
||||||
notebook,
|
notebook,
|
||||||
MediaBackRefList(self.dbstate,self.uistate,self.track,
|
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()
|
notebook.show_all()
|
||||||
self.glade.get_widget('vbox').pack_start(notebook,True)
|
self.glade.get_widget('vbox').pack_start(notebook,True)
|
||||||
|
@ -144,7 +144,9 @@ class EditMediaRef(EditReference):
|
|||||||
self.backref_list = self._add_tab(
|
self.backref_list = self._add_tab(
|
||||||
notebook_src,
|
notebook_src,
|
||||||
MediaBackRefList(self.dbstate,self.uistate,self.track,
|
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(
|
self.note_ref_tab = self._add_tab(
|
||||||
notebook_ref,
|
notebook_ref,
|
||||||
|
@ -179,7 +179,9 @@ class EditPlace(EditPrimary):
|
|||||||
self.backref_list = self._add_tab(
|
self.backref_list = self._add_tab(
|
||||||
notebook,
|
notebook,
|
||||||
PlaceBackRefList(self.dbstate,self.uistate,self.track,
|
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):
|
def _cleanup_on_exit(self):
|
||||||
self.backref_list.close()
|
self.backref_list.close()
|
||||||
|
@ -91,11 +91,10 @@ class EditReference(ManagedWindow.ManagedWindow):
|
|||||||
self.warn_box = box
|
self.warn_box = box
|
||||||
|
|
||||||
def _setup_warnbox(self):
|
def _setup_warnbox(self):
|
||||||
if self.warn_box:
|
pass
|
||||||
if self.source.handle:
|
|
||||||
|
def enable_warnbox(self):
|
||||||
self.warn_box.show_all()
|
self.warn_box.show_all()
|
||||||
else:
|
|
||||||
self.warn_box.hide()
|
|
||||||
|
|
||||||
def define_expander(self,expander):
|
def define_expander(self,expander):
|
||||||
expander.set_expanded(True)
|
expander.set_expanded(True)
|
||||||
|
@ -106,7 +106,9 @@ class EditRepository(EditPrimary):
|
|||||||
self.backref_tab = self._add_tab(
|
self.backref_tab = self._add_tab(
|
||||||
notebook,
|
notebook,
|
||||||
SourceBackRefList(self.dbstate, self.uistate, self.track,
|
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()
|
notebook.show_all()
|
||||||
self.glade.get_widget("vbox").pack_start(notebook,True,True)
|
self.glade.get_widget("vbox").pack_start(notebook,True,True)
|
||||||
|
@ -135,7 +135,9 @@ class EditSource(EditPrimary):
|
|||||||
self.backref_tab = self._add_tab(
|
self.backref_tab = self._add_tab(
|
||||||
notebook,
|
notebook,
|
||||||
SourceBackRefList(self.dbstate, self.uistate, self.track,
|
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()
|
notebook.show_all()
|
||||||
self.glade.get_widget('vbox').pack_start(notebook,True)
|
self.glade.get_widget('vbox').pack_start(notebook,True)
|
||||||
|
@ -150,7 +150,9 @@ class EditSourceRef(EditReference):
|
|||||||
self.srcref_list = self._add_tab(
|
self.srcref_list = self._add_tab(
|
||||||
notebook_src,
|
notebook_src,
|
||||||
SourceBackRefList(self.dbstate,self.uistate, self.track,
|
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(
|
self.comment_tab = self._add_tab(
|
||||||
notebook_ref,
|
notebook_ref,
|
||||||
|
Loading…
Reference in New Issue
Block a user