* src/gramps_main.py: switch to DB as default, remove save option

* src/RelLib.py: setup DB environment better
* src/DbPrompter.py: handle save/open with new DBs


svn: r2924
This commit is contained in:
Don Allingham 2004-02-28 18:46:40 +00:00
parent e94e313a16
commit 89f2a1cfc7
23 changed files with 94 additions and 251 deletions

View File

@ -1,3 +1,8 @@
2004-02-28 Don Allingham <dallingham@users.sourceforge.net>
* src/gramps_main.py: switch to DB as default, remove save option
* src/RelLib.py: setup DB environment better
* src/DbPrompter.py: handle save/open with new DBs
2004-02-26 Don Allingham <dallingham@users.sourceforge.net>
* src/AddMedia.py: media reference fixes
* src/MediaView.py: media reference fixes

View File

@ -131,7 +131,6 @@ class AddMediaObject:
name = filename
mobj.set_path(name)
Utils.modified()
if self.update:
self.update()
self.object = mobj

View File

@ -192,7 +192,6 @@ class AddSpouse:
Utils.destroy_passed_object(obj)
return
Utils.modified()
if not self.active_family:
self.active_family = self.db.new_family()
self.person.add_family_id(self.active_family.get_id())

View File

@ -78,7 +78,6 @@ class Bookmarks :
def add(self,person_id):
"""appends the person to the bottom of the bookmarks"""
if person_id not in self.bookmarks:
Utils.modified()
self.bookmarks.append(person_id)
self.redraw()

View File

@ -573,8 +573,6 @@ class ChooseParents:
self.db.commit_person(self.father)
if self.mother:
self.db.commit_person(self.mother)
Utils.modified()
class ModifyParents:
def __init__(self,db,person,family_id,family_update,full_update,parent_window=None):
@ -679,7 +677,6 @@ class ModifyParents:
self.person.remove_parent_family_id(self.family.get_id())
self.person.add_parent_family_id(self.family.get_id(),mother_rel,father_rel)
mod = 1
Utils.modified()
if len(self.person.get_parent_family_id_list()):
make_pref = self.pref.get_active()
@ -688,12 +685,10 @@ class ModifyParents:
if make_pref:
if self.family != plist[0]:
self.person.set_main_parent_family_id(self.family.get_id())
Utils.modified()
mod = 1
else:
if self.family == plist[0]:
self.person.set_main_parent_family_id(plist[0])
Utils.modified()
mod = 1
if mod:

View File

@ -92,19 +92,13 @@ class DbPrompter:
"on_ok_button1_clicked": self.save_ok_button_clicked,
"destroy_passed_object": self.cancel_button_clicked,
})
if self.new:
wFs.get_widget('fileselection').set_title('%s - GRAMPS' % _('Create database'))
else:
wFs.get_widget('fileselection').set_title('%s - GRAMPS' % _('Save database'))
wFs.get_widget('fileselection').set_title('%s - GRAMPS' % _('Create database'))
def save_ok_button_clicked(self,obj):
filename = obj.get_filename().encode('iso8859-1')
if filename:
Utils.destroy_passed_object(obj)
if GrampsCfg.usevc and GrampsCfg.vc_comment:
self.db.display_comment_box(filename)
else:
self.db.save_file(filename,_("No Comment Provided"))
self.db.read_file(filename)
def open_activate(self):
wFs = gtk.glade.XML(const.revisionFile, "dbopen","gramps")
@ -140,15 +134,8 @@ class DbPrompter:
if not filename:
return
Utils.destroy_passed_object(obj)
if self.getoldrev.get_active():
vc = VersionControl.RcsVersionControl(filename)
VersionControl.RevisionSelect(self.db.database,filename,vc,
self.db.load_revision,self.show)
else:
self.db.read_file(filename)
self.db.read_file(filename)
def open_delete_event(self,obj,event):
gtk.mainquit()

View File

@ -1593,7 +1593,6 @@ class EditPerson:
self.db.add_place(place)
self.pdmap[text] = place.get_id()
self.add_places.append(place)
Utils.modified()
return place.get_id()
else:
return ''

View File

