From 916232a6efb5b3b3ad92370b81a44216f61b79ac Mon Sep 17 00:00:00 2001 From: prculley Date: Fri, 31 Mar 2017 11:53:10 -0500 Subject: [PATCH] Bug 8128; for color chooser dialogs; fixed transient parent for styledtexteditor and Family Lines Graph, Family Colors option --- gramps/gui/editors/editnote.py | 1 + gramps/gui/plug/_guioptions.py | 7 ++++++- gramps/gui/widgets/styledtexteditor.py | 11 +++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/gramps/gui/editors/editnote.py b/gramps/gui/editors/editnote.py index 5075879dd..a80c2682b 100644 --- a/gramps/gui/editors/editnote.py +++ b/gramps/gui/editors/editnote.py @@ -272,6 +272,7 @@ class EditNote(EditPrimary): if not self.dbstate.db.readonly: vbox = self.top.get_object('container') vbox.pack_start(self.texteditor.get_toolbar(), False, False, 0) + self.texteditor.set_transient_parent(self.window) # setup initial values for textview and textbuffer if self.obj: diff --git a/gramps/gui/plug/_guioptions.py b/gramps/gui/plug/_guioptions.py index 671bcacc0..869110c53 100644 --- a/gramps/gui/plug/_guioptions.py +++ b/gramps/gui/plug/_guioptions.py @@ -1486,6 +1486,10 @@ class GuiSurnameColorOption(Gtk.Box): self.__db = dbstate.get_database() self.__uistate = uistate self.__track = track + item = uistate.gwm.get_item_from_track(track) + self.__parent = item[0].window if isinstance(item, list) \ + else item.window + self.set_size_request(150, 150) # This will get populated the first time the dialog is run, @@ -1567,7 +1571,8 @@ class GuiSurnameColorOption(Gtk.Box): rgba.parse(self.__model.get_value(tree_iter, 1)) title = _('Select color for %s') % surname - colour_dialog = Gtk.ColorChooserDialog(title) + colour_dialog = Gtk.ColorChooserDialog(title=title, + transient_for=self.__parent) colour_dialog.set_rgba(rgba) response = colour_dialog.run() diff --git a/gramps/gui/widgets/styledtexteditor.py b/gramps/gui/widgets/styledtexteditor.py index e876c0015..9a5368c9e 100644 --- a/gramps/gui/widgets/styledtexteditor.py +++ b/gramps/gui/widgets/styledtexteditor.py @@ -540,6 +540,9 @@ class StyledTextEditor(Gtk.TextView): return toolbar + def set_transient_parent(self, parent=None): + self.transient_parent = parent + def _init_url_match(self): """Setup regexp matching for URL match.""" self.textbuffer.create_tag('hyperlink', @@ -639,9 +642,13 @@ class StyledTextEditor(Gtk.TextView): current_value = self.textbuffer.get_style_at_cursor(style) if style == StyledTextTagType.FONTCOLOR: - color_dialog = Gtk.ColorChooserDialog(_("Select font color")) + color_dialog = Gtk.ColorChooserDialog( + title=_("Select font color"), + transient_for=self.transient_parent) elif style == StyledTextTagType.HIGHLIGHT: - color_dialog = Gtk.ColorChooserDialog(_("Select background color")) + color_dialog = Gtk.ColorChooserDialog( + title=_("Select background color"), + transient_for=self.transient_parent) else: _LOG.debug("unknown style: '%d'" % style) return