CLI fixup: bugs 1331,2,3,4
svn: r9286
This commit is contained in:
parent
214a12846e
commit
3ce249d923
@ -1,3 +1,10 @@
|
||||
2007-10-31 Jim Sack <jgsack@san.rr.com>
|
||||
* src/gen/db/dbdir.py bug #1331 write_lock_file() add mkdir if needed
|
||||
* src/gramps.py bug #1332 more gramps termination problems fixed
|
||||
* src/ArgHandler bug #1333 change remove to glob remove and rmdir
|
||||
* (op cit) bug #1334 update module name and calling parm to import2
|
||||
* and function name: s/export_data/write_gedcom_file/
|
||||
|
||||
2007-10-31 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||
* src/DataViews/_EventView.py: Add properties icon to column editor
|
||||
menu entry - the other views use that too.
|
||||
|
@ -435,10 +435,13 @@ class ArgHandler:
|
||||
self.cl_export(expt[0],expt[1])
|
||||
|
||||
print "Cleaning up."
|
||||
# remove import db after use
|
||||
# remove import db subdir after use
|
||||
self.state.db.close()
|
||||
if self.imports:
|
||||
os.remove(self.imp_db_path)
|
||||
import glob
|
||||
for f in glob.glob(os.path.join(self.imp_db_path, "*")):
|
||||
os.remove(f)
|
||||
os.rmdir(self.imp_db_path)
|
||||
print "Exiting."
|
||||
sys.exit(0)
|
||||
|
||||
@ -476,8 +479,8 @@ class ArgHandler:
|
||||
filename = os.path.normpath(os.path.abspath(filename))
|
||||
try:
|
||||
# Cheating here to use default encoding
|
||||
from GrampsDbUtils._GedcomParse import import2
|
||||
import2(self.state.db,filename,None,None,False)
|
||||
from GrampsDbUtils._ReadGedcom import import2
|
||||
import2(self.state.db,filename,None,"",False)
|
||||
except:
|
||||
print "Error importing %s" % filename
|
||||
sys.exit(1)
|
||||
@ -574,7 +577,7 @@ class ArgHandler:
|
||||
elif format == 'gedcom':
|
||||
try:
|
||||
gw = GrampsDbUtils.GedcomWriter(self.state.db, None, 1)
|
||||
ret = gw.export_data(filename)
|
||||
ret = gw.write_gedcom_file(filename)
|
||||
except:
|
||||
print "Error exporting %s" % filename
|
||||
sys.exit(1)
|
||||
|
@ -1744,6 +1744,8 @@ def clear_lock_file(name):
|
||||
return
|
||||
|
||||
def write_lock_file(name):
|
||||
if not os.path.isdir(name):
|
||||
os.mkdir(name)
|
||||
f = open(os.path.join(name, "lock"), "w")
|
||||
if os.name == 'nt':
|
||||
text = os.environ['USERNAME']
|
||||
|
@ -184,17 +184,40 @@ def run():
|
||||
program.set_property('app-prefix', const.PREFIXDIR)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
try:
|
||||
quit_now = False
|
||||
exit_code = 0
|
||||
import gramps_main
|
||||
gramps_main.Gramps(args)
|
||||
# TODO: check for returns from gramps_main.Gramps.__init__()
|
||||
# that perhaps should have raised an exception to be caught here
|
||||
|
||||
except SystemExit, e:
|
||||
quit_now = True
|
||||
if e.code:
|
||||
log.error("Gramps terminated with exit code: %d." % e.code, exc_info=True)
|
||||
gtk.main_quit()
|
||||
return False
|
||||
exit_code = e.code
|
||||
log.error("Gramps terminated with exit code: %d." \
|
||||
% e.code, exc_info=True)
|
||||
except OSError, e:
|
||||
quit_now = True
|
||||
exit_code = e[0] or 1
|
||||
try:
|
||||
fn = e.filename
|
||||
except AttributeError:
|
||||
fn = ""
|
||||
log.error("Gramps terminated because of OS Error\n" +
|
||||
"Error detais: %s %s" % (repr(e), fn), exc_info=True)
|
||||
except:
|
||||
quit_now = True
|
||||
exit_code = 1
|
||||
log.error("Gramps failed to start.", exc_info=True)
|
||||
|
||||
if quit_now:
|
||||
gtk.main_quit()
|
||||
sys.exit(exit_code)
|
||||
|
||||
return False
|
||||
|
||||
gobject.timeout_add(100, run, priority=100)
|
||||
gtk.main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user