* src/AddMedia.py: fix issue #1350, relative path not working addmedia
* src/Editors/_EditPerson.py: family rebuild callback error 2007-11-07 Benny Malengier <benny.malengier@gramps-project.org> svn: r9317
This commit is contained in:
parent
070be15e0d
commit
60fc844167
@ -1,3 +1,7 @@
|
|||||||
|
2007-11-07 Benny Malengier <benny.malengier@gramps-project.org>
|
||||||
|
* src/AddMedia.py: fix issue #1350, relative path not working addmedia
|
||||||
|
* src/Editors/_EditPerson.py: family rebuild callback error
|
||||||
|
|
||||||
2007-11-07 Benny Malengier <benny.malengier@gramps-project.org>
|
2007-11-07 Benny Malengier <benny.malengier@gramps-project.org>
|
||||||
* src/AddMedia.py: media crash, fix issue #1349, change unicode to Utils
|
* src/AddMedia.py: media crash, fix issue #1349, change unicode to Utils
|
||||||
|
|
||||||
|
@ -59,6 +59,15 @@ import Mime
|
|||||||
import GrampsDisplay
|
import GrampsDisplay
|
||||||
import ManagedWindow
|
import ManagedWindow
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# global variables
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
_last_directory = None
|
||||||
|
_relative_path = False
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# AddMediaObject
|
# AddMediaObject
|
||||||
@ -69,8 +78,6 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
|
|||||||
Displays the Add Media Dialog window, allowing the user to select
|
Displays the Add Media Dialog window, allowing the user to select
|
||||||
a media object from the file system, while providing a description.
|
a media object from the file system, while providing a description.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
last_directory = None
|
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate, track):
|
def __init__(self, dbstate, uistate, track):
|
||||||
"""
|
"""
|
||||||
@ -92,12 +99,13 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
|
|||||||
self.description = self.glade.get_widget("photoDescription")
|
self.description = self.glade.get_widget("photoDescription")
|
||||||
self.image = self.glade.get_widget("image")
|
self.image = self.glade.get_widget("image")
|
||||||
self.file_text = self.glade.get_widget("fname")
|
self.file_text = self.glade.get_widget("fname")
|
||||||
if self.last_directory and os.path.isdir(self.last_directory):
|
if _last_directory and os.path.isdir(_last_directory):
|
||||||
self.file_text.set_current_folder(self.last_directory)
|
self.file_text.set_current_folder(_last_directory)
|
||||||
|
|
||||||
self.internal = self.glade.get_widget('internal')
|
self.internal = self.glade.get_widget('internal')
|
||||||
self.internal.connect('toggled', self.internal_toggled)
|
self.internal.connect('toggled', self.internal_toggled)
|
||||||
self.relpath = self.glade.get_widget('relpath')
|
self.relpath = self.glade.get_widget('relpath')
|
||||||
|
self.relpath.set_active(_relative_path)
|
||||||
self.temp_name = ""
|
self.temp_name = ""
|
||||||
self.object = None
|
self.object = None
|
||||||
|
|
||||||
@ -127,6 +135,9 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
|
|||||||
Callback function called with the save button is pressed.
|
Callback function called with the save button is pressed.
|
||||||
A new media object is created, and added to the database.
|
A new media object is created, and added to the database.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
global _last_directory, _relative_path
|
||||||
|
|
||||||
description = unicode(self.description.get_text())
|
description = unicode(self.description.get_text())
|
||||||
|
|
||||||
if self.internal.get_active():
|
if self.internal.get_active():
|
||||||
@ -141,7 +152,8 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
|
|||||||
ErrorDialog(msgstr, msgstr2)
|
ErrorDialog(msgstr, msgstr2)
|
||||||
return
|
return
|
||||||
|
|
||||||
filename = Utils.get_unicode_path(self.file_text.get_filename())
|
filename = unicode(self.file_text.get_filename(),
|
||||||
|
sys.getfilesystemencoding())
|
||||||
full_file = filename
|
full_file = filename
|
||||||
|
|
||||||
if self.relpath.get_active():
|
if self.relpath.get_active():
|
||||||
@ -165,7 +177,8 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
|
|||||||
mobj.set_mime_type(mtype)
|
mobj.set_mime_type(mtype)
|
||||||
name = filename
|
name = filename
|
||||||
mobj.set_path(name)
|
mobj.set_path(name)
|
||||||
self.last_directory = os.path.dirname(filename)
|
_last_directory = os.path.dirname(full_file)
|
||||||
|
_relative_path = self.relpath.get_active()
|
||||||
|
|
||||||
mobj.set_handle(Utils.create_id())
|
mobj.set_handle(Utils.create_id())
|
||||||
if not mobj.get_gramps_id():
|
if not mobj.get_gramps_id():
|
||||||
|
@ -171,7 +171,7 @@ class EditPerson(EditPrimary):
|
|||||||
self._add_db_signal('family-update', self.family_change)
|
self._add_db_signal('family-update', self.family_change)
|
||||||
self._add_db_signal('family-add', self.family_change)
|
self._add_db_signal('family-add', self.family_change)
|
||||||
|
|
||||||
def family_change(self, handle_list):
|
def family_change(self, handle_list=[]):
|
||||||
"""Callback for family change signals. This should rebuild the
|
"""Callback for family change signals. This should rebuild the
|
||||||
backreferences to family in person when:
|
backreferences to family in person when:
|
||||||
1)a family the person is parent of changes. Person could have
|
1)a family the person is parent of changes. Person could have
|
||||||
@ -183,7 +183,6 @@ class EditPerson(EditPrimary):
|
|||||||
"""
|
"""
|
||||||
#As this would be an extensive check, we choose the easy path and
|
#As this would be an extensive check, we choose the easy path and
|
||||||
# rebuild family backreferences on all family changes
|
# rebuild family backreferences on all family changes
|
||||||
|
|
||||||
self._update_families()
|
self._update_families()
|
||||||
|
|
||||||
def _update_families(self):
|
def _update_families(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user