@ -302,8 +302,6 @@ class EditPlace:
def update_lists(self):
self.place.set_url_list(self.ulist)
self.place.set_alternate_locations(self.llist)
if self.lists_changed:
Utils.modified()
def redraw_url_list(self):
length = Utils.redraw_list(self.ulist,self.web_model,disp_url)
@ -338,7 +336,6 @@ class EditPlace:
text = unicode(field.get_text())
if text != getf():
setf(text)
Utils.modified()
def on_place_apply_clicked(self,obj):
@ -362,15 +359,12 @@ class EditPlace:
if self.lists_changed:
self.place.set_source_reference_list(self.srcreflist)
Utils.modified()
if note != self.place.get_note():
self.place.set_note(note)
Utils.modified()
if format != self.place.get_note_format():
self.place.set_note_format(format)
Utils.modified()
self.gallery_ok = 1
self.update_lists()
@ -559,7 +553,6 @@ class DeletePlaceQuery:
def query_response(self):
self.db.remove_place(self.place.get_id())
Utils.modified()
for key in self.db.get_person_keys():
p = self.db.get_person(key)

View File

@ -306,31 +306,22 @@ class EditSource:
if author != self.source.get_author():
self.source.set_author(author)
Utils.modified()
if title != self.source.get_title():
self.source.set_title(title)
Utils.modified()
if pubinfo != self.source.get_publication_info():
self.source.set_publication_info(pubinfo)
Utils.modified()
if abbrev != self.source.get_abbreviation():
self.source.set_abbreviation(abbrev)
Utils.modified()
if note != self.source.get_note():
self.source.set_note(note)
Utils.modified()
if format != self.source.get_note_format():
self.source.set_note_format(format)
Utils.modified()
if self.lists_changed:
Utils.modified()
self.gallery_ok = 1
if self.callback:
@ -371,7 +362,6 @@ class DelSrcQuery:
def query_response(self):
self.db.remove_source_id(self.source.get_id())
Utils.modified()
for key in self.db.get_person_keys():
p = self.db.get_person(key)

View File

@ -276,7 +276,6 @@ class EventEditor:
self.parent.db.add_place(place)
self.pmap[text] = place.get_id()
self.plist.append(place)
Utils.modified()
return place
else:
return None

View File

@ -728,7 +728,6 @@ class FamilyView:
self.parent.db.commit_person(child)
self.parent.db.commit_family(self.family)
Utils.modified()
self.load_family()
def remove_spouse(self,obj):
@ -775,8 +774,6 @@ class FamilyView:
if len(self.person.get_family_id_list()) <= 1:
self.spouse_selection.set_mode(gtk.SELECTION_NONE)
Utils.modified()
def spouse_swap(self,obj):
if self.selected_spouse:
self.parent.change_active_person(self.selected_spouse)
@ -1232,7 +1229,6 @@ class FamilyView:
person.remove_parent_family_id(fam[0])
self.parent.db.commit_person(person)
Utils.modified()
self.load_family()
def drag_data_received(self,widget,context,x,y,sel_data,info,time):
@ -1268,7 +1264,6 @@ class FamilyView:
return
self.family.set_child_id_list(list)
self.display_marriage(self.family)
Utils.modified()
def drag_data_get(self,widget, context, sel_data, info, time):
store,iter = self.child_selection.get_selected()

View File

