Bug 8128; for color chooser dialogs; fixed transient parent

for styledtexteditor and Family Lines Graph, Family Colors option
This commit is contained in:
prculley 2017-03-31 11:53:10 -05:00
parent 8a3b606b7a
commit 916232a6ef
3 changed files with 16 additions and 3 deletions

View File

@ -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:

View File

@ -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()

View File

@ -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