* src/DisplayTabs.py: Handle notes properly

* src/EventEdit.py: commit modified events
* src/PeopleModel.py: remove unused functions
* src/PersonView.py: remove debug


svn: r5876
This commit is contained in:
Don Allingham 2006-02-03 22:31:46 +00:00
parent de0559e32c
commit 6c8eae791c
5 changed files with 33 additions and 28 deletions

View File

@ -1,3 +1,9 @@
2006-02-03 Don Allingham <don@gramps-project.org>
* src/DisplayTabs.py: Handle notes properly
* src/EventEdit.py: commit modified events
* src/PeopleModel.py: remove unused functions
* src/PersonView.py: remove debug
2006-02-03 Alex Roitman <shura@gramps-project.org> 2006-02-03 Alex Roitman <shura@gramps-project.org>
* RelLib/_*.py: Make objects serialize all the way down to built-in * RelLib/_*.py: Make objects serialize all the way down to built-in
python objects, so that Gramps classes are never pickled. python objects, so that Gramps classes are never pickled.

View File

@ -574,7 +574,6 @@ class EventEmbedList(EmbeddedList):
def event_updated(self,value): def event_updated(self,value):
self.changed = True self.changed = True
print value
self.rebuild() self.rebuild()
def event_added(self,value): def event_added(self,value):
@ -586,8 +585,8 @@ class EventEmbedList(EmbeddedList):
class PersonEventEmbedList(EventEmbedList): class PersonEventEmbedList(EventEmbedList):
def __init__(self,dbstate,uistate,track,obj): def __init__(self,dbstate,uistate,track,obj):
self.orig_data = [ data for data in [ obj.get_birth_ref(), \ self.orig_data = [ data for data in [ obj.get_birth_ref(), \
obj.get_death_ref()] + \ obj.get_death_ref()] + \
obj.get_event_ref_list() \ obj.get_event_ref_list() \
if data ] if data ]
EventEmbedList.__init__(self, dbstate, uistate, track, obj) EventEmbedList.__init__(self, dbstate, uistate, track, obj)
@ -927,8 +926,8 @@ class NoteTab(GrampsTab):
def build_interface(self): def build_interface(self):
vbox = gtk.VBox() vbox = gtk.VBox()
self.text = gtk.TextView()
self.text = gtk.TextView()
self.flowed = gtk.RadioButton(None,_('Flowed')) self.flowed = gtk.RadioButton(None,_('Flowed'))
self.format = gtk.RadioButton(self.flowed,_('Formatted')) self.format = gtk.RadioButton(self.flowed,_('Formatted'))
@ -944,6 +943,7 @@ class NoteTab(GrampsTab):
scroll = gtk.ScrolledWindow() scroll = gtk.ScrolledWindow()
scroll.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC) scroll.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
scroll.add_with_viewport(self.text) scroll.add_with_viewport(self.text)
scroll.connect('focus-out-event',self.update)
vbox.pack_start(scroll,True) vbox.pack_start(scroll,True)
vbox.set_spacing(6) vbox.set_spacing(6)
@ -963,9 +963,17 @@ class NoteTab(GrampsTab):
else: else:
self.empty = True self.empty = True
self.buf.connect('changed',self._update_label) self.buf.connect('changed',self.update)
self.rebuild() self.rebuild()
def update(self,obj):
self._update_label(obj)
if self.note_obj:
self.note_obj.set(self.buf.get_start_iter(),self.buf.get_end_iter(),False)
else:
print "NOTE OBJ DOES NOT EXIST"
return False
def flow_changed(self,obj): def flow_changed(self,obj):
if obj.get_active(): if obj.get_active():
self.text.set_wrap_mode(gtk.WRAP_WORD) self.text.set_wrap_mode(gtk.WRAP_WORD)

View File

