From 632ea7248b90823f06772f9f42a834e02393a1de Mon Sep 17 00:00:00 2001 From: Michael Curran Date: Tue, 28 Mar 2017 11:17:03 +1000 Subject: [PATCH 1/2] PythonConsole: the list of completions in the autocomplete context menu no longer shows any objec path leading up to the final symbol being completed. This object path was always the same for all items for a given completion and caused choosing an item to be inefficient for the user (especially for large menus). An example: typing nav.parent.n and pressing tab used to list: nav.parent.name nav.parent.next Now it lists: name next --- source/pythonConsole.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/pythonConsole.py b/source/pythonConsole.py index dc9b919ec23..68cdebfd8bf 100755 --- a/source/pythonConsole.py +++ b/source/pythonConsole.py @@ -249,7 +249,9 @@ def complete(self): if self.completionAmbiguous: menu = wx.Menu() for comp in completions: - item = menu.Append(wx.ID_ANY, comp) + # Only show text after the last dot (so as to not keep repeting the class or module in the context menu) + label=comp.split('.')[-1] + item = menu.Append(wx.ID_ANY, label) self.Bind(wx.EVT_MENU, lambda evt, completion=comp: self._insertCompletion(original, completion), item) From c30f80460aed24183b41e3dcef88e47879bdb958 Mon Sep 17 00:00:00 2001 From: Michael Curran Date: Tue, 28 Mar 2017 13:14:09 +1000 Subject: [PATCH 2/2] Address review comments --- source/pythonConsole.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/pythonConsole.py b/source/pythonConsole.py index 68cdebfd8bf..cf3c0d52cc0 100755 --- a/source/pythonConsole.py +++ b/source/pythonConsole.py @@ -2,7 +2,7 @@ #A part of NonVisual Desktop Access (NVDA) #This file is covered by the GNU General Public License. #See the file COPYING for more details. -#Copyright (C) 2008-2013 NV Access Limited +#Copyright (C) 2008-2017 NV Access Limited import watchdog @@ -250,7 +250,7 @@ def complete(self): menu = wx.Menu() for comp in completions: # Only show text after the last dot (so as to not keep repeting the class or module in the context menu) - label=comp.split('.')[-1] + label=comp.rsplit('.',1)[-1] item = menu.Append(wx.ID_ANY, label) self.Bind(wx.EVT_MENU, lambda evt, completion=comp: self._insertCompletion(original, completion),