* src/EditPerson.py: more readonly patches

* src/EventEdit.py: more readonly patches
* src/Marriage.py: more readonly patches
* src/gramps.glade: more readonly patches


svn: r4053
This commit is contained in:
Don Allingham 2005-02-19 04:41:59 +00:00
parent c3abb66292
commit 3ca70aac2d
5 changed files with 316 additions and 23 deletions

View File

@ -1,3 +1,9 @@
2005-02-18 Don Allingham <dallingham@users.sourceforge.net>
* src/EditPerson.py: more readonly patches
* src/EventEdit.py: more readonly patches
* src/Marriage.py: more readonly patches
* src/gramps.glade: more readonly patches
2005-02-18 Alex Roitman <shura@alex.neuro.umn.edu>
* src/docgen/LPRDoc.py (draw_path,draw_bar): Fill, then stroke.
* src/DbPrompter.py: Change file filter name.

View File

@ -1116,7 +1116,8 @@ class EditPerson:
pname = self.name_display.display(self.person)
EventEdit.EventEditor(self,pname,const.personalEvents,
const.personal_events,None,None,0,
self.event_edit_callback)
self.event_edit_callback,
noedit=self.db.readonly)
def on_edit_birth_clicked(self,obj):
"""Brings up the EventEditor for the birth record, event
@ -1134,7 +1135,9 @@ class EditPerson:
event.set_place_handle(p)
EventEdit.EventEditor(self,pname,const.personalEvents,
const.personal_events,event,def_placename,1,
self.event_edit_callback)
self.event_edit_callback,
noedit=self.db.readonly)
def on_edit_death_clicked(self,obj):
"""Brings up the EventEditor for the death record, event
@ -1152,7 +1155,8 @@ class EditPerson:
event.set_place_handle(p)
EventEdit.EventEditor(self,pname,const.personalEvents,
const.personal_events,event,def_placename,1,
self.event_edit_callback)
self.event_edit_callback,
noedit=self.db.readonly)
def on_aka_delete_clicked(self,obj):
"""Deletes the selected name from the name list"""
@ -1399,7 +1403,255 @@ class EditPerson:
event = self.etree.get_object(node)
EventEdit.EventEditor(self,pname,const.personalEvents,
const.personal_events,event,None,0,
self.event_edit_callback)
self.event_edit_callback,
noedit=self.db.readonly)
def on_aka_delete_clicked(self,obj):
"""Deletes the selected name from the name list"""
store,node = self.ntree.get_selected()
if node:
self.nlist.remove(self.ntree.get_object(node))
self.lists_changed = True
self.redraw_name_list()
def on_delete_url_clicked(self,obj):
"""Deletes the selected URL from the URL list"""
store,node = self.wtree.get_selected()
if node:
self.ulist.remove(self.wtree.get_object(node))
self.lists_changed = True
self.redraw_url_list()
def on_delete_attr_clicked(self,obj):
"""Deletes the selected attribute from the attribute list"""
store,node = self.atree.get_selected()
if node:
self.alist.remove(self.atree.get_object(node))
self.lists_changed = True
self.redraw_attr_list()
def on_delete_addr_clicked(self,obj):
"""Deletes the selected address from the address list"""
store,node = self.ptree.get_selected()
if node:
self.plist.remove(self.ptree.get_object(node))
self.lists_changed = True
self.redraw_addr_list()
def on_web_go_clicked(self,obj):
"""Attempts to display the selected URL in a web browser"""
text = obj.get()
if text:
gnome.url_show(text)
def on_cancel_edit(self,obj):
"""If the data has changed, give the user a chance to cancel
the close window"""
if self.did_data_change() and not GrampsKeys.get_dont_ask():
n = "<i>%s</i>" % self.person.get_primary_name().get_regular_name()
SaveDialog(_('Save changes to %s?') % n,
_('If you close without saving, the changes you '
'have made will be lost'),
self.cancel_callback,
self.save)
else:
self.close()
def save(self):
self.on_apply_person_clicked(None)
def on_delete_event(self,obj,b):
"""If the data has changed, give the user a chance to cancel
the close window"""
if self.did_data_change() and not GrampsKeys.get_dont_ask():
n = "<i>%s</i>" % self.person.get_primary_name().get_regular_name()
SaveDialog(_('Save Changes to %s?') % n,
_('If you close without saving, the changes you '
'have made will be lost'),
self.cancel_callback,
self.save)
return True
else:
self.close()
return False
def cancel_callback(self):
"""If the user answered yes to abandoning changes, close the window"""
self.close()
def did_data_change(self):
"""Check to see if any of the data has changed from the
orig record"""
surname = unicode(self.surname.get_text())
self.birth.set_date_object(self.birth_date_object)
self.death.set_date_object(self.death_date_object)
ntype = unicode(self.ntype_field.child.get_text())
suffix = unicode(self.suffix.get_text())
prefix = unicode(self.prefix.get_text())
given = unicode(self.given.get_text())
nick = unicode(self.nick.get_text())
title = unicode(self.title.get_text())
male = self.is_male.get_active()
female = self.is_female.get_active()
unknown = self.is_unknown.get_active()
text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(),
self.notes_buffer.get_end_iter(),gtk.FALSE))
format = self.preform.get_active()
idval = unicode(self.gid.get_text())
if idval == "":
idval = None
changed = False
name = self.person.get_primary_name()
if self.complete.get_active() != self.person.get_complete_flag():
changed = True
if self.person.get_gramps_id() != idval:
changed = True
if suffix != name.get_suffix():
changed = True
if self.use_patronymic:
if prefix != name.get_patronymic():
changed = True
elif prefix != name.get_surname_prefix():
changed = True
if surname.upper() != name.get_surname().upper():
changed = True
if ntype != const.NameTypesMap.find_value(name.get_type()):
changed = True
if given != name.get_first_name():
changed = True
if nick != self.person.get_nick_name():
changed = True
if title != name.get_title():
changed = True
if self.pname.get_note() != name.get_note():
changed = True
if not self.lds_not_loaded and self.check_lds():
changed = True
bplace = unicode(self.bplace.get_text().strip())
dplace = unicode(self.dplace.get_text().strip())
if self.pdmap.has_key(bplace):
self.birth.set_place_handle(self.pdmap[bplace])
else:
if bplace != "":
changed = True
self.birth.set_place_handle('')
if self.pdmap.has_key(dplace):
self.death.set_place_handle(self.pdmap[dplace])
else:
if dplace != "":
changed = True
self.death.set_place_handle('')
if not self.birth.are_equal(self.orig_birth):
changed = True
if not self.death.are_equal(self.orig_death):
changed = True
if male and self.person.get_gender() != RelLib.Person.MALE:
changed = True
elif female and self.person.get_gender() != RelLib.Person.FEMALE:
changed = True
elif unknown and self.person.get_gender() != RelLib.Person.UNKNOWN:
changed = True
if text != self.person.get_note():
changed = True
if format != self.person.get_note_format():
changed = True
if not self.lds_not_loaded:
if not self.lds_baptism.are_equal(self.person.get_lds_baptism()):
changed= True
if not self.lds_endowment.are_equal(self.person.get_lds_endowment()):
changed = True
if not self.lds_sealing.are_equal(self.person.get_lds_sealing()):
changed = True
return changed
def check_lds(self):
self.lds_baptism.set_date(unicode(self.ldsbap_date.get_text()))
temple = unicode(self.ldsbap_temple.child.get_text())
if const.lds_temple_codes.has_key(temple):
self.lds_baptism.set_temple(const.lds_temple_codes[temple])
else:
self.lds_baptism.set_temple("")
self.lds_baptism.set_place_handle(self.get_place(self.ldsbapplace,1))
self.lds_endowment.set_date(unicode(self.ldsend_date.get_text()))
temple = unicode(self.ldsend_temple.child.get_text())
if const.lds_temple_codes.has_key(temple):
self.lds_endowment.set_temple(const.lds_temple_codes[temple])
else:
self.lds_endowment.set_temple("")
self.lds_endowment.set_place_handle(self.get_place(self.ldsendowplace,1))
self.lds_sealing.set_date(unicode(self.ldsseal_date.get_text()))
temple = unicode(self.ldsseal_temple.child.get_text())
if const.lds_temple_codes.has_key(temple):
self.lds_sealing.set_temple(const.lds_temple_codes[temple])
else:
self.lds_sealing.set_temple("")
self.lds_sealing.set_family_handle(self.ldsfam)
self.lds_sealing.set_place_handle(self.get_place(self.ldssealplace,1))
def on_event_delete_clicked(self,obj):
"""Delete the selected event"""
if Utils.delete_selected(obj,self.elist):
self.lists_changed = True
self.redraw_event_list()
def update_birth_death(self):
self.bplace.set_text(place_title(self.db,self.birth))
self.dplace.set_text(place_title(self.db,self.death))
self.bdate.set_text(self.dd.display(self.birth_date_object))
self.ddate.set_text(self.dd.display(self.death_date_object))
def on_update_attr_clicked(self,obj):
import AttrEdit
store,node = self.atree.get_selected()
if node:
attr = self.atree.get_object(node)
pname = self.name_display.display(self.person)
AttrEdit.AttributeEditor(self,attr,pname,const.personalAttributes,
self.attr_edit_callback,self.window)
def on_update_addr_clicked(self,obj):
import AddrEdit
store,node = self.ptree.get_selected()
if node:
AddrEdit.AddressEditor(self,self.ptree.get_object(node),
self.addr_edit_callback,self.window)
def on_update_url_clicked(self,obj):
import UrlEdit
store,node = self.wtree.get_selected()
if node:
pname = self.name_display.display(self.person)
url = self.wtree.get_object(node)
UrlEdit.UrlEditor(self,pname,url,self.url_edit_callback,self.window)
def on_event_update_clicked(self,obj):
import EventEdit
store,node = self.etree.get_selected()
if not node:
return
pname = self.name_display.display(self.person)
event = self.etree.get_object(node)
EventEdit.EventEditor(self,pname,const.personalEvents,
const.personal_events,event,None,0,
noedit=self.db.readonly)
def on_event_select_row(self,obj):
store,node = obj.get_selected()

