8128: GtkDialog mapped without a transient parent

This commit is contained in:
Paul Franklin 2016-08-09 13:48:57 -07:00
parent a8b0037fab
commit 3edab6e2e6
8 changed files with 32 additions and 20 deletions

View File

@ -25,8 +25,6 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
import re
import time
@ -35,7 +33,10 @@ import time
# Gramps modules
#
#-------------------------------------------------------------------------
from ...const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
from . import Rule
from gramps.gen.errors import FilterError
#-------------------------------------------------------------------------
#
@ -77,8 +78,8 @@ class ChangedSinceBase(Rule):
time_tup = time.strptime(iso_date_time, "%Y-%m-%d %H:%M:%S")
time_sec = time.mktime(time_tup)
except ValueError:
from gramps.gui.dialog import WarningDialog
WarningDialog(_("Wrong format of date-time"), # no-parent
raise FilterError(
_("Wrong format of date-time"),
_("Only date-times in the iso format of yyyy-mm-dd "
"hh:mm:ss, where the time part is optional, are "
"accepted. %s does not satisfy.") % iso_date_time)

View File

@ -114,7 +114,8 @@ class LastNameDialog(ManagedWindow):
# build up the list of surnames, keeping track of the count for each
# name (this can be a lengthy process, so by passing in the
# dictionary we can be certain we only do this once)
progress = ProgressMeter(_('Finding Surnames')) # no-parent
progress = ProgressMeter( # parent-OK
_('Finding Surnames'), parent=uistate.window)
progress.set_pass(_('Finding surnames'),
database.get_number_of_people())
for person in database.iter_people():

View File

@ -305,7 +305,8 @@ class PluginStatus(ManagedWindow):
except:
print("Error: cannot open %s" % URL)
return
pm = ProgressMeter(_("Refreshing Addon List")) # no-parent
pm = ProgressMeter(_("Refreshing Addon List"), # parent-OK
parent=self.uistate.window)
pm.set_pass(header=_("Reading gramps-project.org..."))
state = "read"
rows = []
@ -383,8 +384,9 @@ class PluginStatus(ManagedWindow):
Get all addons from the wiki and install them.
"""
from ..utils import ProgressMeter
pm = ProgressMeter( # no-parent
_("Install all Addons"), _("Installing..."), message_area=True)
pm = ProgressMeter( # parent-OK
_("Install all Addons"), _("Installing..."), message_area=True,
parent=self.uistate.window)
pm.set_pass(total=len(self.addon_model))
errors = []
for row in self.addon_model:
@ -402,8 +404,9 @@ class PluginStatus(ManagedWindow):
Toplevel method to get an addon.
"""
from ..utils import ProgressMeter
pm = ProgressMeter( # no-parent
_("Installing Addon"), message_area=True)
pm = ProgressMeter( # parent-OK
_("Installing Addon"), message_area=True,
parent=self.uistate.window)
pm.set_pass(total=2, header=_("Reading gramps-project.org..."))
pm.step()
self.__get_addon(obj, callback=pm.append_message)
@ -879,7 +882,8 @@ class ToolManagedWindowBase(ManagedWindow):
def pre_run(self):
from ..utils import ProgressMeter
self.progress = ProgressMeter(self.get_title()) # no-parent
self.progress = ProgressMeter(self.get_title(), # parent-OK
parent=self.uistate.window)
def run(self):
raise NotImplementedError("tool needs to define a run() method")

View File

@ -412,7 +412,7 @@ def open_file_with_default_application(path):
norm_path = os.path.normpath(path)
if not os.path.exists(norm_path):
display_error_dialog(0, _("File does not exist"))
display_error_dialog(0, _("File %s does not exist") % norm_path)
return
if win():

View File

@ -57,13 +57,13 @@ from .navigationview import NavigationView
from ..actiongroup import ActionGroup
from ..columnorder import ColumnOrder
from gramps.gen.config import config
from gramps.gen.errors import WindowActiveError
from gramps.gen.errors import WindowActiveError, FilterError
from ..filters import SearchBar
from ..widgets.menuitem import add_menuitem
from gramps.gen.const import CUSTOM_FILTERS
from gramps.gen.utils.debug import profile
from gramps.gen.utils.string import data_recover_msg
from ..dialog import QuestionDialog, QuestionDialog2
from ..dialog import QuestionDialog, QuestionDialog2, ErrorDialog
from ..editors import FilterEditor
from ..ddtargets import DdTargets
from ..plug.quick import create_quickreport_menu, create_web_connect_menu
@ -328,7 +328,12 @@ class ListView(NavigationView):
#run only the part that determines what to show
self.list.set_model(None)
self.model.set_search(filter_info)
self.model.rebuild_data()
try:
self.model.rebuild_data()
except FilterError as msg:
(msg1, msg2) = msg.messages()
ErrorDialog(msg1, msg2, # parent-OK
parent=self.uistate.window)
cput1 = time.clock()
self.build_columns()

View File

@ -167,8 +167,9 @@ class PatchNames(tool.BatchTool, ManagedWindow):
self.cb = callback
self.handle_to_action = {}
self.progress = ProgressMeter( # no-parent
_('Extracting Information from Names'), '')
self.progress = ProgressMeter( # parent-OK
_('Extracting Information from Names'), '',
parent=self.uistate.window)
self.progress.set_pass(_('Analyzing names'),
self.db.get_number_of_people())

View File

@ -134,8 +134,8 @@ class PopulateSources(tool.Tool, ManagedWindow):
num_citations_text = self.citations_entry.get_text()
num_citations = int(num_citations_text)
self.progress = ProgressMeter( # no-parent
'Generating data', '')
self.progress = ProgressMeter( # parent-OK
'Generating data', '', parent=self.uistate.window)
self.progress.set_pass('Generating data',
num_sources*num_citations)
LOG.debug("sources %04d citations %04d" % (num_sources,

View File

@ -118,5 +118,5 @@ authors_email = [""],
category = TOOL_DEBUG,
toolclass = 'PopulateSources',
optionclass = 'PopulateSourcesOptions',
tool_modes = [TOOL_MODE_GUI, TOOL_MODE_CLI]
tool_modes = [TOOL_MODE_GUI]
)