Repository: spyder-ide/spyder

Issue:
Variable explorer shortcuts not updated after configuration change
The variable explorer copy, search shortcuts are not being updated on configuration change, but only on restart

<img width="781" alt="Screen Shot 2019-11-06 at 12 26 38" src="https://user-images.githubusercontent.com/3627835/68322043-b62e4e00-0090-11ea-94ff-6bbef8942b33.png">



Discussion:

Resolving patch:
diff --git a/spyder/plugins/variableexplorer/plugin.py b/spyder/plugins/variableexplorer/plugin.py
--- a/spyder/plugins/variableexplorer/plugin.py
+++ b/spyder/plugins/variableexplorer/plugin.py
@@ -106,6 +106,7 @@ def remove_widget(self, nsb):
         self.stack.removeWidget(nsb)
 
     def add_widget(self, nsb):
+        self.register_widget_shortcuts(nsb)
         self.stack.addWidget(nsb)
 
     # ----- Public API --------------------------------------------------------
diff --git a/spyder/plugins/variableexplorer/widgets/namespacebrowser.py b/spyder/plugins/variableexplorer/widgets/namespacebrowser.py
--- a/spyder/plugins/variableexplorer/widgets/namespacebrowser.py
+++ b/spyder/plugins/variableexplorer/widgets/namespacebrowser.py
@@ -187,8 +187,35 @@ def setup(self, check_all=None, exclude_private=None,
 
         self.setLayout(layout)
 
+        # Local shortcuts
+        self.shortcuts = self.create_shortcuts()
+
         self.sig_option_changed.connect(self.option_changed)
 
+    def create_shortcuts(self):
+        """Create local shortcut for the nsbrowser."""
+        search = CONF.config_shortcut(
+            lambda: self.show_finder(set_visible=True),
+            context='variable_explorer',
+            name='search',
+            parent=self)
+        refresh = CONF.config_shortcut(
+            self.refresh_table,
+            context='variable_explorer',
+            name='refresh',
+            parent=self)
+
+        return [search, refresh]
+
+    def get_shortcut_data(self):
+        """
+        Returns shortcut data, a list of tuples (shortcut, text, default)
+        shortcut (QShortcut or QAction instance)
+        text (string): action/shortcut description
+        default (string): default key sequence
+        """
+        return [sc.data for sc in self.shortcuts]
+
     def set_shellwidget(self, shellwidget):
         """Bind shellwidget instance to namespace browser"""
         self.shellwidget = shellwidget
@@ -230,24 +257,12 @@ def setup_toolbar(self):
             icon=ima.icon('find'),
             toggled=self.show_finder)
 
-        CONF.config_shortcut(
-            lambda: self.show_finder(set_visible=True),
-            context='variable_explorer',
-            name='search',
-            parent=self)
-
         self.refresh_button = create_toolbutton(
             self,
             text=_("Refresh variables"),
             icon=ima.icon('refresh'),
             triggered=lambda: self.refresh_table(interrupt=True))
 
-        CONF.config_shortcut(
-            self.refresh_table,
-            context='variable_explorer',
-            name='refresh',
-            parent=self)
-
         return [load_button, self.save_button, save_as_button,
                 reset_namespace_button, self.search_button,
                 self.refresh_button]


Test patch: