8128: GtkDialog mapped without a transient parent
This commit is contained in:
parent
675ae1a8d4
commit
f9dbfd9dbd
@ -222,7 +222,7 @@ class User(user.User):
|
||||
) % {'gramps_bugtracker_url' : URL_BUGHOME}
|
||||
+ error + '\n\n')
|
||||
|
||||
def info(self, msg1, infotext, parent=None, monospaced=False):
|
||||
def info(self, msg1, infotext, parent=None, monospaced=False): # parent-OK
|
||||
"""
|
||||
Displays information to the CLI
|
||||
"""
|
||||
|
@ -27,4 +27,4 @@ gen data specific for output (eg markup in gen/lib) and output where needed
|
||||
from .docbackend import DocBackendError, DocBackend
|
||||
from .cairobackend import CairoBackend
|
||||
|
||||
#__all__ = [ DocBackend, CairoBackend, LateXBackend ]
|
||||
#__all__ = [ DocBackend, CairoBackend, LaTeXBackend ]
|
||||
|
@ -183,7 +183,7 @@ class User(metaclass=ABCMeta):
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def info(self, msg1, infotext, parent=None, monospaced=False):
|
||||
def info(self, msg1, infotext, parent=None, monospaced=False): # parent-OK
|
||||
"""
|
||||
Displays information to the user
|
||||
"""
|
||||
|
@ -167,7 +167,10 @@ class AddMedia(ManagedWindow):
|
||||
pname = str(media_path(self.dbase))
|
||||
if not os.path.exists(pname):
|
||||
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, # parent-OK
|
||||
parent=self.window)
|
||||
return
|
||||
|
@ -24,8 +24,6 @@
|
||||
# Python classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -40,6 +38,8 @@ from gi.repository import Gdk
|
||||
# Gramps classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from ...widgets import SimpleButton
|
||||
from .grampstab import GrampsTab
|
||||
from gramps.gen.errors import WindowActiveError
|
||||
|
@ -24,8 +24,6 @@
|
||||
# Python classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
import logging
|
||||
LOG = logging.getLogger(".citation")
|
||||
|
||||
@ -41,6 +39,8 @@ from gi.repository import GObject, GLib
|
||||
# Gramps classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.errors import WindowActiveError
|
||||
from gramps.gen.lib import Citation, Source
|
||||
from ...dbguielement import DbGUIElement
|
||||
@ -168,8 +168,9 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
|
||||
callertitle=self.callertitle)
|
||||
except WindowActiveError:
|
||||
from ...dialog import WarningDialog
|
||||
WarningDialog(_("Cannot share this reference"), # no-parent
|
||||
self.__blocked_text())
|
||||
WarningDialog(_("Cannot share this reference"), # parent-OK
|
||||
self.__blocked_text(),
|
||||
parent=self.uistate.window)
|
||||
elif isinstance(object, Citation):
|
||||
try:
|
||||
from .. import EditCitation
|
||||
@ -178,8 +179,9 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
|
||||
callertitle=self.callertitle)
|
||||
except WindowActiveError:
|
||||
from ...dialog import WarningDialog
|
||||
WarningDialog(_("Cannot share this reference"), # no-parent
|
||||
self.__blocked_text())
|
||||
WarningDialog(_("Cannot share this reference"), # parent-OK
|
||||
self.__blocked_text(),
|
||||
parent=self.uistate.window)
|
||||
else:
|
||||
raise ValueError("selection must be either source or citation")
|
||||
|
||||
@ -251,8 +253,9 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
|
||||
callertitle=self.callertitle)
|
||||
except WindowActiveError:
|
||||
from ...dialog import WarningDialog
|
||||
WarningDialog(_("Cannot share this reference"), # no-parent
|
||||
self.__blocked_text())
|
||||
WarningDialog(_("Cannot share this reference"), # parent-OK
|
||||
self.__blocked_text(),
|
||||
parent=self.uistate.window)
|
||||
else:
|
||||
raise ValueError("selection must be either source or citation")
|
||||
|
||||
@ -271,7 +274,8 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
|
||||
callertitle=self.callertitle)
|
||||
except WindowActiveError:
|
||||
from ...dialog import WarningDialog
|
||||
WarningDialog(_("Cannot share this reference"), # no-parent
|
||||
self.__blocked_text())
|
||||
WarningDialog(_("Cannot share this reference"), # parent-OK
|
||||
self.__blocked_text(),
|
||||
parent=self.uistate.window)
|
||||
else:
|
||||
raise ValueError("selection must be either source or citation")
|
||||
|
@ -24,8 +24,6 @@
|
||||
# python
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
import pickle
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -44,6 +42,8 @@ from gi.repository import Pango
|
||||
# Gramps classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from ...utils import is_right_click
|
||||
from .buttontab import ButtonTab
|
||||
|
||||
@ -576,7 +576,7 @@ class EmbeddedList(ButtonTab):
|
||||
from ...dialog import RunDatabaseRepair
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
RunDatabaseRepair(str(msg)) # no-parent
|
||||
RunDatabaseRepair(str(msg), parent=self.uistate.window) # parent-OK
|
||||
return
|
||||
|
||||
self.tree.set_model(self.model)
|
||||
|
@ -24,8 +24,6 @@
|
||||
# Python classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import GObject
|
||||
from gi.repository import GLib
|
||||
@ -35,6 +33,8 @@ from gi.repository import GLib
|
||||
# Gramps classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.lib import Event, EventRef, EventRoleType, EventType
|
||||
from gramps.gen.errors import WindowActiveError
|
||||
from ...ddtargets import DdTargets
|
||||
@ -264,8 +264,9 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
||||
event, ref, self.object_added)
|
||||
except WindowActiveError:
|
||||
from ...dialog import WarningDialog
|
||||
WarningDialog(_("Cannot share this reference"), # no-parent
|
||||
self.__blocked_text())
|
||||
WarningDialog(_("Cannot share this reference"), # parent-OK
|
||||
self.__blocked_text(),
|
||||
parent=self.uistate.window)
|
||||
|
||||
def edit_button_clicked(self, obj):
|
||||
ref = self.get_selected()
|
||||
@ -277,8 +278,9 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
||||
event, ref[1], self.object_edited)
|
||||
except WindowActiveError:
|
||||
from ...dialog import WarningDialog
|
||||
WarningDialog(_("Cannot edit this reference"), # no-parent
|
||||
self.__blocked_text())
|
||||
WarningDialog(_("Cannot edit this reference"), # parent-OK
|
||||
self.__blocked_text(),
|
||||
parent=self.uistate.window)
|
||||
elif ref and ref[0] != self._WORKGROUP:
|
||||
#bring up family editor
|
||||
key = self._groups[ref[0]][0]
|
||||
@ -318,9 +320,10 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
||||
handle change request of non native data
|
||||
"""
|
||||
from ...dialog import WarningDialog
|
||||
WarningDialog(_("Cannot change Person"), # no-parent
|
||||
_("You cannot change Person events in the Family Editor")
|
||||
)
|
||||
WarningDialog( # parent-OK
|
||||
_("Cannot change Person"),
|
||||
_("You cannot change Person events in the Family Editor"),
|
||||
parent=self.uistate.window)
|
||||
|
||||
def _handle_drag(self, row, obj):
|
||||
"""
|
||||
@ -340,14 +343,14 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
|
||||
event, obj, self.object_edited)
|
||||
except WindowActiveError:
|
||||
from ...dialog import WarningDialog
|
||||
WarningDialog( # no-parent
|
||||
WarningDialog( # parent-OK
|
||||
_("Cannot edit this reference"),
|
||||
_("This event reference cannot be edited at this time. "
|
||||
"Either the associated event is already being edited "
|
||||
"or another event reference that is associated with "
|
||||
"the same event is being edited.\n\nTo edit this event "
|
||||
"reference, you need to close the event.")
|
||||
)
|
||||
"reference, you need to close the event."),
|
||||
parent=self.uistate.window)
|
||||
else:
|
||||
self.dropnotworkgroup(row, obj)
|
||||
|
||||
|
@ -61,6 +61,7 @@ from .buttontab import ButtonTab
|
||||
from gramps.gen.const import THUMBSCALE
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -259,8 +260,9 @@ class GalleryTab(ButtonTab, DbGUIElement):
|
||||
if obj is None :
|
||||
#notify user of error
|
||||
from ...dialog import RunDatabaseRepair
|
||||
RunDatabaseRepair( # no-parent
|
||||
_('Non existing media found in the Gallery'))
|
||||
RunDatabaseRepair( # parent-OK
|
||||
_('Non existing media found in the Gallery'),
|
||||
parent=self.uistate.window)
|
||||
else :
|
||||
pixbuf = get_thumbnail_image(
|
||||
media_path_full(self.dbstate.db,
|
||||
@ -334,8 +336,9 @@ class GalleryTab(ButtonTab, DbGUIElement):
|
||||
src, sref, self.add_callback)
|
||||
except WindowActiveError:
|
||||
from ...dialog import WarningDialog
|
||||
WarningDialog(_("Cannot share this reference"), # no-parent
|
||||
self.__blocked_text())
|
||||
WarningDialog(_("Cannot share this reference"), # parent-OK
|
||||
self.__blocked_text(),
|
||||
parent=self.uistate.window)
|
||||
|
||||
def del_button_clicked(self, obj):
|
||||
ref = self.get_selected()
|
||||
@ -354,8 +357,9 @@ class GalleryTab(ButtonTab, DbGUIElement):
|
||||
obj, ref, self.edit_callback)
|
||||
except WindowActiveError:
|
||||
from ...dialog import WarningDialog
|
||||
WarningDialog(_("Cannot edit this reference"), # no-parent
|
||||
self.__blocked_text())
|
||||
WarningDialog(_("Cannot edit this reference"), # parent-OK
|
||||
self.__blocked_text(),
|
||||
parent=self.uistate.window)
|
||||
|
||||
def edit_callback(self, media_ref, media):
|
||||
"""
|
||||
|
@ -24,8 +24,6 @@
|
||||
# python
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gi.repository import GObject
|
||||
from gi.repository import GLib
|
||||
|
||||
@ -34,6 +32,8 @@ from gi.repository import GLib
|
||||
# Gramps classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.lib import EventRoleType, EventType
|
||||
from gramps.gen.display.name import displayer as name_displayer
|
||||
from .eventembedlist import EventEmbedList
|
||||
@ -126,10 +126,11 @@ class PersonEventEmbedList(EventEmbedList):
|
||||
handle change request of non native data
|
||||
"""
|
||||
from ...dialog import WarningDialog
|
||||
WarningDialog( # no-parent
|
||||
_("Cannot change Family"),
|
||||
_("You cannot change Family events in the Person Editor")
|
||||
)
|
||||
WarningDialog( # parent-OK
|
||||
_("Cannot change Family"),
|
||||
_("You cannot change Family events in the Person Editor"),
|
||||
parent=self.uistate.window)
|
||||
|
||||
def _move_up_group(self, groupindex):
|
||||
"""
|
||||
move up pressed on the group
|
||||
|
@ -23,8 +23,6 @@
|
||||
# Python classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gi.repository import GObject
|
||||
from gi.repository import GLib
|
||||
|
||||
@ -33,6 +31,8 @@ from gi.repository import GLib
|
||||
# Gramps classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.lib import Place, PlaceRef
|
||||
from gramps.gen.errors import WindowActiveError
|
||||
from ...dialog import ErrorDialog
|
||||
@ -138,9 +138,10 @@ class PlaceRefEmbedList(EmbeddedList):
|
||||
|
||||
def handle_extra_type(self, objtype, obj):
|
||||
if obj in self.get_skip_list(self.handle):
|
||||
ErrorDialog(_("Place cycle detected"), # no-parent
|
||||
ErrorDialog(_("Place cycle detected"), # parent-OK
|
||||
_("The place you are adding is already enclosed by "
|
||||
"this place"))
|
||||
"this place"),
|
||||
parent=self.uistate.window)
|
||||
return
|
||||
place = self.dbstate.db.get_place_from_handle(obj)
|
||||
placeref = PlaceRef()
|
||||
|
@ -23,8 +23,6 @@
|
||||
# Python classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gi.repository import GObject, GLib
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -32,6 +30,8 @@ from gi.repository import GObject, GLib
|
||||
# Gramps classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.lib import RepoRef, Repository
|
||||
from ...dbguielement import DbGUIElement
|
||||
from ...selectors import SelectorFactory
|
||||
@ -164,15 +164,15 @@ class RepoEmbedList(EmbeddedList, DbGUIElement):
|
||||
ref, self.edit_callback)
|
||||
except WindowActiveError:
|
||||
from ...dialog import WarningDialog
|
||||
WarningDialog( # no-parent
|
||||
WarningDialog( # parent-OK
|
||||
_("Cannot edit this reference"),
|
||||
_("This repository reference cannot be edited at this "
|
||||
"time. Either the associated repository is already "
|
||||
"being edited or another repository reference that is "
|
||||
"associated with the same repository is being edited."
|
||||
"\n\nTo edit this repository reference, you need to "
|
||||
"close the repository.")
|
||||
)
|
||||
"close the repository."),
|
||||
parent=self.uistate.window)
|
||||
|
||||
|
||||
def edit_callback(self, name):
|
||||
|
@ -1043,7 +1043,7 @@ class EditFamily(EditPrimary):
|
||||
#try:
|
||||
self.__do_save()
|
||||
#except bsddb_db.DBRunRecoveryError as msg:
|
||||
# RunDatabaseRepair(msg[1]) # no-parent
|
||||
# RunDatabaseRepair(msg[1], parent=self.window) # parent-OK
|
||||
|
||||
def __do_save(self):
|
||||
self.ok_button.set_sensitive(False)
|
||||
|
@ -957,8 +957,9 @@ class EditPerson(EditPrimary):
|
||||
if obj is None :
|
||||
#notify user of error
|
||||
from ..dialog import RunDatabaseRepair
|
||||
RunDatabaseRepair( # no-parent
|
||||
_('Non existing media found in the Gallery'))
|
||||
RunDatabaseRepair( # parent-OK
|
||||
_('Non existing media found in the Gallery'),
|
||||
parent=self.window)
|
||||
else :
|
||||
self.load_photo(ref, obj)
|
||||
else:
|
||||
@ -1083,7 +1084,7 @@ class EditPerson(EditPrimary):
|
||||
#config.save()
|
||||
|
||||
|
||||
class GenderDialog(Gtk.MessageDialog):
|
||||
class GenderDialog(Gtk.MessageDialog): # parent-OK
|
||||
def __init__(self, parent=None):
|
||||
Gtk.MessageDialog.__init__(self,
|
||||
parent,
|
||||
|
@ -237,7 +237,7 @@ class EditPersonRef(EditSecondary):
|
||||
else:
|
||||
from ..dialog import ErrorDialog
|
||||
|
||||
ErrorDialog( # no-parent
|
||||
ErrorDialog( # parent-OK
|
||||
_('No person selected'),
|
||||
_('You must either select a person or Cancel '
|
||||
'the edit'))
|
||||
_('You must either select a person or Cancel the edit'),
|
||||
parent=self.uistate.window)
|
||||
|
@ -127,7 +127,7 @@ def _display_welcome_message(parent=None):
|
||||
Display a welcome message to the user.
|
||||
(This docstring seems very legacy/historical, not accurate.)
|
||||
"""
|
||||
_display_generic_message("master", 'behavior.betawarn', parent)
|
||||
_display_generic_message("master", 'behavior.betawarn', parent=parent)
|
||||
|
||||
def _display_generic_message(warning_type, config_key, parent=None):
|
||||
"""
|
||||
@ -224,9 +224,9 @@ class Gramps:
|
||||
if (lin()
|
||||
and glocale.lang != 'C'
|
||||
and not gettext.find(GTK_GETTEXT_DOMAIN)):
|
||||
_display_gtk_gettext_message(parent=self._vm.window)
|
||||
_display_gtk_gettext_message(parent=self._vm.window) # parent-OK
|
||||
|
||||
_display_welcome_message(parent=self._vm.window)
|
||||
_display_welcome_message(parent=self._vm.window) # parent-OK
|
||||
|
||||
self._vm.init_interface()
|
||||
|
||||
|
@ -662,8 +662,9 @@ class WriterOptionBox:
|
||||
lambda : self.edit_filter_save(filterdb, namespace))
|
||||
else: # can't edit this filter
|
||||
from ...dialog import ErrorDialog
|
||||
ErrorDialog(_("Cannot edit a system filter"), # no-parent
|
||||
_("Please select a different filter to edit"))
|
||||
ErrorDialog(_("Cannot edit a system filter"), # parent-OK
|
||||
_("Please select a different filter to edit"),
|
||||
parent=self.uistate.window)
|
||||
|
||||
def edit_filter_save(self, filterdb, namespace):
|
||||
"""
|
||||
|
@ -23,11 +23,12 @@
|
||||
import os
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import GObject
|
||||
|
||||
from gramps.gen.constfunc import get_curr_dir
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
class FileEntry(Gtk.Box):
|
||||
class FileEntry(Gtk.Box): # parent-OK
|
||||
""" A widget that allows the user to select a file from the file system """
|
||||
def __init__(self, defname, title, parent=None):
|
||||
Gtk.Box.__init__(self)
|
||||
|
@ -446,7 +446,8 @@ class ReportDialog(ManagedWindow):
|
||||
hid = self.style_name
|
||||
if hid[-4:] == ".xml":
|
||||
hid = hid[0:-4]
|
||||
self.target_fileentry = FileEntry(hid, _("Save As"), parent=self.window)
|
||||
self.target_fileentry = FileEntry(hid, _("Save As"), # parent-OK
|
||||
parent=self.window)
|
||||
spath = self.get_default_directory()
|
||||
self.target_fileentry.set_filename(spath)
|
||||
# need any labels at top:
|
||||
@ -729,7 +730,8 @@ def report(dbstate, uistate, person, report_class, options_class,
|
||||
# if str(msg).startswith("'NoneType' object has no attribute"):
|
||||
# # "'NoneType' object has no attribute ..." usually means
|
||||
# # database corruption
|
||||
# RunDatabaseRepair(str(msg)) # no-parent
|
||||
# RunDatabaseRepair(str(msg),
|
||||
# parent=self.window) # parent-OK
|
||||
# else:
|
||||
# raise
|
||||
raise
|
||||
|
@ -32,8 +32,6 @@ Paragraph/Font style editor
|
||||
# Python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
import logging
|
||||
log = logging.getLogger(".")
|
||||
import re
|
||||
@ -50,6 +48,8 @@ from gi.repository import Gtk, Gdk
|
||||
# Gramps modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from gramps.gen.plug.docgen import (StyleSheet, FONT_SERIF, FONT_SANS_SERIF,
|
||||
PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER, PARA_ALIGN_LEFT,
|
||||
PARA_ALIGN_JUSTIFY, ParagraphStyle, TableStyle, TableCellStyle,
|
||||
@ -81,6 +81,8 @@ class StyleListDisplay:
|
||||
|
||||
self.sheetlist = stylesheetlist
|
||||
|
||||
self.parent_window = parent_window
|
||||
|
||||
self.top = Glade(toplevel='styles')
|
||||
self.window = self.top.toplevel
|
||||
|
||||
@ -136,7 +138,8 @@ class StyleListDisplay:
|
||||
self.sheetlist.save()
|
||||
except IOError as msg:
|
||||
from ...dialog import ErrorDialog
|
||||
ErrorDialog(_("Error saving stylesheet"), str(msg)) # no-parent
|
||||
ErrorDialog(_("Error saving stylesheet"), str(msg), # parent-OK
|
||||
parent=self.parent_window)
|
||||
except:
|
||||
log.error("Failed to save stylesheet", exc_info=True)
|
||||
|
||||
|
@ -27,8 +27,6 @@
|
||||
# Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
import logging
|
||||
log = logging.getLogger(".")
|
||||
|
||||
@ -37,6 +35,8 @@ log = logging.getLogger(".")
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.const import TOOL_OPTIONS
|
||||
from gramps.gen.display.name import displayer as name_displayer
|
||||
from gramps.gen.errors import WindowActiveError
|
||||
@ -132,10 +132,10 @@ class ActivePersonTool(Tool):
|
||||
if not uistate.get_active('Person'):
|
||||
# TODO: should we replace this with a callback?
|
||||
from ..dialog import ErrorDialog
|
||||
|
||||
ErrorDialog(_('Active person has not been set'), # no-parent
|
||||
ErrorDialog(_('Active person has not been set'), # parent-OK
|
||||
_('You must select an active person for this '
|
||||
'tool to work properly.'))
|
||||
'tool to work properly.'),
|
||||
parent=uistate.window)
|
||||
self.fail = True
|
||||
return
|
||||
|
||||
|
@ -29,8 +29,6 @@ Handles the Tip of the Day dialog
|
||||
#-------------------------------------------------------------------------
|
||||
from xml.parsers.expat import ParserCreate, ExpatError
|
||||
from random import Random
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
import os
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -44,6 +42,8 @@ import os
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.const import IMAGE_DIR, TIP_DATA
|
||||
from gramps.gen.config import config
|
||||
from .managedwindow import ManagedWindow
|
||||
@ -82,9 +82,10 @@ class TipOfDay(ManagedWindow):
|
||||
tparser = TipParser()
|
||||
except (IOError,ExpatError) as e:
|
||||
self.close()
|
||||
ErrorDialog( # no-parent
|
||||
ErrorDialog( # parent-OK
|
||||
_("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,
|
||||
parent=uistate.window)
|
||||
return
|
||||
self.tip_list = tparser.get()
|
||||
|
||||
|
@ -38,6 +38,7 @@ from gramps.gen import user
|
||||
from .utils import ProgressMeter
|
||||
from .dialog import (WarningDialog, ErrorDialog, DBErrorDialog,
|
||||
RunDatabaseRepair, InfoDialog, QuestionDialog2)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# User class
|
||||
@ -175,7 +176,7 @@ class User(user.User):
|
||||
else:
|
||||
RunDatabaseRepair(error, parent=None) # parent-OK
|
||||
|
||||
def info(self, msg1, infotext, parent=None, monospaced=False):
|
||||
def info(self, msg1, infotext, parent=None, monospaced=False): # parent-OK
|
||||
"""
|
||||
Calls the GUI InfoDialog
|
||||
"""
|
||||
|
@ -31,8 +31,6 @@ import os
|
||||
import sys
|
||||
import subprocess
|
||||
import threading
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
# gtk is not included here, because this file is currently imported
|
||||
# by code that needs to run without the DISPLAY variable (eg, in
|
||||
# the cli only).
|
||||
@ -52,6 +50,8 @@ from gi.repository import GLib
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.lib.person import Person
|
||||
from gramps.gen.constfunc import has_display, is_quartz, mac, win
|
||||
from gramps.gen.config import config
|
||||
@ -586,8 +586,9 @@ def edit_object(dbstate, uistate, reftype, ref):
|
||||
"alone")
|
||||
|
||||
from .dialog import WarningDialog
|
||||
WarningDialog(_("Cannot open new citation editor"), # no-parent
|
||||
blocked_text)
|
||||
WarningDialog(_("Cannot open new citation editor"), # parent-OK
|
||||
blocked_text,
|
||||
parent=uistate.window)
|
||||
elif reftype == 'Place':
|
||||
try:
|
||||
place = dbstate.db.get_place_from_handle(ref)
|
||||
|
@ -429,12 +429,15 @@ class CitationBookmarks(ListBookmarks):
|
||||
# more comprehensive solution is needed in the long term. See also
|
||||
# change_active in CitatinTreeView
|
||||
from gramps.gui.dialog import WarningDialog
|
||||
WarningDialog(_("Cannot bookmark this reference"), # no-parent
|
||||
"Only Citations can be bookmarked in this view. "
|
||||
"You are probably trying to bookmark a Source in the "
|
||||
"Citation Tree View. In this view, only Citations "
|
||||
"can be bookmarked. To bookmark a Source, switch to "
|
||||
"the Source View")
|
||||
WarningDialog( # parent-OK
|
||||
_("Cannot bookmark this reference"),
|
||||
# FIXME should this next string be translated?
|
||||
"Only Citations can be bookmarked in this view. "
|
||||
"You are probably trying to bookmark a Source in the "
|
||||
"Citation Tree View. In this view, only Citations "
|
||||
"can be bookmarked. To bookmark a Source, switch to "
|
||||
"the Source View",
|
||||
parent=self.uistate.window)
|
||||
|
||||
def connect_signals(self):
|
||||
self.dbstate.db.connect('citation-delete', self.remove_handles)
|
||||
|
@ -50,6 +50,8 @@ from gi.repository import Pango
|
||||
# Gramps
|
||||
#
|
||||
#----------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from .pageview import PageView
|
||||
from .navigationview import NavigationView
|
||||
from ..actiongroup import ActionGroup
|
||||
@ -63,8 +65,6 @@ from gramps.gen.utils.debug import profile
|
||||
from gramps.gen.utils.string import data_recover_msg
|
||||
from ..dialog import QuestionDialog, QuestionDialog2
|
||||
from ..editors import FilterEditor
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from ..ddtargets import DdTargets
|
||||
from ..plug.quick import create_quickreport_menu, create_web_connect_menu
|
||||
from ..utils import is_right_click
|
||||
@ -445,10 +445,10 @@ class ListView(NavigationView):
|
||||
self.bookmarks.add(mlist[0])
|
||||
else:
|
||||
from ..dialog import WarningDialog
|
||||
WarningDialog( # no-parent
|
||||
_("Could Not Set a Bookmark"),
|
||||
_("A bookmark could not be set because "
|
||||
"nothing was selected."))
|
||||
WarningDialog(_("Could Not Set a Bookmark"), # parent-OK
|
||||
_("A bookmark could not be set because "
|
||||
"nothing was selected."),
|
||||
parent=self.uistate.window)
|
||||
|
||||
####################################################################
|
||||
#
|
||||
@ -537,12 +537,13 @@ class ListView(NavigationView):
|
||||
"""
|
||||
prompt = True
|
||||
if len(self.selected_handles()) > 1:
|
||||
q = QuestionDialog2( # no-parent
|
||||
q = QuestionDialog2( # parent-OK
|
||||
_("Multiple Selection Delete"),
|
||||
_("More than one item has been selected for deletion. "
|
||||
"Select the option indicating how to delete the items:"),
|
||||
_("Delete All"),
|
||||
_("Confirm Each Delete"))
|
||||
_("Confirm Each Delete"),
|
||||
parent=self.uistate.window)
|
||||
prompt = not q.run()
|
||||
|
||||
if not prompt:
|
||||
@ -563,8 +564,9 @@ class ListView(NavigationView):
|
||||
#if descr == "":
|
||||
descr = object.get_gramps_id()
|
||||
self.uistate.set_busy_cursor(True)
|
||||
QuestionDialog(_('Delete %s?') % descr, msg, # no-parent
|
||||
_('_Delete Item'), query.query_response)
|
||||
QuestionDialog(_('Delete %s?') % descr, msg, # parent-OK
|
||||
_('_Delete Item'), query.query_response,
|
||||
parent=self.uistate.window)
|
||||
self.uistate.set_busy_cursor(False)
|
||||
else:
|
||||
query.query_response()
|
||||
|
@ -46,10 +46,10 @@ from gi.repository import Gtk
|
||||
# Gramps
|
||||
#
|
||||
#----------------------------------------------------------------
|
||||
from .pageview import PageView
|
||||
from ..actiongroup import ActionGroup
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from .pageview import PageView
|
||||
from ..actiongroup import ActionGroup
|
||||
from gramps.gen.utils.db import navigation_label
|
||||
from gramps.gen.constfunc import mod_key
|
||||
|
||||
@ -252,10 +252,11 @@ class NavigationView(PageView):
|
||||
_("%s has been bookmarked") % name)
|
||||
else:
|
||||
from ..dialog import WarningDialog
|
||||
WarningDialog( # no-parent
|
||||
WarningDialog( # parent-OK
|
||||
_("Could Not Set a Bookmark"),
|
||||
_("A bookmark could not be set because "
|
||||
"no one was selected."))
|
||||
"no one was selected."),
|
||||
parent=self.uistate.window)
|
||||
|
||||
def edit_bookmarks(self, obj):
|
||||
"""
|
||||
|
@ -486,12 +486,13 @@ class OrganizeTagsDialog:
|
||||
tag_handle = store.get_value(iter_, 1)
|
||||
tag_name = store.get_value(iter_, 2)
|
||||
|
||||
yes_no = QuestionDialog2( # no-parent
|
||||
yes_no = QuestionDialog2( # parent-OK
|
||||
_("Remove tag '%s'?") % tag_name,
|
||||
_("The tag definition will be removed. "
|
||||
"The tag will be also removed from all objects in the database."),
|
||||
_("The tag definition will be removed. The tag will be also "
|
||||
"removed from all objects in the database."),
|
||||
_("Yes"),
|
||||
_("No"))
|
||||
_("No"),
|
||||
parent=self.parent_window)
|
||||
prompt = yes_no.run()
|
||||
if prompt:
|
||||
|
||||
@ -582,9 +583,9 @@ class EditTag:
|
||||
self.tag.set_color(hexval)
|
||||
|
||||
if not self.tag.get_name():
|
||||
ErrorDialog( # no-parent
|
||||
_("Cannot save tag"),
|
||||
_("The tag name cannot be empty"))
|
||||
ErrorDialog(_("Cannot save tag"), # parent-OK
|
||||
_("The tag name cannot be empty"),
|
||||
parent=self.parent_window)
|
||||
return
|
||||
|
||||
if not self.tag.get_handle():
|
||||
|
@ -37,8 +37,6 @@ LOG = logging.getLogger('.grampletbar')
|
||||
# Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
import time
|
||||
import os
|
||||
import configparser
|
||||
@ -55,6 +53,8 @@ from gi.repository import Gtk
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.const import URL_MANUAL_PAGE, VERSION_DIR
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.constfunc import win
|
||||
@ -541,11 +541,13 @@ class GrampletBar(Gtk.Notebook):
|
||||
"""
|
||||
Called when restore defaults is clicked from the context menu.
|
||||
"""
|
||||
QuestionDialog(_("Restore to defaults?"), # no-parent
|
||||
QuestionDialog(
|
||||
_("Restore to defaults?"), # parent-OK
|
||||
_("The gramplet bar will be restored to contain its default "
|
||||
"gramplets. This action cannot be undone."),
|
||||
_("OK"),
|
||||
self.restore)
|
||||
self.restore,
|
||||
parent=self.uistate.window)
|
||||
|
||||
def get_config_funcs(self):
|
||||
"""
|
||||
|
@ -77,7 +77,7 @@ SEPARATION_PAT = '&&'
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Latex Article Template
|
||||
# LaTeX Article Template
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
@ -407,20 +407,20 @@ _LATEX_TEMPLATE = '''%
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
# These tables correlate font sizes to Latex. The first table contains
|
||||
# These tables correlate font sizes to LaTeX. The first table contains
|
||||
# typical font sizes in points. The second table contains the standard
|
||||
# Latex font size names. Since we use bisect to map the first table to the
|
||||
# LaTeX font size names. Since we use bisect to map the first table to the
|
||||
# second, we are guaranteed that any font less than 6 points is 'tiny', fonts
|
||||
# from 6-7 points are 'script', etc. and fonts greater than or equal to 22
|
||||
# are considered 'Huge'. Note that fonts from 12-13 points are not given a
|
||||
# Latex font size name but are considered "normal."
|
||||
# LaTeX font size name but are considered "normal."
|
||||
|
||||
_FONT_SIZES = [6, 8, 10, 12, 14, 16, 18, 20, 22]
|
||||
_FONT_NAMES = ['tiny', 'scriptsize', 'footnotesize', 'small', '',
|
||||
'large', 'Large', 'LARGE', 'huge', 'Huge']
|
||||
|
||||
def map_font_size(fontsize):
|
||||
""" Map font size in points to Latex font size """
|
||||
""" Map font size in points to LaTeX font size """
|
||||
return _FONT_NAMES[bisect(_FONT_SIZES, fontsize)]
|
||||
|
||||
|
||||
@ -545,7 +545,7 @@ def latexescapeverbatim(text):
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
class LateXBackend(DocBackend):
|
||||
class LaTeXBackend(DocBackend):
|
||||
"""
|
||||
Implementation of docbackend for latex docs.
|
||||
File and File format management for latex docs
|
||||
@ -570,13 +570,13 @@ class LateXBackend(DocBackend):
|
||||
|
||||
def setescape(self, preformatted=False):
|
||||
"""
|
||||
Latex needs two different escape functions depending on the type.
|
||||
LaTeX needs two different escape functions depending on the type.
|
||||
This function allows to switch the escape function
|
||||
"""
|
||||
if not preformatted:
|
||||
LateXBackend.ESCAPE_FUNC = lambda x: latexescape
|
||||
LaTeXBackend.ESCAPE_FUNC = lambda x: latexescape
|
||||
else:
|
||||
LateXBackend.ESCAPE_FUNC = lambda x: latexescapeverbatim
|
||||
LaTeXBackend.ESCAPE_FUNC = lambda x: latexescapeverbatim
|
||||
|
||||
def _create_xmltag(self, type, value):
|
||||
"""
|
||||
@ -949,7 +949,7 @@ class LaTeXDoc(BaseDoc, TextDoc):
|
||||
def open(self, filename):
|
||||
"""Opens the specified file, making sure that it has the
|
||||
extension of .tex"""
|
||||
self._backend = LateXBackend(filename)
|
||||
self._backend = LaTeXBackend(filename)
|
||||
self._backend.open()
|
||||
|
||||
# Font size control seems to be limited. For now, ignore
|
||||
|
@ -2779,7 +2779,7 @@ class GedcomParser(UpdateCallback):
|
||||
parent_window = self.user.uistate.window
|
||||
else:
|
||||
parent_window = None
|
||||
self.user.info(message, "".join(self.errors),
|
||||
self.user.info(message, "".join(self.errors), # parent-OK
|
||||
parent=parent_window, monospaced=True)
|
||||
|
||||
def __clean_up(self):
|
||||
|
@ -51,7 +51,7 @@ from gramps.gen.db import DbTxn
|
||||
|
||||
class PopulateSources(tool.Tool, ManagedWindow):
|
||||
"""
|
||||
Gramplet that populates the database with sources and citations.
|
||||
Tool that populates the database with sources and citations.
|
||||
"""
|
||||
|
||||
def __init__(self, dbstate, user, options_class, name, callback=None):
|
||||
@ -67,8 +67,9 @@ class PopulateSources(tool.Tool, ManagedWindow):
|
||||
|
||||
if response == Gtk.ResponseType.ACCEPT:
|
||||
self.on_ok_clicked()
|
||||
OkDialog('Data generated', # no-parent
|
||||
"The requested sources and citations were generated")
|
||||
OkDialog('Data generated', # parent-OK
|
||||
"The requested sources and citations were generated",
|
||||
parent=uistate.window)
|
||||
|
||||
self.close()
|
||||
|
||||
|
@ -28,8 +28,6 @@
|
||||
# Standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -44,6 +42,8 @@ from gi.repository import Gtk
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.display.name import displayer as name_displayer
|
||||
from gramps.gui.managedwindow import ManagedWindow
|
||||
from gramps.gui.views.treemodels import PeopleBaseModel, PersonTreeModel
|
||||
@ -146,9 +146,10 @@ class RelCalc(tool.Tool, ManagedWindow):
|
||||
|
||||
if not self.person:
|
||||
self.window.hide()
|
||||
ErrorDialog(_('Active person has not been set'), # no-parent
|
||||
ErrorDialog(_('Active person has not been set'), # parent-OK
|
||||
_('You must select an active person for this '
|
||||
'tool to work properly.'))
|
||||
'tool to work properly.'),
|
||||
parent=uistate.window)
|
||||
self.close()
|
||||
return
|
||||
|
||||
|
@ -689,7 +689,8 @@ class PedigreeView(NavigationView):
|
||||
else:
|
||||
self.rebuild_trees(None)
|
||||
except AttributeError as msg:
|
||||
RunDatabaseRepair(str(msg)) # no-parent
|
||||
RunDatabaseRepair(str(msg), # parent-OK
|
||||
parent=self.uistate.window)
|
||||
|
||||
def _connect_db_signals(self):
|
||||
"""
|
||||
@ -1496,8 +1497,9 @@ class PedigreeView(NavigationView):
|
||||
try:
|
||||
alive = probably_alive(person, self.dbstate.db)
|
||||
except RuntimeError:
|
||||
ErrorDialog(_('Relationship loop detected'), # no-parent
|
||||
_('A person was found to be his/her own ancestor.'))
|
||||
ErrorDialog(_('Relationship loop detected'), # parent-OK
|
||||
_('A person was found to be his/her own ancestor.'),
|
||||
parent=self.uistate.window)
|
||||
alive = False
|
||||
lst[index] = [person, val, None, alive, None]
|
||||
|
||||
|
@ -27,9 +27,6 @@ Relationship View
|
||||
# Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
|
||||
from html import escape
|
||||
import pickle
|
||||
|
||||
@ -55,6 +52,9 @@ from gi.repository import Pango
|
||||
# Gramps Modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
ngettext = glocale.translation.ngettext # else "nearby" comments are ignored
|
||||
from gramps.gen.lib import (ChildRef, EventRoleType, EventType, Family,
|
||||
FamilyRelType, Name, Person, Surname)
|
||||
from gramps.gen.lib.date import Today
|
||||
@ -473,7 +473,8 @@ class RelationshipView(NavigationView):
|
||||
exc = traceback.format_exc()
|
||||
_LOG.error(str(msg) +"\n" + exc)
|
||||
from gramps.gui.dialog import RunDatabaseRepair
|
||||
RunDatabaseRepair(str(msg)) # no-parent
|
||||
RunDatabaseRepair(str(msg), # parent-OK
|
||||
parent=self.uistate.window)
|
||||
self.redrawing = False
|
||||
return True
|
||||
|
||||
@ -1350,9 +1351,10 @@ class RelationshipView(NavigationView):
|
||||
family = self.dbstate.db.get_family_from_handle(family_handle)
|
||||
if family is None:
|
||||
from gramps.gui.dialog import WarningDialog
|
||||
WarningDialog( # no-parent
|
||||
WarningDialog( # parent-OK
|
||||
_('Broken family detected'),
|
||||
_('Please run the Check and Repair Database tool'))
|
||||
_('Please run the Check and Repair Database tool'),
|
||||
parent=self.uistate.window)
|
||||
return
|
||||
|
||||
father_handle = family.get_father_handle()
|
||||
|
Loading…
Reference in New Issue
Block a user