@ -492,7 +492,6 @@ class Gallery(ImageSelect):
photo.setLocal(1)
self.parent.lists_changed = 1
if GrampsCfg.globalprop:
Utils.modified()
GlobalMediaProperties(self.db,photo,None)
elif protocol != "":
import urllib
@ -524,7 +523,6 @@ class Gallery(ImageSelect):
self.add_thumbnail(oref)
self.parent.lists_changed = 1
if GrampsCfg.globalprop:
Utils.modified()
GlobalMediaProperties(self.db,photo,None)
else:
if self.db.get_object_map().has_key(data.data):
@ -544,7 +542,6 @@ class Gallery(ImageSelect):
del nl[index]
nl = nl[0:icon_index] + [item] + nl[icon_index:]
self.dataobj.set_media_list(nl)
Utils.modified()
self.parent.lists_changed = 1
self.load_images()
return
@ -556,7 +553,6 @@ class Gallery(ImageSelect):
self.parent.lists_changed = 1
if GrampsCfg.globalprop:
LocalMediaProperties(oref,self.path,self,self.parent_window)
Utils.modified()
def on_photolist_drag_data_get(self,w, context, selection_data, info, time):
if info == 1:
@ -821,14 +817,11 @@ class LocalMediaProperties:
self.photo.set_note(text)
self.photo.set_privacy(priv)
self.parent.lists_changed = 1
Utils.modified()
if format != self.photo.get_note_format():
self.photo.set_note_format(format)
Utils.modified()
if self.lists_changed:
self.photo.set_attribute_list(self.alist)
self.parent.lists_changed = 1
Utils.modified()
self.db.commit_media_object(self.object)
def on_help_clicked(self, obj):
@ -1060,13 +1053,10 @@ class GlobalMediaProperties:
if text != note or desc != self.object.get_description():
self.object.set_note(text)
self.object.set_description(desc)
Utils.modified()
if format != self.object.get_note_format():
self.object.set_note_format(format)
Utils.modified()
if self.lists_changed:
self.object.set_attribute_list(self.alist)
Utils.modified()
if self.update != None:
self.update()
self.db.commit_media_object(self.object)
@ -1124,7 +1114,6 @@ class DeleteMediaQuery:
def query_response(self):
del self.db.get_object_map()[self.media.get_id()]
Utils.modified()
for key in self.db.get_person_keys():
p = self.db.get_person(key)

View File

@ -565,7 +565,6 @@ class Marriage:
del m[family.get_id()]
m[idval] = family
family.set_id(idval)
Utils.modified()
else:
WarningDialog(_("GRAMPS ID value was not changed."),
_('The GRAMPS ID that you chose for this '
@ -587,22 +586,18 @@ class Marriage:
self.family.set_father_id(mother)
self.family.set_mother_id(father)
self.family.set_relationship(val)
Utils.modified()
text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(),
self.notes_buffer.get_end_iter(),gtk.FALSE))
if text != self.family.get_note():
self.family.set_note(text)
Utils.modified()
format = self.preform.get_active()
if format != self.family.get_note_format():
self.family.set_note_format(format)
Utils.modified()
if self.complete.get_active() != self.family.get_complete():
self.family.set_complete(self.complete.get_active())
Utils.modified()
date = unicode(self.lds_date.get_text())
temple = unicode(self.lds_temple.entry.get_text())
@ -621,30 +616,22 @@ class Marriage:
ord.set_status(self.seal_stat)
ord.set_place_id(place)
self.family.set_lds_sealing(ord)
Utils.modified()
else:
d = Date.Date()
d.set(date)
if Date.compare_dates(d,ord.get_date_object()) != 0:
ord.set_date_object(d)
Utils.modified()
if ord.get_temple() != temple:
ord.set_temple(temple)
Utils.modified()
if ord.get_status() != self.seal_stat:
ord.set_status(self.seal_stat)
Utils.modified()
if ord.get_place_id() != place.get_id():
ord.set_place_id(place.get_id())
Utils.modified()
if self.lists_changed:
self.family.set_source_reference_list(self.srcreflist)
Utils.modified()
self.update_lists()
if self.lists_changed:
Utils.modified()
self.update_fv(self.family)
self.db.commit_family(self.family)

View File

@ -302,7 +302,6 @@ class MediaView:
ans.query_response)
else:
self.db.remove_object(mobj.get_id())
Utils.modified()
self.update(0)
def is_object_used(self,mobj):
@ -363,7 +362,6 @@ class MediaView:
description = os.path.basename(name)
photo.set_description(description)
self.db.add_object(photo)
Utils.modified()
self.load_media()
if GrampsCfg.mediaref == 0:
name = RelImage.import_media_object(name,
@ -402,7 +400,6 @@ class MediaView:
except:
photo.set_path(tfile)
return
Utils.modified()
self.db.commit_media_object(photo)
if GrampsCfg.globalprop:
ImageSelect.GlobalMediaProperties(self.db,photo,None)

View File

@ -230,8 +230,6 @@ class MergePeople:
one.add_source_reference(xsrc)
def on_merge_clicked(self,obj):
Utils.modified()
list = self.p1.get_alternate_names()[:]
for xdata in self.p2.get_alternate_names():
for data in list:
@ -903,6 +901,5 @@ class MergePlaces:
self.db.build_place_display(self.p1.get_id(),old_id)
self.update(self.p1.get_id())
Utils.modified()
Utils.destroy_passed_object(obj)

View File

@ -123,5 +123,4 @@ class NoteEditor:
buffer.get_end_iter(),gtk.FALSE))
if text != self.data.get_note():
self.data.set_note(text)
Utils.modified()
self.close(obj)

