Fixed notes, sources being saved properly

svn: r293
This commit is contained in:
Don Allingham
2001-08-05 18:42:11 +00:00
parent b41fe16139
commit af44271357
6 changed files with 944 additions and 918 deletions

View File

@@ -2512,8 +2512,8 @@
<wrap>False</wrap> <wrap>False</wrap>
<xalign>0</xalign> <xalign>0</xalign>
<yalign>0.5</yalign> <yalign>0.5</yalign>
<xpad>3</xpad> <xpad>0</xpad>
<ypad>3</ypad> <ypad>0</ypad>
<child> <child>
<left_attach>1</left_attach> <left_attach>1</left_attach>
<right_attach>4</right_attach> <right_attach>4</right_attach>
@@ -2538,8 +2538,8 @@
<wrap>False</wrap> <wrap>False</wrap>
<xalign>0</xalign> <xalign>0</xalign>
<yalign>0.5</yalign> <yalign>0.5</yalign>
<xpad>3</xpad> <xpad>0</xpad>
<ypad>3</ypad> <ypad>0</ypad>
<child> <child>
<left_attach>1</left_attach> <left_attach>1</left_attach>
<right_attach>2</right_attach> <right_attach>2</right_attach>

View File

@@ -144,6 +144,10 @@ class EditPerson:
self.ulist = person.getUrlList()[:] self.ulist = person.getUrlList()[:]
self.plist = person.getAddressList()[:] self.plist = person.getAddressList()[:]
self.death = Event(person.getDeath())
self.birth = Event(person.getBirth())
self.pname = Name(person.getPrimaryName())
self.selectedIcon = -1 self.selectedIcon = -1
self.top_window.signal_autoconnect({ self.top_window.signal_autoconnect({
@@ -179,7 +183,6 @@ class EditPerson:
"on_name_source_clicked" : on_primary_name_source_clicked, "on_name_source_clicked" : on_primary_name_source_clicked,
"on_photolist_button_press_event" : on_photolist_button_press_event, "on_photolist_button_press_event" : on_photolist_button_press_event,
"on_photolist_select_icon" : on_photo_select_icon, "on_photolist_select_icon" : on_photo_select_icon,
"on_showsource_clicked" : on_showsource_clicked,
"on_update_address_clicked" : on_update_address_clicked, "on_update_address_clicked" : on_update_address_clicked,
"on_update_attr_clicked" : on_update_attr_clicked, "on_update_attr_clicked" : on_update_attr_clicked,
"on_update_url_clicked" : on_update_url_clicked, "on_update_url_clicked" : on_update_url_clicked,
@@ -190,10 +193,6 @@ class EditPerson:
const.surnames.sort() const.surnames.sort()
self.get_widget("lastNameList").set_popdown_strings(const.surnames) self.get_widget("lastNameList").set_popdown_strings(const.surnames)
name = person.getPrimaryName()
birth = person.getBirth()
death = person.getDeath()
self.get_widget("gid").set_text(": %s" % person.getId()) self.get_widget("gid").set_text(": %s" % person.getId())
self.event_list.set_column_visibility(3,Config.show_detail) self.event_list.set_column_visibility(3,Config.show_detail)
self.name_list.set_column_visibility(1,Config.show_detail) self.name_list.set_column_visibility(1,Config.show_detail)
@@ -218,10 +217,10 @@ class EditPerson:
# initial values # initial values
self.get_widget("activepersonTitle").set_text(Config.nameof(person)) self.get_widget("activepersonTitle").set_text(Config.nameof(person))
self.suffix.set_text(name.getSuffix()) self.suffix.set_text(self.pname.getSuffix())
self.surname_field.set_text(name.getSurname()) self.surname_field.set_text(self.pname.getSurname())
self.given.set_text(name.getFirstName()) self.given.set_text(self.pname.getFirstName())
if person.getGender() == Person.male: if person.getGender() == Person.male:
self.is_male.set_active(1) self.is_male.set_active(1)
@@ -229,11 +228,11 @@ class EditPerson:
self.is_female.set_active(1) self.is_female.set_active(1)
self.nick.set_text(person.getNickName()) self.nick.set_text(person.getNickName())
self.title.set_text(name.getTitle()) self.title.set_text(self.pname.getTitle())
self.bdate.set_text(birth.getDate()) self.bdate.set_text(self.birth.getDate())
self.bplace.set_text(birth.getPlace()) self.bplace.set_text(self.birth.getPlace())
self.ddate.set_text(death.getDate()) self.ddate.set_text(self.death.getDate())
self.dplace.set_text(death.getPlace()) self.dplace.set_text(self.death.getPlace())
# load photos into the photo window # load photos into the photo window
photo_list = person.getPhotoList() photo_list = person.getPhotoList()
@@ -526,26 +525,28 @@ def did_data_change(obj):
gender = epo.is_male.get_active() gender = epo.is_male.get_active()
text = epo.notes_field.get_chars(0,-1) text = epo.notes_field.get_chars(0,-1)
name = person.getPrimaryName()
birth = person.getBirth()
death = person.getDeath()
changed = 0 changed = 0
name = person.getPrimaryName()
if suffix != name.getSuffix() or surname != name.getSurname(): if suffix != name.getSuffix() or surname != name.getSurname():
changed = 1 changed = 1
if given != name.getFirstName() or nick != person.getNickName(): if given != name.getFirstName() or nick != person.getNickName():
changed = 1 changed = 1
if title != name.getTitle(): if title != name.getTitle():
changed = 1 changed = 1
if epo.pname.getNote() != name.getNote():
newBirth = Event() changed = 1
newBirth.set("Birth",bdate,bplace,"") if not epo.pname.getSourceRef().are_equal(name.getSourceRef()):
if newBirth.compare(birth):
changed = 1 changed = 1
newDeath = Event() epo.birth.setDate(bdate)
newDeath.set("Death",ddate,dplace,"") epo.birth.setPlace(bplace)
if newDeath.compare(death): if not epo.birth.are_equal(epo.person.getBirth()):
changed = 1
epo.death.setDate(ddate)
epo.death.setPlace(dplace)
if not epo.death.are_equal(epo.person.getDeath()):
changed = 1 changed = 1
if gender and person.getGender() == Person.female: if gender and person.getGender() == Person.female:
@@ -1223,59 +1224,49 @@ def save_person(obj):
nick = epo.nick.get_text() nick = epo.nick.get_text()
title = epo.title.get_text() title = epo.title.get_text()
name = person.getPrimaryName() name = epo.pname
if suffix != name.getSuffix(): if suffix != name.getSuffix():
name.setSuffix(suffix) name.setSuffix(suffix)
utils.modified()
if surname != name.getSurname(): if surname != name.getSurname():
name.setSurname(surname) name.setSurname(surname)
if surname not in const.surnames: if surname not in const.surnames:
const.surnames.append(surname) const.surnames.append(surname)
const.surnames.sort() const.surnames.sort()
utils.modified()
if given != name.getFirstName(): if given != name.getFirstName():
name.setFirstName(given) name.setFirstName(given)
if title != name.getTitle():
name.setTitle(title)
if not name.are_equal(epo.person.getPrimaryName()):
epo.person.setPrimaryName(name)
utils.modified() utils.modified()
if nick != person.getNickName(): if nick != person.getNickName():
person.setNickName(nick) person.setNickName(nick)
utils.modified() utils.modified()
if title != name.getTitle():
name.setTitle(title)
utils.modified()
birth = person.getBirth()
bdate = epo.bdate.get_text()
bplace = epo.bplace.get_text() bplace = epo.bplace.get_text()
death = person.getDeath()
ddate = epo.ddate.get_text()
dplace = epo.dplace.get_text() dplace = epo.dplace.get_text()
epo.birth.setDate(epo.bdate.get_text())
epo.birth.setPlace(bplace)
if not person.getBirth().are_equal(epo.birth):
person.setBirth(epo.birth)
epo.death.setDate(epo.ddate.get_text())
epo.death.setPlace(dplace)
if not person.getDeath().are_equal(epo.death):
person.setDeath(epo.death)
for place in [ dplace, bplace ]: for place in [ dplace, bplace ]:
if place not in const.places: if place not in const.places:
const.places.append(place) const.places.append(place)
const.places.sort() const.places.sort()
newBirth = Event()
newBirth.set("Birth",bdate,bplace,"")
if newBirth.compare(birth):
person.setBirth(newBirth)
utils.modified()
newDeath = Event()
newDeath.set("Death",ddate,dplace,"")
if newDeath.compare(death):
person.setDeath(newDeath)
utils.modified()
gender = epo.is_male.get_active() gender = epo.is_male.get_active()
error = 0 error = 0
if gender and person.getGender() == Person.female: if gender and person.getGender() == Person.female:
@@ -1391,7 +1382,7 @@ def on_save_note_clicked(obj):
def on_birth_note_clicked(obj): def on_birth_note_clicked(obj):
epo = obj.get_data(EDITPERSON) epo = obj.get_data(EDITPERSON)
editnote = libglade.GladeXML(const.editnoteFile,"editnote") editnote = libglade.GladeXML(const.editnoteFile,"editnote")
data = epo.person.getBirth() data = epo.birth
textobj = editnote.get_widget("notetext") textobj = editnote.get_widget("notetext")
en_obj = editnote.get_widget("editnote") en_obj = editnote.get_widget("editnote")
en_obj.set_data("n",data) en_obj.set_data("n",data)
@@ -1414,7 +1405,7 @@ def on_birth_note_clicked(obj):
def on_name_note_clicked(obj): def on_name_note_clicked(obj):
epo = obj.get_data(EDITPERSON) epo = obj.get_data(EDITPERSON)
editnote = libglade.GladeXML(const.editnoteFile,"editnote") editnote = libglade.GladeXML(const.editnoteFile,"editnote")
data = epo.person.getPrimaryName() data = epo.pname
textobj = editnote.get_widget("notetext") textobj = editnote.get_widget("notetext")
en_obj = editnote.get_widget("editnote") en_obj = editnote.get_widget("editnote")
en_obj.set_data("n",data) en_obj.set_data("n",data)
@@ -1438,7 +1429,7 @@ def on_death_note_clicked(obj):
epo = obj.get_data(EDITPERSON) epo = obj.get_data(EDITPERSON)
editnote = libglade.GladeXML(const.editnoteFile,"editnote") editnote = libglade.GladeXML(const.editnoteFile,"editnote")
textobj = editnote.get_widget("notetext") textobj = editnote.get_widget("notetext")
data = epo.person.getDeath() data = epo.death
en_obj = editnote.get_widget("editnote") en_obj = editnote.get_widget("editnote")
en_obj.set_data("n",data) en_obj.set_data("n",data)
en_obj.set_data("w",textobj) en_obj.set_data("w",textobj)
@@ -1459,7 +1450,7 @@ def on_death_note_clicked(obj):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_death_source_clicked(obj): def on_death_source_clicked(obj):
epo = obj.get_data(EDITPERSON) epo = obj.get_data(EDITPERSON)
Sources.SourceEditor(epo.person.getDeath(),epo.db) Sources.SourceEditor(epo.death.getSourceRef(),epo.db)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -1468,7 +1459,7 @@ def on_death_source_clicked(obj):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_primary_name_source_clicked(obj): def on_primary_name_source_clicked(obj):
epo = obj.get_data(EDITPERSON) epo = obj.get_data(EDITPERSON)
Sources.SourceEditor(epo.person.getPrimaryName(),epo.db) Sources.SourceEditor(epo.pname.getSourceRef(),epo.db)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -1477,18 +1468,7 @@ def on_primary_name_source_clicked(obj):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_birth_source_clicked(obj): def on_birth_source_clicked(obj):
epo = obj.get_data(EDITPERSON) epo = obj.get_data(EDITPERSON)
Sources.SourceEditor(epo.person.getBirth(),epo.db) Sources.SourceEditor(epo.birth.getSourceRef(),epo.db)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def on_showsource_clicked(obj):
row = obj.get_data(INDEX)
epo = obj.get_data(EDITPERSON)
if row >= 0:
Sources.SourceEditor(obj.get_row_data(row),epo.db)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -1741,7 +1721,7 @@ def on_event_edit_ok_clicked(obj):
if update_event(event,ename,edate,eplace,edesc,enote,epriv,econf): if update_event(event,ename,edate,eplace,edesc,enote,epriv,econf):
ee.parent.events_changed = 1 ee.parent.events_changed = 1
if not source_refs_equal(event.getSourceRef(),ee.srcref): if not event.getSourceRef().are_equal(ee.srcref):
event.setSourceRef(ee.srcref) event.setSourceRef(ee.srcref)
ee.parent.events_changed = 1 ee.parent.events_changed = 1
@@ -1845,7 +1825,7 @@ def on_attrib_edit_ok_clicked(obj):
if update_attrib(attrib,type,value,note,priv,conf): if update_attrib(attrib,type,value,note,priv,conf):
ee.parent.attr_changed = 1 ee.parent.attr_changed = 1
if not source_refs_equal(attrib.getSourceRef(),ee.srcref): if not attrib.getSourceRef().are_equal(ee.srcref):
attrib.setSourceRef(ee.srcref) attrib.setSourceRef(ee.srcref)
ee.parent.events_changed = 1 ee.parent.events_changed = 1
@@ -1952,7 +1932,7 @@ def on_name_edit_ok_clicked(obj):
if update_name(name,first,last,suffix,note,priv,conf): if update_name(name,first,last,suffix,note,priv,conf):
ee.parent.name_changed = 1 ee.parent.name_changed = 1
if not source_refs_equal(name.getSourceRef(),ee.srcref): if not name.getSourceRef().are_equal(ee.srcref):
name.setSourceRef(ee.srcref) name.setSourceRef(ee.srcref)
ee.parent.name_changed = 1 ee.parent.name_changed = 1
@@ -2066,7 +2046,7 @@ def on_addr_edit_ok_clicked(obj):
if update_address(addr,date,street,city,state,country,postal,note,priv,conf): if update_address(addr,date,street,city,state,country,postal,note,priv,conf):
ee.parent.addr_changed = 1 ee.parent.addr_changed = 1
if not source_refs_equal(addr.getSourceRef(),ee.srcref): if not addr.getSourceRef().are_equal(ee.srcref):
addr.setSourceRef(ee.srcref) addr.setSourceRef(ee.srcref)
ee.parent.addr_changed = 1 ee.parent.addr_changed = 1
@@ -2166,22 +2146,3 @@ def get_detail_text(obj):
details = "%s, %s" % (details,_("Private")) details = "%s, %s" % (details,_("Private"))
return details return details
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def source_refs_equal(one,two):
if not one or not two:
return 0
if one.ref != two.ref:
return 0
if one.page != two.page:
return 0
if one.date != two.date:
return 0
if one.comments != two.comments:
return 0
if one.text != two.text:
return 0
return 1

View File

@@ -89,7 +89,6 @@ class Marriage:
"on_marriageUpdateBtn_clicked" : on_update_clicked, "on_marriageUpdateBtn_clicked" : on_update_clicked,
"on_photolist_button_press_event" : on_photolist_button_press_event, "on_photolist_button_press_event" : on_photolist_button_press_event,
"on_photolist_select_icon" : on_photo_select_icon, "on_photolist_select_icon" : on_photo_select_icon,
"on_showsource_clicked" : on_showsource_clicked,
"on_update_attr_clicked" : on_update_attr_clicked, "on_update_attr_clicked" : on_update_attr_clicked,
}) })
@@ -377,8 +376,8 @@ def on_close_marriage_editor(obj):
if family_obj.events_changed: if family_obj.events_changed:
utils.modified() utils.modified()
family_obj.update_events() family_obj.update_attributes()
if family_obj.events_changed: if family_obj.attr_changed:
utils.modified() utils.modified()
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@@ -519,18 +518,6 @@ def update_event(event,name,date,place,desc,note,priv,conf):
changed = 1 changed = 1
return changed return changed
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def on_showsource_clicked(obj):
import Sources
row = obj.get_data(INDEX)
family_obj = obj.get_data(MARRIAGE)
if row >= 0:
Sources.SourceEditor(obj.get_row_data(row),family_obj.db)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -776,6 +763,10 @@ class EventEditor:
def __init__(self,parent,event): def __init__(self,parent,event):
self.parent = parent self.parent = parent
self.event = event self.event = event
if self.event:
self.srcref = SourceRef(self.event.getSourceRef())
else:
self.srcref = SourceRef()
self.top = libglade.GladeXML(const.dialogFile, "event_edit") self.top = libglade.GladeXML(const.dialogFile, "event_edit")
self.window = self.top.get_widget("event_edit") self.window = self.top.get_widget("event_edit")
self.name_field = self.top.get_widget("eventName") self.name_field = self.top.get_widget("eventName")
@@ -847,7 +838,7 @@ class EventEditor:
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_edit_source_clicked(obj): def on_edit_source_clicked(obj):
ee = obj.get_data("o") ee = obj.get_data("o")
Sources.SourceEditor(ee.event,ee.parent.db,ee.source_field) Sources.SourceEditor(ee.srcref,ee.parent.db,ee.source_field)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -873,7 +864,12 @@ def on_event_edit_ok_clicked(obj):
if update_event(event,ename,edate,eplace,edesc,enote,epriv,econf): if update_event(event,ename,edate,eplace,edesc,enote,epriv,econf):
ee.parent.events_changed = 1 ee.parent.events_changed = 1
if not source_refs_equal(event.getSourceRef(),ee.srcref):
event.setSourceRef(ee.srcref)
ee.parent.events_changed = 1
ee.parent.redraw_events() ee.parent.redraw_events()
utils.destroy_passed_object(obj) utils.destroy_passed_object(obj)
@@ -896,6 +892,10 @@ class AttributeEditor:
self.source_field = self.top.get_widget("attr_source") self.source_field = self.top.get_widget("attr_source")
self.conf_menu = self.top.get_widget("conf") self.conf_menu = self.top.get_widget("conf")
self.priv = self.top.get_widget("priv") self.priv = self.top.get_widget("priv")
if self.attrib:
self.srcref = SourceRef(self.attrib.getSourceRef())
else:
self.srcref = SourceRef()
father = parent.family.getFather() father = parent.family.getFather()
mother = parent.family.getMother() mother = parent.family.getMother()
@@ -954,7 +954,7 @@ class AttributeEditor:
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_attrib_source_clicked(obj): def on_attrib_source_clicked(obj):
ee = obj.get_data("o") ee = obj.get_data("o")
Sources.SourceEditor(ee.attrib,ee.parent.db,ee.source_field) Sources.SourceEditor(ee.srcref,ee.parent.db,ee.source_field)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@@ -978,9 +978,14 @@ def on_attrib_edit_ok_clicked(obj):
if update_attrib(attrib,type,value,note,priv,conf): if update_attrib(attrib,type,value,note,priv,conf):
ee.parent.attr_changed = 1 ee.parent.attr_changed = 1
if not source_refs_equal(attrib.getSourceRef(),ee.srcref):
attrib.setSourceRef(ee.srcref)
ee.parent.attr_changed = 1
ee.parent.redraw_attr_list() ee.parent.redraw_attr_list()
utils.destroy_passed_object(obj) utils.destroy_passed_object(obj)
#-------------------------------------------------------------------------
# #
# #
# #
@@ -1017,3 +1022,23 @@ def get_detail_text(obj):
else: else:
details = "%s, %s" % (details,_("Private")) details = "%s, %s" % (details,_("Private"))
return details return details
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def source_refs_equal(one,two):
if not one or not two:
return 0
if one.ref != two.ref:
return 0
if one.page != two.page:
return 0
if one.date != two.date:
return 0
if one.comments != two.comments:
return 0
if one.text != two.text:
return 0
return 1

