* src/gramps_main.py (open_example): Add example database funciton.
svn: r4625
This commit is contained in:
parent
998ebb2ae7
commit
0927aac3b8
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
* src/po/template.po: Update for 2.0.1.
|
* src/po/template.po: Update for 2.0.1.
|
||||||
|
|
||||||
|
* src/gramps_main.py (open_example): Add example database funciton.
|
||||||
|
|
||||||
2005-05-18 Don Allingham <don@gramps-project.org>
|
2005-05-18 Don Allingham <don@gramps-project.org>
|
||||||
* src/ReadGedcom.py: grab description for birth and death events
|
* src/ReadGedcom.py: grab description for birth and death events
|
||||||
* src/WriteGedcom.py: export description for birth and death events
|
* src/WriteGedcom.py: export description for birth and death events
|
||||||
|
@ -1888,7 +1888,40 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
|
|||||||
task(self.db,self.active_person,self.tool_callback,self)
|
task(self.db,self.active_person,self.tool_callback,self)
|
||||||
|
|
||||||
def open_example(self,obj):
|
def open_example(self,obj):
|
||||||
pass
|
import shutil
|
||||||
|
dest = os.path.expanduser("~/.gramps/example")
|
||||||
|
if not os.path.isdir(dest):
|
||||||
|
try:
|
||||||
|
os.mkdir(dest)
|
||||||
|
except IOError,msg:
|
||||||
|
ErrorDialog(_('Could not create example database'),
|
||||||
|
_('The directory ~/.gramps/example could not '
|
||||||
|
'be created.') + '\n' + str(msg) )
|
||||||
|
except OSError,msg:
|
||||||
|
ErrorDialog(_('Could not create example database'),
|
||||||
|
_('The directory ~/.gramps/example could not '
|
||||||
|
'be created.') + '\n' + str(msg) )
|
||||||
|
except:
|
||||||
|
ErrorDialog(_('Could not create example database'),
|
||||||
|
_('The directory ~/.gramps/example could not '
|
||||||
|
'be created.'))
|
||||||
|
try:
|
||||||
|
example_dir = "%s/share/gramps/example" % const.prefixdir
|
||||||
|
for filename in os.listdir(example_dir):
|
||||||
|
shutil.copyfile("%s/%s" % (example_dir,filename),
|
||||||
|
"%s/%s" % (dest,filename) )
|
||||||
|
try:
|
||||||
|
shutil.copystat("%s/%s" % (example_dir,filename),
|
||||||
|
"%s/%s" % (dest,filename))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
except IOError,msg:
|
||||||
|
ErrorDialog(_('Could not create example database'),str(msg))
|
||||||
|
except OSError,msg:
|
||||||
|
ErrorDialog(_('Could not create example database'),str(msg))
|
||||||
|
|
||||||
|
filename = "%s/%s" % (dest,const.xmlFile)
|
||||||
|
DbPrompter.open_native(self,filename,const.app_gramps_xml)
|
||||||
|
|
||||||
DARKEN = 1.4
|
DARKEN = 1.4
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user