diff --git a/ChangeLog b/ChangeLog index 0e9b71fab..a1e4db8f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-11-07 Benny Malengier + * src/AddMedia.py: fix issue #1350, relative path not working addmedia + * src/Editors/_EditPerson.py: family rebuild callback error + 2007-11-07 Benny Malengier * src/AddMedia.py: media crash, fix issue #1349, change unicode to Utils diff --git a/src/AddMedia.py b/src/AddMedia.py index 17b51c736..99a836a8c 100644 --- a/src/AddMedia.py +++ b/src/AddMedia.py @@ -59,6 +59,15 @@ import Mime import GrampsDisplay import ManagedWindow +#------------------------------------------------------------------------- +# +# global variables +# +#------------------------------------------------------------------------- + +_last_directory = None +_relative_path = False + #------------------------------------------------------------------------- # # AddMediaObject @@ -69,8 +78,6 @@ class AddMediaObject(ManagedWindow.ManagedWindow): Displays the Add Media Dialog window, allowing the user to select a media object from the file system, while providing a description. """ - - last_directory = None def __init__(self, dbstate, uistate, track): """ @@ -92,12 +99,13 @@ class AddMediaObject(ManagedWindow.ManagedWindow): self.description = self.glade.get_widget("photoDescription") self.image = self.glade.get_widget("image") self.file_text = self.glade.get_widget("fname") - if self.last_directory and os.path.isdir(self.last_directory): - self.file_text.set_current_folder(self.last_directory) + if _last_directory and os.path.isdir(_last_directory): + self.file_text.set_current_folder(_last_directory) self.internal = self.glade.get_widget('internal') self.internal.connect('toggled', self.internal_toggled) self.relpath = self.glade.get_widget('relpath') + self.relpath.set_active(_relative_path) self.temp_name = "" self.object = None @@ -127,6 +135,9 @@ class AddMediaObject(ManagedWindow.ManagedWindow): Callback function called with the save button is pressed. A new media object is created, and added to the database. """ + + global _last_directory, _relative_path + description = unicode(self.description.get_text()) if self.internal.get_active(): @@ -141,7 +152,8 @@ class AddMediaObject(ManagedWindow.ManagedWindow): ErrorDialog(msgstr, msgstr2) return - filename = Utils.get_unicode_path(self.file_text.get_filename()) + filename = unicode(self.file_text.get_filename(), + sys.getfilesystemencoding()) full_file = filename if self.relpath.get_active(): @@ -165,7 +177,8 @@ class AddMediaObject(ManagedWindow.ManagedWindow): mobj.set_mime_type(mtype) name = filename 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()) if not mobj.get_gramps_id(): diff --git a/src/Editors/_EditPerson.py b/src/Editors/_EditPerson.py index 06f9be0d1..4f1039eb1 100644 --- a/src/Editors/_EditPerson.py +++ b/src/Editors/_EditPerson.py @@ -171,7 +171,7 @@ class EditPerson(EditPrimary): self._add_db_signal('family-update', 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 backreferences to family in person when: 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 # rebuild family backreferences on all family changes - self._update_families() def _update_families(self):