summaryrefslogtreecommitdiff
path: root/grc/gui
diff options
context:
space:
mode:
authorOleksandr Kravchuk <open.source@oleksandr-kravchuk.com>2020-07-17 21:23:25 +0200
committerMartin Braun <martin@gnuradio.org>2021-01-11 12:28:58 -0800
commitf788f65c7b5b52183a3d97fd8d3b17f9bd21c733 (patch)
treea2ab1949ec43c581edc85a73ab54234281f4b31a /grc/gui
parent43eac48b42c781c66b56279ff76e1b3d401f2753 (diff)
grc: Make it possible to copy error message
Diffstat (limited to 'grc/gui')
-rw-r--r--grc/gui/Dialogs.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/grc/gui/Dialogs.py b/grc/gui/Dialogs.py
index eedd724e00..68c9f252cf 100644
--- a/grc/gui/Dialogs.py
+++ b/grc/gui/Dialogs.py
@@ -9,7 +9,7 @@ import sys
import textwrap
from distutils.spawn import find_executable
-from gi.repository import Gtk, GLib
+from gi.repository import Gtk, GLib, Gdk
from . import Utils, Actions, Constants
from ..core import Messages
@@ -203,6 +203,7 @@ class ErrorsDialog(Gtk.Dialog):
modal=True,
destroy_with_parent=True,
)
+ self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
self.add_buttons(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)
self.set_size_request(750, Constants.MIN_DIALOG_HEIGHT)
self.set_border_width(10)
@@ -211,6 +212,7 @@ class ErrorsDialog(Gtk.Dialog):
self.update(flowgraph)
self.treeview = Gtk.TreeView(model=self.store)
+ self.treeview.connect("button_press_event", self.mouse_click)
for i, column_title in enumerate(["Block", "Aspect", "Message"]):
renderer = Gtk.CellRendererText()
column = Gtk.TreeViewColumn(column_title, renderer, text=i)
@@ -248,6 +250,20 @@ class ErrorsDialog(Gtk.Dialog):
self.hide()
return response
+ def mouse_click(self, _, event):
+ """ Handle mouse click, so user can copy the error message """
+ if event.button == 3:
+ path_info = self.treeview.get_path_at_pos(event.x, event.y)
+ if path_info is not None:
+ path, col, _, _ = path_info
+ self.treeview.grab_focus()
+ self.treeview.set_cursor(path, col, 0)
+
+ selection = self.treeview.get_selection()
+ (model, iterator) = selection.get_selected()
+ self.clipboard.set_text(model[iterator][2], -1)
+ print(model[iterator][2])
+
def show_about(parent, config):
ad = Gtk.AboutDialog(transient_for=parent)