View File

@ -61,8 +61,8 @@ from QuestionDialog import WarningDialog
#-------------------------------------------------------------------------
class EventEditor:
def __init__(self,parent,name,elist,trans,event,def_placename,read_only,cb,
def_event=None):
def __init__(self,parent,name,elist,trans,event,def_placename,
read_only, cb, def_event=None, noedit=False):
self.parent = parent
self.db = self.parent.db
if event:
@ -128,38 +128,58 @@ class EventEditor:
_('Event Editor'))
self.place_field = self.top.get_widget("eventPlace")
self.place_field.set_editable(not noedit)
self.cause_field = self.top.get_widget("eventCause")
self.cause_field.set_editable(not noedit)
self.slist = self.top.get_widget("slist")
self.wlist = self.top.get_widget("wlist")
self.place_combo = self.top.get_widget("eventPlace_combo")
self.date_field = self.top.get_widget("eventDate")
self.cause_field = self.top.get_widget("eventCause")
self.date_field.set_editable(not noedit)
self.descr_field = self.top.get_widget("event_description")
self.descr_field.set_editable(not noedit)
self.note_field = self.top.get_widget("eventNote")
self.note_field.set_editable(not noedit)
self.event_menu = self.top.get_widget("personal_events")
self.priv = self.top.get_widget("priv")
self.priv.set_sensitive(not noedit)
self.sources_label = self.top.get_widget("sourcesEvent")
self.notes_label = self.top.get_widget("notesEvent")
self.flowed = self.top.get_widget("eventflowed")
self.flowed.set_sensitive(not noedit)
self.preform = self.top.get_widget("eventpreform")
self.preform.set_sensitive(not noedit)
self.gallery_label = self.top.get_widget("galleryEvent")
self.witnesses_label = self.top.get_widget("witnessesEvent")
self.top.get_widget('ok').set_sensitive(not noedit)
if read_only:
self.event_menu.set_sensitive(0)
if read_only or not noedit:
self.event_menu.set_sensitive(False)
self.date_field.grab_focus()
add_src = self.top.get_widget('add_src')
add_src.set_sensitive(not noedit)
del_src = self.top.get_widget('del_src')
del_src.set_sensitive(not noedit)
self.sourcetab = Sources.SourceTab(self.srcreflist,self,
self.top,self.window,self.slist,
self.top.get_widget('add_src'),
add_src,
self.top.get_widget('edit_src'),
self.top.get_widget('del_src'))
del_src, self.db.readonly
)
add_witness = self.top.get_widget('add_witness')
add_witness.set_sensitive(not noedit)
edit_witness = self.top.get_widget('edit_witness')
del_witness = self.top.get_widget('del_witness')
del_witness.set_sensitive(not noedit)
self.witnesstab = Witness.WitnessTab(self.witnesslist,self,
self.top,self.window,self.wlist,
self.top.get_widget('add_witness'),
self.top.get_widget('edit_witness'),
self.top.get_widget('del_witness'))
add_witness,
edit_witness,
del_witness)
AutoComp.fill_combo(self.event_menu,self.elist)
AutoComp.fill_entry(self.place_field,self.pmap.keys())
@ -204,7 +224,8 @@ class EventEditor:
if not event:
event = RelLib.Event()
self.icon_list = self.top.get_widget("iconlist")
self.gallery = ImageSelect.Gallery(event, self.db.commit_event, self.path, self.icon_list,
self.gallery = ImageSelect.Gallery(event, self.db.commit_event,
self.path, self.icon_list,
self.db,self,self.window)
self.top.signal_autoconnect({
@ -220,6 +241,10 @@ class EventEditor:
"on_editphoto_clicked" : self.gallery.on_edit_media_clicked,
})
self.top.get_widget('del_obj').set_sensitive(not noedit)
self.top.get_widget('sel_obj').set_sensitive(not noedit)
self.top.get_widget('add_obj').set_sensitive(not noedit)
self.window.set_transient_for(self.parent.window)
self.add_itself_to_menu()
self.window.show()

View File

@ -131,6 +131,8 @@ class Marriage:
})
mode = not self.db.readonly
fid = family.get_father_handle()
mid = family.get_mother_handle()
@ -152,14 +154,18 @@ class Marriage:
# widgets
self.complete = self.get_widget('complete')
self.complete.set_sensitive(mode)
self.date_field = self.get_widget("marriageDate")
self.place_field = self.get_widget("marriagePlace")
self.cause_field = self.get_widget("marriageCause")
self.name_field = self.get_widget("marriageEventName")
self.descr_field = self.get_widget("marriageDescription")
self.type_field = self.get_widget("marriage_type")
self.type_field.set_sensitive(mode)
self.notes_field = self.get_widget("marriageNotes")
self.notes_field.set_editable(mode)
self.gid = self.get_widget("gid")
self.gid.set_editable(mode)
self.attr_list = self.get_widget("attr_list")
self.attr_type = self.get_widget("attr_type")
self.attr_value = self.get_widget("attr_value")
@ -168,9 +174,13 @@ class Marriage:
self.attr_src_field = self.get_widget("attr_srcinfo")
self.attr_conf_field = self.get_widget("attr_conf")
self.lds_date = self.get_widget("lds_date")
self.lds_date.set_editable(mode)
self.lds_temple = self.get_widget("lds_temple")
self.lds_temple.set_sensitive(mode)
self.lds_status = self.get_widget("lds_status")
self.lds_status.set_sensitive(mode)
self.lds_place = self.get_widget("lds_place")
self.lds_place.set_sensitive(mode)
self.slist = self.get_widget("slist")
self.sources_label = self.get_widget("sourcesMarriage")
self.gallery_label = self.get_widget("galleryMarriage")
@ -181,7 +191,9 @@ class Marriage:
self.lds_label = self.get_widget("ldsMarriage")
self.flowed = self.get_widget("mar_flowed")
self.flowed.set_sensitive(mode)
self.preform = self.get_widget("mar_preform")
self.preform.set_sensitive(mode)
self.elist = family.get_event_list()[:]
self.alist = family.get_attribute_list()[:]
@ -210,7 +222,6 @@ class Marriage:
frel = family.get_relationship()
self.type_field.set_active(frel)
self.gid.set_text(family.get_gramps_id())
self.gid.set_editable(1)
AutoComp.fill_combo(self.lds_temple,_temple_names)
@ -286,7 +297,6 @@ class Marriage:
self.add_itself_to_winsmenu()
self.top.get_widget('ok').set_sensitive(not self.db.readonly)
mode = not self.db.readonly
self.top.get_widget('marriage_del').set_sensitive(mode)
self.top.get_widget('marriage_add').set_sensitive(mode)
self.top.get_widget('attr_del').set_sensitive(mode)

View File

@ -26496,7 +26496,7 @@ Very High</property>
</child>
<child>
<widget class="GtkButton" id="button113">
<widget class="GtkButton" id="ok">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Accept changes and close window</property>
<property name="can_default">True</property>
@ -27451,7 +27451,7 @@ Very High</property>
<property name="spacing">6</property>
<child>
<widget class="GtkButton" id="button170">
<widget class="GtkButton" id="add_obj">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Add a new media object to the database and place it in this gallery</property>
<property name="can_focus">True</property>
@ -27479,7 +27479,7 @@ Very High</property>
</child>
<child>
<widget class="GtkButton" id="button171">
<widget class="GtkButton" id="sel_obj">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Select an existing media object from the database and place it in this gallery</property>
<property name="can_focus">True</property>
@ -27534,7 +27534,7 @@ Very High</property>
</child>
<child>
<widget class="GtkButton" id="button173">
<widget class="GtkButton" id="del_obj">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Remove selected object from this gallery only</property>
<property name="can_focus">True</property>