8128: GtkDialog mapped without a transient parent

This commit is contained in:
Paul Franklin 2016-08-01 12:16:58 -07:00
parent b40c92465a
commit d9ec7d5e2a
87 changed files with 283 additions and 255 deletions

View File

@ -78,7 +78,7 @@ class ChangedSinceBase(Rule):
time_sec = time.mktime(time_tup) time_sec = time.mktime(time_tup)
except ValueError: except ValueError:
from gramps.gui.dialog import WarningDialog from gramps.gui.dialog import WarningDialog
WarningDialog(_("Wrong format of date-time"), WarningDialog(_("Wrong format of date-time"), # no-parent
_("Only date-times in the iso format of yyyy-mm-dd " _("Only date-times in the iso format of yyyy-mm-dd "
"hh:mm:ss, where the time part is optional, are " "hh:mm:ss, where the time part is optional, are "
"accepted. %s does not satisfy.") % iso_date_time) "accepted. %s does not satisfy.") % iso_date_time)

View File

@ -82,7 +82,7 @@ except:
# GrampsAboutDialog # GrampsAboutDialog
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class GrampsAboutDialog(Gtk.AboutDialog): class GrampsAboutDialog(Gtk.AboutDialog): # parent-OK
"""Create an About dialog with all fields set.""" """Create an About dialog with all fields set."""
def __init__(self, parent): def __init__(self, parent):
"""Setup all the fields shown in the About dialog.""" """Setup all the fields shown in the About dialog."""

View File

@ -226,12 +226,14 @@ class ConfigureDialog(ManagedWindow):
obj.get_text() % 'test_markup' obj.get_text() % 'test_markup'
except TypeError: except TypeError:
print("WARNING: ignoring invalid value for '%s'" % constant) print("WARNING: ignoring invalid value for '%s'" % constant)
ErrorDialog(_("Invalid or incomplete format definition."), ErrorDialog( # parent-OK
_("Invalid or incomplete format definition."),
obj.get_text(), parent=self.window) obj.get_text(), parent=self.window)
obj.set_text('<b>%s</b>') obj.set_text('<b>%s</b>')
except ValueError: except ValueError:
print("WARNING: ignoring invalid value for '%s'" % constant) print("WARNING: ignoring invalid value for '%s'" % constant)
ErrorDialog(_("Invalid or incomplete format definition."), ErrorDialog( # parent-OK
_("Invalid or incomplete format definition."),
obj.get_text(), parent=self.window) obj.get_text(), parent=self.window)
obj.set_text('<b>%s</b>') obj.set_text('<b>%s</b>')
@ -774,7 +776,7 @@ class GrampsPreferences(ConfigureDialog):
oldname = self.fmt_model.get_value(node, COL_NAME) oldname = self.fmt_model.get_value(node, COL_NAME)
# check to see if this pattern already exists # check to see if this pattern already exists
if self.__check_for_name(translation, node): if self.__check_for_name(translation, node):
ErrorDialog(_("This format exists already."), ErrorDialog(_("This format exists already."), # parent-OK
translation, parent=self.window) translation, parent=self.window)
self.edit_button.emit('clicked') self.edit_button.emit('clicked')
return return
@ -1227,7 +1229,7 @@ class GrampsPreferences(ConfigureDialog):
def date_format_changed(self, obj): def date_format_changed(self, obj):
config.set('preferences.date-format', obj.get_active()) config.set('preferences.date-format', obj.get_active())
OkDialog(_('Change is not immediate'), OkDialog(_('Change is not immediate'), # parent-OK
_('Changing the date format will not take ' _('Changing the date format will not take '
'effect until the next time Gramps is started.'), 'effect until the next time Gramps is started.'),
parent=self.window) parent=self.window)
@ -1395,20 +1397,21 @@ class GrampsPreferences(ConfigureDialog):
try: try:
addon_update_list = available_updates() addon_update_list = available_updates()
except: except:
OkDialog(_("Checking Addons Failed"), OkDialog(_("Checking Addons Failed"), # parent-OK
_("The addon repository appears to be unavailable. " _("The addon repository appears to be unavailable. "
"Please try again later."), "Please try again later."),
self.window) parent=self.window)
return return
if len(addon_update_list) > 0: if len(addon_update_list) > 0:
PluginWindows.UpdateAddons(addon_update_list, self.window) PluginWindows.UpdateAddons(addon_update_list, self.window)
else: else:
check_types = config.get('behavior.check-for-update-types') check_types = config.get('behavior.check-for-update-types')
OkDialog(_("There are no available addons of this type"), OkDialog( # parent-OK
_("There are no available addons of this type"),
_("Checked for '%s'") % _("Checked for '%s'") %
_("' and '").join([_(t) for t in check_types]), _("' and '").join([_(t) for t in check_types]),
self.window) parent=self.window)
# List of translated strings used here # List of translated strings used here
# Dead code for l10n # Dead code for l10n

View File