View File

@ -265,7 +265,6 @@ class PlaceView:
else:
self.db.remove_place(place.get_id())
self.update(0)
Utils.modified()
def on_edit_clicked(self,obj):
"""Display the selected places in the EditPlace display"""

View File

@ -32,6 +32,7 @@ __version__ = "$Revision$"
#-------------------------------------------------------------------------
from re import compile
import os
import os.path
import types
#-------------------------------------------------------------------------
@ -2269,24 +2270,6 @@ class GrampsDB:
def __init__(self):
"""creates a new GrampsDB"""
self.env = db.DBEnv()
flags = db.DB_CREATE|db.DB_INIT_MPOOL
self.env.open(".", flags)
self.person_map = dbshelve.open('person.db', dbname="person", dbenv=self.env)
self.family_map = dbshelve.open('person.db', dbname="family", dbenv=self.env)
self.place_map = dbshelve.open('person.db', dbname="places", dbenv=self.env)
self.source_map = dbshelve.open('person.db', dbname="sources",dbenv=self.env)
self.media_map = dbshelve.open('person.db', dbname="media", dbenv=self.env)
self.event_map = dbshelve.open('person.db', dbname="events", dbenv=self.env)
self.surnames = db.DB(self.env)
self.surnames.set_flags(db.DB_DUP)
self.surnames.open("person.db", "surnames", db.DB_HASH, flags=db.DB_CREATE)
self.person_map.associate(self.surnames, find_surname, db.DB_CREATE)
self.iprefix = "I%04d"
self.sprefix = "S%04d"
self.oprefix = "O%04d"
@ -2297,6 +2280,37 @@ class GrampsDB:
self.added_files = []
self.genderStats = GenderStats ()
self.env = None
self.person_map = None
self.family_map = None
self.place_map = None
self.source_map = None
self.media_map = None
self.event_map = None
self.surnames = None
def load(self,name,callback):
if self.person_map:
self.close()
self.env = db.DBEnv()
flags = db.DB_CREATE|db.DB_INIT_MPOOL|db.DB_PRIVATE
self.env.open(os.path.dirname(name), flags)
name = os.path.basename(name)
self.person_map = dbshelve.open(name, dbname="person", dbenv=self.env)
self.family_map = dbshelve.open(name, dbname="family", dbenv=self.env)
self.place_map = dbshelve.open(name, dbname="places", dbenv=self.env)
self.source_map = dbshelve.open(name, dbname="sources",dbenv=self.env)
self.media_map = dbshelve.open(name, dbname="media", dbenv=self.env)
self.event_map = dbshelve.open(name, dbname="events", dbenv=self.env)
self.surnames = db.DB(self.env)
self.surnames.set_flags(db.DB_DUP)
self.surnames.open(name, "surnames", db.DB_HASH, flags=db.DB_CREATE)
self.person_map.associate(self.surnames, find_surname, db.DB_CREATE)
def close(self):
self.person_map.close()
self.family_map.close()
@ -2305,6 +2319,7 @@ class GrampsDB:
self.media_map.close()
self.event_map.close()
self.surnames.close()
self.env.close()
def get_added_media_objects(self):
return self.added_files
@ -2318,17 +2333,20 @@ class GrampsDB:
def get_base(self):
return ""
def need_autosave(self):
return 1
def get_number_of_people(self):
return len(self.person_map)
def get_person_keys(self):
return self.person_map.keys()
if self.person_map:
return self.person_map.keys()
else:
return []
def get_family_keys(self):
return self.family_map.keys()
if self.family_map:
return self.family_map.keys()
else:
return []
def sort_by_name(self,f,s):
n1 = self.person_map.get(str(f))[2].sname
@ -2336,7 +2354,10 @@ class GrampsDB:
return cmp(n1,n2)
def sort_person_keys(self):
return self.person_map.keys()
if self.person_map:
return self.person_map.keys()
else:
return []
# keys = self.person_map.keys()
# if type(keys) == type([]):
# keys.sort(self.sort_by_name)
@ -2921,13 +2942,18 @@ class GrampsDB:
return cmp(fp,sp)
def sort_place_keys(self):
keys = self.place_map.keys()
if type(keys) == type([]):
keys.sort(self.sortbyplace)
return keys
if self.place_map:
keys = self.place_map.keys()
if type(keys) == type([]):
keys.sort(self.sortbyplace)
return keys
return []
def get_place_id_keys(self):
return self.place_map.keys()
if self.place_map:
return self.place_map.keys()
else:
return []
def get_place_id(self,key):
place = Place()
@ -2941,10 +2967,14 @@ class GrampsDB:
return place.get_display_info()
def get_source_keys(self):
return self.source_map.keys()
if self.source_map:
return self.source_map.keys()
return []
def get_object_keys(self):
return self.media_map.keys()
if self.media_map:
return self.media_map.keys()
return []
def sortbysource(self,f,s):
f1 = self.source_map[f][1].upper()

