From b548e9703d7992c00daacb1c2b4988588e199f9d Mon Sep 17 00:00:00 2001 From: Tomas Zigo <50632337+tmszi@users.noreply.github.com> Date: Sun, 23 Jan 2022 05:59:55 +0100 Subject: [PATCH] wxGUI/gui_core: fix right mouse click on the root tree node to invoke menu (#2119) --- gui/wxpython/gui_core/query.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/gui/wxpython/gui_core/query.py b/gui/wxpython/gui_core/query.py index 09ac7490c14..e1e3288b277 100644 --- a/gui/wxpython/gui_core/query.py +++ b/gui/wxpython/gui_core/query.py @@ -144,13 +144,11 @@ def ShowContextMenu(self, node): else: label1 = nodes[0].label texts.append((_("Copy '%s'" % self._cutLabel(label1)), label1)) - if nodes[0].data and nodes[0].data[self._colNames[1]]: - label2 = nodes[0].data[self._colNames[1]] - texts.insert( - 0, (_( - "Copy '%s'" % - self._cutLabel(label2)), label2)) - texts.append((_("Copy line"), label1 + ': ' + label2)) + col1 = self._colNames[1] + if nodes[0].data and col1 in nodes[0].data and nodes[0].data[col1]: + label2 = nodes[0].data[col1] + texts.insert(0, (_("Copy '%s'" % self._cutLabel(label2)), label2)) + texts.append((_("Copy line"), label1 + ": " + label2)) ids = [] for text in texts: