setting dialogs parent

This commit is contained in:
Josip 2015-06-10 02:22:21 +02:00
parent 891b9d2e34
commit fedfabc87e
34 changed files with 115 additions and 77 deletions

View File

@ -147,7 +147,7 @@ class AddMediaObject(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) ErrorDialog(msgstr, msgstr2, parent=self.window)
return return
filename = conv_to_unicode(self.file_text.get_filename()) filename = conv_to_unicode(self.file_text.get_filename())
@ -158,7 +158,7 @@ class AddMediaObject(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=self.window)
return return
filename = relative_path(filename, pname) filename = relative_path(filename, pname)

View File

@ -137,7 +137,8 @@ class EditAttributeRoot(EditSecondary):
from ..dialog import ErrorDialog from ..dialog import ErrorDialog
ErrorDialog( ErrorDialog(
_("Cannot save attribute"), _("Cannot save attribute"),
_("The attribute type cannot be empty")) _("The attribute type cannot be empty"),
parent=self.window)
return return
if self.callback: if self.callback:
self.callback(self.obj) self.callback(self.obj)

View File

@ -280,7 +280,8 @@ class EditCitation(EditPrimary):
"derived. To create a citation, first select the " "derived. To create a citation, first select the "
"required source, and then record the location of " "required source, and then record the location of "
"the information referenced within the source in the " "the information referenced within the source in the "
"'Volume/Page' field.")) "'Volume/Page' field."),
parent=self.window)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
@ -294,7 +295,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) ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

View File

@ -236,7 +236,8 @@ class EditEvent(EditPrimary):
if self.object_is_empty(): if self.object_is_empty():
ErrorDialog(_("Cannot save event"), ErrorDialog(_("Cannot save event"),
_("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)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
@ -250,7 +251,7 @@ 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) ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
@ -258,7 +259,7 @@ class EditEvent(EditPrimary):
if t.is_custom() and str(t) == '': if t.is_custom() and str(t) == '':
ErrorDialog( ErrorDialog(
_("Cannot save event"), _("Cannot save event"),
_("The event type cannot be empty")) _("The event type cannot be empty"), parent=self.window)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

View File

@ -362,7 +362,8 @@ class EditFamily(EditPrimary):
"are available when you create a new family. The " "are available when you create a new family. The "
"remaining fields will become available after you " "remaining fields will become available after you "
"attempt to select a parent."), "attempt to select a parent."),
'preferences.family-warn') 'preferences.family-warn',
parent=self.window)
else: else:
self.add_parent = False self.add_parent = False
@ -1049,8 +1050,9 @@ class EditFamily(EditPrimary):
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"),
_("%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)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
elif self.obj.get_mother_handle() in child_list: elif self.obj.get_mother_handle() in child_list:
@ -1059,8 +1061,9 @@ class EditFamily(EditPrimary):
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"),
_("%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)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
@ -1068,7 +1071,8 @@ class EditFamily(EditPrimary):
ErrorDialog( ErrorDialog(
_("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."),
parent=self.window)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
@ -1080,7 +1084,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) ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

View File

@ -290,7 +290,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) ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
@ -304,7 +304,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) ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

View File

@ -382,7 +382,8 @@ class EditName(EditSecondary):
) % { 'surname' : surname, ) % { 'surname' : surname,
'group_name':group_as}, 'group_name':group_as},
_("Continue"), _("Continue"),
_("Return to Name Editor")) _("Return to Name Editor"),
parent=self.window)
val = q.run() val = q.run()
if val: if val:
#delete the grouping link on database #delete the grouping link on database
@ -414,7 +415,8 @@ class EditName(EditSecondary):
) % { 'surname' : surname, ) % { 'surname' : surname,
'group_name':group_as}, 'group_name':group_as},
_("Group all"), _("Group all"),
_("Group this name only")) _("Group this name only"),
parent=self.window)
val = q.run() val = q.run()
if val: if val:
if group_as == surname : if group_as == surname :

View File

@ -301,7 +301,8 @@ class EditNote(EditPrimary):
if self.object_is_empty(): if self.object_is_empty():
ErrorDialog(_("Cannot save note"), ErrorDialog(_("Cannot save note"),
_("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)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
@ -313,7 +314,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) ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

View File

@ -811,7 +811,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) ErrorDialog(msg2, msg, parent=self.window)
def save(self, *obj): def save(self, *obj):
""" """
@ -821,7 +821,8 @@ class EditPerson(EditPrimary):
if self.object_is_empty(): if self.object_is_empty():
ErrorDialog(_("Cannot save person"), ErrorDialog(_("Cannot save person"),
_("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)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
# fix surname problems # fix surname problems
@ -849,7 +850,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) ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

View File

@ -229,4 +229,5 @@ class EditPersonRef(EditSecondary):
ErrorDialog( ErrorDialog(
_('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'),
parent=self.window)

View File

@ -272,7 +272,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) ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
@ -286,7 +286,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) ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

View File

@ -87,7 +87,8 @@ 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"),
_("The place name cannot be empty")) _("The place name cannot be empty"),
parent=self.window)
return return
if self.callback: if self.callback:

View File

@ -274,7 +274,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) ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

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) ErrorDialog(msg1, msg2, parent=self.window)
return True return True
return False return False

View File

@ -167,7 +167,8 @@ class EditRepository(EditPrimary):
if self.object_is_empty(): if self.object_is_empty():
ErrorDialog(_("Cannot save repository"), ErrorDialog(_("Cannot save repository"),
_("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)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
@ -181,7 +182,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) ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

View File

@ -187,7 +187,8 @@ class EditSource(EditPrimary):
if self.object_is_empty(): if self.object_is_empty():
ErrorDialog(_("Cannot save source"), ErrorDialog(_("Cannot save source"),
_("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)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
@ -201,7 +202,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) ErrorDialog(msg1, msg2, parent=self.window)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return

View File

@ -136,7 +136,8 @@ class StyleListDisplay(object):
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), parent=self.window)
except: except:
log.error("Failed to save stylesheet", exc_info=True) log.error("Failed to save stylesheet", exc_info=True)

View File

@ -663,7 +663,7 @@ class ViewManager(CLIManager):
""" """
Initialize the interface. Initialize the interface.
""" """
self.views = get_available_views() self.views = get_available_views(self.uistate)
defaults = views_to_show(self.views, defaults = views_to_show(self.views,
config.get('preferences.use-last-view')) config.get('preferences.use-last-view'))
self.current_views = defaults[2] self.current_views = defaults[2]
@ -764,7 +764,7 @@ class ViewManager(CLIManager):
try: try:
backup(self.dbstate.db) backup(self.dbstate.db)
except DbException as msg: except DbException as msg:
ErrorDialog(_("Error saving backup data"), msg) ErrorDialog(_("Error saving backup data"), msg, parent=self.uistate.window)
self.uistate.set_busy_cursor(False) self.uistate.set_busy_cursor(False)
self.uistate.progress.hide() self.uistate.progress.hide()
@ -779,7 +779,8 @@ class ViewManager(CLIManager):
_("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."),
_("Abort changes"), _("Abort changes"),
_("Cancel")) _("Cancel"),
parent=self.uistate.window)
if dialog.run(): if dialog.run():
self.dbstate.db.disable_signals() self.dbstate.db.disable_signals()
@ -791,7 +792,8 @@ class ViewManager(CLIManager):
_("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 '
'limit.')) 'limit.'),
parent=self.uistate.window)
def __init_action_group(self, name, actions, sensitive=True, toggles=None): def __init_action_group(self, name, actions, sensitive=True, toggles=None):
""" """
@ -1608,7 +1610,8 @@ def run_plugin(pdata, dbstate, uistate):
'gramps_bugtracker_url' : URL_BUGHOME, 'gramps_bugtracker_url' : URL_BUGHOME,
'firstauthoremail': pdata.authors_email[0] if 'firstauthoremail': pdata.authors_email[0] if
pdata.authors_email else '...', pdata.authors_email else '...',
'error_msg': pmgr.get_fail_list()[-1][1][1]}) 'error_msg': pmgr.get_fail_list()[-1][1][1]},
parent=uistate.window)
return return
if pdata.ptype == REPORT: if pdata.ptype == REPORT:
@ -1633,7 +1636,7 @@ def make_plugin_callback(pdata, dbstate, uistate):
""" """
return lambda x: run_plugin(pdata, dbstate, uistate) return lambda x: run_plugin(pdata, dbstate, uistate)
def get_available_views(): def get_available_views(uistate):
""" """
Query the views and determine what views to show and in which order Query the views and determine what views to show and in which order
@ -1664,7 +1667,8 @@ def get_available_views():
'gramps_bugtracker_url' : URL_BUGHOME, 'gramps_bugtracker_url' : URL_BUGHOME,
'firstauthoremail': pdata.authors_email[0] if 'firstauthoremail': pdata.authors_email[0] if
pdata.authors_email else '...', pdata.authors_email else '...',
'error_msg': lasterror}) 'error_msg': lasterror},
parent=uistate.window)
continue continue
viewclass = getattr(mod, pdata.viewclass) viewclass = getattr(mod, pdata.viewclass)

View File

@ -409,7 +409,8 @@ class CitationBookmarks(ListBookmarks) :
"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 "
"can be bookmarked. To bookmark a Source, switch to " "can be bookmarked. To bookmark a Source, switch to "
"the Source View") "the Source View",
parent=self.uistate.window)
def connect_signals(self): def connect_signals(self):
self.dbstate.db.connect('citation-delete', self.remove_handles) self.dbstate.db.connect('citation-delete', self.remove_handles)

View File

@ -447,7 +447,8 @@ class ListView(NavigationView):
WarningDialog( WarningDialog(
_("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."),
parent=self.uistate.window)
#################################################################### ####################################################################
# #
@ -541,7 +542,8 @@ class ListView(NavigationView):
_("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:"),
_("Delete All"), _("Delete All"),
_("Confirm Each Delete")) _("Confirm Each Delete"),
parent=self.uistate.window)
prompt = not q.run() prompt = not q.run()
if not prompt: if not prompt:
@ -563,7 +565,8 @@ class ListView(NavigationView):
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,
_('_Delete Item'), query.query_response) _('_Delete Item'), query.query_response,
parent=self.uistate.window)
self.uistate.set_busy_cursor(False) self.uistate.set_busy_cursor(False)
else: else:
query.query_response() query.query_response()

View File

@ -254,7 +254,8 @@ class NavigationView(PageView):
WarningDialog( WarningDialog(
_("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."),
parent=self.uistate.window)
def edit_bookmarks(self, obj): def edit_bookmarks(self, obj):
""" """
@ -343,7 +344,7 @@ class NavigationView(PageView):
""" """
A dialog to move to a Gramps ID entered by the user. A dialog to move to a Gramps ID entered by the user.
""" """
dialog = Gtk.Dialog(_('Jump to by Gramps ID')) dialog = Gtk.Dialog(_('Jump to by Gramps ID'), parent=self.uistate.window)
dialog.set_border_width(12) dialog.set_border_width(12)
label = Gtk.Label(label='<span weight="bold" size="larger">%s</span>' % label = Gtk.Label(label='<span weight="bold" size="larger">%s</span>' %
_('Jump to by Gramps ID')) _('Jump to by Gramps ID'))

View File

@ -485,7 +485,9 @@ class OrganizeTagsDialog(object):
_("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."),
_("Yes"), _("Yes"),
_("No")) _("No"),
parent=top)
prompt = yes_no.run() prompt = yes_no.run()
if prompt: if prompt:
@ -571,7 +573,8 @@ class EditTag(object):
if not self.tag.get_name(): if not self.tag.get_name():
ErrorDialog( ErrorDialog(
_("Cannot save tag"), _("Cannot save tag"),
_("The tag name cannot be empty")) _("The tag name cannot be empty"),
parent=self.top)
return return
if not self.tag.get_handle(): if not self.tag.get_handle():

View File

@ -296,7 +296,8 @@ class BasePersonView(ListView):
QuestionDialog(msg1, QuestionDialog(msg1,
msg2, msg2,
_('_Delete Person'), _('_Delete Person'),
self.delete_person_response) self.delete_person_response,
parent=self.uistate.window)
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
@ -304,7 +305,8 @@ class BasePersonView(ListView):
self._message2_format, self._message2_format,
handles, handles,
self._lookup_person, self._lookup_person,
yes_func=self.delete_person_response) # Yes yes_func=self.delete_person_response,
parent=self.uistate.window) # Yes
def _message1_format(self, person): def _message1_format(self, person):
return _('Delete %s?') % (name_displayer.display(person) + return _('Delete %s?') % (name_displayer.display(person) +
@ -417,7 +419,8 @@ class BasePersonView(ListView):
_("Cannot merge people"), _("Cannot merge people"),
_("Exactly two people must be selected to perform a merge. " _("Exactly two people must be selected to perform a merge. "
"A second person can be selected by holding down the " "A second person can be selected by holding down the "
"control key while clicking on the desired person.")) "control key while clicking on the desired person."),
parent=self.uistate.window)
else: else:
MergePerson(self.dbstate, self.uistate, mlist[0], mlist[1]) MergePerson(self.dbstate, self.uistate, mlist[0], mlist[1])

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) ErrorDialog(msg, msg2, parent=self.uistate.window)
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) ErrorDialog(msg, msg2, parent=self.uistate.window)
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) ErrorDialog(msg, msg2, parent=self.uistate.window)
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) ErrorDialog(msg, msg2, parent=self.uistate.window)
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) ErrorDialog(msg, msg2, parent=self.uistate.window)
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

