fix few more dialog without parent

This commit is contained in:
Josip 2015-04-18 23:00:54 +02:00
parent 4ac02a4ca0
commit 45adb70330

View File

@ -83,24 +83,24 @@ class DbLoader(CLIDbLoader):
self.import_info = None self.import_info = None
def _warn(self, title, warnmessage): def _warn(self, title, warnmessage):
WarningDialog(title, warnmessage) WarningDialog(title, warnmessage, parent=self.uistate.window)
def _errordialog(self, title, errormessage): def _errordialog(self, title, errormessage):
""" """
Show the error. Show the error.
In the GUI, the error is shown, and a return happens In the GUI, the error is shown, and a return happens
""" """
ErrorDialog(title, errormessage) ErrorDialog(title, errormessage, parent=self.uistate.window)
return 1 return 1
def _dberrordialog(self, msg): def _dberrordialog(self, msg):
import traceback import traceback
exc = traceback.format_exc() exc = traceback.format_exc()
try: try:
DBErrorDialog(str(msg.value)) DBErrorDialog(str(msg.value), parent=self.uistate.window)
_LOG.error(str(msg.value)) _LOG.error(str(msg.value))
except: except:
DBErrorDialog(str(msg)) DBErrorDialog(str(msg), parent=self.uistate.window)
_LOG.error(str(msg) +"\n" + exc) _LOG.error(str(msg) +"\n" + exc)
def _begin_progress(self): def _begin_progress(self):
@ -198,7 +198,8 @@ class DbLoader(CLIDbLoader):
_("Could not open file: %s") % filename, _("Could not open file: %s") % filename,
_('File type "%s" is unknown to Gramps.\n\n' _('File type "%s" is unknown to Gramps.\n\n'
'Valid types are: Gramps database, Gramps XML, ' 'Valid types are: Gramps database, Gramps XML, '
'Gramps package, GEDCOM, and others.') % extension) 'Gramps package, GEDCOM, and others.') % extension,
parent=self.uistate.window)
import_dialog.destroy() import_dialog.destroy()
return False return False
@ -220,13 +221,15 @@ class DbLoader(CLIDbLoader):
elif os.path.isdir(filename): elif os.path.isdir(filename):
ErrorDialog( ErrorDialog(
_('Cannot open file'), _('Cannot open file'),
_('The selected file is a directory, not a file.\n')) _('The selected file is a directory, not a file.\n'),
parent=self.uistate.window)
return True return True
elif os.path.exists(filename): elif os.path.exists(filename):
if not os.access(filename, os.R_OK): if not os.access(filename, os.R_OK):
ErrorDialog( ErrorDialog(
_('Cannot open file'), _('Cannot open file'),
_('You do not have read access to the selected file.')) _('You do not have read access to the selected file.'),
parent=self.uistate.window)
return True return True
else: else:
try: try:
@ -236,7 +239,8 @@ class DbLoader(CLIDbLoader):
except IOError: except IOError:
ErrorDialog( ErrorDialog(
_('Cannot create file'), _('Cannot create file'),
_('You do not have write access to the selected file.')) _('You do not have write access to the selected file.'),
parent=self.uistate.window)
return True return True
return False return False
@ -259,7 +263,8 @@ class DbLoader(CLIDbLoader):
_("Could not import file: %s") % filename, _("Could not import file: %s") % filename,
_("This file incorrectly identifies its character " _("This file incorrectly identifies its character "
"set, so it cannot be accurately imported. Please fix the " "set, so it cannot be accurately imported. Please fix the "
"encoding, and import again") + "\n\n %s" % msg) "encoding, and import again") + "\n\n %s" % msg,
parent=self.uistate.window)
except Exception: except Exception:
_LOG.error("Failed to import database.", exc_info=True) _LOG.error("Failed to import database.", exc_info=True)
self._end_progress() self._end_progress()
@ -327,7 +332,8 @@ class DbLoader(CLIDbLoader):
str(msg), str(msg),
_("I have made a backup,\n" _("I have made a backup,\n"
"please upgrade my Family Tree"), "please upgrade my Family Tree"),
_("Cancel"), self.uistate.window).run(): _("Cancel"),
parent=self.uistate.window).run():
force_schema_upgrade = True force_schema_upgrade = True
force_bsddb_upgrade = False force_bsddb_upgrade = False
force_bsddb_downgrade = False force_bsddb_downgrade = False
@ -341,7 +347,8 @@ class DbLoader(CLIDbLoader):
str(msg), str(msg),
_("I have made a backup,\n" _("I have made a backup,\n"
"please upgrade my tree"), "please upgrade my tree"),
_("Cancel"), self.uistate.window).run(): _("Cancel"),
parent=self.uistate.window).run():
force_schema_upgrade = False force_schema_upgrade = False
force_bsddb_upgrade = True force_bsddb_upgrade = True
force_bsddb_downgrade = False force_bsddb_downgrade = False
@ -355,7 +362,8 @@ class DbLoader(CLIDbLoader):
str(msg), str(msg),
_("I have made a backup,\n" _("I have made a backup,\n"
"please downgrade my Family Tree"), "please downgrade my Family Tree"),
_("Cancel"), self.uistate.window).run(): _("Cancel"),
parent=self.uistate.window).run():
force_schema_upgrade = False force_schema_upgrade = False
force_bsddb_upgrade = False force_bsddb_upgrade = False
force_bsddb_downgrade = True force_bsddb_downgrade = True
@ -369,7 +377,8 @@ class DbLoader(CLIDbLoader):
str(msg), str(msg),
_("I have made a backup,\n" _("I have made a backup,\n"
"please upgrade my Family Tree"), "please upgrade my Family Tree"),
_("Cancel"), self.uistate.window).run(): _("Cancel"),
parent=self.uistate.window).run():
force_schema_upgrade = False force_schema_upgrade = False
force_bsddb_upgrade = False force_bsddb_upgrade = False
force_bsddb_downgrade = False force_bsddb_downgrade = False