* src/GrampsDb/_GrampsDbBase.py: prevent null event types and
attribute types from being added * src/Editors/_EditAttribute.py: prevent null attribute types * src/Editors/_EditEvent.py: prevent null attribute types * src/AutoComp.py: filter out empty strings * src/ImgManip.py: check for file before attempting thumbnailer svn: r6898
This commit is contained in:
parent
8366c12818
commit
4cf930d039
@ -1,4 +1,10 @@
|
|||||||
2006-06-15 Don Allingham <don@gramps-project.org>
|
2006-06-15 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/GrampsDb/_GrampsDbBase.py: prevent null event types and
|
||||||
|
attribute types from being added
|
||||||
|
* src/Editors/_EditAttribute.py: prevent null attribute types
|
||||||
|
* src/Editors/_EditEvent.py: prevent null attribute types
|
||||||
|
* src/AutoComp.py: filter out empty strings
|
||||||
|
* src/ImgManip.py: check for file before attempting thumbnailer
|
||||||
* src/ScratchPad.py: enable Text dnd
|
* src/ScratchPad.py: enable Text dnd
|
||||||
|
|
||||||
2006-06-15 Alex Roitman <shura@gramps-project.org>
|
2006-06-15 Alex Roitman <shura@gramps-project.org>
|
||||||
|
@ -139,6 +139,7 @@ class StandardCustomSelector:
|
|||||||
self.active_key = active_key
|
self.active_key = active_key
|
||||||
self.active_index = 0
|
self.active_index = 0
|
||||||
self.additional = additional
|
self.additional = additional
|
||||||
|
|
||||||
# make model
|
# make model
|
||||||
self.store = gtk.ListStore(int,str)
|
self.store = gtk.ListStore(int,str)
|
||||||
|
|
||||||
@ -176,8 +177,10 @@ class StandardCustomSelector:
|
|||||||
if self.additional:
|
if self.additional:
|
||||||
for event_type in self.additional:
|
for event_type in self.additional:
|
||||||
if type(event_type) == str or type(event_type) == unicode :
|
if type(event_type) == str or type(event_type) == unicode :
|
||||||
|
if event_type:
|
||||||
self.store.append(row=[self.custom_key, event_type])
|
self.store.append(row=[self.custom_key, event_type])
|
||||||
elif type(event_type) == tuple:
|
elif type(event_type) == tuple:
|
||||||
|
if event_type[1]:
|
||||||
self.store.append(row=[event_type[0], event_type[1]])
|
self.store.append(row=[event_type[0], event_type[1]])
|
||||||
else:
|
else:
|
||||||
self.store.append(row=[int(event_type), str(event_type)])
|
self.store.append(row=[int(event_type), str(event_type)])
|
||||||
|
@ -135,6 +135,14 @@ class EditAttribute(EditSecondary):
|
|||||||
Called when the OK button is pressed. Gets data from the
|
Called when the OK button is pressed. Gets data from the
|
||||||
form and updates the Attribute data structure.
|
form and updates the Attribute data structure.
|
||||||
"""
|
"""
|
||||||
|
t = self.obj.get_type()
|
||||||
|
|
||||||
|
if t.is_custom() and str(t) == '':
|
||||||
|
from QuestionDialog import ErrorDialog
|
||||||
|
ErrorDialog(
|
||||||
|
_("Cannot save attribute"),
|
||||||
|
_("The attribute type cannot be empty"))
|
||||||
|
return
|
||||||
if self.callback:
|
if self.callback:
|
||||||
self.callback(self.obj)
|
self.callback(self.obj)
|
||||||
self.close()
|
self.close()
|
||||||
|
@ -204,6 +204,13 @@ class EditEvent(EditPrimary):
|
|||||||
"enter data or cancel the edit."))
|
"enter data or cancel the edit."))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
t = self.obj.get_type()
|
||||||
|
if t.is_custom() and str(t) == '':
|
||||||
|
ErrorDialog(
|
||||||
|
_("Cannot save event"),
|
||||||
|
_("The event type cannot be empty"))
|
||||||
|
return
|
||||||
|
|
||||||
if self.obj.handle == None:
|
if self.obj.handle == None:
|
||||||
trans = self.db.transaction_begin()
|
trans = self.db.transaction_begin()
|
||||||
self.db.add_event(self.obj,trans)
|
self.db.add_event(self.obj,trans)
|
||||||
|
@ -448,7 +448,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
|
|
||||||
self.individual_attributes.update(
|
self.individual_attributes.update(
|
||||||
[str(attr.type) for attr in person.attribute_list
|
[str(attr.type) for attr in person.attribute_list
|
||||||
if attr.type.is_custom()])
|
if attr.type.is_custom() and str(attr.type)])
|
||||||
|
|
||||||
if person.marker.is_custom():
|
if person.marker.is_custom():
|
||||||
self.marker_names.add(str(person.marker))
|
self.marker_names.add(str(person.marker))
|
||||||
@ -468,7 +468,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
attr_list = []
|
attr_list = []
|
||||||
for mref in person.media_list:
|
for mref in person.media_list:
|
||||||
attr_list += [str(attr.type) for attr in mref.attribute_list
|
attr_list += [str(attr.type) for attr in mref.attribute_list
|
||||||
if attr.type.is_custom()]
|
if attr.type.is_custom() and str(attr.type)]
|
||||||
self.media_attributes.update(attr_list)
|
self.media_attributes.update(attr_list)
|
||||||
|
|
||||||
def commit_media_object(self, obj, transaction, change_time=None):
|
def commit_media_object(self, obj, transaction, change_time=None):
|
||||||
@ -482,7 +482,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
transaction, change_time)
|
transaction, change_time)
|
||||||
self.media_attributes.update(
|
self.media_attributes.update(
|
||||||
[str(attr.type) for attr in obj.attribute_list
|
[str(attr.type) for attr in obj.attribute_list
|
||||||
if attr.type.is_custom()])
|
if attr.type.is_custom() and str(attr.type)])
|
||||||
|
|
||||||
def commit_source(self, source, transaction, change_time=None):
|
def commit_source(self, source, transaction, change_time=None):
|
||||||
"""
|
"""
|
||||||
@ -501,7 +501,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
attr_list = []
|
attr_list = []
|
||||||
for mref in source.media_list:
|
for mref in source.media_list:
|
||||||
attr_list += [str(attr.type) for attr in mref.attribute_list
|
attr_list += [str(attr.type) for attr in mref.attribute_list
|
||||||
if attr.type.is_custom()]
|
if attr.type.is_custom() and str(attr.type)]
|
||||||
self.media_attributes.update(attr_list)
|
self.media_attributes.update(attr_list)
|
||||||
|
|
||||||
def commit_place(self, place, transaction, change_time=None):
|
def commit_place(self, place, transaction, change_time=None):
|
||||||
@ -520,7 +520,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
attr_list = []
|
attr_list = []
|
||||||
for mref in place.media_list:
|
for mref in place.media_list:
|
||||||
attr_list += [str(attr.type) for attr in mref.attribute_list
|
attr_list += [str(attr.type) for attr in mref.attribute_list
|
||||||
if attr.type.is_custom()]
|
if attr.type.is_custom() and str(attr.type)]
|
||||||
self.media_attributes.update(attr_list)
|
self.media_attributes.update(attr_list)
|
||||||
|
|
||||||
def commit_personal_event(self, event, transaction, change_time=None):
|
def commit_personal_event(self, event, transaction, change_time=None):
|
||||||
@ -545,7 +545,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
attr_list = []
|
attr_list = []
|
||||||
for mref in event.media_list:
|
for mref in event.media_list:
|
||||||
attr_list += [str(attr.type) for attr in mref.attribute_list
|
attr_list += [str(attr.type) for attr in mref.attribute_list
|
||||||
if attr.type.is_custom()]
|
if attr.type.is_custom() and str(attr.type)]
|
||||||
self.media_attributes.update(attr_list)
|
self.media_attributes.update(attr_list)
|
||||||
|
|
||||||
def commit_family(self, family, transaction, change_time=None):
|
def commit_family(self, family, transaction, change_time=None):
|
||||||
@ -560,7 +560,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
|
|
||||||
self.family_attributes.update(
|
self.family_attributes.update(
|
||||||
[str(attr.type) for attr in family.attribute_list
|
[str(attr.type) for attr in family.attribute_list
|
||||||
if attr.type.is_custom()])
|
if attr.type.is_custom() and str(attr.type)])
|
||||||
|
|
||||||
rel_list = []
|
rel_list = []
|
||||||
for ref in family.child_ref_list:
|
for ref in family.child_ref_list:
|
||||||
@ -580,7 +580,7 @@ class GrampsDbBase(GrampsDBCallback):
|
|||||||
attr_list = []
|
attr_list = []
|
||||||
for mref in family.media_list:
|
for mref in family.media_list:
|
||||||
attr_list += [str(attr.type) for attr in mref.attribute_list
|
attr_list += [str(attr.type) for attr in mref.attribute_list
|
||||||
if attr.type.is_custom()]
|
if attr.type.is_custom() and str(attr.type)]
|
||||||
self.media_attributes.update(attr_list)
|
self.media_attributes.update(attr_list)
|
||||||
|
|
||||||
def commit_repository(self, repository, transaction, change_time=None):
|
def commit_repository(self, repository, transaction, change_time=None):
|
||||||
|
@ -116,7 +116,7 @@ def _build_thumb_path(path):
|
|||||||
return os.path.join(const.thumb_dir, m.hexdigest()+'.png')
|
return os.path.join(const.thumb_dir, m.hexdigest()+'.png')
|
||||||
|
|
||||||
def run_thumbnailer(mtype, frm, to, size=const.thumbScale):
|
def run_thumbnailer(mtype, frm, to, size=const.thumbScale):
|
||||||
if const.use_thumbnailer:
|
if const.use_thumbnailer and os.path.isfile(frm):
|
||||||
sublist = {
|
sublist = {
|
||||||
'%s' : "%dx%d" % (int(size),int(size)),
|
'%s' : "%dx%d" % (int(size),int(size)),
|
||||||
'%u' : frm,
|
'%u' : frm,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user