@ -95,11 +95,12 @@ def get_place(field,pmap,db):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class EventEditor(DisplayState.ManagedWindow): class EventEditor(DisplayState.ManagedWindow):
def __init__(self,event,dbstate,uistate,track=[]): def __init__(self,event,dbstate,uistate,track=[],callback=None):
self.db = dbstate.db self.db = dbstate.db
self.uistate = uistate self.uistate = uistate
self.dbstate = dbstate self.dbstate = dbstate
self.track = track self.track = track
self.callback = callback
read_only = self.db.readonly read_only = self.db.readonly
noedit = self.db.readonly noedit = self.db.readonly
@ -245,14 +246,10 @@ class EventEditor(DisplayState.ManagedWindow):
def on_delete_event(self,obj,b): def on_delete_event(self,obj,b):
self.gladeif.close() self.gladeif.close()
# self.gallery.close()
gc.collect()
def close(self,obj): def close(self,obj):
self.gladeif.close() self.gladeif.close()
# self.gallery.close()
self.window.destroy() self.window.destroy()
gc.collect()
def on_help_clicked(self,obj): def on_help_clicked(self,obj):
"""Display the relevant portion of GRAMPS manual""" """Display the relevant portion of GRAMPS manual"""
@ -284,6 +281,7 @@ class EventEditor(DisplayState.ManagedWindow):
self.update_event(event_data,self.date,eplace_obj,edesc,enote,eformat, self.update_event(event_data,self.date,eplace_obj,edesc,enote,eformat,
epriv,ecause) epriv,ecause)
if just_added: if just_added:
trans = self.db.transaction_begin() trans = self.db.transaction_begin()
self.db.add_event(self.event,trans) self.db.add_event(self.event,trans)
@ -292,6 +290,8 @@ class EventEditor(DisplayState.ManagedWindow):
trans = self.db.transaction_begin() trans = self.db.transaction_begin()
self.db.commit_event(self.event,trans) self.db.commit_event(self.event,trans)
self.db.transaction_commit(trans,_("Edit Event")) self.db.transaction_commit(trans,_("Edit Event"))
if self.callback:
self.callback(self.event)
self.close(obj) self.close(obj)
@ -556,14 +556,13 @@ class EventRefEditor(DisplayState.ManagedWindow):
self.lists_changed = 0 self.lists_changed = 0
self.update_event(etype,self.date,eplace_obj,edesc,enote,eformat, self.update_event(etype,self.date,eplace_obj,edesc,enote,eformat,
epriv,ecause) epriv,ecause)
# event is a primary object, so its change has to be committed now
if self.lists_changed: trans = self.db.transaction_begin()
trans = self.db.transaction_begin() self.db.commit_event(self.event,trans)
self.db.commit_event(self.event,trans) if self.event_added:
if self.event_added: self.db.transaction_commit(trans,_("Add Event"))
self.db.transaction_commit(trans,_("Add Event")) else:
else: self.db.transaction_commit(trans,_("Modify Event"))
self.db.transaction_commit(trans,_("Modify Event"))
# then, set properties of the event_ref # then, set properties of the event_ref
self.event_ref.set_role(self.role_selector.get_values()) self.event_ref.set_role(self.role_selector.get_values())

View File

@ -110,8 +110,7 @@ class PeopleModel(gtk.GenericTreeModel):
gtk.GenericTreeModel.__init__(self) gtk.GenericTreeModel.__init__(self)
self.db = db self.db = db
self.visible = {}
self.top_visible = {}
self.invert_result = invert_result self.invert_result = invert_result
self.sortnames = {} self.sortnames = {}
self.marker_color_column = 11 self.marker_color_column = 11
@ -125,7 +124,6 @@ class PeopleModel(gtk.GenericTreeModel):
self.assign_data() self.assign_data()
def calculate_data(self,data_filter=None): def calculate_data(self,data_filter=None):
if data_filter: if data_filter:
self.data_filter = data_filter self.data_filter = data_filter
self.temp_top_path2iter = [] self.temp_top_path2iter = []
@ -174,6 +172,7 @@ class PeopleModel(gtk.GenericTreeModel):
self.build_sub_entry(name) self.build_sub_entry(name)
def build_sub_entry(self,name): def build_sub_entry(self,name):
self.prev_handle = None
slist = map(lambda x: (self.sortnames[x],x),self.temp_sname_sub[name]) slist = map(lambda x: (self.sortnames[x],x),self.temp_sname_sub[name])
slist.sort(lambda f,s: locale.strcoll(f[0],s[0])) slist.sort(lambda f,s: locale.strcoll(f[0],s[0]))
entries = map(lambda x: x[1], slist) entries = map(lambda x: x[1], slist)
@ -249,12 +248,6 @@ class PeopleModel(gtk.GenericTreeModel):
print "".join(traceback.format_exception(*sys.exc_info())) print "".join(traceback.format_exception(*sys.exc_info()))
return u'error' return u'error'
def reset_visible(self):
pass
def set_visible(self,node,val):
pass
def on_iter_next(self, node): def on_iter_next(self, node):
'''returns the next node at this level of the tree''' '''returns the next node at this level of the tree'''
try: try:

View File

@ -545,7 +545,6 @@ class PersonView(PageView.PersonNavView):
# if paths same, just issue row changed signal # if paths same, just issue row changed signal
if oldpath == newpath: if oldpath == newpath:
print "row change", pathval, pnode
self.model.row_changed(pathval,pnode) self.model.row_changed(pathval,pnode)
else: else:
# paths different, get the new surname list # paths different, get the new surname list