@ -83,24 +83,28 @@ class DbLoader(CLIDbLoader):
self.import_info = None self.import_info = None
def _warn(self, title, warnmessage): def _warn(self, title, warnmessage):
WarningDialog(title, warnmessage, parent=self.uistate.window) WarningDialog(title, warnmessage, # parent-OK
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, parent=self.uistate.window) ErrorDialog(title, errormessage, # parent-OK
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), parent=self.uistate.window) DBErrorDialog(str(msg.value), # parent-OK
parent=self.uistate.window)
_LOG.error(str(msg.value)) _LOG.error(str(msg.value))
except: except:
DBErrorDialog(str(msg), parent=self.uistate.window) DBErrorDialog(str(msg), # parent-OK
parent=self.uistate.window)
_LOG.error(str(msg) +"\n" + exc) _LOG.error(str(msg) +"\n" + exc)
def _begin_progress(self): def _begin_progress(self):
@ -121,7 +125,7 @@ class DbLoader(CLIDbLoader):
# so we will lose the undo history. Warn the user. # so we will lose the undo history. Warn the user.
if self.dbstate.db.get_number_of_people() > 0: if self.dbstate.db.get_number_of_people() > 0:
warn_dialog = QuestionDialog2( warn_dialog = QuestionDialog2( # parent-OK
_('Undo history warning'), _('Undo history warning'),
_('Proceeding with import will erase the undo history ' _('Proceeding with import will erase the undo history '
'for this session. In particular, you will not be able ' 'for this session. In particular, you will not be able '
@ -129,7 +133,7 @@ class DbLoader(CLIDbLoader):
'If you think you may want to revert the import, ' 'If you think you may want to revert the import, '
'please stop here and backup your database.'), 'please stop here and backup your database.'),
_('_Proceed with import'), _('_Stop'), _('_Proceed with import'), _('_Stop'),
self.uistate.window) parent=self.uistate.window)
if not warn_dialog.run(): if not warn_dialog.run():
return False return False
@ -194,7 +198,7 @@ class DbLoader(CLIDbLoader):
return True return True
# Finally, we give up and declare this an unknown format # Finally, we give up and declare this an unknown format
ErrorDialog( ErrorDialog( # parent-OK
_("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, '
@ -219,14 +223,14 @@ class DbLoader(CLIDbLoader):
if len(filename) == 0: if len(filename) == 0:
return True return True
elif os.path.isdir(filename): elif os.path.isdir(filename):
ErrorDialog( ErrorDialog( # parent-OK
_('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) 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( # parent-OK
_('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) parent=self.uistate.window)
@ -237,7 +241,7 @@ class DbLoader(CLIDbLoader):
f.close() f.close()
os.remove(filename) os.remove(filename)
except IOError: except IOError:
ErrorDialog( ErrorDialog( # parent-OK
_('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) parent=self.uistate.window)
@ -260,7 +264,7 @@ class DbLoader(CLIDbLoader):
dirname = os.path.dirname(filename) + os.path.sep dirname = os.path.dirname(filename) + os.path.sep
config.set('paths.recent-import-dir', dirname) config.set('paths.recent-import-dir', dirname)
except UnicodeError as msg: except UnicodeError as msg:
ErrorDialog( ErrorDialog( # parent-OK
_("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 "
@ -340,12 +344,13 @@ class DbLoader(CLIDbLoader):
self.dbstate.change_database(db) self.dbstate.change_database(db)
break break
except DbUpgradeRequiredError as msg: except DbUpgradeRequiredError as msg:
if QuestionDialog2(_("Are you sure you want to upgrade " if QuestionDialog2(_("Are you sure you want " # parent-OK
"this Family Tree?"), "to upgrade this Family Tree?"),
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
@ -354,12 +359,13 @@ class DbLoader(CLIDbLoader):
self.dbstate.no_database() self.dbstate.no_database()
break break
except BsddbUpgradeRequiredError as msg: except BsddbUpgradeRequiredError as msg:
if QuestionDialog2(_("Are you sure you want to upgrade " if QuestionDialog2(_("Are you sure you want " # parent-OK
"this Family Tree?"), "to upgrade this Family Tree?"),
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 = True force_bsddb_upgrade = True
force_bsddb_downgrade = False force_bsddb_downgrade = False
@ -368,12 +374,13 @@ class DbLoader(CLIDbLoader):
self.dbstate.no_database() self.dbstate.no_database()
break break
except BsddbDowngradeRequiredError as msg: except BsddbDowngradeRequiredError as msg:
if QuestionDialog2(_("Are you sure you want to downgrade " if QuestionDialog2(_("Are you sure you want " # parent-OK
"this Family Tree?"), "to downgrade this Family Tree?"),
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
@ -382,12 +389,13 @@ class DbLoader(CLIDbLoader):
self.dbstate.no_database() self.dbstate.no_database()
break break
except PythonUpgradeRequiredError as msg: except PythonUpgradeRequiredError as msg:
if QuestionDialog2(_("Are you sure you want to upgrade " if QuestionDialog2(_("Are you sure you want " # parent-OK
"this Family Tree?"), "to upgrade this Family Tree?"),
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

View File

@ -52,7 +52,7 @@ try:
except: except:
ICON = None ICON = None
class SaveDialog: class SaveDialog: # parent-OK
def __init__(self, msg1, msg2, task1, task2, parent=None): def __init__(self, msg1, msg2, task1, task2, parent=None):
self.xml = Glade(toplevel='savedialog') self.xml = Glade(toplevel='savedialog')
@ -83,7 +83,7 @@ class SaveDialog:
config.set('interface.dont-ask', self.dontask.get_active()) config.set('interface.dont-ask', self.dontask.get_active())
self.top.destroy() self.top.destroy()
class QuestionDialog: class QuestionDialog: # parent-OK
def __init__(self, msg1, msg2, label, task, parent=None): def __init__(self, msg1, msg2, label, task, parent=None):
self.xml = Glade(toplevel='questiondialog') self.xml = Glade(toplevel='questiondialog')
@ -115,7 +115,7 @@ def on_activate_link(label, uri):
display_url(uri) display_url(uri)
return True return True
class QuestionDialog2: class QuestionDialog2: # parent-OK
def __init__(self, msg1, msg2, label_msg1, label_msg2, parent=None): def __init__(self, msg1, msg2, label_msg1, label_msg2, parent=None):
self.xml = Glade(toplevel='questiondialog') self.xml = Glade(toplevel='questiondialog')
@ -147,7 +147,7 @@ class QuestionDialog2:
self.top.destroy() self.top.destroy()
return (response == Gtk.ResponseType.ACCEPT) return (response == Gtk.ResponseType.ACCEPT)
class OptionDialog: class OptionDialog: # parent-OK
def __init__(self, msg1, msg2, btnmsg1, task1, btnmsg2, task2, parent=None): def __init__(self, msg1, msg2, btnmsg1, task1, btnmsg2, task2, parent=None):
self.xml = Glade(toplevel='optiondialog') self.xml = Glade(toplevel='optiondialog')
@ -180,7 +180,7 @@ class OptionDialog:
def get_response(self): def get_response(self):
return self.response return self.response
class ErrorDialog(Gtk.MessageDialog): class ErrorDialog(Gtk.MessageDialog): # parent-OK
def __init__(self, msg1, msg2="", parent=None): def __init__(self, msg1, msg2="", parent=None):
Gtk.MessageDialog.__init__(self, parent, Gtk.MessageDialog.__init__(self, parent,
@ -195,7 +195,7 @@ class ErrorDialog(Gtk.MessageDialog):
self.run() self.run()
self.destroy() self.destroy()
class RunDatabaseRepair(ErrorDialog): class RunDatabaseRepair(ErrorDialog): # parent-OK
def __init__(self, msg, parent=None): def __init__(self, msg, parent=None):
ErrorDialog.__init__( ErrorDialog.__init__(
self, self,
@ -207,7 +207,7 @@ class RunDatabaseRepair(ErrorDialog):
'%(gramps_bugtracker_url)s\n\n') '%(gramps_bugtracker_url)s\n\n')
% {'gramps_bugtracker_url' : URL_BUGHOME} + msg, parent) % {'gramps_bugtracker_url' : URL_BUGHOME} + msg, parent)
class DBErrorDialog(ErrorDialog): class DBErrorDialog(ErrorDialog): # parent-OK
def __init__(self, msg, parent=None): def __init__(self, msg, parent=None):
ErrorDialog.__init__( ErrorDialog.__init__(
self, self,
@ -217,7 +217,7 @@ class DBErrorDialog(ErrorDialog):
"the Family Tree Manager. Select the database and " "the Family Tree Manager. Select the database and "
'click on the Repair button') + '\n\n' + msg, parent) 'click on the Repair button') + '\n\n' + msg, parent)
class WarningDialog(Gtk.MessageDialog): class WarningDialog(Gtk.MessageDialog): # parent-OK
def __init__(self, msg1, msg2="", parent=None): def __init__(self, msg1, msg2="", parent=None):
Gtk.MessageDialog.__init__(self, parent, Gtk.MessageDialog.__init__(self, parent,
@ -237,7 +237,7 @@ class WarningDialog(Gtk.MessageDialog):
self.run() self.run()
self.destroy() self.destroy()
class OkDialog(Gtk.MessageDialog): class OkDialog(Gtk.MessageDialog): # parent-OK
def __init__(self, msg1, msg2="", parent=None): def __init__(self, msg1, msg2="", parent=None):
Gtk.MessageDialog.__init__(self, parent, Gtk.MessageDialog.__init__(self, parent,
@ -252,7 +252,7 @@ class OkDialog(Gtk.MessageDialog):
self.run() self.run()
self.destroy() self.destroy()
class InfoDialog: class InfoDialog: # parent-OK
""" """
Non modal dialog to show selectable info in a scrolled window Non modal dialog to show selectable info in a scrolled window
""" """
@ -285,7 +285,7 @@ class InfoDialog:
#no matter how it finishes, destroy dialog #no matter how it finishes, destroy dialog
dialog.destroy() dialog.destroy()
class MissingMediaDialog: class MissingMediaDialog: # parent-OK
def __init__(self, msg1, msg2, task1, task2, task3, parent=None): def __init__(self, msg1, msg2, task1, task2, task3, parent=None):
self.xml = Glade(toplevel='missmediadialog') self.xml = Glade(toplevel='missmediadialog')
@ -332,14 +332,14 @@ class MissingMediaDialog:
self.top.destroy() self.top.destroy()
def warn(self, obj, obj2): def warn(self, obj, obj2):
WarningDialog( WarningDialog( # parent-OK
_("Attempt to force closing the dialog"), _("Attempt to force closing the dialog"),
_("Please do not force closing this important dialog.\n" _("Please do not force closing this important dialog.\n"
"Instead select one of the available options"), "Instead select one of the available options"),
parent=self.top) parent=self.top)
return True return True
class MultiSelectDialog: class MultiSelectDialog: # parent-OK
def __init__(self, msg1_func, msg2_func, items, lookup, def __init__(self, msg1_func, msg2_func, items, lookup,
cancel_func=None, no_func=None, yes_func=None, cancel_func=None, no_func=None, yes_func=None,
parent=None): parent=None):
@ -405,14 +405,14 @@ class MultiSelectDialog:
self.top.destroy() self.top.destroy()
def warn(self, obj, obj2): def warn(self, obj, obj2):
WarningDialog( WarningDialog( # parent-OK
_("Attempt to force closing the dialog"), _("Attempt to force closing the dialog"),
_("Please do not force closing this important dialog.\n" _("Please do not force closing this important dialog.\n"
"Instead select one of the available options"), "Instead select one of the available options"),
parent=self.top) parent=self.top)
return True return True
class MessageHideDialog: class MessageHideDialog: # parent-OK
def __init__(self, title, message, key, parent=None): def __init__(self, title, message, key, parent=None):
self.xml = Glade(toplevel='hidedialog') self.xml = Glade(toplevel='hidedialog')
@ -452,7 +452,7 @@ def main(args):
def test_info(obj): def test_info(obj):
InfoDialog('The title', InfoDialog('The title', # parent-OK
'This is a lot of info\n to show to all!', 'This is a lot of info\n to show to all!',
parent=win) parent=win)

View File

@ -157,7 +157,7 @@ class AddMedia(ManagedWindow):
if self.file_text.get_filename() is None: if self.file_text.get_filename() is None:
msgstr = _("Import failed") msgstr = _("Import failed")
msgstr2 = _("The filename supplied could not be found.") msgstr2 = _("The filename supplied could not be found.")
ErrorDialog(msgstr, msgstr2, parent=self.window) ErrorDialog(msgstr, msgstr2, parent=self.window) # parent-OK
return return
filename = self.file_text.get_filename() filename = self.file_text.get_filename()
@ -168,7 +168,7 @@ class AddMedia(ManagedWindow):
if not os.path.exists(pname): if not os.path.exists(pname):
msgstr = _("Cannot import %s") msgstr = _("Cannot import %s")
msgstr2 = _("Directory specified in preferences: Base path for relative media paths: %s does not exist. Change preferences or do not use relative path when importing") msgstr2 = _("Directory specified in preferences: Base path for relative media paths: %s does not exist. Change preferences or do not use relative path when importing")
ErrorDialog(msgstr % filename, msgstr2 % pname, ErrorDialog(msgstr % filename, msgstr2 % pname, # parent-OK
parent=self.window) parent=self.window)
return return
filename = relative_path(filename, pname) filename = relative_path(filename, pname)
@ -244,5 +244,5 @@ def scale_image(path, size):
return image1.scale_simple(int(scale*width), int(scale*height), return image1.scale_simple(int(scale*width), int(scale*height),
GdkPixbuf.InterpType.BILINEAR) GdkPixbuf.InterpType.BILINEAR)
except: except:
WarningDialog(title_msg, detail_msg) WarningDialog(title_msg, detail_msg) # no-parent
return GdkPixbuf.Pixbuf.new_from_file(ICON) return GdkPixbuf.Pixbuf.new_from_file(ICON)

View File

@ -168,7 +168,7 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
callertitle=self.callertitle) callertitle=self.callertitle)
except WindowActiveError: except WindowActiveError:
from ...dialog import WarningDialog from ...dialog import WarningDialog
WarningDialog(_("Cannot share this reference"), WarningDialog(_("Cannot share this reference"), # no-parent
self.__blocked_text()) self.__blocked_text())
elif isinstance(object, Citation): elif isinstance(object, Citation):
try: try:
@ -178,7 +178,7 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
callertitle=self.callertitle) callertitle=self.callertitle)
except WindowActiveError: except WindowActiveError:
from ...dialog import WarningDialog from ...dialog import WarningDialog
WarningDialog(_("Cannot share this reference"), WarningDialog(_("Cannot share this reference"), # no-parent
self.__blocked_text()) self.__blocked_text())
else: else:
raise ValueError("selection must be either source or citation") raise ValueError("selection must be either source or citation")
@ -251,7 +251,7 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
callertitle=self.callertitle) callertitle=self.callertitle)
except WindowActiveError: except WindowActiveError:
from ...dialog import WarningDialog from ...dialog import WarningDialog
WarningDialog(_("Cannot share this reference"), WarningDialog(_("Cannot share this reference"), # no-parent
self.__blocked_text()) self.__blocked_text())
else: else:
raise ValueError("selection must be either source or citation") raise ValueError("selection must be either source or citation")
@ -271,7 +271,7 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
callertitle=self.callertitle) callertitle=self.callertitle)
except WindowActiveError: except WindowActiveError:
from ...dialog import WarningDialog from ...dialog import WarningDialog
WarningDialog(_("Cannot share this reference"), WarningDialog(_("Cannot share this reference"), # no-parent
self.__blocked_text()) self.__blocked_text())
else: else:
raise ValueError("selection must be either source or citation") raise ValueError("selection must be either source or citation")

View File

@ -576,7 +576,7 @@ class EmbeddedList(ButtonTab):
from ...dialog import RunDatabaseRepair from ...dialog import RunDatabaseRepair
import traceback import traceback
traceback.print_exc() traceback.print_exc()
RunDatabaseRepair(str(msg)) RunDatabaseRepair(str(msg)) # no-parent
return return
self.tree.set_model(self.model) self.tree.set_model(self.model)

View File

@ -264,7 +264,7 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
event, ref, self.object_added) event, ref, self.object_added)
except WindowActiveError: except WindowActiveError:
from ...dialog import WarningDialog from ...dialog import WarningDialog
WarningDialog(_("Cannot share this reference"), WarningDialog(_("Cannot share this reference"), # no-parent
self.__blocked_text()) self.__blocked_text())
def edit_button_clicked(self, obj): def edit_button_clicked(self, obj):
@ -277,7 +277,7 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
event, ref[1], self.object_edited) event, ref[1], self.object_edited)
except WindowActiveError: except WindowActiveError:
from ...dialog import WarningDialog from ...dialog import WarningDialog
WarningDialog(_("Cannot edit this reference"), WarningDialog(_("Cannot edit this reference"), # no-parent
self.__blocked_text()) self.__blocked_text())
elif ref and ref[0] != self._WORKGROUP: elif ref and ref[0] != self._WORKGROUP:
#bring up family editor #bring up family editor
@ -318,8 +318,7 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
handle change request of non native data handle change request of non native data
""" """
from ...dialog import WarningDialog from ...dialog import WarningDialog
WarningDialog( WarningDialog(_("Cannot change Person"), # no-parent
_("Cannot change Person"),
_("You cannot change Person events in the Family Editor") _("You cannot change Person events in the Family Editor")
) )
@ -341,7 +340,7 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
event, obj, self.object_edited) event, obj, self.object_edited)
except WindowActiveError: except WindowActiveError:
from ...dialog import WarningDialog from ...dialog import WarningDialog
WarningDialog( WarningDialog( # no-parent
_("Cannot edit this reference"), _("Cannot edit this reference"),
_("This event reference cannot be edited at this time. " _("This event reference cannot be edited at this time. "
"Either the associated event is already being edited " "Either the associated event is already being edited "

View File

@ -259,7 +259,7 @@ class GalleryTab(ButtonTab, DbGUIElement):
if obj is None : if obj is None :
#notify user of error #notify user of error
from ...dialog import RunDatabaseRepair from ...dialog import RunDatabaseRepair
RunDatabaseRepair( RunDatabaseRepair( # no-parent
_('Non existing media found in the Gallery')) _('Non existing media found in the Gallery'))
else : else :
pixbuf = get_thumbnail_image( pixbuf = get_thumbnail_image(
@ -334,7 +334,7 @@ class GalleryTab(ButtonTab, DbGUIElement):
src, sref, self.add_callback) src, sref, self.add_callback)
except WindowActiveError: except WindowActiveError:
from ...dialog import WarningDialog from ...dialog import WarningDialog
WarningDialog(_("Cannot share this reference"), WarningDialog(_("Cannot share this reference"), # no-parent
self.__blocked_text()) self.__blocked_text())
def del_button_clicked(self, obj): def del_button_clicked(self, obj):
@ -354,7 +354,7 @@ class GalleryTab(ButtonTab, DbGUIElement):
obj, ref, self.edit_callback) obj, ref, self.edit_callback)
except WindowActiveError: except WindowActiveError:
from ...dialog import WarningDialog from ...dialog import WarningDialog
WarningDialog(_("Cannot edit this reference"), WarningDialog(_("Cannot edit this reference"), # no-parent
self.__blocked_text()) self.__blocked_text())
def edit_callback(self, media_ref, media): def edit_callback(self, media_ref, media):

View File

@ -126,7 +126,7 @@ class PersonEventEmbedList(EventEmbedList):
handle change request of non native data handle change request of non native data
""" """
from ...dialog import WarningDialog from ...dialog import WarningDialog
WarningDialog( WarningDialog( # no-parent
_("Cannot change Family"), _("Cannot change Family"),
_("You cannot change Family events in the Person Editor") _("You cannot change Family events in the Person Editor")
) )

View File

@ -138,7 +138,7 @@ class PlaceRefEmbedList(EmbeddedList):
def handle_extra_type(self, objtype, obj): def handle_extra_type(self, objtype, obj):
if obj in self.get_skip_list(self.handle): if obj in self.get_skip_list(self.handle):
ErrorDialog(_("Place cycle detected"), ErrorDialog(_("Place cycle detected"), # no-parent
_("The place you are adding is already enclosed by " _("The place you are adding is already enclosed by "
"this place")) "this place"))
return return

View File

@ -164,7 +164,7 @@ class RepoEmbedList(EmbeddedList, DbGUIElement):
ref, self.edit_callback) ref, self.edit_callback)
except WindowActiveError: except WindowActiveError:
from ...dialog import WarningDialog from ...dialog import WarningDialog
WarningDialog( WarningDialog( # no-parent
_("Cannot edit this reference"), _("Cannot edit this reference"),
_("This repository reference cannot be edited at this " _("This repository reference cannot be edited at this "
"time. Either the associated repository is already " "time. Either the associated repository is already "

View File

@ -145,7 +145,7 @@ class EditAttributeRoot(EditSecondary):
if t.is_custom() and str(t) == '': if t.is_custom() and str(t) == '':
from ..dialog import ErrorDialog from ..dialog import ErrorDialog
ErrorDialog( ErrorDialog( # parent-OK
_("Cannot save attribute"), _("Cannot save attribute"),
_("The attribute type cannot be empty"), _("The attribute type cannot be empty"),
parent=self.window) parent=self.window)

View File

@ -284,7 +284,7 @@ class EditCitation(EditPrimary):
""" """
self.ok_button.set_sensitive(False) self.ok_button.set_sensitive(False)
if not self.obj.get_reference_handle(): if not self.obj.get_reference_handle():
ErrorDialog(_("No source selected"), ErrorDialog(_("No source selected"), # parent-OK
_("A source is anything (personal testimony, " _("A source is anything (personal testimony, "
"video recording, photograph, newspaper column, " "video recording, photograph, newspaper column, "
"gravestone...) from which information can be " "gravestone...) from which information can be "
@ -305,7 +305,7 @@ class EditCitation(EditPrimary):
"%(prim_object)s'. Please enter a different ID or leave " "%(prim_object)s'. Please enter a different ID or leave "
"blank to get the next available ID value.") % { "blank to get the next available ID value.") % {
'id' : gramps_id, 'prim_object' : name } 'id' : gramps_id, 'prim_object' : name }
ErrorDialog(msg1, msg2, parent=self.window) ErrorDialog(msg1, msg2, parent=self.window) # parent-OK
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

View File

@ -236,7 +236,7 @@ class EditEvent(EditPrimary):
def save(self, *obj): def save(self, *obj):
self.ok_button.set_sensitive(False) self.ok_button.set_sensitive(False)
if self.object_is_empty(): if self.object_is_empty():
ErrorDialog(_("Cannot save event"), ErrorDialog(_("Cannot save event"), # parent-OK
_("No data exists for this event. Please " _("No data exists for this event. Please "
"enter data or cancel the edit."), "enter data or cancel the edit."),
parent=self.window) parent=self.window)
@ -253,13 +253,13 @@ class EditEvent(EditPrimary):
"%(prim_object)s'. Please enter a different ID or leave " "%(prim_object)s'. Please enter a different ID or leave "
"blank to get the next available ID value.") % { "blank to get the next available ID value.") % {
'id' : id, 'prim_object' : name } 'id' : id, 'prim_object' : name }
ErrorDialog(msg1, msg2, parent=self.window) ErrorDialog(msg1, msg2, parent=self.window) # parent-OK
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
t = self.obj.get_type() t = self.obj.get_type()
if t.is_custom() and str(t) == '': if t.is_custom() and str(t) == '':
ErrorDialog( ErrorDialog( # parent-OK
_("Cannot save event"), _("Cannot save event"),
_("The event type cannot be empty"), _("The event type cannot be empty"),
parent=self.window) parent=self.window)

View File

@ -363,7 +363,7 @@ class EditFamily(EditPrimary):
for i in self.hidden: for i in self.hidden:
i.set_sensitive(False) i.set_sensitive(False)
MessageHideDialog( MessageHideDialog( # parent-OK
_("Adding parents to a person"), _("Adding parents to a person"),
_("It is possible to accidentally create multiple " _("It is possible to accidentally create multiple "
"families with the same parents. To help avoid " "families with the same parents. To help avoid "
@ -459,14 +459,15 @@ class EditFamily(EditPrimary):
# No matter why the family changed (eg delete of a source), we notify # No matter why the family changed (eg delete of a source), we notify
# the user # the user
WarningDialog( WarningDialog( # parent-OK
_("Family has changed"), _("Family has changed"),
_("The %(object)s you are editing has changed outside this editor." _("The %(object)s you are editing has changed outside this editor."
" This can be due to a change in one of the main views, for " " This can be due to a change in one of the main views, for "
"example a source used here is deleted in the source view.\n" "example a source used here is deleted in the source view.\n"
"To make sure the information shown is still correct, the " "To make sure the information shown is still correct, the "
"data shown has been updated. Some edits you have made may have" "data shown has been updated. Some edits you have made may have"
" been lost.") % {'object': _('family')}, parent=self.window) " been lost.") % {'object': _('family')},
parent=self.window)
def topdata_updated(self, *obj): def topdata_updated(self, *obj):
""" """
@ -902,7 +903,7 @@ class EditFamily(EditPrimary):
common = list(mfam.intersection(ffam)) common = list(mfam.intersection(ffam))
if len(common) > 0: if len(common) > 0:
if self.add_parent or self.obj.handle not in common: if self.add_parent or self.obj.handle not in common:
WarningDialog( WarningDialog( # parent-OK
_('Duplicate Family'), _('Duplicate Family'),
_('A family with these parents already exists ' _('A family with these parents already exists '
'in the database. If you save, you will create ' 'in the database. If you save, you will create '
@ -1042,7 +1043,7 @@ class EditFamily(EditPrimary):
#try: #try:
self.__do_save() self.__do_save()
#except bsddb_db.DBRunRecoveryError as msg: #except bsddb_db.DBRunRecoveryError as msg:
# RunDatabaseRepair(msg[1]) # RunDatabaseRepair(msg[1]) # no-parent
def __do_save(self): def __do_save(self):
self.ok_button.set_sensitive(False) self.ok_button.set_sensitive(False)
@ -1061,7 +1062,7 @@ class EditFamily(EditPrimary):
father = self.db.get_person_from_handle(self.obj.get_father_handle()) father = self.db.get_person_from_handle(self.obj.get_father_handle())
name = "%s [%s]" % (name_displayer.display(father), name = "%s [%s]" % (name_displayer.display(father),
father.gramps_id) father.gramps_id)
ErrorDialog(_("A father cannot be his own child"), ErrorDialog(_("A father cannot be his own child"), # parent-OK
_("%s is listed as both the father and child " _("%s is listed as both the father and child "
"of the family.") % name, "of the family.") % name,
parent=self.window) parent=self.window)
@ -1072,7 +1073,7 @@ class EditFamily(EditPrimary):
mother = self.db.get_person_from_handle(self.obj.get_mother_handle()) mother = self.db.get_person_from_handle(self.obj.get_mother_handle())
name = "%s [%s]" % (name_displayer.display(mother), name = "%s [%s]" % (name_displayer.display(mother),
mother.gramps_id) mother.gramps_id)
ErrorDialog(_("A mother cannot be her own child"), ErrorDialog(_("A mother cannot be her own child"), # parent-OK
_("%s is listed as both the mother and child " _("%s is listed as both the mother and child "
"of the family.") % name, "of the family.") % name,
parent=self.window) parent=self.window)
@ -1080,7 +1081,7 @@ class EditFamily(EditPrimary):
return return
if not original and self.object_is_empty(): if not original and self.object_is_empty():
ErrorDialog( ErrorDialog( # parent-OK
_("Cannot save family"), _("Cannot save family"),
_("No data exists for this family. " _("No data exists for this family. "
"Please enter data or cancel the edit."), "Please enter data or cancel the edit."),
@ -1096,7 +1097,7 @@ class EditFamily(EditPrimary):
"enter a different ID or leave " "enter a different ID or leave "
"blank to get the next available ID value.") % { "blank to get the next available ID value.") % {
'id' : id} 'id' : id}
ErrorDialog(msg1, msg2, parent=self.window) ErrorDialog(msg1, msg2, parent=self.window) # parent-OK
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

View File

@ -285,7 +285,7 @@ class EditMedia(EditPrimary):
self.ok_button.set_sensitive(False) self.ok_button.set_sensitive(False)
if self.object_is_empty(): if self.object_is_empty():
ErrorDialog(_("Cannot save media object"), ErrorDialog(_("Cannot save media object"), # parent-OK
_("No data exists for this media object. Please " _("No data exists for this media object. Please "
"enter data or cancel the edit."), "enter data or cancel the edit."),
parent=self.window) parent=self.window)
@ -302,7 +302,7 @@ class EditMedia(EditPrimary):
"%(prim_object)s'. Please enter a different ID or leave " "%(prim_object)s'. Please enter a different ID or leave "
"blank to get the next available ID value.") % { "blank to get the next available ID value.") % {
'id' : id, 'prim_object' : name } 'id' : id, 'prim_object' : name }
ErrorDialog(msg1, msg2, parent=self.window) ErrorDialog(msg1, msg2, parent=self.window) # parent-OK
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
@ -316,7 +316,7 @@ class EditMedia(EditPrimary):
"value '%(path)s'. This path does not exist!" "value '%(path)s'. This path does not exist!"
" Please enter a different path") % { " Please enter a different path") % {
'path' : path } 'path' : path }
ErrorDialog(msg1, msg2, parent=self.window) ErrorDialog(msg1, msg2, parent=self.window) # parent-OK
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

View File

@ -376,7 +376,7 @@ class EditName(EditSecondary):
if self.global_group_set and not self.original_group_set : if self.global_group_set and not self.original_group_set :
#warn that group will revert to surname #warn that group will revert to surname
from ..dialog import QuestionDialog2 from ..dialog import QuestionDialog2
q = QuestionDialog2( q = QuestionDialog2( # parent-OK
_("Break global name grouping?"), _("Break global name grouping?"),
_("All people with the name of %(surname)s will no longer " _("All people with the name of %(surname)s will no longer "
"be grouped with the name of %(group_name)s." "be grouped with the name of %(group_name)s."
@ -408,7 +408,7 @@ class EditName(EditSecondary):
if self.global_group_as != group_as: if self.global_group_as != group_as:
from ..dialog import QuestionDialog2 from ..dialog import QuestionDialog2
q = QuestionDialog2( q = QuestionDialog2( # parent-OK
_("Group all people with the same name?"), _("Group all people with the same name?"),
_("You have the choice of grouping all people with the " _("You have the choice of grouping all people with the "
"name of %(surname)s with the name of %(group_name)s, or " "name of %(surname)s with the name of %(group_name)s, or "

View File

@ -310,7 +310,7 @@ class EditNote(EditPrimary):
self.update_note() self.update_note()
if self.object_is_empty(): if self.object_is_empty():
ErrorDialog(_("Cannot save note"), ErrorDialog(_("Cannot save note"), # parent-OK
_("No data exists for this note. Please " _("No data exists for this note. Please "
"enter data or cancel the edit."), "enter data or cancel the edit."),
parent=self.window) parent=self.window)
@ -325,7 +325,7 @@ class EditNote(EditPrimary):
"enter a different ID or leave " "enter a different ID or leave "
"blank to get the next available ID value.") % { "blank to get the next available ID value.") % {
'id' : id } 'id' : id }
ErrorDialog(msg1, msg2, parent=self.window) ErrorDialog(msg1, msg2, parent=self.window) # parent-OK
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

View File

@ -747,7 +747,7 @@ class EditPerson(EditPrimary):
def _check_for_unknown_gender(self): def _check_for_unknown_gender(self):
if self.obj.get_gender() == Person.UNKNOWN: if self.obj.get_gender() == Person.UNKNOWN:
d = GenderDialog(self.window) d = GenderDialog(parent=self.window) # parent-OK
gender = d.run() gender = d.run()
d.destroy() d.destroy()
if gender >= 0: if gender >= 0:
@ -810,7 +810,7 @@ class EditPerson(EditPrimary):
msg = _("Changing the gender caused problems " msg = _("Changing the gender caused problems "
"with marriage information.\nPlease check " "with marriage information.\nPlease check "
"the person's marriages.") "the person's marriages.")
ErrorDialog(msg2, msg, parent=self.window) ErrorDialog(msg2, msg, parent=self.window) # parent-OK
def save(self, *obj): def save(self, *obj):
""" """
@ -818,7 +818,7 @@ class EditPerson(EditPrimary):
""" """
self.ok_button.set_sensitive(False) self.ok_button.set_sensitive(False)
if self.object_is_empty(): if self.object_is_empty():
ErrorDialog(_("Cannot save person"), ErrorDialog(_("Cannot save person"), # parent-OK
_("No data exists for this person. Please " _("No data exists for this person. Please "
"enter data or cancel the edit."), "enter data or cancel the edit."),
parent=self.window) parent=self.window)
@ -849,7 +849,7 @@ class EditPerson(EditPrimary):
"%(prim_object)s'. Please enter a different ID or leave " "%(prim_object)s'. Please enter a different ID or leave "
"blank to get the next available ID value.") % { "blank to get the next available ID value.") % {
'id' : id, 'prim_object' : name } 'id' : id, 'prim_object' : name }
ErrorDialog(msg1, msg2, parent=self.window) ErrorDialog(msg1, msg2, parent=self.window) # parent-OK
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
@ -957,7 +957,7 @@ class EditPerson(EditPrimary):
if obj is None : if obj is None :
#notify user of error #notify user of error
from ..dialog import RunDatabaseRepair from ..dialog import RunDatabaseRepair
RunDatabaseRepair( RunDatabaseRepair( # no-parent
_('Non existing media found in the Gallery')) _('Non existing media found in the Gallery'))
else : else :
self.load_photo(ref, obj) self.load_photo(ref, obj)

View File

@ -237,7 +237,7 @@ class EditPersonRef(EditSecondary):
else: else:
from ..dialog import ErrorDialog from ..dialog import ErrorDialog
ErrorDialog( ErrorDialog( # no-parent
_('No person selected'), _('No person selected'),
_('You must either select a person or Cancel ' _('You must either select a person or Cancel '
'the edit')) 'the edit'))

View File

@ -285,7 +285,7 @@ class EditPlace(EditPrimary):
if self.obj.get_name().get_value().strip() == '': if self.obj.get_name().get_value().strip() == '':
msg1 = _("Cannot save place. Name not entered.") msg1 = _("Cannot save place. Name not entered.")
msg2 = _("You must enter a name before saving.") msg2 = _("You must enter a name before saving.")
ErrorDialog(msg1, msg2, parent=self.window) ErrorDialog(msg1, msg2, parent=self.window) # parent-OK
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
@ -299,7 +299,7 @@ class EditPlace(EditPrimary):
"%(prim_object)s'. Please enter a different ID or leave " "%(prim_object)s'. Please enter a different ID or leave "
"blank to get the next available ID value.") % { "blank to get the next available ID value.") % {
'id' : id, 'prim_object' : name } 'id' : id, 'prim_object' : name }
ErrorDialog(msg1, msg2, parent=self.window) ErrorDialog(msg1, msg2, parent=self.window) # parent-OK
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

View File

@ -135,7 +135,7 @@ class EditPlaceName(EditSecondary):
def save(self, *obj): def save(self, *obj):
if not self.obj.get_value(): if not self.obj.get_value():
ErrorDialog(_("Cannot save place name"), ErrorDialog(_("Cannot save place name"), # parent-OK
_("The place name cannot be empty"), _("The place name cannot be empty"),
parent=self.window) parent=self.window)
return return

View File

@ -276,7 +276,7 @@ class EditPlaceRef(EditReference):
if self.source.get_name().get_value().strip() == '': if self.source.get_name().get_value().strip() == '':
msg1 = _("Cannot save place. Name not entered.") msg1 = _("Cannot save place. Name not entered.")
msg2 = _("You must enter a name before saving.") msg2 = _("You must enter a name before saving.")
ErrorDialog(msg1, msg2, parent=self.window) ErrorDialog(msg1, msg2, parent=self.window) # parent-OK
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

View File

@ -234,7 +234,7 @@ class EditPrimary(ManagedWindow, DbGUIElement, metaclass=abc.ABCMeta):
"""If the data has changed, give the user a chance to cancel """If the data has changed, give the user a chance to cancel
the close window""" the close window"""
if not config.get('interface.dont-ask') and self.data_has_changed(): if not config.get('interface.dont-ask') and self.data_has_changed():
SaveDialog( SaveDialog( # parent-OK
_('Save Changes?'), _('Save Changes?'),
_('If you close without saving, the changes you ' _('If you close without saving, the changes you '
'have made will be lost'), 'have made will be lost'),

View File

@ -297,6 +297,6 @@ class EditReference(ManagedWindow, DbGUIElement):
"different ID or leave blank to get the next " "different ID or leave blank to get the next "
"available ID value.") % { "available ID value.") % {
'id' : new_id} 'id' : new_id}
ErrorDialog(msg1, msg2, parent=self.window) ErrorDialog(msg1, msg2, parent=self.window) # parent-OK
return True return True
return False return False

View File

@ -176,7 +176,7 @@ class EditRepository(EditPrimary):
def save(self, *obj): def save(self, *obj):
self.ok_button.set_sensitive(False) self.ok_button.set_sensitive(False)
if self.object_is_empty(): if self.object_is_empty():
ErrorDialog(_("Cannot save repository"), ErrorDialog(_("Cannot save repository"), # parent-OK
_("No data exists for this repository. Please " _("No data exists for this repository. Please "
"enter data or cancel the edit."), "enter data or cancel the edit."),
parent=self.window) parent=self.window)
@ -193,7 +193,7 @@ class EditRepository(EditPrimary):
"%(prim_object)s'. Please enter a different ID or leave " "%(prim_object)s'. Please enter a different ID or leave "
"blank to get the next available ID value.") % { "blank to get the next available ID value.") % {
'id' : id, 'prim_object' : name } 'id' : id, 'prim_object' : name }
ErrorDialog(msg1, msg2, parent=self.window) ErrorDialog(msg1, msg2, parent=self.window) # parent-OK
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

View File

@ -196,7 +196,7 @@ class EditSource(EditPrimary):
def save(self, *obj): def save(self, *obj):
self.ok_button.set_sensitive(False) self.ok_button.set_sensitive(False)
if self.object_is_empty(): if self.object_is_empty():
ErrorDialog(_("Cannot save source"), ErrorDialog(_("Cannot save source"), # parent-OK
_("No data exists for this source. Please " _("No data exists for this source. Please "
"enter data or cancel the edit."), "enter data or cancel the edit."),
parent=self.window) parent=self.window)
@ -213,7 +213,7 @@ class EditSource(EditPrimary):
"%(prim_object)s'. Please enter a different ID or leave " "%(prim_object)s'. Please enter a different ID or leave "
"blank to get the next available ID value.") % { "blank to get the next available ID value.") % {
'id' : id, 'prim_object' : name } 'id' : id, 'prim_object' : name }
ErrorDialog(msg1, msg2, parent=self.window) ErrorDialog(msg1, msg2, parent=self.window) # parent-OK
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

View File

@ -1177,7 +1177,7 @@ class FilterEditor(ManagedWindow):
gfilter = self.clist.get_object(node) gfilter = self.clist.get_object(node)
name = gfilter.get_name() name = gfilter.get_name()
if self.check_recursive_filters(self.namespace, name): if self.check_recursive_filters(self.namespace, name):
QuestionDialog( _('Delete Filter?'), QuestionDialog( _('Delete Filter?'), # parent-OK
_('This filter is currently being used ' _('This filter is currently being used '
'as the base for other filters. Deleting' 'as the base for other filters. Deleting'
'this filter will result in removing all ' 'this filter will result in removing all '

View File

@ -141,7 +141,7 @@ def _display_generic_message(warning_type, config_key, parent=None):
""" """
if not config.get(config_key): if not config.get(config_key):
from .dialog import WarningDialog from .dialog import WarningDialog
WarningDialog( WarningDialog( # parent-OK
_('Danger: This is unstable code!'), _('Danger: This is unstable code!'),
_("This Gramps ('%s') is a development release.\n" _("This Gramps ('%s') is a development release.\n"
) % warning_type + ) % warning_type +
@ -175,7 +175,8 @@ def _display_gtk_gettext_message(parent=None):
LOG.warning("GTK translations missing, GUI will be broken, " LOG.warning("GTK translations missing, GUI will be broken, "
"especially for RTL languages!") "especially for RTL languages!")
from .dialog import WarningDialog from .dialog import WarningDialog
WarningDialog(_("Gramps detected an incomplete GTK installation"), WarningDialog(_("Gramps detected " # parent-OK
"an incomplete GTK installation"),
_("GTK translations for the current language (%(language)s) " _("GTK translations for the current language (%(language)s) "
"are missing.\n" "are missing.\n"
"%(bold_start)sGramps%(bold_end)s will " "%(bold_start)sGramps%(bold_end)s will "
@ -261,7 +262,8 @@ class Gramps:
if hasattr(self, '_vm'): if hasattr(self, '_vm'):
if hasattr(self._vm, 'window'): if hasattr(self._vm, 'window'):
parent = self._vm.window parent = self._vm.window
ErrorDialog(_("Error parsing arguments"), string, parent=parent) ErrorDialog(_("Error parsing arguments"), string, # parent-OK
parent=parent)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -279,13 +281,13 @@ def __startgramps(errors, argparser):
#handle first existing errors in GUI fashion #handle first existing errors in GUI fashion
if errors: if errors:
for error in errors: for error in errors:
ErrorDialog(error[0], error[1]) ErrorDialog(error[0], error[1]) # no-parent
Gtk.main_quit() Gtk.main_quit()
sys.exit(1) sys.exit(1)
if argparser.errors: if argparser.errors:
for error in argparser.errors: for error in argparser.errors:
ErrorDialog(error[0], error[1]) ErrorDialog(error[0], error[1]) # no-parent
Gtk.main_quit() Gtk.main_quit()
sys.exit(1) sys.exit(1)

View File

@ -219,7 +219,7 @@ class MergeFamily(ManagedWindow):
phoenix_fh, phoenix_mh) phoenix_fh, phoenix_mh)
query.execute() query.execute()
except MergeError as err: except MergeError as err:
ErrorDialog(_("Cannot merge people"), str(err), ErrorDialog(_("Cannot merge people"), str(err), # parent-OK
parent=self.uistate.window) parent=self.uistate.window)
self.uistate.set_busy_cursor(False) self.uistate.set_busy_cursor(False)
self.close() self.close()

View File

@ -325,7 +325,7 @@ class MergePerson(ManagedWindow):
query = MergePersonQuery(self.database, phoenix, titanic) query = MergePersonQuery(self.database, phoenix, titanic)
query.execute() query.execute()
except MergeError as err: except MergeError as err:
ErrorDialog(_("Cannot merge people"), str(err), ErrorDialog(_("Cannot merge people"), str(err), # parent-OK
parent=self.uistate.window) parent=self.uistate.window)
self.uistate.set_busy_cursor(False) self.uistate.set_busy_cursor(False)
self.close() self.close()

View File

@ -1240,7 +1240,7 @@ class GuiPersonListOption(Gtk.Box):
spouse_name = _nd.display(spouse) spouse_name = _nd.display(spouse)
text = _('Also include %s?') % spouse_name text = _('Also include %s?') % spouse_name
prompt = OptionDialog(_('Select Person'), prompt = OptionDialog(_('Select Person'), # parent-OK
text, text,
_('No'), None, _('No'), None,
_('Yes'), None, _('Yes'), None,

View File

@ -611,7 +611,8 @@ class PluginStatus(ManagedWindow):
'plugfil': _("Filename"), 'plugfil': _("Filename"),
'plugpat': _("Location"), 'plugpat': _("Location"),
} }
InfoDialog(_('Detailed Info'), infotxt, parent=self.window) InfoDialog(_('Detailed Info'), infotxt, # parent-OK
parent=self.window)
def __hide(self, obj, list_obj, id_col, hide_col): def __hide(self, obj, list_obj, id_col, hide_col):
""" Callback function from the "Hide" button """ Callback function from the "Hide" button
@ -1191,22 +1192,22 @@ class UpdateAddons:
if not longop.was_cancelled(): if not longop.was_cancelled():
longop.end() longop.end()
if errors: if errors:
OkDialog(_("Installation Errors"), OkDialog(_("Installation Errors"), # parent-OK
_("The following addons had errors: ") + _("The following addons had errors: ") +
", ".join(errors), ", ".join(errors),
self.window) parent=self.window)
if count: if count:
OkDialog(_("Done downloading and installing addons"), OkDialog(_("Done downloading and installing addons"), # parent-OK
# translators: leave all/any {...} untranslated # translators: leave all/any {...} untranslated
"%s %s" % (ngettext("{number_of} addon was installed.", "%s %s" % (ngettext("{number_of} addon was installed.",
"{number_of} addons were installed.", "{number_of} addons were installed.",
count).format(number_of=count), count).format(number_of=count),
_("You need to restart Gramps to see new views.")), _("You need to restart Gramps to see new views.")),
self.window) parent=self.window)
else: else:
OkDialog(_("Done downloading and installing addons"), OkDialog(_("Done downloading and installing addons"), # parent-OK
_("No addons were installed."), _("No addons were installed."),
self.window) parent=self.window)
self.window.destroy() self.window.destroy()
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -662,7 +662,7 @@ class WriterOptionBox:
lambda : self.edit_filter_save(filterdb, namespace)) lambda : self.edit_filter_save(filterdb, namespace))
else: # can't edit this filter else: # can't edit this filter
from ...dialog import ErrorDialog from ...dialog import ErrorDialog
ErrorDialog(_("Cannot edit a system filter"), ErrorDialog(_("Cannot edit a system filter"), # no-parent
_("Please select a different filter to edit")) _("Please select a different filter to edit"))
def edit_filter_save(self, filterdb, namespace): def edit_filter_save(self, filterdb, namespace):

View File

@ -237,7 +237,7 @@ class BookListDisplay:
def on_booklist_cancel_clicked(self, obj): def on_booklist_cancel_clicked(self, obj):
""" cancel the booklist dialog """ """ cancel the booklist dialog """
if self.unsaved_changes: if self.unsaved_changes:
qqq = QuestionDialog2( qqq = QuestionDialog2( # parent-OK
_('Discard Unsaved Changes'), _('Discard Unsaved Changes'),
_('You have made changes which have not been saved.'), _('You have made changes which have not been saved.'),
_('Proceed'), _('Proceed'),
@ -440,7 +440,7 @@ class BookSelector(ManagedWindow):
if book.get_output(): if book.get_output():
self.book.set_output(book.get_output()) self.book.set_output(book.get_output())
if book.get_dbname() != self._db.get_save_path(): if book.get_dbname() != self._db.get_save_path():
WarningDialog( WarningDialog( # parent-OK
_('Different database'), _('Different database'),
_('This book was created with the references to database ' _('This book was created with the references to database '
'%s.\n\n This makes references to the central person ' '%s.\n\n This makes references to the central person '
@ -547,7 +547,7 @@ class BookSelector(ManagedWindow):
""" """
store, the_iter = self.book_model.get_selected() store, the_iter = self.book_model.get_selected()
if not the_iter: if not the_iter:
WarningDialog(_('No selected book item'), WarningDialog(_('No selected book item'), # parent-OK
_('Please select a book item to configure.'), _('Please select a book item to configure.'),
parent=self.window) parent=self.window)
return return
@ -711,7 +711,8 @@ class BookSelector(ManagedWindow):
if self.book_list.get_needs_saving(): if self.book_list.get_needs_saving():
self.book_list.save() self.book_list.save()
else: else:
WarningDialog(_('No items'), _('This book has no items.'), WarningDialog(_('No items'), # parent-OK
_('This book has no items.'),
parent=self.window) parent=self.window)
return return
self.close() self.close()
@ -722,14 +723,14 @@ class BookSelector(ManagedWindow):
""" """
name = str(self.name_entry.get_text()) name = str(self.name_entry.get_text())
if not name: if not name:
WarningDialog( WarningDialog( # parent-OK
_('No book name'), _('No book name'),
_('You are about to save away a book with no name.\n\n' _('You are about to save away a book with no name.\n\n'
'Please give it a name before saving it away.'), 'Please give it a name before saving it away.'),
parent=self.window) parent=self.window)
return return
if name in self.book_list.get_book_names(): if name in self.book_list.get_book_names():
qqq = QuestionDialog2( qqq = QuestionDialog2( # parent-OK
_('Book name already exists'), _('Book name already exists'),
_('You are about to save away a ' _('You are about to save away a '
'book with a name which already exists.'), 'book with a name which already exists.'),
@ -949,7 +950,7 @@ class BookDialog(DocReportDialog):
try: try:
self.make_book() self.make_book()
except (IOError, OSError) as msg: except (IOError, OSError) as msg:
ErrorDialog(str(msg), parent=self.window) ErrorDialog(str(msg), parent=self.window) # parent-OK
self.close() self.close()
def setup_style_frame(self): def setup_style_frame(self):
@ -1015,10 +1016,10 @@ class BookDialog(DocReportDialog):
except ReportError as msg: except ReportError as msg:
(msg1, msg2) = msg.messages() (msg1, msg2) = msg.messages()
msg2 += ' (%s)' % name # which report has the error? msg2 += ' (%s)' % name # which report has the error?
ErrorDialog(msg1, msg2, parent=self.uistate.window) ErrorDialog(msg1, msg2, parent=self.uistate.window) # parent-OK
except FilterError as msg: except FilterError as msg:
(msg1, msg2) = msg.messages() (msg1, msg2) = msg.messages()
ErrorDialog(msg1, msg2, parent=self.uistate.window) ErrorDialog(msg1, msg2, parent=self.uistate.window) # parent-OK
finally: finally:
return return
@ -1063,10 +1064,10 @@ def write_book_item(database, report_class, options, user):
return report_class(database, options, user) return report_class(database, options, user)
except ReportError as msg: except ReportError as msg:
(msg1, msg2) = msg.messages() (msg1, msg2) = msg.messages()
ErrorDialog(msg1, msg2, parent=user.uistate.window) ErrorDialog(msg1, msg2, parent=user.uistate.window) # parent-OK
except FilterError as msg: except FilterError as msg:
(msg1, msg2) = msg.messages() (msg1, msg2) = msg.messages()
ErrorDialog(msg1, msg2, parent=user.uistate.window) ErrorDialog(msg1, msg2, parent=user.uistate.window) # parent-OK
except: except:
LOG.error("Failed to write book item.", exc_info=True) LOG.error("Failed to write book item.", exc_info=True)
return None return None

View File

@ -496,7 +496,7 @@ class ReportDialog(ManagedWindow):
# check whether the dir has rwx permissions # check whether the dir has rwx permissions
if not os.access(self.target_path, os.R_OK|os.W_OK|os.X_OK): if not os.access(self.target_path, os.R_OK|os.W_OK|os.X_OK):
ErrorDialog(_('Permission problem'), ErrorDialog(_('Permission problem'), # parent-OK
_("You do not have permission to write " _("You do not have permission to write "
"under the directory %s\n\n" "under the directory %s\n\n"
"Please select another directory or correct " "Please select another directory or correct "
@ -506,7 +506,7 @@ class ReportDialog(ManagedWindow):
# selected path is an existing file and we need a file # selected path is an existing file and we need a file
if os.path.isfile(self.target_path): if os.path.isfile(self.target_path):
aaa = OptionDialog(_('File already exists'), aaa = OptionDialog(_('File already exists'), # parent-OK
_('You can choose to either overwrite the ' _('You can choose to either overwrite the '
'file, or change the selected filename.'), 'file, or change the selected filename.'),
_('_Overwrite'), None, _('_Overwrite'), None,
@ -523,7 +523,7 @@ class ReportDialog(ManagedWindow):
parent_dir = os.path.dirname(os.path.normpath(self.target_path)) parent_dir = os.path.dirname(os.path.normpath(self.target_path))
if os.path.isdir(parent_dir): if os.path.isdir(parent_dir):
if not os.access(parent_dir, os.W_OK): if not os.access(parent_dir, os.W_OK):
ErrorDialog(_('Permission problem'), ErrorDialog(_('Permission problem'), # parent-OK
_("You do not have permission to create " _("You do not have permission to create "
"%s\n\n" "%s\n\n"
"Please select another path or correct " "Please select another path or correct "
@ -531,7 +531,7 @@ class ReportDialog(ManagedWindow):
parent=self.window) parent=self.window)
return None return None
else: else:
ErrorDialog(_('No directory'), ErrorDialog(_('No directory'), # parent-OK
_('There is no directory %s.\n\n' _('There is no directory %s.\n\n'
'Please select another directory ' 'Please select another directory '
'or create it.') % parent_dir, 'or create it.') % parent_dir,
@ -657,7 +657,7 @@ def report(dbstate, uistate, person, report_class, options_class,
its arguments. its arguments.
""" """
if require_active and not person: if require_active and not person:
ErrorDialog( ErrorDialog( # parent-OK
_('Active person has not been set'), _('Active person has not been set'),
_('You must select an active person for this report to work ' _('You must select an active person for this report to work '
'properly.'), 'properly.'),
@ -709,15 +709,17 @@ def report(dbstate, uistate, person, report_class, options_class,
except FilterError as msg: except FilterError as msg:
(msg1, msg2) = msg.messages() (msg1, msg2) = msg.messages()
ErrorDialog(msg1, msg2, parent=uistate.window) ErrorDialog(msg1, msg2, parent=uistate.window) # parent-OK
except IOError as msg: except IOError as msg:
ErrorDialog(_("Report could not be created"), str(msg), ErrorDialog(_("Report could not be created"), # parent-OK
str(msg),
parent=uistate.window) parent=uistate.window)
except ReportError as msg: except ReportError as msg:
(msg1, msg2) = msg.messages() (msg1, msg2) = msg.messages()
ErrorDialog(msg1, msg2, parent=uistate.window) ErrorDialog(msg1, msg2, parent=uistate.window) # parent-OK
except DatabaseError as msg: except DatabaseError as msg:
ErrorDialog(_("Report could not be created"), str(msg), ErrorDialog(_("Report could not be created"), # parent-OK
str(msg),
parent=uistate.window) parent=uistate.window)
# The following except statement will catch all "NoneType" exceptions. # The following except statement will catch all "NoneType" exceptions.
# This is useful for released code where the exception is most likely # This is useful for released code where the exception is most likely
@ -727,7 +729,7 @@ def report(dbstate, uistate, person, report_class, options_class,
# if str(msg).startswith("'NoneType' object has no attribute"): # if str(msg).startswith("'NoneType' object has no attribute"):
# # "'NoneType' object has no attribute ..." usually means # # "'NoneType' object has no attribute ..." usually means
# # database corruption # # database corruption
# RunDatabaseRepair(str(msg)) # RunDatabaseRepair(str(msg)) # no-parent
# else: # else:
# raise # raise
raise raise

View File

@ -136,7 +136,7 @@ class StyleListDisplay:
self.sheetlist.save() self.sheetlist.save()
except IOError as msg: except IOError as msg:
from ...dialog import ErrorDialog from ...dialog import ErrorDialog
ErrorDialog(_("Error saving stylesheet"), str(msg)) ErrorDialog(_("Error saving stylesheet"), str(msg)) # no-parent
except: except:
log.error("Failed to save stylesheet", exc_info=True) log.error("Failed to save stylesheet", exc_info=True)

View File

@ -133,7 +133,7 @@ class ActivePersonTool(Tool):
# TODO: should we replace this with a callback? # TODO: should we replace this with a callback?
from ..dialog import ErrorDialog from ..dialog import ErrorDialog
ErrorDialog(_('Active person has not been set'), ErrorDialog(_('Active person has not been set'), # no-parent
_('You must select an active person for this ' _('You must select an active person for this '
'tool to work properly.')) 'tool to work properly.'))
self.fail = True self.fail = True

View File

@ -43,7 +43,7 @@ class TestUser_prompt(unittest.TestCase):
self.user = user.User() self.user = user.User()
@unittest.skipUnless(MOCKING, "Requires unittest.mock to run") @unittest.skipUnless(MOCKING, "Requires unittest.mock to run")
def test_prompt_runs_QuestionDialog2(self): def test_prompt_runs_QuestionDialog2(self): # parent-OK
with patch('gramps.gui.user.QuestionDialog2') as MockQD: with patch('gramps.gui.user.QuestionDialog2') as MockQD:
self.user.prompt(TestUser.TITLE, TestUser.MSG, self.user.prompt(TestUser.TITLE, TestUser.MSG,
TestUser.ACCEPT, TestUser.REJECT, None) TestUser.ACCEPT, TestUser.REJECT, None)

View File

@ -82,7 +82,7 @@ class TipOfDay(ManagedWindow):
tparser = TipParser() tparser = TipParser()
except (IOError,ExpatError) as e: except (IOError,ExpatError) as e:
self.close() self.close()
ErrorDialog( ErrorDialog( # no-parent
_("Failed to display tip of the day"), _("Failed to display tip of the day"),
_("Unable to read the tips from external file.\n\n%s")%e) _("Unable to read the tips from external file.\n\n%s")%e)
return return

View File

@ -194,11 +194,11 @@ class UndoHistory(ManagedWindow):
return (self.title, None) return (self.title, None)
def _clear_clicked(self, obj=None): def _clear_clicked(self, obj=None):
QuestionDialog(_("Delete confirmation"), QuestionDialog(_("Delete confirmation"), # parent-OK
_("Are you sure you want to clear the Undo history?"), _("Are you sure you want to clear the Undo history?"),
_("Clear"), _("Clear"),
self.clear, self.clear,
self.window) parent=self.window)
def clear(self): def clear(self):
self.undodb.clear() self.undodb.clear()

View File

@ -111,8 +111,9 @@ class User(user.User):
:returns: the user's answer to the question :returns: the user's answer to the question
:rtype: bool :rtype: bool
""" """
dialog = QuestionDialog2(title, message, accept_label, reject_label, dialog = QuestionDialog2(title, message, # parent-OK
parent) accept_label, reject_label,
parent=parent)
return dialog.run() return dialog.run()
def warn(self, title, warning=""): def warn(self, title, warning=""):
@ -126,9 +127,10 @@ class User(user.User):
:returns: none :returns: none
""" """
if self.uistate: if self.uistate:
WarningDialog(title, warning, parent=self.uistate.window) WarningDialog(title, warning, # parent-OK
parent=self.uistate.window)
else: else:
WarningDialog(title, warning) WarningDialog(title, warning, parent=None) # parent-OK
def notify_error(self, title, error=""): def notify_error(self, title, error=""):
""" """
@ -143,9 +145,9 @@ class User(user.User):
if self.error_function: if self.error_function:
self.error_function(title, error) self.error_function(title, error)
elif self.uistate: elif self.uistate:
ErrorDialog(title, error, parent=self.uistate.window) ErrorDialog(title, error, parent=self.uistate.window) # parent-OK
else: else:
ErrorDialog(title, error) ErrorDialog(title, error, parent=None) # parent-OK
def notify_db_error(self, error): def notify_db_error(self, error):
""" """
@ -156,12 +158,12 @@ class User(user.User):
:returns: none :returns: none
""" """
if self.uistate: if self.uistate:
DBErrorDialog(error, parent=self.uistate.window) DBErrorDialog(error, parent=self.uistate.window) # parent-OK
else: else:
DBErrorDialog(error) DBErrorDialog(error, parent=None) # parent-OK
def info(self, msg1, infotext, parent=None, monospaced=False): def info(self, msg1, infotext, parent=None, monospaced=False):
""" """
Calls the GUI InfoDialog Calls the GUI InfoDialog
""" """
InfoDialog(msg1, infotext, parent, monospaced) InfoDialog(msg1, infotext, parent, monospaced) # parent-OK

View File

@ -297,10 +297,10 @@ class ProgressMeter:
Don't let the user close the progress dialog. Don't let the user close the progress dialog.
""" """
from .dialog import WarningDialog from .dialog import WarningDialog
WarningDialog( WarningDialog( # parent-OK
_("Attempt to force closing the dialog"), _("Attempt to force closing the dialog"),
_("Please do not force closing this important dialog."), _("Please do not force closing this important dialog."),
self.__dialog) parent=self.__dialog)
return True return True
def close(self, widget=None): def close(self, widget=None):
@ -372,7 +372,7 @@ def display_error_dialog (index, errorstrings):
else: else:
error = errorstrings error = errorstrings
ErrorDialog(_("Error from external program"), error) ErrorDialog(_("Error from external program"), error) # no-parent
def poll_external (args): def poll_external (args):
""" """
@ -586,7 +586,7 @@ def edit_object(dbstate, uistate, reftype, ref):
"alone") "alone")
from .dialog import WarningDialog from .dialog import WarningDialog
WarningDialog(_("Cannot open new citation editor"), WarningDialog(_("Cannot open new citation editor"), # no-parent
blocked_text) blocked_text)
elif reftype == 'Place': elif reftype == 'Place':
try: try:

View File

@ -347,7 +347,8 @@ class ViewManager(CLIManager):
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, parent=self.uistate.window) ErrorDialog(title, errormessage, # parent-OK
parent=self.uistate.window)
return 1 return 1
def __build_main_window(self): def __build_main_window(self):
@ -772,7 +773,7 @@ class ViewManager(CLIManager):
""" """
if self.dbstate.db.abort_possible: if self.dbstate.db.abort_possible:
dialog = QuestionDialog2( dialog = QuestionDialog2( # parent-OK
_("Abort changes?"), _("Abort changes?"),
_("Aborting changes will return the database to the state " _("Aborting changes will return the database to the state "
"it was before you started this editing session."), "it was before you started this editing session."),
@ -786,7 +787,7 @@ class ViewManager(CLIManager):
pass pass
self.quit() self.quit()
else: else:
WarningDialog( WarningDialog( # parent-OK
_("Cannot abandon session's changes"), _("Cannot abandon session's changes"),
_('Changes cannot be completely abandoned because the ' _('Changes cannot be completely abandoned because the '
'number of changes made in the session exceeded the ' 'number of changes made in the session exceeded the '
@ -1096,7 +1097,7 @@ class ViewManager(CLIManager):
self.db_loader.import_file() self.db_loader.import_file()
infotxt = self.db_loader.import_info_text() infotxt = self.db_loader.import_info_text()
if infotxt: if infotxt:
InfoDialog(_('Import Statistics'), infotxt, InfoDialog(_('Import Statistics'), infotxt, # parent-OK
parent=self.window) parent=self.window)
self.__post_load() self.__post_load()
@ -1353,7 +1354,7 @@ class ViewManager(CLIManager):
basefile = basefile.replace("/", r"-") basefile = basefile.replace("/", r"-")
filename = os.path.join(path_entry.get_text(), basefile) filename = os.path.join(path_entry.get_text(), basefile)
if os.path.exists(filename): if os.path.exists(filename):
question = QuestionDialog2( question = QuestionDialog2( # parent-OK
_("Backup file already exists! Overwrite?"), _("Backup file already exists! Overwrite?"),
_("The file '%s' exists.") % filename, _("The file '%s' exists.") % filename,
_("Proceed and overwrite"), _("Proceed and overwrite"),
@ -1591,7 +1592,7 @@ class ViewManager(CLIManager):
def display_about_box(self, obj): def display_about_box(self, obj):
"""Display the About box.""" """Display the About box."""
about = GrampsAboutDialog(self.uistate.window) about = GrampsAboutDialog(self.uistate.window) # parent-OK
about.run() about.run()
about.destroy() about.destroy()
@ -1652,7 +1653,7 @@ def run_plugin(pdata, dbstate, uistate):
error_msg = failed[-1][1][1] error_msg = failed[-1][1][1]
else: else:
error_msg = "(no error message)" error_msg = "(no error message)"
ErrorDialog( ErrorDialog( # parent-OK
_('Failed Loading Plugin'), _('Failed Loading Plugin'),
_('The plugin %(name)s did not load and reported an error.\n\n' _('The plugin %(name)s did not load and reported an error.\n\n'
'%(error_msg)s\n\n' '%(error_msg)s\n\n'

View File

@ -429,7 +429,7 @@ class CitationBookmarks(ListBookmarks):
# more comprehensive solution is needed in the long term. See also # more comprehensive solution is needed in the long term. See also
# change_active in CitatinTreeView # change_active in CitatinTreeView
from gramps.gui.dialog import WarningDialog from gramps.gui.dialog import WarningDialog
WarningDialog(_("Cannot bookmark this reference"), WarningDialog(_("Cannot bookmark this reference"), # no-parent
"Only Citations can be bookmarked in this view. " "Only Citations can be bookmarked in this view. "
"You are probably trying to bookmark a Source in the " "You are probably trying to bookmark a Source in the "
"Citation Tree View. In this view, only Citations " "Citation Tree View. In this view, only Citations "

View File

@ -445,7 +445,7 @@ class ListView(NavigationView):
self.bookmarks.add(mlist[0]) self.bookmarks.add(mlist[0])
else: else:
from ..dialog import WarningDialog from ..dialog import WarningDialog
WarningDialog( WarningDialog( # no-parent
_("Could Not Set a Bookmark"), _("Could Not Set a Bookmark"),
_("A bookmark could not be set because " _("A bookmark could not be set because "
"nothing was selected.")) "nothing was selected."))
@ -537,7 +537,7 @@ class ListView(NavigationView):
""" """
prompt = True prompt = True
if len(self.selected_handles()) > 1: if len(self.selected_handles()) > 1:
q = QuestionDialog2( q = QuestionDialog2( # no-parent
_("Multiple Selection Delete"), _("Multiple Selection Delete"),
_("More than one item has been selected for deletion. " _("More than one item has been selected for deletion. "
"Select the option indicating how to delete the items:"), "Select the option indicating how to delete the items:"),
@ -563,7 +563,7 @@ class ListView(NavigationView):
#if descr == "": #if descr == "":
descr = object.get_gramps_id() descr = object.get_gramps_id()
self.uistate.set_busy_cursor(True) self.uistate.set_busy_cursor(True)
QuestionDialog(_('Delete %s?') % descr, msg, QuestionDialog(_('Delete %s?') % descr, msg, # no-parent
_('_Delete Item'), query.query_response) _('_Delete Item'), query.query_response)
self.uistate.set_busy_cursor(False) self.uistate.set_busy_cursor(False)
else: else:

View File

@ -252,7 +252,7 @@ class NavigationView(PageView):
_("%s has been bookmarked") % name) _("%s has been bookmarked") % name)
else: else:
from ..dialog import WarningDialog from ..dialog import WarningDialog
WarningDialog( WarningDialog( # no-parent
_("Could Not Set a Bookmark"), _("Could Not Set a Bookmark"),
_("A bookmark could not be set because " _("A bookmark could not be set because "
"no one was selected.")) "no one was selected."))
@ -333,7 +333,7 @@ class NavigationView(PageView):
self.change_active(defperson.get_handle()) self.change_active(defperson.get_handle())
else: else:
from ..dialog import WarningDialog from ..dialog import WarningDialog
WarningDialog(_("No Home Person"), WarningDialog(_("No Home Person"), # parent-OK
_("You need to set a 'default person' to go to. " _("You need to set a 'default person' to go to. "
"Select the People View, select the person you want as " "Select the People View, select the person you want as "
"'Home Person', then confirm your choice " "'Home Person', then confirm your choice "

View File

@ -245,7 +245,8 @@ class Tags(DbGUIElement):
""" """
Display the Organize Tags dialog. Display the Organize Tags dialog.
""" """
organize_dialog = OrganizeTagsDialog(self.db, self.uistate.window) organize_dialog = OrganizeTagsDialog(self.db, # parent-OK
self.uistate.window)
organize_dialog.run() organize_dialog.run()
def cb_new_tag(self, action): def cb_new_tag(self, action):
@ -485,7 +486,7 @@ class OrganizeTagsDialog:
tag_handle = store.get_value(iter_, 1) tag_handle = store.get_value(iter_, 1)
tag_name = store.get_value(iter_, 2) tag_name = store.get_value(iter_, 2)
yes_no = QuestionDialog2( yes_no = QuestionDialog2( # no-parent
_("Remove tag '%s'?") % tag_name, _("Remove tag '%s'?") % tag_name,
_("The tag definition will be removed. " _("The tag definition will be removed. "
"The tag will be also removed from all objects in the database."), "The tag will be also removed from all objects in the database."),
@ -581,7 +582,7 @@ class EditTag:
self.tag.set_color(hexval) self.tag.set_color(hexval)
if not self.tag.get_name(): if not self.tag.get_name():
ErrorDialog( ErrorDialog( # no-parent
_("Cannot save tag"), _("Cannot save tag"),
_("The tag name cannot be empty")) _("The tag name cannot be empty"))
return return

View File

@ -541,7 +541,7 @@ class GrampletBar(Gtk.Notebook):
""" """
Called when restore defaults is clicked from the context menu. Called when restore defaults is clicked from the context menu.
""" """
QuestionDialog(_("Restore to defaults?"), QuestionDialog(_("Restore to defaults?"), # no-parent
_("The gramplet bar will be restored to contain its default " _("The gramplet bar will be restored to contain its default "
"gramplets. This action cannot be undone."), "gramplets. This action cannot be undone."),
_("OK"), _("OK"),

View File

@ -799,7 +799,7 @@ def gramps_upgrade_16(self):
"Tools -> Family Tree Processing -> Merge\n" "Tools -> Family Tree Processing -> Merge\n"
"in order to merge citations that contain similar\n" "in order to merge citations that contain similar\n"
"information") "information")
InfoDialog(_('Upgrade Statistics'), txt, monospaced=True) InfoDialog(_('Upgrade Statistics'), txt, monospaced=True) # no-parent
def upgrade_media_list_16(self, media_list): def upgrade_media_list_16(self, media_list):
new_media_list = [] new_media_list = []

View File

@ -269,7 +269,7 @@ class HtmlDoc(BaseDoc, TextDoc):
shutil.copyfile(from_fname, dest) shutil.copyfile(from_fname, dest)
elif self.warn_dir: elif self.warn_dir:
from gramps.gui.dialog import WarningDialog from gramps.gui.dialog import WarningDialog
WarningDialog( WarningDialog( # no-parent
_("Possible destination error") + "\n" + _("Possible destination error") + "\n" +
_("You appear to have set your target directory " _("You appear to have set your target directory "
"to a directory used for data storage. This " "to a directory used for data storage. This "

View File

@ -1243,7 +1243,8 @@ class LaTeXDoc(BaseDoc, TextDoc):
"Use your package manager to install " "Use your package manager to install "
"python-imaging or python-pillow or " "python-imaging or python-pillow or "
"python3-pillow") "python3-pillow")
MessageHideDialog(title, message, 'interface.ignore-pil') MessageHideDialog(title, message, # no-parent
'interface.ignore-pil')
self.emit(''.join(('%\n *** Error: cannot convert ', infile, self.emit(''.join(('%\n *** Error: cannot convert ', infile,
'\n *** to ', outfile, '\n *** to ', outfile,
'\n *** PIL not installed %\n'))) '\n *** PIL not installed %\n')))

View File

@ -190,7 +190,7 @@ class PackageWriter:
# else: # else:
# # File is lost => ask what to do # # File is lost => ask what to do
# if missmedia_action == 0: # if missmedia_action == 0:
# mmd = MissingMediaDialog( # mmd = MissingMediaDialog( # no-parent
# _("Media object could not be found"), # _("Media object could not be found"),
# _("%(file_name)s is referenced in the database, " # _("%(file_name)s is referenced in the database, "
# "but no longer exists. The file may have been " # "but no longer exists. The file may have been "

View File

@ -422,7 +422,8 @@ else:
message = _("Image metadata functionality will not be available.\n" message = _("Image metadata functionality will not be available.\n"
"To build it for Gramps see " "To build it for Gramps see "
"%(gramps_wiki_build_gexiv2_url)s" % gexiv2_dict ) "%(gramps_wiki_build_gexiv2_url)s" % gexiv2_dict )
MessageHideDialog(title, message, 'interface.ignore-gexiv2') MessageHideDialog(title, message, # no-parent
'interface.ignore-gexiv2')
register(GRAMPLET, register(GRAMPLET,
id="Person Residence", id="Person Residence",

View File

@ -130,7 +130,7 @@ class Leak(Gramplet):
text += str(referrer) + '\n' text += str(referrer) + '\n'
except ReferenceError: except ReferenceError:
pass pass
InfoDialog(_('Referrers of %d') % count, text, InfoDialog(_('Referrers of %d') % count, text, # parent-OK
parent=self.uistate.window) parent=self.uistate.window)
def refers_to(self): def refers_to(self):
@ -144,7 +144,7 @@ class Leak(Gramplet):
text += str(referent) + '\n' text += str(referent) + '\n'
except ReferenceError: except ReferenceError:
pass pass
InfoDialog(_('%d refers to') % count, text, InfoDialog(_('%d refers to') % count, text, # parent-OK
parent=self.uistate.window) parent=self.uistate.window)
def display(self): def display(self):

View File

@ -7301,7 +7301,7 @@ class GedcomParser(UpdateCallback):
# coding is now wrong. # coding is now wrong.
if self.genby.upper() == "LEGACY": if self.genby.upper() == "LEGACY":
fname = os.path.basename(self.filename) fname = os.path.basename(self.filename)
WarningDialog( WarningDialog( # no-parent
_("Import of GEDCOM file %(filename)s with DEST=%(by)s, " _("Import of GEDCOM file %(filename)s with DEST=%(by)s, "
"could cause errors in the resulting database!") "could cause errors in the resulting database!")
% {'filename': fname, 'by': self.genby}, % {'filename': fname, 'by': self.genby},

View File

@ -293,7 +293,7 @@ class BasePersonView(ListView):
msg2 = self._message2_format(person) msg2 = self._message2_format(person)
msg2 = "%s %s" % (msg2, data_recover_msg) msg2 = "%s %s" % (msg2, data_recover_msg)
# This gets person to delete self.active_person: # This gets person to delete self.active_person:
QuestionDialog(msg1, QuestionDialog(msg1, # parent-OK
msg2, msg2,
_('_Delete Person'), _('_Delete Person'),
self.delete_person_response, self.delete_person_response,
@ -301,7 +301,7 @@ class BasePersonView(ListView):
else: else:
# Ask to delete; option to cancel, delete rest # Ask to delete; option to cancel, delete rest
# This gets person to delete from parameter # This gets person to delete from parameter
MultiSelectDialog(self._message1_format, MultiSelectDialog(self._message1_format, # parent-OK
self._message2_format, self._message2_format,
handles, handles,
self._lookup_person, self._lookup_person,
@ -421,7 +421,7 @@ class BasePersonView(ListView):
mlist = self.selected_handles() mlist = self.selected_handles()
if len(mlist) != 2: if len(mlist) != 2:
ErrorDialog(_("Cannot merge people"), ErrorDialog(_("Cannot merge people"), # parent-OK
_("Exactly two people must be selected to perform " _("Exactly two people must be selected to perform "
"a merge. A second person can be selected by " "a merge. A second person can be selected by "
"holding down the control key while clicking on " "holding down the control key while clicking on "

View File

@ -258,7 +258,7 @@ class PlaceBaseView(ListView):
if not len(self.mapservicedata): if not len(self.mapservicedata):
msg = _("No map service is available.") msg = _("No map service is available.")
msg2 = _("Check your installation.") msg2 = _("Check your installation.")
ErrorDialog(msg, msg2, parent=self.uistate.window) ErrorDialog(msg, msg2, parent=self.uistate.window) # parent-OK
return return
place_handles = self.selected_handles() place_handles = self.selected_handles()
@ -269,7 +269,7 @@ class PlaceBaseView(ListView):
msg2 = _("You need to select a place to be able to view it" msg2 = _("You need to select a place to be able to view it"
" on a map. Some Map Services might support multiple" " on a map. Some Map Services might support multiple"
" selections.") " selections.")
ErrorDialog(msg, msg2, parent=self.uistate.window) ErrorDialog(msg, msg2, parent=self.uistate.window) # parent-OK
return return
#TODO: support for descriptions in some cases. For now, pass None #TODO: support for descriptions in some cases. For now, pass None
@ -363,7 +363,7 @@ class PlaceBaseView(ListView):
msg = _("Cannot delete place.") msg = _("Cannot delete place.")
msg2 = _("This place is currently referenced by another place. " msg2 = _("This place is currently referenced by another place. "
"First remove the places it contains.") "First remove the places it contains.")
ErrorDialog(msg, msg2, parent=self.uistate.window) ErrorDialog(msg, msg2, parent=self.uistate.window) # parent-OK
return return
self.remove_selected_objects() self.remove_selected_objects()
@ -406,14 +406,14 @@ class PlaceBaseView(ListView):
msg2 = _("Exactly two places must be selected to perform a merge. " msg2 = _("Exactly two places must be selected to perform a merge. "
"A second place can be selected by holding down the " "A second place can be selected by holding down the "
"control key while clicking on the desired place.") "control key while clicking on the desired place.")
ErrorDialog(msg, msg2, parent=self.uistate.window) ErrorDialog(msg, msg2, parent=self.uistate.window) # parent-OK
else: else:
if (located_in(self.dbstate.db, mlist[0], mlist[1]) or if (located_in(self.dbstate.db, mlist[0], mlist[1]) or
located_in(self.dbstate.db, mlist[1], mlist[0])): located_in(self.dbstate.db, mlist[1], mlist[0])):
msg = _("Cannot merge places.") msg = _("Cannot merge places.")
msg2 = _("Merging these places would create a cycle in the " msg2 = _("Merging these places would create a cycle in the "
"place hierarchy.") "place hierarchy.")
ErrorDialog(msg, msg2, parent=self.uistate.window) ErrorDialog(msg, msg2, parent=self.uistate.window) # parent-OK
else: else:
MergePlace(self.dbstate, self.uistate, mlist[0], mlist[1], MergePlace(self.dbstate, self.uistate, mlist[0], mlist[1],
self.merged) self.merged)

View File

@ -198,7 +198,7 @@ class GeoGraphyView(OsmGps, NavigationView):
self.bookmarks.add(mlist[0]) self.bookmarks.add(mlist[0])
else: else:
from gramps.gui.dialog import WarningDialog from gramps.gui.dialog import WarningDialog
WarningDialog( WarningDialog( # parent-OK
_("Could Not Set a Bookmark"), _("Could Not Set a Bookmark"),
_("A bookmark could not be set because " _("A bookmark could not be set because "
"no one was selected."), "no one was selected."),
@ -214,7 +214,7 @@ class GeoGraphyView(OsmGps, NavigationView):
self.bookmarks.redraw() self.bookmarks.redraw()
else: else:
from gramps.gui.dialog import WarningDialog from gramps.gui.dialog import WarningDialog
WarningDialog( WarningDialog( # parent-OK
_("Could Not Set a Bookmark"), _("Could Not Set a Bookmark"),
_("A bookmark could not be set because " _("A bookmark could not be set because "
"no one was selected."), "no one was selected."),
@ -845,7 +845,7 @@ class GeoGraphyView(OsmGps, NavigationView):
""" """
if Gtk.MAJOR_VERSION == 3 and Gtk.MINOR_VERSION < 11: if Gtk.MAJOR_VERSION == 3 and Gtk.MINOR_VERSION < 11:
from gramps.gui.dialog import WarningDialog from gramps.gui.dialog import WarningDialog
WarningDialog( WarningDialog( # parent-OK
_("You can't use the print functionality"), _("You can't use the print functionality"),
_("Your Gtk version is too old."), _("Your Gtk version is too old."),
parent=self.uistate.window) parent=self.uistate.window)
@ -1031,7 +1031,7 @@ class GeoGraphyView(OsmGps, NavigationView):
gids = gids + ", " + plce.gramps_id gids = gids + ", " + plce.gramps_id
if nb_places > 1: if nb_places > 1:
from gramps.gui.dialog import WarningDialog from gramps.gui.dialog import WarningDialog
WarningDialog( WarningDialog( # parent-OK
_('You have at least two places with the same title.'), _('You have at least two places with the same title.'),
_("The title of the places is:\n%(title)s\n" _("The title of the places is:\n%(title)s\n"
"The following places are similar: %(gid)s\n" "The following places are similar: %(gid)s\n"

View File

@ -116,8 +116,8 @@ class OsmGps:
try: try:
os.makedirs(cache_path, 0o755) # create dir like mkdir -p os.makedirs(cache_path, 0o755) # create dir like mkdir -p
except: except:
ErrorDialog(_("Can't create tiles cache directory %s") % ErrorDialog(_("Can't create " # no-parent
cache_path) "tiles cache directory %s") % cache_path)
return self.vbox return self.vbox
self.change_map(None, config.get("geography.map_service")) self.change_map(None, config.get("geography.map_service"))
@ -138,7 +138,8 @@ class OsmGps:
try: try:
os.makedirs(tiles_path, 0o755) # create dir like mkdir -p os.makedirs(tiles_path, 0o755) # create dir like mkdir -p
except: except:
ErrorDialog(_("Can't create tiles cache directory for '%s'.") % ErrorDialog(_("Can't create " # no-parent
"tiles cache directory for '%s'.") %
constants.MAP_TITLE[map_type]) constants.MAP_TITLE[map_type])
config.set("geography.map_service", map_type) config.set("geography.map_service", map_type)
self.current_map = map_type self.current_map = map_type

View File

@ -144,7 +144,7 @@ class EniroSVMapService(MapService):
else: else:
msg2 = _("Latitude not within '54.55' to '69.05'\n") + \ msg2 = _("Latitude not within '54.55' to '69.05'\n") + \
_("Longitude not within '8.05' to '24.15'") _("Longitude not within '8.05' to '24.15'")
WarningDialog(_("Eniro map not available"), msg2 ) WarningDialog(_("Eniro map not available"), msg2) # no-parent
return return
if coord_ok: if coord_ok:
@ -171,13 +171,13 @@ class EniroSVMapService(MapService):
self.url = path.replace(" ","%20") self.url = path.replace(" ","%20")
return return
else: else:
WarningDialog(_("Eniro map not available"), \ WarningDialog(_("Eniro map not available"), # no-parent
_("Coordinates needed in Denmark")) _("Coordinates needed in Denmark"))
self.url = "" self.url = ""
return return
WarningDialog(_("Eniro map not available"), WarningDialog(_("Eniro map not available"), # no-parent
_("Latitude and longitude,\n" \ _("Latitude and longitude,\n"
"or street and city needed")) "or street and city needed"))
return return

View File

@ -549,7 +549,8 @@ class IndivCompleteReport(Report):
media = self._db.get_media_from_handle(media_handle) media = self._db.get_media_from_handle(media_handle)
if media is None: if media is None:
from gramps.gui.dialog import RunDatabaseRepair from gramps.gui.dialog import RunDatabaseRepair
RunDatabaseRepair(_('Non existing media found in the Gallery')) RunDatabaseRepair( # no-parent
_('Non existing media found in the Gallery'))
return return
mime_type = media.get_mime_type() mime_type = media.get_mime_type()
if not mime_type or not mime_type.startswith("image"): if not mime_type or not mime_type.startswith("image"):

View File

@ -141,7 +141,7 @@ class ChangeNames(tool.BatchTool, ManagedWindow):
else: else:
self.progress.close() self.progress.close()
self.close() self.close()
OkDialog(_('No modifications made'), OkDialog(_('No modifications made'), # parent-OK
_("No capitalization changes were detected."), _("No capitalization changes were detected."),
parent=uistate.window) parent=uistate.window)

View File

@ -722,7 +722,7 @@ class CheckIntegrity:
'found' % 'found' %
{'desc' : photo_desc, {'desc' : photo_desc,
'name' : photo_name}) 'name' : photo_name})
mmd = MissingMediaDialog( mmd = MissingMediaDialog( # parent-OK
_("Media object could not be found"), _("Media object could not be found"),
_("The file:\n%(file_name)s\nis referenced in " _("The file:\n%(file_name)s\nis referenced in "
"the database, but no longer exists.\n" "the database, but no longer exists.\n"
@ -2107,7 +2107,7 @@ class CheckIntegrity:
if errors == 0: if errors == 0:
if uistate: if uistate:
OkDialog(_("No errors were found"), OkDialog(_("No errors were found"), # parent-OK
_('The database has passed internal checks'), _('The database has passed internal checks'),
parent=uistate.window) parent=uistate.window)
else: else:

View File

@ -64,7 +64,7 @@ class DateParserDisplayTest(tool.Tool):
if uistate: if uistate:
# Running with gui -> Show message # Running with gui -> Show message
self.parent_window = uistate.window self.parent_window = uistate.window
QuestionDialog(_("Start date test?"), QuestionDialog(_("Start date test?"), # parent-OK
_("This test will create many persons and events " \ _("This test will create many persons and events " \
"in the current database. Do you really want to " \ "in the current database. Do you really want to " \
"run this test?"), "run this test?"),

View File

@ -191,7 +191,8 @@ class EventComparison(tool.Tool,ManagedWindow):
self.options.handler.save_options() self.options.handler.save_options()
if len(plist) == 0: if len(plist) == 0:
WarningDialog(_("No matches were found"), parent=self.window) WarningDialog(_("No matches were found"), # parent-OK
parent=self.window)
else: else:
DisplayChart(self.dbstate,self.uistate,plist,self.track) DisplayChart(self.dbstate,self.uistate,plist,self.track)

View File

@ -163,7 +163,7 @@ class Merge(tool.Tool,ManagedWindow):
try: try:
self.find_potentials(threshold) self.find_potentials(threshold)
except AttributeError as msg: except AttributeError as msg:
RunDatabaseRepair(str(msg), parent=self.window) RunDatabaseRepair(str(msg), parent=self.window) # parent-OK
return return
self.options.handler.options_dict['threshold'] = threshold self.options.handler.options_dict['threshold'] = threshold
@ -172,7 +172,7 @@ class Merge(tool.Tool,ManagedWindow):
self.options.handler.save_options() self.options.handler.save_options()
if len(self.map) == 0: if len(self.map) == 0:
OkDialog( OkDialog( # parent-OK
_("No matches found"), _("No matches found"),
_("No potential duplicate people were found"), _("No potential duplicate people were found"),
parent=self.window) parent=self.window)

View File

@ -229,7 +229,7 @@ class MergeCitations(tool.BatchTool,ManagedWindow):
db.enable_signals() db.enable_signals()
db.request_rebuild() db.request_rebuild()
self.progress.close() self.progress.close()
OkDialog(_("Number of merges done"), OkDialog(_("Number of merges done"), # parent-OK
# translators: leave all/any {...} untranslated # translators: leave all/any {...} untranslated
ngettext("{number_of} citation merged", ngettext("{number_of} citation merged",
"{number_of} citations merged", num_merges "{number_of} citations merged", num_merges

View File

@ -360,7 +360,7 @@ class PatchNames(tool.BatchTool, ManagedWindow):
else: else:
self.progress.close() self.progress.close()
self.close() self.close()
OkDialog(_('No modifications made'), OkDialog(_('No modifications made'), # parent-OK
_("No titles, nicknames or prefixes were found"), _("No titles, nicknames or prefixes were found"),
parent=self.uistate.window) parent=self.uistate.window)

View File

@ -67,7 +67,7 @@ class PopulateSources(tool.Tool, ManagedWindow):
if response == Gtk.ResponseType.ACCEPT: if response == Gtk.ResponseType.ACCEPT:
self.on_ok_clicked() self.on_ok_clicked()
OkDialog('Data generated', OkDialog('Data generated', # no-parent
"The requested sources and citations were generated") "The requested sources and citations were generated")
self.close() self.close()

View File

@ -83,7 +83,7 @@ class Rebuild(tool.Tool, UpdateCallback):
uistate.set_busy_cursor(False) uistate.set_busy_cursor(False)
uistate.progress.hide() uistate.progress.hide()
OkDialog(_("Secondary indexes rebuilt"), OkDialog(_("Secondary indexes rebuilt"), # parent-OK
_('All secondary indexes have been rebuilt.'), _('All secondary indexes have been rebuilt.'),
parent=uistate.window) parent=uistate.window)
else: else:

View File

@ -92,7 +92,7 @@ class RebuildGenderStat(tool.Tool, UpdateCallback):
if uistate: if uistate:
uistate.set_busy_cursor(False) uistate.set_busy_cursor(False)
uistate.progress.hide() uistate.progress.hide()
OkDialog(_("Gender statistics rebuilt"), OkDialog(_("Gender statistics rebuilt"), # parent-OK
_('Gender statistics for name gender guessing have been rebuilt.'), _('Gender statistics for name gender guessing have been rebuilt.'),
parent=uistate.window) parent=uistate.window)
else: else:

View File

@ -88,7 +88,7 @@ class RebuildRefMap(tool.Tool, UpdateCallback):
if uistate: if uistate:
uistate.set_busy_cursor(False) uistate.set_busy_cursor(False)
uistate.progress.hide() uistate.progress.hide()
OkDialog(_("Reference maps rebuilt"), OkDialog(_("Reference maps rebuilt"), # parent-OK
_('All reference maps have been rebuilt.'), _('All reference maps have been rebuilt.'),
parent=uistate.window) parent=uistate.window)
else: else:

View File

@ -146,7 +146,7 @@ class RelCalc(tool.Tool, ManagedWindow):
if not self.person: if not self.person:
self.window.hide() self.window.hide()
ErrorDialog(_('Active person has not been set'), ErrorDialog(_('Active person has not been set'), # no-parent
_('You must select an active person for this ' _('You must select an active person for this '
'tool to work properly.')) 'tool to work properly.'))
self.close() self.close()

View File

@ -313,7 +313,7 @@ class CitationListView(ListView):
"merge. A second citation can be selected by holding " "merge. A second citation can be selected by holding "
"down the control key while clicking on the desired " "down the control key while clicking on the desired "
"citation.") "citation.")
ErrorDialog(msg, msg2, parent=self.uistate.window) ErrorDialog(msg, msg2, parent=self.uistate.window) # parent-OK
else: else:
citation1 = self.dbstate.db.get_citation_from_handle(mlist[0]) citation1 = self.dbstate.db.get_citation_from_handle(mlist[0])
citation2 = self.dbstate.db.get_citation_from_handle(mlist[1]) citation2 = self.dbstate.db.get_citation_from_handle(mlist[1])
@ -324,7 +324,7 @@ class CitationListView(ListView):
"source to perform a merge. If you want to merge " "source to perform a merge. If you want to merge "
"these two citations, then you must merge the " "these two citations, then you must merge the "
"sources first.") "sources first.")
ErrorDialog(msg, msg2, parent=self.uistate.window) ErrorDialog(msg, msg2, parent=self.uistate.window) # parent-OK
else: else:
MergeCitation(self.dbstate, self.uistate, mlist[0], mlist[1]) MergeCitation(self.dbstate, self.uistate, mlist[0], mlist[1])

View File

@ -427,7 +427,7 @@ class CitationTreeView(ListView):
Citation(), source) Citation(), source)
except WindowActiveError: except WindowActiveError:
from gramps.gui.dialog import WarningDialog from gramps.gui.dialog import WarningDialog
WarningDialog(_("Cannot share this reference"), WarningDialog(_("Cannot share this reference"), # parent-OK
self.__blocked_text(), self.__blocked_text(),
parent=self.uistate.window) parent=self.uistate.window)
# #
@ -478,7 +478,7 @@ class CitationTreeView(ListView):
EditSource(self.dbstate, self.uistate, [], source) EditSource(self.dbstate, self.uistate, [], source)
except WindowActiveError: except WindowActiveError:
from gramps.gui.dialog import WarningDialog from gramps.gui.dialog import WarningDialog
WarningDialog(_("Cannot share this reference"), WarningDialog(_("Cannot share this reference"), # parent-OK
self.__blocked_text2(), self.__blocked_text2(),
parent=self.uistate.window) parent=self.uistate.window)
@ -514,7 +514,7 @@ class CitationTreeView(ListView):
"merge. A second citation can be selected by holding " "merge. A second citation can be selected by holding "
"down the control key while clicking on the desired " "down the control key while clicking on the desired "
"citation.") "citation.")
ErrorDialog(msg, msg2, parent=self.uistate.window) ErrorDialog(msg, msg2, parent=self.uistate.window) # parent-OK
else: else:
source1 = self.dbstate.db.get_source_from_handle(mlist[0]) source1 = self.dbstate.db.get_source_from_handle(mlist[0])
citation1 = self.dbstate.db.get_citation_from_handle(mlist[0]) citation1 = self.dbstate.db.get_citation_from_handle(mlist[0])
@ -534,7 +534,8 @@ class CitationTreeView(ListView):
"source to perform a merge. If you want to merge " "source to perform a merge. If you want to merge "
"these two citations, then you must merge the " "these two citations, then you must merge the "
"sources first.") "sources first.")
ErrorDialog(msg, msg2, parent=self.uistate.window) ErrorDialog(msg, msg2, # parent-OK
parent=self.uistate.window)
else: else:
MergeCitation(self.dbstate, self.uistate, mlist[0], MergeCitation(self.dbstate, self.uistate, mlist[0],
mlist[1]) mlist[1])
@ -545,7 +546,7 @@ class CitationTreeView(ListView):
msg2 = _("Both objects must be of the same type, either " msg2 = _("Both objects must be of the same type, either "
"both must be sources, or both must be " "both must be sources, or both must be "
"citations.") "citations.")
ErrorDialog(msg, msg2, parent=self.uistate.window) ErrorDialog(msg, msg2, parent=self.uistate.window) # parent-OK
def get_handle_from_gramps_id(self, gid): def get_handle_from_gramps_id(self, gid):
obj = self.dbstate.db.get_citation_from_gramps_id(gid) obj = self.dbstate.db.get_citation_from_gramps_id(gid)

View File

@ -264,7 +264,7 @@ class EventView(ListView):
msg2 = _("Exactly two events must be selected to perform a merge. " msg2 = _("Exactly two events must be selected to perform a merge. "
"A second object can be selected by holding down the " "A second object can be selected by holding down the "
"control key while clicking on the desired event.") "control key while clicking on the desired event.")
ErrorDialog(msg, msg2, parent=self.uistate.window) ErrorDialog(msg, msg2, parent=self.uistate.window) # parent-OK
else: else:
MergeEvent(self.dbstate, self.uistate, mlist[0], mlist[1]) MergeEvent(self.dbstate, self.uistate, mlist[0], mlist[1])

View File

@ -216,7 +216,7 @@ class FamilyView(ListView):
self.bookmarks.add(mlist[0]) self.bookmarks.add(mlist[0])
else: else:
from gramps.gui.dialog import WarningDialog from gramps.gui.dialog import WarningDialog
WarningDialog( WarningDialog( # parent-OK
_("Could Not Set a Bookmark"), _("Could Not Set a Bookmark"),
_("A bookmark could not be set because " _("A bookmark could not be set because "
"no one was selected."), parent=self.uistate.window) "no one was selected."), parent=self.uistate.window)
@ -240,13 +240,13 @@ class FamilyView(ListView):
msg1 = self._message1_format(family) msg1 = self._message1_format(family)
msg2 = self._message2_format(family) msg2 = self._message2_format(family)
msg2 = "%s %s" % (msg2, data_recover_msg) msg2 = "%s %s" % (msg2, data_recover_msg)
QuestionDialog(msg1, QuestionDialog(msg1, # parent-OK
msg2, msg2,
_('_Delete Family'), _('_Delete Family'),
lambda: self.delete_family_response(family), lambda: self.delete_family_response(family),
parent=self.uistate.window) parent=self.uistate.window)
else: else:
MultiSelectDialog(self._message1_format, MultiSelectDialog(self._message1_format, # parent-OK
self._message2_format, self._message2_format,
handles, handles,
self.dbstate.db.get_family_from_handle, self.dbstate.db.get_family_from_handle,
@ -306,7 +306,7 @@ class FamilyView(ListView):
msg2 = _("Exactly two families must be selected to perform a merge." msg2 = _("Exactly two families must be selected to perform a merge."
" A second family can be selected by holding down the " " A second family can be selected by holding down the "
"control key while clicking on the desired family.") "control key while clicking on the desired family.")
ErrorDialog(msg, msg2, parent=self.uistate.window) ErrorDialog(msg, msg2, parent=self.uistate.window) # parent-OK
else: else:
MergeFamily(self.dbstate, self.uistate, mlist[0], mlist[1]) MergeFamily(self.dbstate, self.uistate, mlist[0], mlist[1])

View File

@ -72,7 +72,8 @@ if not OSMGPSMAP:
MESSAGE = _("Geography functionality will not be available.\n" MESSAGE = _("Geography functionality will not be available.\n"
"To build it for Gramps see " "To build it for Gramps see "
"%(gramps_wiki_build_osmgps_url)s") % OSMGPS_DICT "%(gramps_wiki_build_osmgps_url)s") % OSMGPS_DICT
MessageHideDialog(TITLE, MESSAGE, 'interface.ignore-osmgpsmap') MessageHideDialog(TITLE, MESSAGE, # no-parent
'interface.ignore-osmgpsmap')
else: else:
# Load the view only if osmgpsmap library is present. # Load the view only if osmgpsmap library is present.
register(VIEW, register(VIEW,

View File

@ -350,7 +350,7 @@ class MediaView(ListView):
msg2 = _("Exactly two media objects must be selected to perform a " msg2 = _("Exactly two media objects must be selected to perform a "
"merge. A second object can be selected by holding down the " "merge. A second object can be selected by holding down the "
"control key while clicking on the desired object.") "control key while clicking on the desired object.")
ErrorDialog(msg, msg2, parent=self.uistate.window) ErrorDialog(msg, msg2, parent=self.uistate.window) # parent-OK
else: else:
MergeMedia(self.dbstate, self.uistate, mlist[0], mlist[1]) MergeMedia(self.dbstate, self.uistate, mlist[0], mlist[1])

View File

@ -242,7 +242,7 @@ class NoteView(ListView):
msg2 = _("Exactly two notes must be selected to perform a merge. " msg2 = _("Exactly two notes must be selected to perform a merge. "
"A second note can be selected by holding down the " "A second note can be selected by holding down the "
"control key while clicking on the desired note.") "control key while clicking on the desired note.")
ErrorDialog(msg, msg2, parent=self.uistate.window) ErrorDialog(msg, msg2, parent=self.uistate.window) # parent-OK
else: else:
MergeNote(self.dbstate, self.uistate, mlist[0], mlist[1]) MergeNote(self.dbstate, self.uistate, mlist[0], mlist[1])

View File

@ -689,7 +689,7 @@ class PedigreeView(NavigationView):
else: else:
self.rebuild_trees(None) self.rebuild_trees(None)
except AttributeError as msg: except AttributeError as msg:
RunDatabaseRepair(str(msg)) RunDatabaseRepair(str(msg)) # no-parent
def _connect_db_signals(self): def _connect_db_signals(self):
""" """
@ -1496,7 +1496,7 @@ class PedigreeView(NavigationView):
try: try:
alive = probably_alive(person, self.dbstate.db) alive = probably_alive(person, self.dbstate.db)
except RuntimeError: except RuntimeError:
ErrorDialog(_('Relationship loop detected'), ErrorDialog(_('Relationship loop detected'), # no-parent
_('A person was found to be his/her own ancestor.')) _('A person was found to be his/her own ancestor.'))
alive = False alive = False
lst[index] = [person, val, None, alive, None] lst[index] = [person, val, None, alive, None]

View File

@ -473,7 +473,7 @@ class RelationshipView(NavigationView):
exc = traceback.format_exc() exc = traceback.format_exc()
_LOG.error(str(msg) +"\n" + exc) _LOG.error(str(msg) +"\n" + exc)
from gramps.gui.dialog import RunDatabaseRepair from gramps.gui.dialog import RunDatabaseRepair
RunDatabaseRepair(str(msg)) RunDatabaseRepair(str(msg)) # no-parent
self.redrawing = False self.redrawing = False
return True return True
@ -1350,7 +1350,7 @@ class RelationshipView(NavigationView):
family = self.dbstate.db.get_family_from_handle(family_handle) family = self.dbstate.db.get_family_from_handle(family_handle)
if family is None: if family is None:
from gramps.gui.dialog import WarningDialog from gramps.gui.dialog import WarningDialog
WarningDialog( WarningDialog( # no-parent
_('Broken family detected'), _('Broken family detected'),
_('Please run the Check and Repair Database tool')) _('Please run the Check and Repair Database tool'))
return return

View File

@ -247,7 +247,7 @@ class RepositoryView(ListView):
"merge. A second repository can be selected by holding " "merge. A second repository can be selected by holding "
"down the control key while clicking on the desired " "down the control key while clicking on the desired "
"repository.") "repository.")
ErrorDialog(msg, msg2, parent=self.uistate.window) ErrorDialog(msg, msg2, parent=self.uistate.window) # parent-OK
else: else:
MergeRepository(self.dbstate, self.uistate, mlist[0], mlist[1]) MergeRepository(self.dbstate, self.uistate, mlist[0], mlist[1])

View File

@ -230,7 +230,7 @@ class SourceView(ListView):
msg2 = _("Exactly two sources must be selected to perform a merge. " msg2 = _("Exactly two sources must be selected to perform a merge. "
"A second source can be selected by holding down the " "A second source can be selected by holding down the "
"control key while clicking on the desired source.") "control key while clicking on the desired source.")
ErrorDialog(msg, msg2, parent=self.uistate.window) ErrorDialog(msg, msg2, parent=self.uistate.window) # parent-OK
else: else:
MergeSource(self.dbstate, self.uistate, mlist[0], mlist[1]) MergeSource(self.dbstate, self.uistate, mlist[0], mlist[1])