View File

@@ -90,7 +90,7 @@ class Attribute:
else: else:
self.source_ref = None self.source_ref = None
if source.note: if source.note:
self.note = Note(source.note) self.note = Note(source.note.get())
else: else:
self.note = None self.note = None
self.confidence = 2 self.confidence = 2
@@ -166,7 +166,7 @@ class Address:
else: else:
self.source_ref = None self.source_ref = None
if source.note: if source.note:
self.note = Note(source.note) self.note = Note(source.note.get())
else: else:
self.note = None self.note = None
self.confidence = source.confidence self.confidence = source.confidence
@@ -277,7 +277,7 @@ class Name:
else: else:
self.source_ref = None self.source_ref = None
if source.note: if source.note:
self.note = Note(source.note) self.note = Note(source.note.get())
else: else:
self.note = None self.note = None
self.private = 0 self.private = 0
@@ -372,6 +372,25 @@ class Name:
self.source_ref = SourceRef() self.source_ref = SourceRef()
return self.source_ref return self.source_ref
def are_equal(self,other):
if self.FirstName != other.FirstName:
return 0
if self.Surname != other.Surname:
return 0
if self.Suffix != other.Suffix:
return 0
if self.Title != other.Title:
return 0
if self.private != other.private:
return 0
if self.confidence != other.confidence:
return 0
if self.getNote() != other.getNote():
return 0
if not self.getSourceRef().are_equal(other.getSourceRef()):
return 0
return 1
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# #
@@ -627,7 +646,7 @@ class Event:
else: else:
self.source_ref = None self.source_ref = None
if source.note: if source.note:
self.note = Note(source.note) self.note = Note(source.note.get())
else: else:
self.note = None self.note = None
self.confidence = source.confidence self.confidence = source.confidence
@@ -660,17 +679,24 @@ class Event:
self.description = description self.description = description
self.setDate(date) self.setDate(date)
def compare(self,other): def are_equal(self,other):
if other == None: if other == None:
return 0
if self.name != other.name:
return 0
if self.place != other.place:
return 0
if compare_dates(self.date,other.date):
return 0
if self.description != other.description:
return 0
if self.confidence != other.confidence:
return 0
if self.private != other.private:
return 0
if not self.getSourceRef().are_equal(other.getSourceRef()):
return 0
return 1 return 1
c = cmp(self.name,other.name)
if c == 0:
c = cmp(self.place,other.place)
if c == 0:
c = compare_dates(self.date,other.date)
if c == 0:
return cmp(self.description,other.description)
return c
def setName(self,name) : def setName(self,name) :
self.name = name self.name = name
@@ -745,7 +771,7 @@ class Family:
self.Children = [] self.Children = []
self.Marriage = None self.Marriage = None
self.Divorce = None self.Divorce = None
self.type = "" self.type = "Married"
self.EventList = [] self.EventList = []
self.id = "" self.id = ""
self.photoList = [] self.photoList = []
@@ -966,6 +992,21 @@ class SourceRef:
def getComments(self): def getComments(self):
return self.comments.get() return self.comments.get()
def are_equal(self,other):
if self.ref and other.ref:
if self.page != other.page:
return 0
if compare_dates(self.date,other.date) != 0:
return 0
if self.getText() != other.getText():
return 0
if self.getComments() != other.getComments():
return 0
elif not self.ref and not other.ref:
return 1
else:
return 0
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# #

