浏览代码

wxGUI/gui_core: fix right mouse click on the root tree node to invoke menu (#2119)

Tomas Zigo 3 年之前
父节点
当前提交
b548e9703d
共有 1 个文件被更改,包括 5 次插入7 次删除
  1. 5 7
      gui/wxpython/gui_core/query.py

+ 5 - 7
gui/wxpython/gui_core/query.py

@@ -144,13 +144,11 @@ class QueryDialog(wx.Dialog):
         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: