* src/ChooseParents.py: readonly fixes

* src/EditPerson.py: readonly fixes
* src/EditPlace.py: readonly fixes
* src/EditSource.py: readonly fixes
* src/FamilyView.py: readonly fixes
* src/ImageSelect.py: readonly fixes
* src/Marriage.py: readonly fixes


svn: r4062
This commit is contained in:
Don Allingham 2005-02-20 01:02:15 +00:00
parent 1ea0356d99
commit 25c2598147
10 changed files with 2777 additions and 179 deletions

View File

@ -1,4 +1,13 @@
2005-02-19 Don Allingham <dallingham@users.sourceforge.net>
* src/ChooseParents.py: readonly fixes
* src/EditPerson.py: readonly fixes
* src/EditPlace.py: readonly fixes
* src/EditSource.py: readonly fixes
* src/FamilyView.py: readonly fixes
* src/ImageSelect.py: readonly fixes
* src/Marriage.py: readonly fixes
* src/EditPerson.py: add privacy marker
* src/GrampBSDDB.py: record database version, handle person privacy flag
* src/RelLIb.py: Privacy flag for person (inherit from DataObj instead of SourceNote)

View File

@ -635,9 +635,11 @@ class ModifyParents:
self.family = self.db.get_family_from_handle(family_handle)
self.family_update = family_update
self.full_update = full_update
self.father = self.db.get_person_from_handle(self.family.get_father_handle())
self.mother = self.db.get_person_from_handle(self.family.get_mother_handle())
fid = self.family.get_father_handle()
mid = self.family.get_mother_handle()
self.father = self.db.get_person_from_handle(fid)
self.mother = self.db.get_person_from_handle(mid)
self.glade = gtk.glade.XML(const.gladeFile,"modparents","gramps")
self.top = self.glade.get_widget("modparents")
@ -699,6 +701,11 @@ class ModifyParents:
if parent_window:
self.top.set_transient_for(parent_window)
self.glade.get_widget('fcombo').set_sensitive(False)
self.glade.get_widget('mcombo').set_sensitive(False)
self.glade.get_widget('ok').set_sensitive(False)
self.val = self.top.run()
if self.val == gtk.RESPONSE_OK:
self.save_parents_clicked()

View File

@ -1810,8 +1810,9 @@ class EditPerson:
item = gtk.TearoffMenuItem()
item.show()
menu.append(item)
msg = _("Make the selected name the preferred name")
Utils.add_menuitem(menu,msg,None,self.change_name)
if not self.db.readonly:
msg = _("Make the selected name the preferred name")
Utils.add_menuitem(menu,msg,None,self.change_name)
menu.popup(None,None,None,event.button,event.time)
def on_aka_update_clicked(self,obj):

View File

