Merge pull request #370 from prculley/bug8128

Bug 8128; for color chooser dialogs; fixed transient parent
This commit is contained in:
Sam Manzi 2017-04-02 10:20:04 +10:00 committed by GitHub
commit 3fdc986542
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

@ -541,6 +541,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',
@ -640,9 +643,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