From 039b7f3591ad1e0b045d06e95355f2a7097be7b2 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 16 Feb 2006 05:06:40 +0000 Subject: [PATCH] * src/DisplayTabs.py: Set up for EditSourceRef * src/GrampsMime.py: handle special mime types * src/gramps.glade: add sourceref editor * src/GrampsDb/_GedTokens.py: Unused tokens, FTM 3.0 tokens * src/GrampsDb/_ReadGedcom.py: use TOKEN_IGNORE * src/EditSourceRef.py: added svn: r5942 --- ChangeLog | 8 + src/DisplayTabs.py | 11 +- src/EditSourceRef.py | 214 ++++++++++ src/GrampsDb/_GedTokens.py | 198 ++++----- src/GrampsDb/_ReadGedcom.py | 26 +- src/GrampsMime.py | 14 + src/gramps.glade | 828 ++++++++++++++++++++++++++++++++++++ 7 files changed, 1168 insertions(+), 131 deletions(-) create mode 100644 src/EditSourceRef.py diff --git a/ChangeLog b/ChangeLog index fbf575995..890a0723f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-02-15 Don Allingham + * src/DisplayTabs.py: Set up for EditSourceRef + * src/GrampsMime.py: handle special mime types + * src/gramps.glade: add sourceref editor + * src/GrampsDb/_GedTokens.py: Unused tokens, FTM 3.0 tokens + * src/GrampsDb/_ReadGedcom.py: use TOKEN_IGNORE + * src/EditSourceRef.py: added + 2006-02-09 Don Allingham * src/DisplayState.py: Manage history on db change * src/Navigation.py: Manage history on db change diff --git a/src/DisplayTabs.py b/src/DisplayTabs.py index 10d5b2ab6..e54a51ed4 100644 --- a/src/DisplayTabs.py +++ b/src/DisplayTabs.py @@ -1008,9 +1008,9 @@ class LocationEmbedList(EmbeddedList): #------------------------------------------------------------------------- class NoteTab(GrampsTab): - def __init__(self, dbstate, uistate, track, note_obj): + def __init__(self, dbstate, uistate, track, note_obj,title=_('Note')): self.note_obj = note_obj - GrampsTab.__init__(self, dbstate, uistate, track, _('Note')) + GrampsTab.__init__(self, dbstate, uistate, track, title) self.show_all() def _update_label(self,*obj): @@ -1218,11 +1218,12 @@ class SourceEmbedList(EmbeddedList): return ((1,0),(1,1),(1,2),(1,3)) def add_button_clicked(self,obj): - from Sources import SourceEditor + from EditSourceRef import EditSourceRef sref = RelLib.SourceRef() - SourceEditor(self.dbstate, self.uistate, self.track, sref, - self.add_callback) + src = RelLib.Source() + EditSourceRef(self.dbstate, self.uistate, self.track, + src, sref, self.add_callback) def add_callback(self,obj): self.get_data().append(obj) diff --git a/src/EditSourceRef.py b/src/EditSourceRef.py new file mode 100644 index 000000000..d6030f750 --- /dev/null +++ b/src/EditSourceRef.py @@ -0,0 +1,214 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2000-2006 Donald N. Allingham +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +# $Id$ + +#------------------------------------------------------------------------- +# +# Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + +try: + set() +except: + from sets import Set as set + +#------------------------------------------------------------------------- +# +# GTK/Gnome modules +# +#------------------------------------------------------------------------- +import gtk +import gtk.glade + +#------------------------------------------------------------------------- +# +# gramps modules +# +#------------------------------------------------------------------------- +import Sources +import Witness +import const +import Utils +import AutoComp +import RelLib +from DateHandler import parser as _dp, displayer as _dd +import DateEdit +import GrampsDisplay +import DisplayState + +from QuestionDialog import WarningDialog, ErrorDialog +from WindowUtils import GladeIf +from DisplayTabs import * +from GrampsWidgets import * + +#------------------------------------------------------------------------- +# +# EditSourceRef class +# +#------------------------------------------------------------------------- +class EditSourceRef(DisplayState.ManagedWindow): + def __init__(self, state, uistate, track, + source, source_ref, update): + self.db = state.db + self.state = state + self.uistate = uistate + self.source_ref = source_ref + self.source = source + + DisplayState.ManagedWindow.__init__(self, uistate, track, source_ref) + if self.already_exist: + return + + self.update = update + + self.title = _('Source Reference Editor') + + self.top = gtk.glade.XML(const.gladeFile, "source_ref_edit","gramps") + self.window = self.top.get_widget('source_ref_edit') + + self.ref_note_field = self.top.get_widget('eer_ref_note') + self.role_combo = self.top.get_widget('eer_role_combo') + self.date_field = self.top.get_widget("eer_date") + self.place_field = self.top.get_widget("eer_place") + self.cause_field = self.top.get_widget("eer_cause") + self.ev_note_field = self.top.get_widget("eer_ev_note") + self.type_combo = self.top.get_widget("eer_type_combo") + self.general_label = self.top.get_widget("eer_general_tab") + self.ok = self.top.get_widget('ok') + self.expander = self.top.get_widget("src_expander") + self.warning = self.top.get_widget("warn_box") + self.notebook = self.top.get_widget('notebook') + + if self.source: + self.source_added = False + if self.source_ref: + self.expander.set_expanded(False) + self.warning.show_all() + else: + self.source = RelLib.Source() + self.source.set_handle(self.db.create_id()) + self.source_added = True + self.expander.set_expanded(True) + self.warning.hide() + + if not self.source_ref: + self.source_ref = RelLib.SourceRef() + self.source_ref.set_reference_handle(self.source.get_handle()) + + self.privacy = PrivacyButton(self.top.get_widget('privacy'), + self.source_ref) + + self.volume = MonitoredEntry(self.top.get_widget("volume"), + self.source.set_volume, + self.source.get_volume, False) + + Utils.set_titles(self.window, self.top.get_widget('source_title'), + self.title) + + self.date_check = DateEdit.DateEdit( + self.date, self.date_field, + self.top.get_widget("date_stat"), self.window) + + self.date_field.set_text(_dd.display(self.date)) + + self._create_tabbed_pages() + + self.show() + + def _add_page(self,page): + self.notebook.insert_page(page) + self.notebook.set_tab_label(page,page.get_tab_widget()) + return page + + def _create_tabbed_pages(self): + """ + Creates the notebook tabs and inserts them into the main + window. + + """ + + self.srcref_list = self._add_page(SourceEmbedList( + self.state,self.uistate, self.track, + self.source.source_list)) + self.note_tab = self._add_page(NoteTab( + self.state, self.uistate, self.track, + self.source.get_note_object())) + self.gallery_tab = self._add_page(GalleryTab( + self.state, self.uistate, self.track, + self.source.get_media_list())) + + def build_menu_names(self,sourceref): + if self.source: + source_name = self.source.get_title() + submenu_label = _('Source: %s') % source_name + else: + submenu_label = _('New Source') + return (_('Source Reference Editor'),submenu_label) + + def build_window_key(self,sourceref): + if self.source: + return self.source.get_handle() + else: + return id(self) + + def on_help_clicked(self,obj): + pass + + def on_ok_clicked(self,obj): + + # first, save source if changed + etype = self.type_selector.get_values() + eplace_obj = get_place(self.place_field,self.pmap,self.db) + self.update_source(etype,self.date,eplace_obj) + + trans = self.db.transaction_begin() + self.db.commit_source(self.source,trans) + if self.source_added: + self.db.transaction_commit(trans,_("Add Source")) + else: + self.db.transaction_commit(trans,_("Modify Source")) + + # then, set properties of the source_ref + self.source_ref.set_role(self.role_selector.get_values()) + self.source_ref.set_privacy(self.ref_privacy.get_active()) + self.close(None) + + if self.update: + self.update((self.source_ref,self.source)) + + def update_source(self,the_type,date,place): + if place: + if self.source.get_place_handle() != place.get_handle(): + self.source.set_place_handle(place.get_handle()) + else: + if self.source.get_place_handle(): + self.source.set_place_handle("") + + if self.source.get_type() != the_type: + self.source.set_type(the_type) + + dobj = self.source.get_date_object() + + if not dobj.is_equal(date): + self.source.set_date_object(date) + diff --git a/src/GrampsDb/_GedTokens.py b/src/GrampsDb/_GedTokens.py index a8b94eb50..2c0bc1431 100644 --- a/src/GrampsDb/_GedTokens.py +++ b/src/GrampsDb/_GedTokens.py @@ -27,8 +27,7 @@ TOKEN_ADOP = 3 TOKEN_ADR1 = 4 TOKEN_ADR2 = 5 TOKEN_AFN = 6 -TOKEN_AGE = 7 -TOKEN_AGNC = 8 +TOKEN_IGNORE = 7 TOKEN__AKA = 9 TOKEN__ALIA = 10 TOKEN_ALIA = 11 @@ -51,13 +50,11 @@ TOKEN_CORP = 27 TOKEN_CTRY = 28 TOKEN_DATA = 29 TOKEN_DATE = 30 -TOKEN__DATE2 = 31 TOKEN_DEAT = 32 TOKEN_DESI = 33 TOKEN_DEST = 34 TOKEN_ENDL = 35 TOKEN_EVEN = 36 -TOKEN__EVENT_DEFN = 37 TOKEN_FAM = 38 TOKEN_FAMC = 39 TOKEN_FAMS = 40 @@ -93,7 +90,6 @@ TOKEN__PRIMARY = 69 TOKEN__PRIV = 70 TOKEN_PUBL = 71 TOKEN_QUAY = 72 -TOKEN_REFN = 73 TOKEN_RELI = 74 TOKEN_REPO = 75 TOKEN_RESI = 76 @@ -124,117 +120,93 @@ TOKEN_VERS = 100 TOKEN_WIFE = 101 TOKEN__WITN = 102 TOKEN__WTN = 103 -TOKEN__CHUR = 104 TOKEN_HEAD = 105 TOKEN_CALN = 106 TOKEN_MEDI = 107 tokens = { - "HEAD" : TOKEN_HEAD, - "MEDI" : TOKEN_MEDI, - "CALN" : TOKEN_CALN, - "ABBR" : TOKEN_ABBR, - "ADDR" : TOKEN_ADDR, - "ADOP" : TOKEN_ADOP, - "ADR1" : TOKEN_ADR1, - "ADR2" : TOKEN_ADR2, - "AFN" : TOKEN_AFN, - "AGE" : TOKEN_AGE, - "AGNC" : TOKEN_AGNC, - "_AKA" : TOKEN__AKA, - "_ALIA" : TOKEN__ALIA, - "ALIA" : TOKEN_ALIA, - "ANCI" : TOKEN_ANCI, - "ASSO" : TOKEN_ASSO, - "AUTH" : TOKEN_AUTH, - "BAPL" : TOKEN_BAPL, - "BIRT" : TOKEN_BIRT, - "_CAT" : TOKEN__CAT, - "CAUS" : TOKEN_CAUS, - "CHAN" : TOKEN_CHAN, - "CHAR" : TOKEN_CHAR, - "CHIL" : TOKEN_CHIL, - "CITY" : TOKEN_CITY, - "_COMM" : TOKEN__COMM, - "CONC" : TOKEN_CONC, - "CONT" : TOKEN_CONT, - "COPR" : TOKEN_COPR, - "CORP" : TOKEN_CORP, - "CTRY" : TOKEN_CTRY, - "DATA" : TOKEN_DATA, - "DATE" : TOKEN_DATE, - "_DATE2" : TOKEN__DATE2, - "DEAT" : TOKEN_DEAT, - "DESI" : TOKEN_DESI, - "DEST" : TOKEN_DEST, - "ENDL" : TOKEN_ENDL, - "EVEN" : TOKEN_EVEN, - "_EVENT_DEFN" : TOKEN__EVENT_DEFN, - "FAM" : TOKEN_FAM, - "FAMC" : TOKEN_FAMC, - "FAMS" : TOKEN_FAMS, - "FILE" : TOKEN_FILE, - "FORM" : TOKEN_FORM, - "_FREL" : TOKEN__FREL, - "GEDC" : TOKEN_GEDC, - "GIVN" : TOKEN_GIVN, - "_GODP" : TOKEN__GODP, - "HUSB" : TOKEN_HUSB, - "INDI" : TOKEN_INDI, - "LABL" : TOKEN_LABL, - "LANG" : TOKEN_LANG, - "_LOC" : TOKEN__LOC, - "_MARNM" : TOKEN__MARNM, - "_MREL" : TOKEN__MREL, - "_NAME" : TOKEN__NAME, - "NAME" : TOKEN_NAME, - "NCHI" : TOKEN_NCHI, - "NICK" : TOKEN_NICK, - "NOTE" : TOKEN_NOTE, - "NPFX" : TOKEN_NPFX, - "NSFX" : TOKEN_NSFX, - "OBJE" : TOKEN_OBJE, - "OFFI" : TOKEN_OFFI, - "PAGE" : TOKEN_PAGE, - "PEDI" : TOKEN_PEDI, - "PERI" : TOKEN_PERI, - "PHON" : TOKEN_PHON, - "PLAC" : TOKEN_PLAC, - "POST" : TOKEN_POST, - "_PRIMARY" : TOKEN__PRIMARY, - "_PRIV" : TOKEN__PRIV, - "PUBL" : TOKEN_PUBL, - "QUAY" : TOKEN_QUAY, - "REFN" : TOKEN_REFN, - "RELI" : TOKEN_RELI, - "REPO" : TOKEN_REPO, - "RESI" : TOKEN_RESI, - "RFN" : TOKEN_RFN, - "RIN" : TOKEN_RIN, - "_SCHEMA" : TOKEN__SCHEMA, - "SEX" : TOKEN_SEX, - "SLGC" : TOKEN_SLGC, - "SLGS" : TOKEN_SLGS, - "SOUR" : TOKEN_SOUR, - "SPFX" : TOKEN_SPFX, - "STAE" : TOKEN_STAE, - "_STAT" : TOKEN__STAT, - "STAT" : TOKEN_STAT, - "SUBM" : TOKEN_SUBM, - "SUBN" : TOKEN_SUBN, - "SURN" : TOKEN_SURN, - "TAXT" : TOKEN_TAXT, - "TEMP" : TOKEN_TEMP, - "TEXT" : TOKEN_TEXT, - "TIME" : TOKEN_TIME, - "TITL" : TOKEN_TITL, - "_TODO" : TOKEN__TODO, - "TRLR" : TOKEN_TRLR, - "TYPE" : TOKEN_TYPE, - "_UID" : TOKEN__UID, - "VERS" : TOKEN_VERS, - "WIFE" : TOKEN_WIFE, - "_WITN" : TOKEN__WITN, - "_WTN" : TOKEN__WTN, - "_CHUR" : TOKEN__CHUR, + "HEAD" : TOKEN_HEAD, "MEDI" : TOKEN_MEDI, + "CALN" : TOKEN_CALN, "ABBR" : TOKEN_ABBR, + "ABBREVIATION" : TOKEN_ABBR, "ADDR" : TOKEN_ADDR, + "ADDRESS" : TOKEN_ADDR, "ADOP" : TOKEN_ADOP, + "ADOPT" : TOKEN_ADOP, "ADR1" : TOKEN_ADR1, + "ADDRESS1" : TOKEN_ADR1, "ADR2" : TOKEN_ADR2, + "ADDRESS2" : TOKEN_ADR2, "AFN" : TOKEN_AFN, + "AGE" : TOKEN_IGNORE, "AGNC" : TOKEN_IGNORE, + "AGENCY" : TOKEN_AGNC, "_AKA" : TOKEN__AKA, + "_ALIA" : TOKEN__ALIA, "ALIA" : TOKEN_ALIA, + "ALIAS" : TOKEN_ALIA, "ANCI" : TOKEN_ANCI, + "ASSO" : TOKEN_ASSO, "ASSOCIATES" : TOKEN_ASSO, + "AUTH" : TOKEN_AUTH, "AUTHOR" : TOKEN_AUTH, + "BAPL" : TOKEN_BAPL, "BAPTISM-LDS" : TOKEN_BAPL, + "BIRT" : TOKEN_BIRT, "BIRTH" : TOKEN_BIRT, + "_CAT" : TOKEN_IGNORE, "CAUS" : TOKEN_CAUS, + "CAUSE" : TOKEN_CAUS, "CHAN" : TOKEN_CHAN, + "CHANGE" : TOKEN_CHAN, "CHAR" : TOKEN_CHAR, + "CHARACTER" : TOKEN_CHAR, "CHIL" : TOKEN_CHIL, + "CHILD" : TOKEN_CHIL, "CITY" : TOKEN_CITY, + "_COMM" : TOKEN__COMM, "CONC" : TOKEN_CONC, + "CONCATENTATE" : TOKEN_CONC, "CONT" : TOKEN_CONT, + "CONTINUATION" : TOKEN_CONT, "COPR" : TOKEN_COPR, + "COPYRIGHT" : TOKEN_COPR, "CORP" : TOKEN_CORP, + "CORPORATION" : TOKEN_CORP, "CTRY" : TOKEN_CTRY, + "COUNTRY" : TOKEN_CTRY, "DATA" : TOKEN_DATA, + "DATE" : TOKEN_DATE, "_DATE2" : TOKEN_IGNORE, + "DEAT" : TOKEN_DEAT, "DEATH" : TOKEN_DEAT, + "DESI" : TOKEN_DESI, "DEST" : TOKEN_DEST, + "DESTINATION" : TOKEN_DEST, "ENDL" : TOKEN_ENDL, + "ENDOWMENT" : TOKEN_ENDL, "EVEN" : TOKEN_EVEN, + "EVENT" : TOKEN_EVEN, + "FAM" : TOKEN_FAM, "FAMILY" : TOKEN_FAM, + "FAMC" : TOKEN_FAMC, "FAMILY_CHILD" : TOKEN_FAMC, + "FAMS" : TOKEN_FAMS, "FAMILY_SPOUSE" : TOKEN_FAMS, + "FILE" : TOKEN_FILE, "FORM" : TOKEN_FORM, + "_FREL" : TOKEN__FREL, "GEDC" : TOKEN_GEDC, + "GEDCOM" : TOKEN_GEDC, "GIVN" : TOKEN_GIVN, + "GIVEN_NAME" : TOKEN_GIVN, "_GODP" : TOKEN__GODP, + "HUSB" : TOKEN_HUSB, "HUSBAND" : TOKEN_HUSB, + "INDI" : TOKEN_INDI, "INDIVIDUAL" : TOKEN_INDI, + "LABL" : TOKEN_LABL, "LABEL" : TOKEN_LABL, + "LANG" : TOKEN_LANG, "_LOC" : TOKEN__LOC, + "_MARNM" : TOKEN__MARNM, "_MREL" : TOKEN__MREL, + "_NAME" : TOKEN__NAME, "NAME" : TOKEN_NAME, + "NCHI" : TOKEN_NCHI, "CHILDREN_COUNT": TOKEN_NCHI, + "NICK" : TOKEN_NICK, "NICKNAME" : TOKEN_NICK, + "NOTE" : TOKEN_NOTE, "NPFX" : TOKEN_NPFX, + "NAME_PREFIX" : TOKEN_NPFX, "NSFX" : TOKEN_NSFX, + "NAME_SUFFIX" : TOKEN_NSFX, "OBJE" : TOKEN_OBJE, + "OBJECT" : TOKEN_OBJE, "OFFI" : TOKEN_OFFI, + "PAGE" : TOKEN_PAGE, "PEDIGREE" : TOKEN_PEDI, + "PEDI" : TOKEN_PEDI, "PERI" : TOKEN_PERI, + "PHON" : TOKEN_PHON, "PHONE" : TOKEN_PHON, + "PHONE_NUMBER" : TOKEN_PHON, "PLAC" : TOKEN_PLAC, + "PLACE" : TOKEN_PLAC, "POST" : TOKEN_POST, + "POSTAL_CODE" : TOKEN_POST, "_PRIMARY" : TOKEN__PRIMARY, + "_PRIV" : TOKEN__PRIV, "PUBL" : TOKEN_PUBL, + "PUBLICATION" : TOKEN_PUBL, "QUAY" : TOKEN_QUAY, + "QUALITY_OF_DATA": TOKEN_QUAY, "REFN" : TOKEN_REFN, + "REFERENCE" : TOKEN_REFN, "RELI" : TOKEN_RELI, + "RELIGION" : TOKEN_RELI, "REPO" : TOKEN_REPO, + "REPOSITORY" : TOKEN_REPO, "RESI" : TOKEN_RESI, + "RESIDENCE" : TOKEN_RESI, "RFN" : TOKEN_RFN, + "RIN" : TOKEN_RIN, "_SCHEMA" : TOKEN__SCHEMA, + "SEX" : TOKEN_SEX, "SCHEMA" : TOKEN__SCHEMA, + "SLGC" : TOKEN_SLGC, "SLGS" : TOKEN_SLGS, + "SOUR" : TOKEN_SOUR, "SOURCE" : TOKEN_SOUR, + "SPFX" : TOKEN_SPFX, "SURN_PREFIX" : TOKEN_SPFX, + "STAE" : TOKEN_STAE, "STATE" : TOKEN_STAE, + "_STAT" : TOKEN__STAT, "STAT" : TOKEN_STAT, + "STATUS" : TOKEN_STAT, "SUBM" : TOKEN_SUBM, + "SUBMITTER" : TOKEN_SUBM, "SUBN" : TOKEN_SUBN, + "SUBMISSION" : TOKEN_SUBN, "SURN" : TOKEN_SURN, + "SURNAME" : TOKEN_SURN, "TAXT" : TOKEN_TAXT, + "TEMP" : TOKEN_TEMP, "TEMPLE" : TOKEN_TEMP, + "TEXT" : TOKEN_TEXT, "TIME" : TOKEN_TIME, + "TITL" : TOKEN_TITL, "TITLE" : TOKEN_TITL, + "_TODO" : TOKEN__TODO, "TRLR" : TOKEN_TRLR, + "TRAILER" : TOKEN_TRLR, "TYPE" : TOKEN_TYPE, + "_UID" : TOKEN__UID, "VERS" : TOKEN_VERS, + "VERSION" : TOKEN_VERS, "WIFE" : TOKEN_WIFE, + "_WITN" : TOKEN__WITN, "_WTN" : TOKEN__WTN, + "_CHUR" : TOKEN_IGNORE, } diff --git a/src/GrampsDb/_ReadGedcom.py b/src/GrampsDb/_ReadGedcom.py index 7a9fd90e1..8d7b1a1d2 100644 --- a/src/GrampsDb/_ReadGedcom.py +++ b/src/GrampsDb/_ReadGedcom.py @@ -119,6 +119,7 @@ rel_types = ((RelLib.Person.CHILD_BIRTH,''), pedi_type = { 'birth' : (RelLib.Person.CHILD_BIRTH,''), 'natural': (RelLib.Person.CHILD_BIRTH,''), + 'step' : (RelLib.Person.CHILD_ADOPTED,''), 'adopted': (RelLib.Person.CHILD_ADOPTED,''), 'foster' : (RelLib.Person.CHILD_FOSTER,''), } @@ -172,9 +173,9 @@ def importData(database, filename, callback=None, use_trans=False): line = f.readline().split() if len(line) == 0: break - if len(line) > 2 and line[1] == 'CHAR' and line[2] == "ANSEL": + if len(line) > 2 and line[1][0:4] == 'CHAR' and line[2] == "ANSEL": ansel = True - if len(line) > 2 and line[1] == 'SOUR' and line[2] == "GRAMPS": + if len(line) > 2 and line[1][0:4] == 'SOUR' and line[2] == "GRAMPS": gramps = True f.close() @@ -752,7 +753,7 @@ class GedcomParser: repo_ref.set_reference_handle(repo.handle) self.parse_repo_ref(matches,repo_ref,level+1) self.source.add_repo_reference(repo_ref) - elif matches[1] in (TOKEN_OBJE,TOKEN_CHAN,TOKEN__CAT): + elif matches[1] in (TOKEN_OBJE,TOKEN_CHAN,TOKEN_IGNORE): self.ignore_sub_junk(2) else: note = self.source.get_note() @@ -814,7 +815,7 @@ class GedcomParser: del self.repo elif matches[2] in ("SUBM","SUBN"): self.ignore_sub_junk(1) - elif matches[1] in (TOKEN_SUBM,TOKEN_SUBN,TOKEN_OBJE,TOKEN__EVENT_DEFN): + elif matches[1] in (TOKEN_SUBM,TOKEN_SUBN,TOKEN_OBJE,TOKEN_IGNORE): self.ignore_sub_junk(1) elif matches[2] == "SOUR": self.parse_source(matches[3],1) @@ -1337,8 +1338,8 @@ class GedcomParser: elif matches[1] == TOKEN_ADDR: address.set_street(matches[2]) self.parse_address(address,level+1) - elif matches[1] in (TOKEN_AGE,TOKEN_AGNC,TOKEN_CAUS,TOKEN_STAT, - TOKEN_TEMP,TOKEN_OBJE,TOKEN_TYPE,TOKEN__DATE2): + elif matches[1] in (TOKEN_IGNORE,TOKEN_CAUS,TOKEN_STAT, + TOKEN_TEMP,TOKEN_OBJE,TOKEN_TYPE): self.ignore_sub_junk(level+1) elif matches[1] == TOKEN_SOUR: address.add_source_reference(self.handle_source(matches,level+1)) @@ -1483,9 +1484,8 @@ class GedcomParser: witness = RelLib.Witness(RelLib.Event.NAME,matches[2]) event.add_witness(witness) self.ignore_sub_junk(level+1) - elif matches[1] in (TOKEN_RELI, TOKEN_TIME, TOKEN_ADDR,TOKEN_AGE, - TOKEN_AGNC,TOKEN_STAT,TOKEN_TEMP,TOKEN_OBJE, - TOKEN__DATE2): + elif matches[1] in (TOKEN_RELI, TOKEN_TIME, TOKEN_ADDR,TOKEN_IGNORE, + TOKEN_STAT,TOKEN_TEMP,TOKEN_OBJE): self.ignore_sub_junk(level+1) else: self.barf(level+1) @@ -1501,7 +1501,7 @@ class GedcomParser: break elif matches[1] == TOKEN_DATE: event.set_date_object(self.extract_date(matches[2])) - elif matches[1] in (TOKEN_TIME,TOKEN_ADDR,TOKEN_AGE,TOKEN_AGNC, + elif matches[1] in (TOKEN_TIME,TOKEN_ADDR,TOKEN_IGNORE, TOKEN_STAT,TOKEN_TEMP,TOKEN_OBJE): self.ignore_sub_junk(level+1) elif matches[1] == TOKEN_SOUR: @@ -1571,7 +1571,7 @@ class GedcomParser: name = matches[2] attr.set_name(name) elif matches[1] in (TOKEN_CAUS,TOKEN_DATE,TOKEN_TIME,TOKEN_ADDR, - TOKEN_AGE,TOKEN_AGNC,TOKEN_STAT,TOKEN_TEMP,TOKEN_OBJE): + TOKEN_IGNORE,TOKEN_STAT,TOKEN_TEMP,TOKEN_OBJE): self.ignore_sub_junk(level+1) elif matches[1] == TOKEN_SOUR: attr.add_source_reference(self.handle_source(matches,level+1)) @@ -1614,8 +1614,8 @@ class GedcomParser: info = matches[2] event.set_cause(info) self.parse_cause(event,level+1) - elif matches[1] in (TOKEN_TIME,TOKEN_AGE,TOKEN_AGNC,TOKEN_ADDR,TOKEN_STAT, - TOKEN_TEMP,TOKEN_HUSB,TOKEN_WIFE,TOKEN_OBJE,TOKEN__CHUR): + elif matches[1] in (TOKEN_TIME,TOKEN_IGNORE,TOKEN_ADDR,TOKEN_STAT, + TOKEN_TEMP,TOKEN_HUSB,TOKEN_WIFE,TOKEN_OBJE): self.ignore_sub_junk(level+1) elif matches[1] == TOKEN_SOUR: event.add_source_reference(self.handle_source(matches,level+1)) diff --git a/src/GrampsMime.py b/src/GrampsMime.py index 78074272a..e509a128e 100644 --- a/src/GrampsMime.py +++ b/src/GrampsMime.py @@ -22,3 +22,17 @@ try: from GnomeMime import * except: from PythonMime import * + +def base_type(val): + return val.split('/')[0] + +def is_image_type(val): + return base_type(val) == "image" + +def is_directory(val): + return base_type(val) == "x-directory" + +_invalid_mime_types = ('x-directory','x-special') + +def is_valid_type(val): + return base_type(val) not in _invalid_mime_types diff --git a/src/gramps.glade b/src/gramps.glade index 57091c7a6..eeb8d3331 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -17483,4 +17483,832 @@ Given name, Family name + + True + + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER_ON_PARENT + False + 600 + True + False + gramps.png + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + False + + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-help + True + GTK_RELIEF_NORMAL + True + -11 + + + + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + -6 + + + + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + -5 + + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + + True + True + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 12 + 12 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + <b>Reference information</b> + True + True + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 6 + 3 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + 6 + True + True + True + True + GTK_POS_TOP + False + False + + + + 12 + True + 3 + 3 + False + 6 + 12 + + + + True + _Date: + True + False + GTK_JUSTIFY_CENTER + False + False + 1 + 0.5 + 0 + 0 + date + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + + + + + + + True + Invoke date editor + True + GTK_RELIEF_NONE + True + + + + + True + 0.5 + 0.5 + 0 + 0 + + + + + 2 + 3 + 0 + 1 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + + + + + + + True + _Volume/Page: + True + False + GTK_JUSTIFY_CENTER + False + False + 1 + 0.5 + 0 + 0 + volume + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + _Confidence: + True + False + GTK_JUSTIFY_CENTER + False + False + 1 + 0.5 + 0 + 0 + confidence + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + Very Low +Low +Normal +High +Very High + False + True + + + 1 + 2 + 2 + 3 + fill + fill + + + + + + True + True + GTK_RELIEF_NONE + True + False + False + + + + True + 4 + stock_lock-open + 0.5 + 0.5 + 0 + 0 + + + + + 2 + 3 + 2 + 3 + fill + + + + + + False + True + + + + + + True + General + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + 0 + True + True + + + + + + 6 + True + True + True + 6 + + + + True + True + True + False + GTK_POS_TOP + False + False + + + + + 12 + True + 6 + 2 + False + 6 + 12 + + + + True + _Title: + True + False + GTK_JUSTIFY_CENTER + False + False + 1 + 0.5 + 0 + 0 + title + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + Author: + True + False + GTK_JUSTIFY_CENTER + False + False + 1 + 0.5 + 0 + 0 + author + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + Abbreviation: + True + False + GTK_JUSTIFY_CENTER + False + False + 1 + 0.5 + 0 + 3 + abbrev + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 3 + 4 + fill + + + + + + + True + Publication Information: + True + False + GTK_JUSTIFY_CENTER + False + False + 1 + 0.5 + 0 + 0 + pub_info + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 4 + 5 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + + + + + + + 6 + False + 12 + + + + True + gtk-dialog-warning + 6 + 0.5 + 0.5 + 0 + 0 + + + 0 + True + False + + + + + + True + <b>Note:</b> Any changes in the shared source information will be reflected in the source itself, for all items that reference the source. + True + True + GTK_JUSTIFY_LEFT + True + False + 0 + 0.5 + 0 + 3 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + True + True + + + + + 0 + 2 + 5 + 6 + expand|shrink|fill + expand|shrink|fill + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 3 + 4 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 4 + 5 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + + + + + + + True + ID: + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + gid + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 2 + 3 + + + + + + False + False + + + + + + True + False + 0 + + + + gtk-file + 1 + 0.5 + 0.5 + 0 + 0 + + + 0 + True + True + + + + + + True + General + False + True + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + tab + + + + + + + + True + <b>Shared event information</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + False + True + + + + + +