@ -96,17 +96,30 @@ class EditPlace:
self.glry = ImageSelect.Gallery(place, self.db.commit_place, self.path,
self.iconlist, self.db, self,self.top)
mode = not self.parent.db.readonly
self.title = self.top_window.get_widget("place_title")
self.title.set_editable(mode)
self.city = self.top_window.get_widget("city")
self.city.set_editable(mode)
self.parish = self.top_window.get_widget("parish")
self.parish.set_editable(mode)
self.county = self.top_window.get_widget("county")
self.county.set_editable(mode)
self.state = self.top_window.get_widget("state")
self.state.set_editable(mode)
self.phone = self.top_window.get_widget("phone")
self.phone.set_editable(mode)
self.postal = self.top_window.get_widget("postal")
self.postal.set_editable(mode)
self.country = self.top_window.get_widget("country")
self.country.set_editable(mode)
self.longitude = self.top_window.get_widget("longitude")
self.longitude.set_editable(mode)
self.latitude = self.top_window.get_widget("latitude")
self.latitude.set_editable(mode)
self.note = self.top_window.get_widget("place_note")
self.note.set_editable(mode)
self.web_list = self.top_window.get_widget("web_list")
self.web_url = self.top_window.get_widget("web_url")
@ -117,10 +130,12 @@ class EditPlace:
self.top_window.get_widget('changed').set_text(place.get_change_display())
# event display
self.web_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING)
self.build_columns(self.web_list, [(_('Path'),150), (_('Description'),150)])
self.web_model = gtk.ListStore(str,str)
self.build_columns(self.web_list, [(_('Path'),150),
(_('Description'),150)])
self.web_list.set_model(self.web_model)
self.web_list.get_selection().connect('changed',self.on_web_list_select_row)
self.web_list.get_selection().connect('changed',
self.on_web_list_select_row)
self.loc_edit = self.top_window.get_widget("loc_edit")
self.loc_list = self.top_window.get_widget("loc_list")
@ -135,8 +150,7 @@ class EditPlace:
self.ulist = place.get_url_list()[:]
self.llist = place.get_alternate_locations()[:]
self.loc_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING,
gobject.TYPE_STRING,gobject.TYPE_STRING)
self.loc_model = gtk.ListStore(str,str,str,str)
self.build_columns(self.loc_list, [(_('City'),150), (_('County'),100),
(_('State'),100), (_('Country'),50)])
self.loc_list.set_model(self.loc_model)
@ -174,6 +188,9 @@ class EditPlace:
else:
self.flowed.set_active(1)
self.flowed.set_sensitive(mode)
self.preform.set_sensitive(mode)
if self.place.get_media_list():
Utils.bold_label(self.gallery_label)
@ -197,13 +214,15 @@ class EditPlace:
"on_apply_clicked" : self.on_place_apply_clicked,
})
self.sourcetab = Sources.SourceTab(self.srcreflist,self,
self.top_window,self.top,self.slist,
self.top_window.get_widget('add_src'),
self.top_window.get_widget('edit_src'),
self.top_window.get_widget('del_src'))
self.sourcetab = Sources.SourceTab(
self.srcreflist,self,
self.top_window,self.top,self.slist,
self.top_window.get_widget('add_src'),
self.top_window.get_widget('edit_src'),
self.top_window.get_widget('del_src'),
self.parent.db.readonly)
if self.place.get_handle() == None:
if self.place.get_handle() == None or self.parent.db.readonly:
self.top_window.get_widget("add_photo").set_sensitive(0)
self.top_window.get_widget("delete_photo").set_sensitive(0)
@ -216,6 +235,9 @@ class EditPlace:
self.web_list.connect('drag_data_received',
self.url_dest_drag_data_received)
for name in ['del_name','add_name','sel_photo','add_url','del_url']:
self.top_window.get_widget(name).set_sensitive(mode)
self.redraw_url_list()
self.redraw_location_list()
self.display_references()

View File

@ -55,7 +55,8 @@ import NameDisplay
class EditSource:
def __init__(self,source,db,parent,parent_window=None,func=None):
def __init__(self,source,db,parent,parent_window=None,
func=None,readonly=False):
if source:
self.source = source
else:
@ -78,6 +79,7 @@ class EditSource:
self.ref_not_loaded = 1
self.lists_changed = 0
self.gallery_ok = 0
mode = not self.db.readonly
self.top_window = gtk.glade.XML(const.gladeFile,"sourceEditor","gramps")
self.top = self.top_window.get_widget("sourceEditor")
@ -92,20 +94,33 @@ class EditSource:
self.pubinfo = self.top_window.get_widget("pubinfo")
self.abbrev = self.top_window.get_widget("abbrev")
self.note = self.top_window.get_widget("source_note")
self.note.set_editable(mode)
self.notes_buffer = self.note.get_buffer()
self.gallery_label = self.top_window.get_widget("gallerySourceEditor")
self.refs_label = self.top_window.get_widget("refsSourceEditor")
self.notes_label = self.top_window.get_widget("notesSourceEditor")
self.flowed = self.top_window.get_widget("source_flowed")
self.flowed.set_sensitive(mode)
self.preform = self.top_window.get_widget("source_preform")
self.preform.set_sensitive(mode)
self.refinfo = self.top_window.get_widget("refinfo")
self.title = self.top_window.get_widget("source_title")
self.title.set_text(source.get_title())
self.title.set_editable(mode)
self.author.set_text(source.get_author())
self.author.set_editable(mode)
self.pubinfo.set_text(source.get_publication_info())
self.pubinfo.set_editable(mode)
self.abbrev.set_text(source.get_abbreviation())
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)
if source.get_note():
self.notes_buffer.set_text(source.get_note())
@ -133,9 +148,9 @@ class EditSource:
"on_add_data_clicked" : self.on_add_data_clicked,
})
if self.source.get_handle() == None:
self.top_window.get_widget("edit_photo").set_sensitive(0)
self.top_window.get_widget("delete_photo").set_sensitive(0)
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)
self.datalist = self.top_window.get_widget('datalist')
colno = 0
@ -165,6 +180,8 @@ class EditSource:
if parent_window:
self.top.set_transient_for(parent_window)
self.top_window.get_widget('ok').set_sensitive(not self.db.readonly)
self.display_references()
if parent_window:
self.top.set_transient_for(parent_window)
@ -181,7 +198,6 @@ class EditSource:
focus_cell=None,
start_editing=True)
self.top_window.get_widget('ok').set_sensitive(not self.db.readonly)
def on_delete_data_clicked(self,widget):
(model,node) = self.data_sel.get_selected()