View File

@@ -66,11 +66,11 @@ class SourceEditor:
# __init__ - Creates a source editor window associated with an event # __init__ - Creates a source editor window associated with an event
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def __init__(self,active_entry,database,update=None): def __init__(self,srcref,database,update=None):
self.db = database self.db = database
self.update = update self.update = update
self.active_entry = active_entry self.source_ref = srcref
self.showSource = libglade.GladeXML(const.gladeFile, "sourceDisplay") self.showSource = libglade.GladeXML(const.gladeFile, "sourceDisplay")
self.showSource.signal_autoconnect({ self.showSource.signal_autoconnect({
"on_sourceok_clicked" : on_sourceok_clicked, "on_sourceok_clicked" : on_sourceok_clicked,
@@ -82,10 +82,6 @@ class SourceEditor:
self.author_field = self.get_widget("sauthor") self.author_field = self.get_widget("sauthor")
self.pub_field = self.get_widget("spubinfo") self.pub_field = self.get_widget("spubinfo")
if active_entry:
self.source_ref = active_entry.getSourceRef()
else:
self.source_ref = None
self.active_source = None self.active_source = None
self.draw() self.draw()
self.sourceDisplay.set_data(SOURCEDISP,self) self.sourceDisplay.set_data(SOURCEDISP,self)
@@ -169,27 +165,22 @@ def on_sourceok_clicked(obj):
src_edit = obj.get_data(SOURCEDISP) src_edit = obj.get_data(SOURCEDISP)
current_source_ref = src_edit.active_entry.getSourceRef() if src_edit.active_source != src_edit.source_ref.getBase():
if current_source_ref == None: src_edit.source_ref.setBase(src_edit.active_source)
current_source_ref = SourceRef()
src_edit.active_entry.setSourceRef(current_source_ref)
if src_edit.active_source != current_source_ref.getBase():
src_edit.active_entry.getSourceRef().setBase(src_edit.active_source)
utils.modified()
page = src_edit.get_widget("spage").get_text() page = src_edit.get_widget("spage").get_text()
date = src_edit.get_widget("sdate").get_text() date = src_edit.get_widget("sdate").get_text()
text = src_edit.get_widget("stext").get_chars(0,-1) text = src_edit.get_widget("stext").get_chars(0,-1)
comments = src_edit.get_widget("scomment").get_chars(0,-1) comments = src_edit.get_widget("scomment").get_chars(0,-1)
current_source_ref.setPage(page) src_edit.source_ref.setPage(page)
current_source_ref.getDate().set(date) src_edit.source_ref.getDate().set(date)
current_source_ref.setText(text) src_edit.source_ref.setText(text)
current_source_ref.setComments(comments) src_edit.source_ref.setComments(comments)
if src_edit.update: if src_edit.update:
if current_source_ref.getBase(): if src_edit.source_ref.getBase():
val = current_source_ref.getBase().getTitle() val = src_edit.source_ref.getBase().getTitle()
else: else:
val = "" val = ""
src_edit.update.set_text(val) src_edit.update.set_text(val)

File diff suppressed because it is too large Load Diff