View File

@ -192,7 +192,6 @@ class SourceView:
ans.query_response,self.topWindow)
else:
self.db.remove_source_id(source.get_id())
Utils.modified()
self.update(0)
def is_used(self,source):

View File

@ -480,7 +480,6 @@ class SourceEditor:
if self.update:
self.update(self.parent,self.source_ref)
Utils.modified()
self.close(obj)
def on_source_changed(self,obj):

View File

@ -51,7 +51,7 @@
<accelerator key="N" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1745">
<widget class="GtkImage" id="image1765">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -73,7 +73,7 @@
<accelerator key="O" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1746">
<widget class="GtkImage" id="image1766">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
@ -86,49 +86,6 @@
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="save1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Save</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_save_activate" last_modification_time="Tue, 01 Apr 2003 03:53:17 GMT"/>
<accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1747">
<property name="visible">True</property>
<property name="stock">gtk-save</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="save_as1">
<property name="visible">True</property>
<property name="label" translatable="yes">Save _As...</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_save_as_activate" last_modification_time="Tue, 01 Apr 2003 03:50:28 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1748">
<property name="visible">True</property>
<property name="stock">gtk-save-as</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="separator9">
<property name="visible">True</property>
@ -150,7 +107,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1749">
<widget class="GtkImage" id="image1767">
<property name="visible">True</property>
<property name="stock">gtk-convert</property>
<property name="icon_size">1</property>
@ -171,7 +128,7 @@
<signal name="activate" handler="on_revert_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1750">
<widget class="GtkImage" id="image1768">
<property name="visible">True</property>
<property name="stock">gtk-revert-to-saved</property>
<property name="icon_size">1</property>
@ -192,7 +149,7 @@
<signal name="activate" handler="on_reload_plugins_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1751">
<widget class="GtkImage" id="image1769">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@ -220,7 +177,7 @@
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1752">
<widget class="GtkImage" id="image1770">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
@ -256,7 +213,7 @@
<accelerator key="Insert" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1753">
<widget class="GtkImage" id="image1771">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -279,7 +236,7 @@
<accelerator key="Delete" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1754">
<widget class="GtkImage" id="image1772">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
@ -317,7 +274,7 @@
<accelerator key="F" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1755">
<widget class="GtkImage" id="image1773">
<property name="visible">True</property>
<property name="stock">gtk-find</property>
<property name="icon_size">1</property>
@ -339,7 +296,7 @@
<accelerator key="M" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1756">
<widget class="GtkImage" id="image1774">
<property name="visible">True</property>
<property name="stock">gtk-convert</property>
<property name="icon_size">1</property>
@ -366,7 +323,7 @@
<signal name="activate" handler="on_preferences1_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1757">
<widget class="GtkImage" id="image1775">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
@ -387,7 +344,7 @@
<signal name="activate" handler="on_default_person_activate" last_modification_time="Sat, 16 Aug 2003 01:58:26 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1758">
<widget class="GtkImage" id="image1776">
<property name="visible">True</property>
<property name="stock">gtk-home</property>
<property name="icon_size">1</property>
@ -473,7 +430,7 @@
<accelerator key="D" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1759">
<widget class="GtkImage" id="image1777">
<property name="visible">True</property>
<property name="stock">gtk-index</property>
<property name="icon_size">1</property>
@ -495,7 +452,7 @@
<accelerator key="B" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1760">
<widget class="GtkImage" id="image1778">
<property name="visible">True</property>
<property name="stock">gnome-stock-book-open</property>
<property name="icon_size">1</property>
@ -568,7 +525,7 @@
<accelerator key="F1" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1761">
<widget class="GtkImage" id="image1779">
<property name="visible">True</property>
<property name="stock">gtk-help</property>
<property name="icon_size">1</property>
@ -589,7 +546,7 @@
<signal name="activate" handler="on_faq_activate" last_modification_time="Wed, 26 Nov 2003 17:59:23 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1762">
<widget class="GtkImage" id="image1780">
<property name="visible">True</property>
<property name="stock">gnome-stock-book-open</property>
<property name="icon_size">1</property>
@ -616,7 +573,7 @@
<signal name="activate" handler="on_gramps_home_page_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1763">
<widget class="GtkImage" id="image1781">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
@ -637,7 +594,7 @@
<signal name="activate" handler="on_gramps_mailing_lists_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1764">
<widget class="GtkImage" id="image1782">
<property name="visible">True</property>
<property name="stock">gnome-stock-mail</property>
<property name="icon_size">1</property>
@ -691,7 +648,7 @@
<signal name="activate" handler="on_about_activate" last_modification_time="Tue, 01 Apr 2003 03:44:24 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1765">
<widget class="GtkImage" id="image1783">
<property name="visible">True</property>
<property name="stock">gnome-stock-about</property>
<property name="icon_size">1</property>
@ -743,17 +700,6 @@
</widget>
</child>
<child>
<widget class="button" id="button3">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Save database</property>
<property name="label" translatable="yes">Save</property>
<property name="use_underline">True</property>
<property name="stock_pixmap">gtk-save</property>
<signal name="clicked" handler="on_save_activate"/>
</widget>
</child>
<child>
<widget class="button" id="back_btn">
<property name="visible">True</property>
@ -6722,7 +6668,7 @@
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Create a new _XML database</property>
<property name="label" translatable="yes">_Create a new database</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>