View File

@ -365,16 +365,18 @@ class FamilyView:
back_sensitivity = self.parent.hindex > 0
fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history)
entries = [
(gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity),
(gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity),
(gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity,False),
(gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity,False),
#FIXME: revert to stock item when German gtk translation is fixed
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
(_("Home"),self.parent.on_home_clicked,1),
(_("Add Bookmark"),self.parent.on_add_bookmark_activate,1),
(_("Home"),self.parent.on_home_clicked,1,False),
(_("Add Bookmark"),self.parent.on_add_bookmark_activate,1,True),
]
menu = gtk.Menu()
menu.set_title(_('People Menu'))
for stock_id,callback,sensitivity in entries:
for stock_id,callback,sensitivity,ro in entries:
if ro and self.parent.db.readonly:
continue
item = gtk.ImageMenuItem(stock_id)
#FIXME: remove when German gtk translation is fixed
if stock_id == _("Home"):
@ -422,17 +424,19 @@ class FamilyView:
back_sensitivity = self.parent.hindex > 0
fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history)
entries = [
(gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity),
(gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity),
#FIXME: revert to stock item when German gtk translation is fixed
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
(_("Home"),self.parent.on_home_clicked,1),
(None,None,0),
(_("Add parents"),self.add_parents_clicked,1),
(gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity,False),
(gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity,False),
(gtk.STOCK_HOME,self.parent.on_home_clicked,1,False),
(None,None,0,True),
(_("Add parents"),self.add_parents_clicked,1,True),
]
menu = gtk.Menu()
menu.set_title(_('People Menu'))
for stock_id,callback,sensitivity in entries:
for (stock_id,callback,sensitivity,ro) in entries:
if self.parent.db.readonly and ro:
continue
item = gtk.ImageMenuItem(stock_id)
#FIXME: remove when German gtk translation is fixed
if stock_id == _("Home"):
@ -452,23 +456,18 @@ class FamilyView:
back_sensitivity = self.parent.hindex > 0
fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history)
entries = [
(gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity),
(gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity),
#FIXME: revert to stock item when German gtk translation is fixed
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
(_("Home"),self.parent.on_home_clicked,1),
(None,None,0),
(_("Add parents"),self.add_sp_parents,1),
(gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity,False),
(gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity,False),
(gtk.STOCK_HOME,self.parent.on_home_clicked,1,False),
(None,None,0,True),
(_("Add parents"),self.add_sp_parents,1,True),
]
menu = gtk.Menu()
menu.set_title(_('People Menu'))
for stock_id,callback,sensitivity in entries:
for stock_id,callback,sensitivity,ro in entries:
if ro and self.parent.db.readonly:
continue
item = gtk.ImageMenuItem(stock_id)
#FIXME: remove when German gtk translation is fixed
if stock_id == _("Home"):
im = gtk.image_new_from_stock(gtk.STOCK_HOME,gtk.ICON_SIZE_MENU)
im.show()
item.set_image(im)
if callback:
item.connect("activate",callback)
item.set_sensitive(sensitivity)
@ -527,8 +526,9 @@ class FamilyView:
(_("Edit the selected child"),self.edit_child_callback),
(_("Remove the selected child"),self.remove_child_clicked),
]
for msg,callback in entries:
Utils.add_menuitem(menu,msg,handle,callback)
if not self.parent.db.readonly:
for msg,callback in entries:
Utils.add_menuitem(menu,msg,handle,callback)
menu.popup(None,None,None,event.button,event.time)
def edit_child_callback(self,obj):
@ -599,8 +599,9 @@ class FamilyView:
(_("Edit the selected spouse"), self.edit_spouse_callback),
(_("Set the selected spouse as the preferred spouse"), self.set_preferred_spouse),
]
for msg,callback in entries:
Utils.add_menuitem(menu,msg,None,callback)
if not self.parent.db.readonly:
for msg,callback in entries:
Utils.add_menuitem(menu,msg,None,callback)
menu.popup(None,None,None,event.button,event.time)
def set_preferred_spouse(self,obj):
@ -1158,8 +1159,9 @@ class FamilyView:
(_("Add parents"), self.add_parents_clicked),
(_("Remove parents"),self.del_parents_clicked),
]
for msg,callback in entries:
Utils.add_menuitem(menu,msg,family,callback)
if not self.parent.db.readonly:
for msg,callback in entries:
Utils.add_menuitem(menu,msg,family,callback)
menu.popup(None,None,None,event.button,event.time)
def build_sp_parents_menu(self,family,event):
@ -1196,8 +1198,9 @@ class FamilyView:
(_("Add parents"), self.add_sp_parents),
(_("Remove parents"),self.del_sp_parents),
]
for msg,callback in entries:
Utils.add_menuitem(menu,msg,family,callback)
if not self.parent.db.readonly:
for msg,callback in entries:
Utils.add_menuitem(menu,msg,family,callback)
menu.popup(None,None,None,event.button,event.time)
def edit_ap_relationships(self,obj):

