GEP18: refractor: move template stuff to srctemplate.py
svn: r22554
This commit is contained in:
parent
8ad6600746
commit
99671bdfaf
@ -1036,14 +1036,14 @@
|
|||||||
;;;;;;;;"[PAGE]";;",";;;;;;;
|
;;;;;;;;"[PAGE]";;",";;;;;;;
|
||||||
;;;;;;;;"[HOUSEHOLD]";;",";;;;;;;
|
;;;;;;;;"[HOUSEHOLD]";;",";;;;;;;
|
||||||
;;;;;;;;"[ITEM OF INTEREST]";"Person of Interest";".";;;;;;;
|
;;;;;;;;"[ITEM OF INTEREST]";"Person of Interest";".";;;;;;;
|
||||||
57;"EE Census Records";"Microfilm (U.S.)";"“Nonpopulation” schedules";"NARA film";"L";"ESM244";;"[JURISDICTION]";;".";"T";"REV.";;;;;
|
57;"EE Census Records";"Microfilm (U.S.)";"Nonpopulation schedules";"NARA film";"L";"ESM244";;"[JURISDICTION]";;".";"T";"REV.";;;;;
|
||||||
;;;;;;;;"[ID]";"Census ID";".";"T";;;;;;
|
;;;;;;;;"[ID]";"Census ID";".";"T";;;;;;
|
||||||
;;;;;;;;"[TITLE]";"Schedule Title";"schedule.";"T";;"Quoted";;;;
|
;;;;;;;;"[TITLE]";"Schedule Title";"schedule.";"T";;"Quoted";;;;
|
||||||
;;;;;;;;"[FILM ID]";;".";"P";;;;;;
|
;;;;;;;;"[FILM ID]";;".";"P";;;;;;
|
||||||
;;;;;;;;"[PUBLICATION PLACE]";;":";"P";;;;;;
|
;;;;;;;;"[PUBLICATION PLACE]";;":";"P";;;;;;
|
||||||
;;;;;;;;"[PUBLISHER]";;",";"P";;;;;;
|
;;;;;;;;"[PUBLISHER]";;",";"P";;;;;;
|
||||||
;;;;;;;;"[YEAR]";"Year(s)";".";"P";;;;;;
|
;;;;;;;;"[YEAR]";"Year(s)";".";"P";;;;;;
|
||||||
57;"EE Census Records";"Microfilm (U.S.)";"“Nonpopulation” schedules";"NARA film";"F";"ESM244";;"[ID]";"Census ID";",";;;;;;;
|
57;"EE Census Records";"Microfilm (U.S.)";"Nonpopulation schedules";"NARA film";"F";"ESM244";;"[ID]";"Census ID";",";;;;;;;
|
||||||
;;;;;;;;"[JURISDICTION]";;",";;;;;;;
|
;;;;;;;;"[JURISDICTION]";;",";;;;;;;
|
||||||
;;;;;;;;"[TITLE]";"Schedule Title";",";;;"Quoted";;;;
|
;;;;;;;;"[TITLE]";"Schedule Title";",";;;"Quoted";;;;
|
||||||
;;;;;;;;"[SECTION]";;",";;;;;;;
|
;;;;;;;;"[SECTION]";;",";;;;;;;
|
||||||
@ -1052,7 +1052,7 @@
|
|||||||
;;;;;;;;"[PAGE]";"Page(s)";",";;;;;;;
|
;;;;;;;;"[PAGE]";"Page(s)";",";;;;;;;
|
||||||
;;;;;;;;"[ITEM OF INTEREST]";"Person of Interest";";";;;;;;;
|
;;;;;;;;"[ITEM OF INTEREST]";"Person of Interest";";";;;;;;;
|
||||||
;;;;;;;;"[FILM ID]";;".";;;;;;;
|
;;;;;;;;"[FILM ID]";;".";;;;;;;
|
||||||
57;"EE Census Records";"Microfilm (U.S.)";"“Nonpopulation” schedules";"NARA film";"S";"ESM244";;"[ID]";"Census ID";",";;;;;;;
|
57;"EE Census Records";"Microfilm (U.S.)";"Nonpopulation schedules";"NARA film";"S";"ESM244";;"[ID]";"Census ID";",";;;;;;;
|
||||||
;;;;;;;;"[JURISDICTION]";;",";;;;;;;
|
;;;;;;;;"[JURISDICTION]";;",";;;;;;;
|
||||||
;;;;;;;;"[TITLE]";"Schedule Title";",";;;"Quoted";;;;
|
;;;;;;;;"[TITLE]";"Schedule Title";",";;;"Quoted";;;;
|
||||||
;;;;;;;;"[SECTION]";;",";;;;;;;
|
;;;;;;;;"[SECTION]";;",";;;;;;;
|
||||||
@ -1060,7 +1060,7 @@
|
|||||||
;;;;;;;;"[DISTRICT]";"Enumeration District";",";;;;;;;
|
;;;;;;;;"[DISTRICT]";"Enumeration District";",";;;;;;;
|
||||||
;;;;;;;"p.";"[PAGE]";"Page(s)";",";;;;;;;
|
;;;;;;;"p.";"[PAGE]";"Page(s)";",";;;;;;;
|
||||||
;;;;;;;;"[ITEM OF INTEREST]";"Person of Interest";".";;;;;;;
|
;;;;;;;;"[ITEM OF INTEREST]";"Person of Interest";".";;;;;;;
|
||||||
58;"EE Census Records";"Microfilm (U.S.)";"“Nonpopulation” schedules";"FHL-GSU preservation film";"L";"ESM245";;"[JURISDICTION]";;".";"T";"REV.";;;;;
|
58;"EE Census Records";"Microfilm (U.S.)";"Nonpopulation schedules";"FHL-GSU preservation film";"L";"ESM245";;"[JURISDICTION]";;".";"T";"REV.";;;;;
|
||||||
;;;;;;;;"[ID]";"Census ID";",";"T";;;;;;
|
;;;;;;;;"[ID]";"Census ID";",";"T";;;;;;
|
||||||
;;;;;;;;"[SCHEDULE]";;".";"T";;;;;;
|
;;;;;;;;"[SCHEDULE]";;".";"T";;;;;;
|
||||||
;;;;;;;;"[ORIGINAL REPOSITORY]";;",";"P";;;;;;
|
;;;;;;;;"[ORIGINAL REPOSITORY]";;",";"P";;;;;;
|
||||||
@ -1068,7 +1068,7 @@
|
|||||||
;;;;;;;;"[FILM ID]";;".";"P";;;;;;
|
;;;;;;;;"[FILM ID]";;".";"P";;;;;;
|
||||||
;;;;;;;;"[REPOSITORY]";;",";"P";;;;;;
|
;;;;;;;;"[REPOSITORY]";;",";"P";;;;;;
|
||||||
;;;;;;;;"[REPOSITORY ADDRESS]";;".";"P";"LOC";;;;;
|
;;;;;;;;"[REPOSITORY ADDRESS]";;".";"P";"LOC";;;;;
|
||||||
58;"EE Census Records";"Microfilm (U.S.)";"“Nonpopulation” schedules";"FHL-GSU preservation film";"F";"ESM245";;"[ID]";"Census ID";",";;;;;;;
|
58;"EE Census Records";"Microfilm (U.S.)";"Nonpopulation schedules";"FHL-GSU preservation film";"F";"ESM245";;"[ID]";"Census ID";",";;;;;;;
|
||||||
;;;;;;;;"[JURISDICTION]";;",";;;;;;;
|
;;;;;;;;"[JURISDICTION]";;",";;;;;;;
|
||||||
;;;;;;;;"[SCHEDULE]";;",";;;;;;;
|
;;;;;;;;"[SCHEDULE]";;",";;;;;;;
|
||||||
;;;;;;;;"[PAGE]";;",";;;;;;;
|
;;;;;;;;"[PAGE]";;",";;;;;;;
|
||||||
@ -1076,12 +1076,12 @@
|
|||||||
;;;;;;;;"[ORIGINAL REPOSITORY]";;",";;;;;;;
|
;;;;;;;;"[ORIGINAL REPOSITORY]";;",";;;;;;;
|
||||||
;;;;;;;;"[ORIGINAL REPOSITORY LOCATION]";;";";;;;;;;
|
;;;;;;;;"[ORIGINAL REPOSITORY LOCATION]";;";";;;;;;;
|
||||||
;;;;;;;;"[FILM ID]";;".";;;;;;;
|
;;;;;;;;"[FILM ID]";;".";;;;;;;
|
||||||
58;"EE Census Records";"Microfilm (U.S.)";"“Nonpopulation” schedules";"FHL-GSU preservation film";"S";"ESM245";;"[ID]";"Census ID";",";;;;;;;
|
58;"EE Census Records";"Microfilm (U.S.)";"Nonpopulation schedules";"FHL-GSU preservation film";"S";"ESM245";;"[ID]";"Census ID";",";;;;;;;
|
||||||
;;;;;;;;"[JURISDICTION]";;",";;;;;;;
|
;;;;;;;;"[JURISDICTION]";;",";;;;;;;
|
||||||
;;;;;;;;"[SCHEDULE]";;",";;;;;;;
|
;;;;;;;;"[SCHEDULE]";;",";;;;;;;
|
||||||
;;;;;;;;"[PAGE]";;",";;;;;;;
|
;;;;;;;;"[PAGE]";;",";;;;;;;
|
||||||
;;;;;;;;"[ITEM OF INTEREST]";;".";;;"Quoted";;;;
|
;;;;;;;;"[ITEM OF INTEREST]";;".";;;"Quoted";;;;
|
||||||
59;"EE Census Records";"Microfilm (U.S.)";"“Nonpopulation” schedules";"UNC microfilm publication";"L";"ESM246";;"[JURISDICTION]";;".";"T";"REV.";;;;;
|
59;"EE Census Records";"Microfilm (U.S.)";"Nonpopulation schedules";"UNC microfilm publication";"L";"ESM246";;"[JURISDICTION]";;".";"T";"REV.";;;;;
|
||||||
;;;;;;;;"[ID]";"Census ID";",";"T";;;;;;
|
;;;;;;;;"[ID]";"Census ID";",";"T";;;;;;
|
||||||
;;;;;;;;"[SCHEDULE]";;".";"T";;;;;;
|
;;;;;;;;"[SCHEDULE]";;".";"T";;;;;;
|
||||||
;;;;;;;;"[TITLE]";"Film Title";".";"T";;"Italics";;;;
|
;;;;;;;;"[TITLE]";"Film Title";".";"T";;"Italics";;;;
|
||||||
@ -1089,7 +1089,7 @@
|
|||||||
;;;;;;;;"[PUBLICATION PLACE]";;":";"P";;;;;;
|
;;;;;;;;"[PUBLICATION PLACE]";;":";"P";;;;;;
|
||||||
;;;;;;;;"[PUBLISHER]";;",";"P";;;;;;
|
;;;;;;;;"[PUBLISHER]";;",";"P";;;;;;
|
||||||
;;;;;;;;"[YEAR]";"Year(s)";".";"P";;;;;;
|
;;;;;;;;"[YEAR]";"Year(s)";".";"P";;;;;;
|
||||||
59;"EE Census Records";"Microfilm (U.S.)";"“Nonpopulation” schedules";"UNC microfilm publication";"F";"ESM246";;"[ID]";"Census ID";",";;;;;;;
|
59;"EE Census Records";"Microfilm (U.S.)";"Nonpopulation schedules";"UNC microfilm publication";"F";"ESM246";;"[ID]";"Census ID";",";;;;;;;
|
||||||
;;;;;;;;"[JURISDICTION]";;",";;;;;;;
|
;;;;;;;;"[JURISDICTION]";;",";;;;;;;
|
||||||
;;;;;;;;"[SCHEDULE]";;",";;;;;;;
|
;;;;;;;;"[SCHEDULE]";;",";;;;;;;
|
||||||
;;;;;;;"p.";"[PAGE]";"Page(s)";",";;;;;;;
|
;;;;;;;"p.";"[PAGE]";"Page(s)";",";;;;;;;
|
||||||
@ -1100,7 +1100,7 @@
|
|||||||
;;;;;;;;"[PUBLISHER]";;",";;;;;;;
|
;;;;;;;;"[PUBLISHER]";;",";;;;;;;
|
||||||
;;;;;;;;"[YEAR]";"Year(s)";"),";;;;;;;
|
;;;;;;;;"[YEAR]";"Year(s)";"),";;;;;;;
|
||||||
;;;;;;;;"[ROLL]";;".";;;;;;;
|
;;;;;;;;"[ROLL]";;".";;;;;;;
|
||||||
59;"EE Census Records";"Microfilm (U.S.)";"“Nonpopulation” schedules";"UNC microfilm publication";"S";"ESM246";;"[ID]";"Census ID";",";;;;;;;
|
59;"EE Census Records";"Microfilm (U.S.)";"Nonpopulation schedules";"UNC microfilm publication";"S";"ESM246";;"[ID]";"Census ID";",";;;;;;;
|
||||||
;;;;;;;;"[JURISDICTION]";;",";;;;;;;
|
;;;;;;;;"[JURISDICTION]";;",";;;;;;;
|
||||||
;;;;;;;;"[SCHEDULE]";;",";;;;;;;
|
;;;;;;;;"[SCHEDULE]";;",";;;;;;;
|
||||||
;;;;;;;"p.";"[PAGE]";"Page(s)";",";;;;;;;
|
;;;;;;;"p.";"[PAGE]";"Page(s)";",";;;;;;;
|
||||||
@ -2592,16 +2592,16 @@
|
|||||||
140;"EE Publications: Books, CDs, Maps, Leaflets & Videos";"Electronic Publications";"Video";;"S";"ESM656";;"[AUTHOR]";"Presenter";",";;"S";;;;;
|
140;"EE Publications: Books, CDs, Maps, Leaflets & Videos";"Electronic Publications";"Video";;"S";"ESM656";;"[AUTHOR]";"Presenter";",";;"S";;;;;
|
||||||
;;;;;;;;"[TITLE]";;",";;;"Italics";;;;
|
;;;;;;;;"[TITLE]";;",";;;"Italics";;;;
|
||||||
;;;;;;;;"[TIMESTAMP]";"Timestamp in Video";".";;;;;;;
|
;;;;;;;;"[TIMESTAMP]";"Timestamp in Video";".";;;;;;;
|
||||||
141;"EE Publications: Books, CDs, Maps, Leaflets & Videos";"Electronic Publications";"Website as “book”";;"L";"ESM657";;"[AUTHOR]";;".";"A";"SG";;;;;
|
141;"EE Publications: Books, CDs, Maps, Leaflets & Videos";"Electronic Publications";"Website as book";;"L";"ESM657";;"[AUTHOR]";;".";"A";"SG";;;;;
|
||||||
;;;;;;;;"[WEBSITE]";;".";"T";;"Italics";;;;
|
;;;;;;;;"[WEBSITE]";;".";"T";;"Italics";;;;
|
||||||
;;;;;;;;"[URL (DIGITAL LOCATION)] ";;":";"P";;;;;;
|
;;;;;;;;"[URL (DIGITAL LOCATION)] ";;":";"P";;;;;;
|
||||||
;;;;;;;;"[YEAR]";"Year(s)";".";"P";;;;;;
|
;;;;;;;;"[YEAR]";"Year(s)";".";"P";;;;;;
|
||||||
141;"EE Publications: Books, CDs, Maps, Leaflets & Videos";"Electronic Publications";"Website as “book”";;"F";"ESM657";;"[AUTHOR]";;",";;"GS";;;;;
|
141;"EE Publications: Books, CDs, Maps, Leaflets & Videos";"Electronic Publications";"Website as book";;"F";"ESM657";;"[AUTHOR]";;",";;"GS";;;;;
|
||||||
;;;;;;;;"[WEBSITE]";;;;;"Italics";;;;
|
;;;;;;;;"[WEBSITE]";;;;;"Italics";;;;
|
||||||
;;;;;;;"(";"[URL (DIGITAL LOCATION)]";;":";;;;;;;
|
;;;;;;;"(";"[URL (DIGITAL LOCATION)]";;":";;;;;;;
|
||||||
;;;;;;;"accessed";"[DATE ACCESSED]";;"),";;;;;;;
|
;;;;;;;"accessed";"[DATE ACCESSED]";;"),";;;;;;;
|
||||||
;;;;;;;;"[ITEM OF INTEREST]";;".";;;"Quoted";;;;
|
;;;;;;;;"[ITEM OF INTEREST]";;".";;;"Quoted";;;;
|
||||||
141;"EE Publications: Books, CDs, Maps, Leaflets & Videos";"Electronic Publications";"Website as “book”";;"S";"ESM657";;"[AUTHOR]";;",";;"S";;;;;
|
141;"EE Publications: Books, CDs, Maps, Leaflets & Videos";"Electronic Publications";"Website as book";;"S";"ESM657";;"[AUTHOR]";;",";;"S";;;;;
|
||||||
;;;;;;;;"[WEBSITE]";;",";;;"Italics";;;;
|
;;;;;;;;"[WEBSITE]";;",";;;"Italics";;;;
|
||||||
;;;;;;;;"[ITEM OF INTEREST]";;".";;;"Quoted";;;;
|
;;;;;;;;"[ITEM OF INTEREST]";;".";;;"Quoted";;;;
|
||||||
142;"EE Publications: Books, CDs, Maps, Leaflets & Videos";"Image Copies";"CD/DVD publication";;"L";"ESM658";;"[AUTHOR]";;".";"A";"SG";;;;;
|
142;"EE Publications: Books, CDs, Maps, Leaflets & Videos";"Image Copies";"CD/DVD publication";;"L";"ESM658";;"[AUTHOR]";;".";"A";"SG";;;;;
|
||||||
|
|
@ -66,6 +66,11 @@ SHORTERALG = {'LOC': 'SHORTERALG_LOC', 'YEAR': 'SHORTERALG_YEAR',
|
|||||||
STYLES = {'Quoted': 'STYLE_QUOTE', 'Italics': 'STYLE_EMPH',
|
STYLES = {'Quoted': 'STYLE_QUOTE', 'Italics': 'STYLE_EMPH',
|
||||||
'QuotedCont': 'STYLE_QUOTECONT', 'Bold': 'STYLE_BOLD'}
|
'QuotedCont': 'STYLE_QUOTECONT', 'Bold': 'STYLE_BOLD'}
|
||||||
|
|
||||||
|
#already defined srcattrtypes
|
||||||
|
KNOWN_FIELDS = ['EVEN_REC', 'EVEN_CITED', 'EVEN_ROLE', 'GEN_BY', 'REPOSITORY',
|
||||||
|
'REPOSITORY_ADDRESS', 'REPOSITORY_SHORT_VERSION', 'REPOSITORY_CALL_NUMBER',
|
||||||
|
'DATE']
|
||||||
|
|
||||||
DEFAULT_HINTS = {
|
DEFAULT_HINTS = {
|
||||||
"ACT": "Public Law 12-98",
|
"ACT": "Public Law 12-98",
|
||||||
"ADDRESS": "Broadway Avenue, New York",
|
"ADDRESS": "Broadway Avenue, New York",
|
||||||
@ -351,6 +356,9 @@ with open(csvfilename, 'rb') as csvfile:
|
|||||||
field_label = field_label.replace("'", "\\'")
|
field_label = field_label.replace("'", "\\'")
|
||||||
if field_type in FIELDTYPEMAP:
|
if field_type in FIELDTYPEMAP:
|
||||||
assert field_descr == FIELDTYPEMAP[field_type][1], 'Problem %s %s %s' % (field_type, field_descr, FIELDTYPEMAP[field_type][1])
|
assert field_descr == FIELDTYPEMAP[field_type][1], 'Problem %s %s %s' % (field_type, field_descr, FIELDTYPEMAP[field_type][1])
|
||||||
|
elif field_type in KNOWN_FIELDS:
|
||||||
|
#no need to add it
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
FIELDTYPEMAP[field_type] = (index, field_descr)
|
FIELDTYPEMAP[field_type] = (index, field_descr)
|
||||||
index += 1
|
index += 1
|
||||||
@ -374,7 +382,7 @@ with open(csvfilename, 'rb') as csvfile:
|
|||||||
#this
|
#this
|
||||||
if shortcite and shorteralg == 'EMPTY':
|
if shortcite and shorteralg == 'EMPTY':
|
||||||
field_type_short = field_type + '_SHORT_VERSION'
|
field_type_short = field_type + '_SHORT_VERSION'
|
||||||
if field_type_short in FIELDTYPEMAP:
|
if field_type_short in FIELDTYPEMAP or field_type_short in KNOWN_FIELDS:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
FIELDTYPEMAP[field_type_short] = (index, field_descr + ' (Short)')
|
FIELDTYPEMAP[field_type_short] = (index, field_descr + ' (Short)')
|
||||||
@ -451,7 +459,7 @@ for source_type in allkeys:
|
|||||||
tooltip = '_("' + field[10] + '")'
|
tooltip = '_("' + field[10] + '")'
|
||||||
else:
|
else:
|
||||||
tooltip = 'None'
|
tooltip = 'None'
|
||||||
code += " ('"+ field[0] + "', " + field[1] + ", _('"\
|
code += " ('"+ field[0] + "', SrcAttributeType." + field[1] + ", _('"\
|
||||||
+field[3] + "'), '"+ field[2] + "', " + field[4] + ", " + field[5] + ", "\
|
+field[3] + "'), '"+ field[2] + "', " + field[4] + ", " + field[5] + ", "\
|
||||||
+ field[6] + ", " + field[7] + ", " + field[8] + ",\n" \
|
+ field[6] + ", " + field[7] + ", " + field[8] + ",\n" \
|
||||||
+ " " +hint + ", " + tooltip + "),\n"
|
+ " " +hint + ", " + tooltip + "),\n"
|
||||||
|
@ -32,6 +32,7 @@ SrcAttributeBase class for GRAMPS.
|
|||||||
from .attrbase import AttributeRootBase
|
from .attrbase import AttributeRootBase
|
||||||
from .srcattribute import SrcAttribute
|
from .srcattribute import SrcAttribute
|
||||||
from .srcattrtype import SrcAttributeType
|
from .srcattrtype import SrcAttributeType
|
||||||
|
from .srctemplate import SrcTemplate
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -56,27 +57,27 @@ class SrcAttributeBase(AttributeRootBase):
|
|||||||
:rtype tuple: (index, description, string_key_as stored)
|
:rtype tuple: (index, description, string_key_as stored)
|
||||||
"""
|
"""
|
||||||
#no template is UNKNOWN!
|
#no template is UNKNOWN!
|
||||||
templ = SrcAttributeType.UNKNOWN
|
templ = SrcTemplate.UNKNOWN
|
||||||
for attr in self.attribute_list:
|
for attr in self.attribute_list:
|
||||||
if int(attr.get_type()) == SrcAttributeType.SRCTEMPLATE:
|
if int(attr.get_type()) == SrcAttributeType.SRCTEMPLATE:
|
||||||
val = attr.get_value()
|
val = attr.get_value()
|
||||||
try:
|
try:
|
||||||
templ = SrcAttributeType.K2I_SRCTEMPLATEMAP[val]
|
templ = SrcTemplate.K2I_SRCTEMPLATEMAP[val]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# a template not in the predefined list. convert to unknown
|
# a template not in the predefined list. convert to unknown
|
||||||
print ('SrcAttributeBase: Keyerror "', val,
|
print ('SrcAttributeBase: Keyerror "', val,
|
||||||
'"for now UNKNOWN taken, later custom templates?')
|
'"for now UNKNOWN taken, later custom templates?')
|
||||||
break
|
break
|
||||||
try:
|
try:
|
||||||
retval = (templ, SrcAttributeType.I2S_SRCTEMPLATEMAP[templ],
|
retval = (templ, SrcTemplate.I2S_SRCTEMPLATEMAP[templ],
|
||||||
SrcAttributeType.I2K_SRCTEMPLATEMAP[templ])
|
SrcTemplate.I2K_SRCTEMPLATEMAP[templ])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
#templ is not present, return the default GEDCOM value as actual
|
#templ is not present, return the default GEDCOM value as actual
|
||||||
#template
|
#template
|
||||||
templ = SrcAttributeType.UNKNOWN
|
templ = SrcTemplate.UNKNOWN
|
||||||
retval = (templ,
|
retval = (templ,
|
||||||
SrcAttributeType.I2S_SRCTEMPLATEMAP[SrcAttributeType.UNKNOWN],
|
SrcTemplate.I2S_SRCTEMPLATEMAP[SrcTemplate.UNKNOWN],
|
||||||
SrcAttributeType.I2K_SRCTEMPLATEMAP[SrcAttributeType.UNKNOWN])
|
SrcTemplate.I2K_SRCTEMPLATEMAP[SrcTemplate.UNKNOWN])
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def set_source_template(self, tempindex, tempcustom_str):
|
def set_source_template(self, tempindex, tempcustom_str):
|
||||||
@ -100,11 +101,11 @@ class SrcAttributeBase(AttributeRootBase):
|
|||||||
#we create a new attribute and add it
|
#we create a new attribute and add it
|
||||||
attrtemp = SrcAttribute()
|
attrtemp = SrcAttribute()
|
||||||
self.add_attribute(attrtemp)
|
self.add_attribute(attrtemp)
|
||||||
if tempindex == SrcAttributeType.UNKNOWN or \
|
if tempindex == SrcTemplate.UNKNOWN or \
|
||||||
(tempindex == SrcAttributeType.CUSTOM and tempcustom_str.strip() == ''):
|
(tempindex == SrcTemplate.CUSTOM and tempcustom_str.strip() == ''):
|
||||||
self.remove_attribute(attrtemp)
|
self.remove_attribute(attrtemp)
|
||||||
elif not (tempindex == SrcAttributeType.CUSTOM):
|
elif not (tempindex == SrcTemplate.CUSTOM):
|
||||||
attrtemp.set_value(SrcAttributeType.I2K_SRCTEMPLATEMAP[tempindex])
|
attrtemp.set_value(SrcTemplate.I2K_SRCTEMPLATEMAP[tempindex])
|
||||||
else:
|
else:
|
||||||
#custom key, store string as is
|
#custom key, store string as is
|
||||||
attrtemp.set_value(tempindex)
|
attrtemp.set_value(tempindex)
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -120,7 +120,6 @@ class SrcTemplateTab(GrampsTab):
|
|||||||
|
|
||||||
:param scrolled: GtkScrolledWindow to which to add treeview with templates
|
:param scrolled: GtkScrolledWindow to which to add treeview with templates
|
||||||
"""
|
"""
|
||||||
srcattr = SrcAttributeType()
|
|
||||||
templ = self.src.get_source_template()
|
templ = self.src.get_source_template()
|
||||||
self.temp_tv = SrcTemplateTreeView(templ[2],
|
self.temp_tv = SrcTemplateTreeView(templ[2],
|
||||||
sel_callback=self.on_template_selected)
|
sel_callback=self.on_template_selected)
|
||||||
@ -199,10 +198,9 @@ class TemplateFields(object):
|
|||||||
Template must be the index of the template.
|
Template must be the index of the template.
|
||||||
"""
|
"""
|
||||||
#obtain the template of the index
|
#obtain the template of the index
|
||||||
srcattr = SrcAttributeType()
|
if index in SrcTemplate.EVIDENCETEMPLATES:
|
||||||
if index in srcattr.EVIDENCETEMPLATES:
|
|
||||||
#a predefined template,
|
#a predefined template,
|
||||||
template = srcattr.EVIDENCETEMPLATES[index]
|
template = SrcTemplate.EVIDENCETEMPLATES[index]
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -298,6 +296,8 @@ class TemplateFields(object):
|
|||||||
"""
|
"""
|
||||||
self.gridfields.insert_row(row)
|
self.gridfields.insert_row(row)
|
||||||
field = srcattrtype
|
field = srcattrtype
|
||||||
|
if isinstance(field, basestring):
|
||||||
|
raise NotImplementedError, "type must be the integer key"
|
||||||
#setup label
|
#setup label
|
||||||
if alt_label:
|
if alt_label:
|
||||||
label = alt_label
|
label = alt_label
|
||||||
|
@ -44,7 +44,7 @@ from gi.repository import Gtk
|
|||||||
# Gramps classes
|
# Gramps classes
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gramps.gen.lib import SrcAttributeType
|
from gramps.gen.lib import SrcTemplate
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -54,7 +54,7 @@ from gramps.gen.lib import SrcAttributeType
|
|||||||
|
|
||||||
class SrcTemplateTreeView(Gtk.TreeView):
|
class SrcTemplateTreeView(Gtk.TreeView):
|
||||||
'''
|
'''
|
||||||
TreeView for SrcAttribute templates, to allow fast selection
|
TreeView for SrcTemplate templates, to allow fast selection
|
||||||
'''
|
'''
|
||||||
def __init__(self, default_key, sel_callback):
|
def __init__(self, default_key, sel_callback):
|
||||||
"""
|
"""
|
||||||
@ -78,11 +78,11 @@ class SrcTemplateTreeView(Gtk.TreeView):
|
|||||||
"""
|
"""
|
||||||
Obtains all templates and stores them in a TreeStore
|
Obtains all templates and stores them in a TreeStore
|
||||||
"""
|
"""
|
||||||
srcattrt = SrcAttributeType()
|
srctemp = SrcTemplate()
|
||||||
self.I2Str = srcattrt.I2S_SRCTEMPLATEMAP
|
self.I2Str = srctemp.I2S_SRCTEMPLATEMAP
|
||||||
self.I2Key = srcattrt.I2K_SRCTEMPLATEMAP
|
self.I2Key = srctemp.I2K_SRCTEMPLATEMAP
|
||||||
self.Str2I = srcattrt.S2I_SRCTEMPLATEMAP
|
self.Str2I = srctemp.S2I_SRCTEMPLATEMAP
|
||||||
self.Key2I = srcattrt.K2I_SRCTEMPLATEMAP
|
self.Key2I = srctemp.K2I_SRCTEMPLATEMAP
|
||||||
self.Key2Path = {}
|
self.Key2Path = {}
|
||||||
# store (index, key, src_type)
|
# store (index, key, src_type)
|
||||||
self.model = Gtk.TreeStore(int, str, str)
|
self.model = Gtk.TreeStore(int, str, str)
|
||||||
|
Loading…
Reference in New Issue
Block a user