@ -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) ErrorDialog(msg, msg2, parent=self.uistate.window)
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) ErrorDialog(msg, msg2, parent=self.uistate.window)
else: else:
MergeCitation(self.dbstate, self.uistate, mlist[0], mlist[1]) MergeCitation(self.dbstate, self.uistate, mlist[0], mlist[1])

View File

@ -427,12 +427,13 @@ class CitationTreeView(ListView):
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"),
self.__blocked_text()) self.__blocked_text(),
parent=self.uistate.window)
else: else:
msg = _("Cannot add citation.") msg = _("Cannot add citation.")
msg2 = _("In order to add a citation to an existing source, " msg2 = _("In order to add a citation to an existing source, "
" you must select a source.") " you must select a source.")
ErrorDialog(msg, msg2) ErrorDialog(msg, msg2, parent=self.uistate.window)
# #
def remove(self, obj): def remove(self, obj):
self.remove_selected_objects() self.remove_selected_objects()
@ -482,7 +483,8 @@ class CitationTreeView(ListView):
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"),
self.__blocked_text2()) self.__blocked_text2(),
parent=self.uistate.window)
def __blocked_text(self): def __blocked_text(self):
""" """
@ -516,7 +518,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) ErrorDialog(msg, msg2, parent=self.uistate.window)
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])
@ -536,7 +538,7 @@ 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) ErrorDialog(msg, msg2, parent=self.uistate.window)
else: else:
MergeCitation(self.dbstate, self.uistate, mlist[0], MergeCitation(self.dbstate, self.uistate, mlist[0],
mlist[1]) mlist[1])
@ -547,7 +549,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) ErrorDialog(msg, msg2, parent=self.uistate.window)
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) ErrorDialog(msg, msg2, parent=self.uistate.window)
else: else:
MergeEvent(self.dbstate, self.uistate, mlist[0], mlist[1]) MergeEvent(self.dbstate, self.uistate, mlist[0], mlist[1])

View File

@ -219,7 +219,8 @@ class FamilyView(ListView):
WarningDialog( WarningDialog(
_("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."),
parent=self.uistate.window)
def add(self, obj): def add(self, obj):
family = Family() family = Family()
@ -243,13 +244,15 @@ class FamilyView(ListView):
QuestionDialog(msg1, QuestionDialog(msg1,
msg2, msg2,
_('_Delete Family'), _('_Delete Family'),
lambda: self.delete_family_response(family)) lambda: self.delete_family_response(family),
parent=self.uistate.window)
else: else:
MultiSelectDialog(self._message1_format, MultiSelectDialog(self._message1_format,
self._message2_format, self._message2_format,
handles, handles,
self.dbstate.db.get_family_from_handle, self.dbstate.db.get_family_from_handle,
yes_func=self.delete_family_response) yes_func=self.delete_family_response,
parent=self.uistate.window)
def _message1_format(self, family): def _message1_format(self, family):
""" """
@ -298,7 +301,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) ErrorDialog(msg, msg2, parent=self.uistate.window)
else: else:
MergeFamily(self.dbstate, self.uistate, mlist[0], mlist[1]) MergeFamily(self.dbstate, self.uistate, mlist[0], mlist[1])

View File

@ -351,7 +351,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) ErrorDialog(msg, msg2, parent=self.uistate.window)
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) ErrorDialog(msg, msg2, parent=self.uistate.window)
else: else:
MergeNote(self.dbstate, self.uistate, mlist[0], mlist[1]) MergeNote(self.dbstate, self.uistate, mlist[0], mlist[1])

View File

@ -1494,7 +1494,8 @@ class PedigreeView(NavigationView):
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'),
_('A person was found to be his/her own ancestor.')) _('A person was found to be his/her own ancestor.'),
parent=self.uistate.window)
alive = False alive = False
lst[index] = [person, val, None, alive, None] lst[index] = [person, val, None, alive, None]

View File

@ -1350,7 +1350,8 @@ class RelationshipView(NavigationView):
from gramps.gui.dialog import WarningDialog from gramps.gui.dialog import WarningDialog
WarningDialog( WarningDialog(
_('Broken family detected'), _('Broken family detected'),
_('Please run the Check and Repair Database tool')) _('Please run the Check and Repair Database tool'),
parent=self.uistate.window)
return return
father_handle = family.get_father_handle() father_handle = family.get_father_handle()

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) ErrorDialog(msg, msg2, parent=self.uistate.window)
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) ErrorDialog(msg, msg2, parent=self.uistate.window)
else: else:
MergeSource(self.dbstate, self.uistate, mlist[0], mlist[1]) MergeSource(self.dbstate, self.uistate, mlist[0], mlist[1])