View File

@ -169,7 +169,7 @@ class GrampsBSDDB(GrampsDbBase):
self.undodb = db.DB()
self.undodb.open(self.undolog, db.DB_RECNO, db.DB_CREATE)
if self.metadata.get('version') == None:
if not self.readonly and self.metadata.get('version') == None:
self.metadata['version'] = _DBVERSION
self.metadata = self.dbopen(name, "meta")

View File

@ -895,13 +895,17 @@ class GlobalMediaProperties:
self.date_object = Date.Date()
self.path = self.db.get_save_path()
self.change_dialog = gtk.glade.XML(const.imageselFile,"change_global","gramps")
self.change_dialog = gtk.glade.XML(const.imageselFile,
"change_global","gramps")
mode = not self.db.readonly
title = _('Media Properties Editor')
self.window = self.change_dialog.get_widget('change_global')
self.date_entry = self.change_dialog.get_widget('date')
self.date_entry.set_editable(mode)
self.pdmap = {}
self.add_places = []
for key in self.db.get_place_handles():
@ -909,6 +913,8 @@ class GlobalMediaProperties:
self.pdmap[p[0]] = key
self.place = self.change_dialog.get_widget('place')
self.place.set_editable(mode)
self.place_list = self.pdmap.keys()
self.place_list.sort()
build_dropdown(self.place,self.place_list)
@ -925,11 +931,19 @@ class GlobalMediaProperties:
self.change_dialog.get_widget('title'),title)
self.descr_window = self.change_dialog.get_widget("description")
self.descr_window.set_editable(mode)
self.notes = self.change_dialog.get_widget("notes")
self.date_check = DateEdit.DateEdit(self.date_object,
self.date_entry,
self.change_dialog.get_widget("date_edit"),
self.window)
self.notes.set_editable(mode)
self.date_edit = self.change_dialog.get_widget("date_edit")
self.date_edit.set_sensitive(mode)
self.date_check = DateEdit.DateEdit(
self.date_object,
self.date_entry,
self.date_edit,
self.window)
self.pixmap = self.change_dialog.get_widget("pixmap")
self.attr_type = self.change_dialog.get_widget("attr_type")
@ -942,7 +956,9 @@ class GlobalMediaProperties:
self.notes_label = self.change_dialog.get_widget("notesGlobal")
self.refs_label = self.change_dialog.get_widget("refsGlobal")
self.flowed = self.change_dialog.get_widget("global_flowed")
self.flowed.set_sensitive(mode)
self.preform = self.change_dialog.get_widget("global_preform")
self.preform.set_sensitive(mode)
titles = [(_('Attribute'),0,150),(_('Value'),1,100)]
@ -1002,6 +1018,10 @@ class GlobalMediaProperties:
"on_global_delete_event" : self.on_delete_event,
})
for name in ['gl_del_src','gl_add_src','add_attr','del_attr','ok']:
self.change_dialog.get_widget(name).set_sensitive(mode)
self.redraw_attr_list()
self.display_refs()
if parent_window:

View File

@ -380,7 +380,7 @@ class Marriage:
if lds_ord == None:
lds_ord = RelLib.LdsOrd()
self.family.set_lds_sealing(lds_ord)
NoteEdit.NoteEditor(lds_ord,self,self.window)
NoteEdit.NoteEditor(lds_ord,self,self.window,readonly=self.db.readonly)
def on_up_clicked(self,obj):
model,node = self.etree.get_selected()

File diff suppressed because it is too large Load Diff