From 006843f5f1b06ce440d0a18b5e9d3fd949b27b84 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 9 Apr 2004 04:05:48 +0000 Subject: [PATCH] export/import filters svn: r3082 --- gramps2/README | 1 - gramps2/TODO | 10 - gramps2/src/Makefile.am | 15 +- gramps2/src/Makefile.in | 15 +- gramps2/src/RelLib.py | 2 +- gramps2/src/WriteXML.py | 16 +- gramps2/src/const.py.in | 2 +- gramps2/src/gramps.glade | 2 +- gramps2/src/gramps.xpm | 101 --------- gramps2/src/pedigree.xpm | 33 --- gramps2/src/people.xpm | 52 ----- gramps2/src/plugins/ReadGedcom.py | 2 - gramps2/src/plugins/ReadPkg.py | 2 +- gramps2/src/plugins/WriteCD.py | 54 +++-- gramps2/src/plugins/WritePkg.py | 16 +- gramps2/src/plugins/pafexport.glade | 327 ---------------------------- 16 files changed, 60 insertions(+), 590 deletions(-) delete mode 100644 gramps2/src/gramps.xpm delete mode 100644 gramps2/src/pedigree.xpm delete mode 100644 gramps2/src/people.xpm delete mode 100644 gramps2/src/plugins/pafexport.glade diff --git a/gramps2/README b/gramps2/README index c1720649c..350120fbf 100644 --- a/gramps2/README +++ b/gramps2/README @@ -9,7 +9,6 @@ The following packages *MUST* be installed in order for Gramps to work: Gnome 2.0 or greater PyGTK2 1.99.14 or greater Gnome-python 1.99.14 or greater - PyXML 0.7.1 or greater Many distributions already provide PyXML, but if your installation does not have it, you can get it from diff --git a/gramps2/TODO b/gramps2/TODO index ddcef63d4..ec9687e3a 100644 --- a/gramps2/TODO +++ b/gramps2/TODO @@ -1,16 +1,6 @@ * Allow for multiple notes. A tabbed interface would be really useful, since there are no titles for notes. Not all objects would necessarily need multiple notes. Determine which ones should and shouldn't. -=== THESE should be obsoleted once we move to a database -* Speed up the reading of the database. The python XML routines are not - as fast as I would like, and it can take a minute or so to read a - large database. This is way too slow. -* Finish the generic load of revision control interfaces to allow a - revision control plugin system. Most of the work is already done. -* Disable the save buttons if gramps database is marked read-only. Disable - the adding of media objects as well, since this will cause gramps to - try to create a thumbnail in a readonly database. -=== * Startup tips. * Date calculator. See http://sourceforge.net/mailarchive/forum.php?thread_id=3252078&forum_id=1993 diff --git a/gramps2/src/Makefile.am b/gramps2/src/Makefile.am index abcdd96b5..bec5d403c 100644 --- a/gramps2/src/Makefile.am +++ b/gramps2/src/Makefile.am @@ -95,21 +95,11 @@ pkgpython_PYTHON = \ # If not using GNU make, then list all files individually # The latter is more portable and POSIX-friendly :) GLADEFILES = \ - dialog.glade\ - edit_person.glade\ - errdialogs.glade\ gramps.glade\ - imagesel.glade\ - marriage.glade\ mergedata.glade\ - places.glade\ plugins.glade\ - preferences.glade\ - revision.glade\ rule.glade\ - srcsel.glade\ - styles.glade\ - choose.glade + styles.glade GRAPHICS = \ bad.png\ @@ -118,12 +108,9 @@ GRAPHICS = \ family48.png\ good.png\ gramps.png\ - gramps.xpm\ logo.png\ media.png\ - pedigree.xpm\ people48.png\ - people.xpm\ place.png\ sources.png\ splash.jpg\ diff --git a/gramps2/src/Makefile.in b/gramps2/src/Makefile.in index ef4775dac..b24776d84 100644 --- a/gramps2/src/Makefile.in +++ b/gramps2/src/Makefile.in @@ -207,21 +207,11 @@ pkgpython_PYTHON = \ # If not using GNU make, then list all files individually # The latter is more portable and POSIX-friendly :) GLADEFILES = \ - dialog.glade\ - edit_person.glade\ - errdialogs.glade\ gramps.glade\ - imagesel.glade\ - marriage.glade\ mergedata.glade\ - places.glade\ plugins.glade\ - preferences.glade\ - revision.glade\ rule.glade\ - srcsel.glade\ - styles.glade\ - choose.glade + styles.glade GRAPHICS = \ @@ -231,12 +221,9 @@ GRAPHICS = \ family48.png\ good.png\ gramps.png\ - gramps.xpm\ logo.png\ media.png\ - pedigree.xpm\ people48.png\ - people.xpm\ place.png\ sources.png\ splash.jpg\ diff --git a/gramps2/src/RelLib.py b/gramps2/src/RelLib.py index 2683f01fd..8f9900fb0 100644 --- a/gramps2/src/RelLib.py +++ b/gramps2/src/RelLib.py @@ -3006,7 +3006,7 @@ class GrampsDB: map[gid] = self.add_event(event,trans) return event - def find_source_from_id(self,val,trans): + def find_source_from_id(self,val,trans=None): """finds a Source in the database from the passed gramps' ID. If no such Source exists, a new Source is added to the database.""" diff --git a/gramps2/src/WriteXML.py b/gramps2/src/WriteXML.py index b4c1e07b2..0b0fbabb0 100644 --- a/gramps2/src/WriteXML.py +++ b/gramps2/src/WriteXML.py @@ -562,14 +562,14 @@ class XmlWriter: else: calstr = '' - if date.isRange(): - d1 = date.get_start_date().getIsoDate() - d2 = date.get_stop_date().getIsoDate() + if date.is_range(): + d1 = date.get_start_date().get_iso_date() + d2 = date.get_stop_date().get_iso_date() self.g.write('%s\n' % (sp,d1,d2,calstr)) - elif date.isValid(): + elif date.is_valid(): d1 = date.get_start_date() - mode = d1.getModeVal() - dstr = d1.getIsoDate() + mode = d1.get_mode_val() + dstr = d1.get_iso_date() if mode == Calendar.BEFORE: pref = ' type="before"' @@ -684,8 +684,8 @@ class XmlWriter: def write_media_list(self,list,indent=3): sp = ' '*indent for photo in list: - mobj = photo.get_reference() - self.g.write('%sFalse True False - gramps.xpm + gramps.png True diff --git a/gramps2/src/gramps.xpm b/gramps2/src/gramps.xpm deleted file mode 100644 index 3063bc1f3..000000000 --- a/gramps2/src/gramps.xpm +++ /dev/null @@ -1,101 +0,0 @@ -/* XPM */ -static char * gramps_xpm[] = { -"48 48 50 1", -" c None", -". c #B39169", -"+ c #E8D3B9", -"@ c #E8D3B8", -"# c #E8D2B7", -"$ c #E7D2B6", -"% c #E7D1B6", -"& c #E7D1B5", -"* c #E7D1B4", -"= c #000000", -"- c #E7D0B4", -"; c #E6D0B3", -"> c #EAD7BE", -", c #EAD6BE", -"' c #EAD6BD", -") c #E9D6BC", -"! c #E9D5BC", -"~ c #E9D5BB", -"{ c #E9D4BA", -"] c #E8D4B9", -"^ c #E6CFB2", -"/ c #E6CFB1", -"( c #E6CEB1", -"_ c #E5CEB0", -": c #E5CDAF", -"< c #E5CDAE", -"[ c #E5CCAE", -"} c #EBD9C1", -"| c #EBD8C1", -"1 c #EBD8C0", -"2 c #EAD8C0", -"3 c #EAD7BF", -"4 c #E4CCAD", -"5 c #E4CCAC", -"6 c #E4CBAC", -"7 c #E4CBAB", -"8 c #E4CAAA", -"9 c #E3CAAA", -"0 c #E3CAA9", -"a c #E3C9A9", -"b c #E3C9A8", -"c c #E3C8A7", -"d c #E2C8A7", -"e c #E2C8A6", -"f c #E2C7A6", -"g c #E2C7A5", -"h c #E2C7A4", -"i c #E2C6A4", -"j c #E1C6A3", -"k c #E1C5A2", -" ", -" ", -" ", -" ", -" .......... ", -" .+@@##$%&. ", -" .@@##$%&*.= ", -" ===.@##$%&*-.= ", -" = .##$%&*-;.= ", -" = .#$%&*-;;.= ", -" .......... = ..........= ", -" .>,')!~~{. = ======== ", -" .,')!~~{{.= = ", -" ===.')!~~{{].==== ", -" = .)!~~{{]+.= = .......... ", -" = .!~~{{]+@.= = .;;^^/(__. ", -" = ..........= = .;^^/(__:.= ", -" = ======== ===.^^/(__::.= ", -" = .^/(__::<.= ", -" = ./(__::<[.= ", -" .......... = ..........= ", -" .}|1233>,. = ======== ", -" .|1233>,'.= = ", -" .1233>,').==== ", -" .233>,')!.= = ", -" .33>,')!~.= = .......... ", -" ..........= = .[4567789. ", -" ======== = .45677890.= ", -" = ===.5677890a.= ", -" = = .677890ab.= ", -" = .......... = .77890abb.= ", -" = .;;^^/(__. = ..........= ", -" = .;^^/(__:.= = ======== ", -" ===.^^/(__::.==== ", -" .^/(__::<.= = ", -" ./(__::<[.= = .......... ", -" ..........= = .bbcdefgh. ", -" ======== = .bcdefghi.= ", -" ===.cdefghij.= ", -" .defghijj.= ", -" .efghijjk.= ", -" ..........= ", -" ======== ", -" ", -" ", -" ", -" ", -" "}; diff --git a/gramps2/src/pedigree.xpm b/gramps2/src/pedigree.xpm deleted file mode 100644 index 356cbfc3d..000000000 --- a/gramps2/src/pedigree.xpm +++ /dev/null @@ -1,33 +0,0 @@ -/* XPM */ -static char * pedegree_xpm[] = { -"22 22 8 1", -" c None", -". c #330066", -"+ c #404040", -"@ c #3F3F3F", -"# c #3C3C3C", -"$ c #3E3E3E", -"% c #434343", -"& c #3D3D3D", -" ", -" ", -" ...... ", -" .++++++ ", -" .+ ", -" .......+ ", -" .++++@.@ ", -" .+ .# ", -" .+ ...... ", -" .+ @@@$$@ ", -" ......+ ", -" +++%.+ ", -" .+ ...... ", -" .+ .++++++ ", -" .@ .+ ", -" .......+ ", -" @&$@@.+ ", -" .+ ", -" ...... ", -" ++++++ ", -" ", -" "}; diff --git a/gramps2/src/people.xpm b/gramps2/src/people.xpm deleted file mode 100644 index a0923f41e..000000000 --- a/gramps2/src/people.xpm +++ /dev/null @@ -1,52 +0,0 @@ -/* XPM */ -static char * icon_people03b_24x24_xpm[] = { -"24 24 25 1", -" c None", -". c #DBD8D1", -"+ c #FBFBFB", -"@ c #B9B4A9", -"# c #BBB6A8", -"$ c #50493B", -"% c #433C31", -"& c #7F796D", -"* c #776E57", -"= c #F0E7C8", -"- c #000000", -"; c #9B9791", -"> c #FFFFFF", -", c #B9B7AB", -"' c #929081", -") c #898777", -"! c #6E6951", -"~ c #817E69", -"{ c #8E8C7B", -"] c #868474", -"^ c #A19E8F", -"/ c #7F796C", -"( c #423C30", -"_ c #50493A", -": c #646464", -" ", -" .++++++++++++++++@ ", -" #$%%%%%%%%%%%%%%&* ", -" #*==============#*- ", -" #*====;;;;;;====#*- ", -" #*===;>>>>>>;===#*- ", -" #*==;>>>,,>>>>==#*- ", -" #*=;>>>,'',>>>>=#*- ", -" #*=;>>>)!!~>>>>=#*- ", -" #*=;>>>!!!!>>>>=#*- ", -" #*=;>>>{!!~>>>>=#*- ", -" #*=;>>>>!!>>>>>=#*- ", -" #*=;>>>,!!,>>>>=#*- ", -" #*=;>>,]!!]^>>>=#*- ", -" #*=;>,]!!!!]^>>=#*- ", -" #*==^!!!!!!!!^==#*- ", -" #*===^!!!!!!^===#*- ", -" #*====^^^^^^====#*- ", -" #*==============#*- ", -" #@++++++++++++++.*- ", -" /((((((((((((((((_- ", -" ------------------ ", -" ::::::::::::::::: ", -" "}; diff --git a/gramps2/src/plugins/ReadGedcom.py b/gramps2/src/plugins/ReadGedcom.py index 5f1f35b94..2df9e54ec 100644 --- a/gramps2/src/plugins/ReadGedcom.py +++ b/gramps2/src/plugins/ReadGedcom.py @@ -507,7 +507,6 @@ class GedcomParser: self.person = self.find_or_create_person(id) self.added[self.person.get_id()] = self.person self.parse_individual() - self.db.build_person_display(self.person.get_id()) self.db.commit_person(self.person) elif matches[2] in ["SUBM","SUBN","REPO"]: self.ignore_sub_junk(1) @@ -1695,7 +1694,6 @@ class GedcomParser: source_ref.set_base_id(s.get_id()) s.set_title('Imported Source #%d' % self.localref) s.set_note(matches[2] + self.parse_continue_data(level)) - self.db.build_source_display(s.get_id()) self.ignore_sub_junk(level+1) else: source_ref.set_base_id(self.db.find_source(matches[2],self.smap).get_id()) diff --git a/gramps2/src/plugins/ReadPkg.py b/gramps2/src/plugins/ReadPkg.py index b1642b07c..110782942 100644 --- a/gramps2/src/plugins/ReadPkg.py +++ b/gramps2/src/plugins/ReadPkg.py @@ -123,7 +123,7 @@ class ReadPkg: os.rmdir(tmpdir_path) self.window.destroy() - self.callback(1) + self.callback() def progress(self,val): self.progress_bar.set_fraction(val) diff --git a/gramps2/src/plugins/WriteCD.py b/gramps2/src/plugins/WriteCD.py index e74b33a9e..553e4f22f 100644 --- a/gramps2/src/plugins/WriteCD.py +++ b/gramps2/src/plugins/WriteCD.py @@ -128,18 +128,25 @@ class PackageWriter: try: uri = gnome.vfs.URI('burn:///%s' % base) gnome.vfs.make_directory(uri,gnome.vfs.OPEN_WRITE) - except gnome.vfs.error, msg: - print msg - os._exit(1) + except gnome.vfs.FileExistsError, msg: + QuestionDialog.ErrorDialog(_("CD export preparation failed"), + "1 %s " % str(msg)) + return + except: + QuestionDialog.ErrorDialog("CD export preparation failed", + 'Could not create burn:///%s' % base) + return try: uri = gnome.vfs.URI('burn:///%s/.thumb' % base) gnome.vfs.make_directory(uri,gnome.vfs.OPEN_WRITE) - except gnome.vfs.error, msg: - print msg - os._exit(1) + except gnome.vfs.FileExistsError, msg: + QuestionDialog.ErrorDialog("CD export preparation failed", + "2 %s " % str(msg)) + return - for obj in self.db.get_object_map().values(): + for obj_id in self.db.get_object_keys(): + obj = self.db.find_object_from_id(obj_id) oldfile = obj.get_path() root = os.path.basename(oldfile) if os.path.isfile(oldfile): @@ -169,41 +176,55 @@ class PackageWriter: try: uri = gnome.vfs.URI('burn:///%s' % base) gnome.vfs.make_directory(uri,gnome.vfs.OPEN_WRITE) - except gnome.vfs.error, msg: - print msg + except gnome.vfs.FileExistsError: + QuestionDialog.ErrorDialog(_("CD export preparation failed"), + "File already exists") + return + except: + QuestionDialog.ErrorDialog(_("CD export preparation failed"), + _('Could not create burn:///%s') % base) + return try: uri = gnome.vfs.URI('burn:///%s/.thumb' % base) gnome.vfs.make_directory(uri,gnome.vfs.OPEN_WRITE) - except gnome.vfs.error, msg: - print msg + except gnome.vfs.FileExistsError, msg: + QuestionDialog.ErrorDialog("CD export preparation failed", + "4 %s " % str(msg)) + return + except: + QuestionDialog.ErrorDialog(_("CD export preparation failed"), + _('Could not create burn:///%s/.thumb') % base) + return #-------------------------------------------------------- def remove_clicked(): # File is lost => remove all references and the object itself mobj = self.db.get_object(self.object_id) - for p in self.db.get_family_id_map().values(): + for p_id in self.db.get_family_keys: + p = self.db.find_family_from_id(p_id) nl = p.get_media_list() for o in nl: if o.get_reference() == mobj: nl.remove(o) p.set_media_list(nl) + for key in self.db.get_person_keys(): - p = self.db.get_person(key) + p = self.db.find_person_from_id(key) nl = p.get_media_list() for o in nl: if o.get_reference() == mobj: nl.remove(o) p.set_media_list(nl) for key in self.db.get_source_keys(): - p = self.db.get_source(key) + p = self.db.find_source_from_id(key) nl = p.get_media_list() for o in nl: if o.get_reference() == mobj: nl.remove(o) p.set_media_list(nl) for key in self.db.get_place_id_keys(): - p = self.db.get_place_id(key) + p = self.db.find_place_from_id(key) nl = p.get_media_list() for o in nl: if o.get_reference() == mobj: @@ -241,7 +262,8 @@ class PackageWriter: # Write media files first, since the database may be modified # during the process (i.e. when removing object) - for obj in self.db.get_object_map().values(): + for obj_id in self.db.get_object_keys(): + obj = self.db.find_object_from_id(obj_id) oldfile = obj.get_path() root = os.path.basename(oldfile) if os.path.isfile(oldfile): diff --git a/gramps2/src/plugins/WritePkg.py b/gramps2/src/plugins/WritePkg.py index d5b9ea054..06146f069 100644 --- a/gramps2/src/plugins/WritePkg.py +++ b/gramps2/src/plugins/WritePkg.py @@ -108,29 +108,30 @@ class PackageWriter: #-------------------------------------------------------------- def remove_clicked(): # File is lost => remove all references and the object itself - mobj = ObjectMap[ObjectId] - for p in self.db.get_family_id_map().values(): + mobj = self.db.find_family_from_id(ObjectId) + for p_id in self.db.get_family_keys(): + p = self.db.find_family_from_id(p_id) nl = p.get_media_list() for o in nl: if o.get_reference() == mobj: nl.remove(o) p.set_media_list(nl) for key in self.db.get_person_keys(): - p = self.db.get_person(key) + p = self.db.find_person_from_id(key) nl = p.get_media_list() for o in nl: if o.get_reference() == mobj: nl.remove(o) p.set_media_list(nl) for key in self.db.get_source_keys(): - p = self.db.get_source(key) + p = self.db.find_person_from_source(key) nl = p.get_media_list() for o in nl: if o.get_reference() == mobj: nl.remove(o) p.set_media_list(nl) for key in self.db.get_place_id_keys(): - p = self.db.get_place_id(key) + p = self.db.find_place_from_id(key) nl = p.get_media_list() for o in nl: if o.get_reference() == mobj: @@ -169,9 +170,8 @@ class PackageWriter: # Write media files first, since the database may be modified # during the process (i.e. when removing object) - ObjectMap = self.db.get_object_map() - for ObjectId in ObjectMap.keys(): - oldfile = ObjectMap[ObjectId].get_path() + for ObjectId in self.db.get_object_keys(): + oldfile = self.db.find_object_from_id(ObjectId).get_path() base = os.path.basename(oldfile) if os.path.isfile(oldfile): g = open(oldfile,"rb") diff --git a/gramps2/src/plugins/pafexport.glade b/gramps2/src/plugins/pafexport.glade deleted file mode 100644 index c6eedd988..000000000 --- a/gramps2/src/plugins/pafexport.glade +++ /dev/null @@ -1,327 +0,0 @@ - - - - - - - - Export PAF for PalmOS file - GTK_WINDOW_TOPLEVEL - yes - no - no - yes - GTK_WIN_POS_CENTER - - - - no - 8 - yes - - - - GTK_BUTTONBOX_END - 8 - yes - - - - yes - yes - yes - gtk-ok - yes - yes - - - - - - - - yes - yes - yes - gtk-cancel - yes - yes - - - - - - - 0 - no - yes - GTK_PACK_END - - - - - - no - 0 - yes - - - - PAF for PalmOS Export - GTK_JUSTIFY_CENTER - no - 0.5 - 0.5 - 0 - 0 - yes - - - 0 - no - no - - - - - - yes - - - 10 - yes - yes - - - - - - pafExport - yes - 350 - no - Export PAF for PalmOS - yes - - - - yes - yes - - 0 - yes - yes - - - - - 5 - no - no - - - - - - 5 - Filter - 0 - GTK_SHADOW_ETCHED_IN - yes - - - - 5 - yes - 0 - yes - - - - yes - - - - - - - 0 - yes - yes - - - - - - 5 - Information - 0 - GTK_SHADOW_ETCHED_IN - yes - - - - no - 0 - yes - - - - no - 0 - yes - - - - Database name: - GTK_JUSTIFY_CENTER - no - 0.5 - 0.5 - 5 - 0 - yes - - - 0 - no - no - - - - - - yes - yes - - 20 - yes - yes - - - 5 - yes - yes - - - - - 0 - no - no - - - - - - Description - GTK_JUSTIFY_CENTER - no - 0.5 - 0.5 - 0 - 3 - yes - - - 0 - no - no - - - - - - yes - yes - - 0 - yes - yes - - - 0 - no - no - - - - - - - 0 - yes - yes - - - - - - 5 - Options - 0 - GTK_SHADOW_ETCHED_IN - yes - - - - no - 0 - yes - - - - 3 - yes - Do not include records marked private - yes - yes - yes - - - 0 - no - no - - - - - - 3 - yes - Restrict information on living people - yes - yes - yes - - - 0 - no - no - - - - - - - 0 - yes - yes - - - - - 0 - yes - yes - - - - - 4 - yes - yes - - - -