diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 75abbec2b..a7dc03f18 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,8 @@ 2006-06-30 Don Allingham + * src/AddMedia.py: use full paths for calculations to avoid pwd issues + * src/DbLoader.py: fix working directories + * example/gramps/example.gramps: remove hard coded paths + * example/gramps/data.gramps: remove hard coded paths * src/GrampsDb/_DbUtils.py (remove_parent_from_family): adjust the transaction message for appropriate father/mother indicator * src/GrampsWidgets.py: Add GenderWidget to try to isolate windows diff --git a/gramps2/example/gramps/data.gramps b/gramps2/example/gramps/data.gramps index e272b60c8..b764ef588 100644 --- a/gramps2/example/gramps/data.gramps +++ b/gramps2/example/gramps/data.gramps @@ -1191,22 +1191,22 @@ Company. He enlisted in the army at Sparks 7 December 1917 and served as a Corpo - + - + - + - + - + - + diff --git a/gramps2/example/gramps/example.gramps b/gramps2/example/gramps/example.gramps index eb698f490..6126dd41f 100644 --- a/gramps2/example/gramps/example.gramps +++ b/gramps2/example/gramps/example.gramps @@ -45563,22 +45563,22 @@ This is a paragraph from the gramps-project.org page that was translated by Goog - + - + - + - + - + - + diff --git a/gramps2/src/AddMedia.py b/gramps2/src/AddMedia.py index 3da828e85..f67d5c490 100644 --- a/gramps2/src/AddMedia.py +++ b/gramps2/src/AddMedia.py @@ -131,20 +131,23 @@ class AddMediaObject(ManagedWindow.ManagedWindow): mobj.set_mime_type(None) else: filename = self.file_text.get_filename() - + full_file = filename + if self.relpath.get_active(): p = self.db.get_save_path() if not os.path.isdir(p): p = os.path.dirname(p) filename = Utils.relative_path(filename,p) - + + print os.getcwd(), filename, full_file + if os.path.exists(filename) == 0: msgstr = _("Cannot import %s") msgstr2 = _("The filename supplied could not be found.") ErrorDialog(msgstr % filename, msgstr2) return - mtype = Mime.get_type(filename) + mtype = Mime.get_type(full_file) if description == "": description = os.path.basename(filename) diff --git a/gramps2/src/DbLoader.py b/gramps2/src/DbLoader.py index 7b3e0812a..b17a20704 100644 --- a/gramps2/src/DbLoader.py +++ b/gramps2/src/DbLoader.py @@ -110,6 +110,10 @@ class DbLoader: const.app_gedcom]: self.read_file(filename,filetype) + try: + os.chdir(os.path.dirname(filename)) + except: + return ('','') return (filename,filetype) else: QuestionDialog.ErrorDialog( @@ -154,6 +158,10 @@ class DbLoader: pass filetype = const.app_gramps self.read_file(filename,filetype) + try: + os.chdir(os.path.dirname(filename)) + except: + return ('','') return (filename,filetype) else: choose.destroy() @@ -353,12 +361,6 @@ class DbLoader: _('You do not have write access to the selected file.')) return True - # FIXME: not sure what this is for at this point - try: - os.chdir(os.path.dirname(filename)) - except: - print "could not change directory" - return False def read_file(self, filename, filetype): @@ -391,6 +393,10 @@ class DbLoader: try: self.dbstate.db.load(filename,self.uistate.pulse_progressbar,mode) + try: + os.chdir(os.path.dirname(filename)) + except: + print "could not change directory" except Exception: log.error("Failed to open database.", exc_info=True)