* 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


svn: r6977
This commit is contained in:
Don Allingham 2006-07-01 04:55:36 +00:00
parent 1353edcca9
commit 3f750b2e40
5 changed files with 34 additions and 21 deletions

View File

@ -1,4 +1,8 @@
2006-06-30 Don Allingham <don@gramps-project.org>
* 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

View File

@ -1191,22 +1191,22 @@ Company. He enlisted in the army at Sparks 7 December 1917 and served as a Corpo
</places>
<objects>
<object id="O0" handle="_HHNT6D73QPKC0KWK2Y" change="1141336857">
<file src="/home/shura/devel-gramps/example/gramps/O0.jpg" mime="image/jpeg" description="Keith Lloyd Smith"/>
<file src="O0.jpg" mime="image/jpeg" description="Keith Lloyd Smith"/>
</object>
<object id="O1" handle="_W2NT6D87SPI9V7G27P" change="1141336857">
<file src="/home/shura/devel-gramps/example/gramps/O1.jpg" mime="image/jpeg" description="Arriving 1910"/>
<file src="O1.jpg" mime="image/jpeg" description="Arriving 1910"/>
</object>
<object id="O2" handle="_43NT6DHH0TBN0PKVC" change="1141336857">
<file src="/home/shura/devel-gramps/example/gramps/O2.jpg" mime="image/jpeg" description="Emil &amp; Gustaf Smith"/>
<file src="O2.jpg" mime="image/jpeg" description="Emil &amp; Gustaf Smith"/>
</object>
<object id="O3" handle="_CVNT6DHG5ICZ1UGUO9" change="1141336857">
<file src="/home/shura/devel-gramps/example/gramps/O3.jpg" mime="image/jpeg" description="Edwin Michael Smith"/>
<file src="O3.jpg" mime="image/jpeg" description="Edwin Michael Smith"/>
</object>
<object id="O4" handle="_Y0OT6DM7FW06A1SLMS" change="1141336857">
<file src="/home/shura/devel-gramps/example/gramps/O4.jpg" mime="image/jpeg" description="Marjorie Alice Smith"/>
<file src="O4.jpg" mime="image/jpeg" description="Marjorie Alice Smith"/>
</object>
<object id="O5" handle="_MNNT6D27G3L8SGVQJV" change="1141336857">
<file src="/home/shura/devel-gramps/example/gramps/O5.jpg" mime="image/jpeg" description="Edwin &amp; Janice Smith"/>
<file src="O5.jpg" mime="image/jpeg" description="Edwin &amp; Janice Smith"/>
</object>
</objects>
<repositories>

View File

@ -45563,22 +45563,22 @@ This is a paragraph from the gramps-project.org page that was translated by Goog
</places>
<objects>
<object id="O0006" handle="_F0QIGQFT275JFJ75E8" change="1147667430">
<file src="/home/shura/2.0-gramps/example/gramps/Alimehemet.jpg" mime="image/jpeg" description="Alimehemet"/>
<file src="Alimehemet.jpg" mime="image/jpeg" description="Alimehemet"/>
</object>
<object id="O0007" handle="_F8JYGQFL2PKLSYH79X" change="1147667430">
<file src="/home/shura/2.0-gramps/example/gramps/E_W_Dahlgren.jpg" mime="image/jpeg" description="E_W_Dahlgren"/>
<file src="E_W_Dahlgren.jpg" mime="image/jpeg" description="E_W_Dahlgren"/>
</object>
<object id="O0008" handle="_B1AUFQV7H8R9NR4SZM" change="1147667430">
<file src="/home/shura/2.0-gramps/example/gramps/654px-Aksel_Andersson.jpg" mime="image/jpeg" description="654px-Aksel_Andersson"/>
<file src="654px-Aksel_Andersson.jpg" mime="image/jpeg" description="654px-Aksel_Andersson"/>
</object>
<object id="O0009" handle="_78V2GQX2FKNSYQ3OHE" change="1147667430">
<file src="/home/shura/2.0-gramps/example/gramps/Gunnlaugur_Larusson_-_Yawn.jpg" mime="image/jpeg" description="Yawn"/>
<file src="Gunnlaugur_Larusson_-_Yawn.jpg" mime="image/jpeg" description="Yawn"/>
</object>
<object id="O0010" handle="_238CGQ939HG18SS5MG" change="1147667430">
<file src="/home/shura/2.0-gramps/example/gramps/1897_expeditionsmannschaft_rio_a.jpg" mime="image/jpeg" description="1897_expeditionsmannschaft_rio_a"/>
<file src="1897_expeditionsmannschaft_rio_a.jpg" mime="image/jpeg" description="1897_expeditionsmannschaft_rio_a"/>
</object>
<object id="O0011" handle="_Y3ARGQWE088EQRTTDH" change="1147667430">
<file src="/home/shura/2.0-gramps/example/gramps/AntoineClaudet.png" mime="image/png" description="AntoineClaudet"/>
<file src="AntoineClaudet.png" mime="image/png" description="AntoineClaudet"/>
</object>
</objects>
<repositories>

View File

@ -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)

View File

@ -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)