View File

@ -72,7 +72,6 @@ import EditPerson
import Find
import VersionControl
import ReadXML
import GrampsXML
#-------------------------------------------------------------------------
#
@ -154,10 +153,6 @@ class Gramps:
import DbPrompter
DbPrompter.DbPrompter(self,0,self.topWindow)
if self.db.need_autosave() and GrampsCfg.autosave_int != 0:
Utils.enable_autosave(self.autosave_database,
GrampsCfg.autosave_int)
self.db.set_researcher(GrampsCfg.get_researcher())
def pref_callback(self,val):
@ -325,8 +320,6 @@ class Gramps:
"on_reload_plugins_activate" : Plugins.reload_plugins,
"on_reports_clicked" : self.on_reports_clicked,
"on_revert_activate" : self.on_revert_activate,
"on_save_activate" : self.on_save_activate,
"on_save_as_activate" : self.on_save_as_activate,
"on_show_plugin_status" : self.on_show_plugin_status,
"on_source_list_button_press" : self.source_view.button_press,
"on_sources_activate" : self.on_sources_activate,
@ -884,13 +877,6 @@ class Gramps:
self.people_view.clear_person_tabs()
self.db = GrampsXML.GrampsXML()
self.db.set_iprefix(GrampsCfg.iprefix)
self.db.set_oprefix(GrampsCfg.oprefix)
self.db.set_fprefix(GrampsCfg.fprefix)
self.db.set_sprefix(GrampsCfg.sprefix)
self.db.set_pprefix(GrampsCfg.pprefix)
self.relationship.set_db(self.db)
self.place_view.change_db(self.db)
@ -919,7 +905,6 @@ class Gramps:
self.import_tool_callback()
def import_tool_callback(self):
Utils.modified()
self.people_view.clear_person_tabs()
if Utils.wasHistory_broken():
self.clear_history()
@ -1042,20 +1027,6 @@ class Gramps:
self.topWindow.set_resizable(gtk.FALSE)
filename = os.path.normpath(os.path.abspath(filename))
base = os.path.basename(filename)
if base == const.xmlFile:
filename = os.path.dirname(filename)
elif base == "autosave.gramps":
filename = os.path.dirname(filename)
elif not os.path.isdir(filename):
import DbPrompter
DbPrompter.DbPrompter(self,0,self.topWindow)
self.displayError(_("Database could not be opened"),
_("%s is not a directory.") % filename + ' ' + \
_("You should select a directory that contains a "
"data.gramps file."))
return
self.clear_database()
if self.load_database(filename) == 1:
if filename[-1] == '/':
@ -1073,10 +1044,7 @@ class Gramps:
if filename:
Utils.destroy_passed_object(obj)
self.save_media(filename)
if GrampsCfg.usevc and GrampsCfg.vc_comment:
self.display_comment_box(filename)
else:
self.save_file(filename,_("No Comment Provided"))
self.save_file(filename,_("No Comment Provided"))
def save_media(self,filename):
import RelImage
@ -1172,6 +1140,7 @@ class Gramps:
def save_file(self,filename,comment):
print "save",filename
path = filename
filename = os.path.normpath(os.path.abspath(filename))
self.status_text(_("Saving %s ...") % filename)
@ -1203,8 +1172,8 @@ class Gramps:
old_file = filename
filename = "%s/%s" % (filename,self.db.get_base())
print filename
try:
self.db.save(filename,self.load_progress)
self.db.clear_added_media_objects()
except (OSError,IOError), msg:
emsg = _("Could not create %s") % filename
@ -1341,8 +1310,6 @@ class Gramps:
self.change_active_person(None)
self.redraw_histmenu()
Utils.modified()
def merge_update(self,p1,p2,old_id):
self.people_view.remove_from_person_list(p1,old_id)
self.people_view.remove_from_person_list(p2)
@ -1494,30 +1461,6 @@ class Gramps:
self.on_ok_button2_clicked(fileSelector)
fileSelector.destroy()
def on_save_activate(self,obj):
"""Saves the file, first prompting for a comment if revision
control needs it"""
if not self.db.get_save_path():
self.on_save_as_activate(obj)
else:
if GrampsCfg.usevc and GrampsCfg.vc_comment:
self.display_comment_box(self.db.get_save_path())
else:
msg = _("No Comment Provided")
self.save_file(self.db.get_save_path(),msg)
def on_save_activate_quit(self):
"""Saves the file, first prompting for a comment if revision
control needs it"""
if not self.db.get_save_path():
self.on_save_as_activate(None)
else:
if GrampsCfg.usevc and GrampsCfg.vc_comment:
self.display_comment_box(self.db.get_save_path())
else:
msg = _("No Comment Provided")
self.save_file(self.db.get_save_path(),msg)
def display_comment_box(self,filename):
"""Displays a dialog box, prompting for a revison control comment"""
filename = os.path.normpath(os.path.abspath(filename))
@ -1685,7 +1628,6 @@ class Gramps:
if res.get_name() == "" and owner.get_name():
self.db.set_researcher(owner)
Utils.modified()
self.setup_bookmarks()
@ -1745,7 +1687,7 @@ class Gramps:
def load_database(self,name):
filename = "%s/%s" % (name,const.xmlFile)
filename = name
self.clear_database()
self.status_text(_("Loading %s...") % name)
@ -1825,7 +1767,6 @@ class Gramps:
def set_person(self):
self.db.set_default_person(self.active_person)
Utils.modified()
def export_callback(self,obj,plugin_function):
"""Call the export plugin, with the active person and database"""

View File

@ -141,7 +141,7 @@
<property name="history_id">recentdbs</property>
<property name="max_saved">10</property>
<property name="browse_dialog_title" translatable="yes">Open a database</property>
<property name="directory_entry">True</property>
<property name="directory_entry">False</property>
<property name="modal">True</property>
<child internal-child="entry">