Repository: spyder-ide/spyder

Issue:
Default Help "Usage" screen always shows hardcoded default inspect shortcut, not actual one
<!--- **PLEASE READ:** Before submitting here, please carefully consult our *Troubleshooting Guide*: https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ and search the issues page for your error/problem, as most posted bugs are duplicates or easy fixes.

If you don't find anything, please provide a detailed step-by-step description (in English) of the problem and what led up to it below. Issue reports without a clear way to reproduce them will be closed. Thanks! --->

## Problem Description

The "Usage" screen, displayed by default in the Help viewer every time Spyder is launched, has the default Ctrl-I shortcut hardcoded, instead of whatever shortcut is actually set. However, if the user ever changes it (or uses a different shortcut profile as in Spyder 4, which would change it without user intervention and perhaps recognition, thus a potential source of real confusion rather than just annoyance/lack of polish), this shortcut will be displayed incorrectly (as I find the default quite horrid, but that's another matter...). Therefore, it should display whatever shortcut is actually set.

## Package Versions

* Spyder version: 3.2.8 
* Python version: 3.6.4
* Qt version: 5.6.2
* PyQt5 version: 5.6
* Operating system: Windows 8.1

### Dependencies

```
IPython >=4.0    :  6.2.1 (OK)
cython >=0.21    :  0.27.3 (OK)
jedi >=0.9.0     :  0.11.1 (OK)
nbconvert >=4.0  :  5.3.1 (OK)
numpy >=1.7      :  1.14.0 (OK)
pandas >=0.13.1  :  0.22.0 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pyflakes >=0.6.0 :  1.6.0 (OK)
pygments >=2.0   :  2.2.0 (OK)
pylint >=0.25    :  1.8.2 (OK)
qtconsole >=4.2.0:  4.3.1 (OK)
rope >=0.9.4     :  0.10.7 (OK)
sphinx >=0.6.6   :  1.7.2 (OK)
sympy >=0.7.3    :  1.1.1 (OK)
```



Discussion:

Resolving patch:
diff --git a/spyder/app/mainwindow.py b/spyder/app/mainwindow.py
--- a/spyder/app/mainwindow.py
+++ b/spyder/app/mainwindow.py
@@ -3095,7 +3095,7 @@ def apply_statusbar_settings(self):
 
     @Slot()
     def show_preferences(self):
-        """Edit Spyder preferences"""
+        """Edit Spyder preferences."""
         from spyder.preferences.configdialog import ConfigDialog
 
         def _dialog_finished(result_code):
@@ -3202,6 +3202,11 @@ def apply_shortcuts(self):
         for index in sorted(toberemoved, reverse=True):
             self.shortcut_data.pop(index)
 
+        # TODO: Update plugin API to include an update shortcuts method
+        # See: spyder-ide/spyder#6992
+        if self.help:
+            self.help.show_intro_message()
+
     @Slot()
     def show_shortcuts_dialog(self):
         from spyder.widgets.shortcutssummary import ShortcutsSummaryDialog
diff --git a/spyder/plugins/help/plugin.py b/spyder/plugins/help/plugin.py
--- a/spyder/plugins/help/plugin.py
+++ b/spyder/plugins/help/plugin.py
@@ -393,24 +393,42 @@ def set_rich_text_html(self, html_text, base_url):
         self.save_text([self.rich_text.set_html, html_text, base_url])
 
     def show_intro_message(self):
-        intro_message = _("Here you can get help of any object by pressing "
-                          "%s in front of it, either on the Editor or the "
-                          "Console.%s"
-                          "Help can also be shown automatically after writing "
-                          "a left parenthesis next to an object. You can "
-                          "activate this behavior in %s.")
+        intro_message_eq = _(
+            "Here you can get help of any object by pressing "
+            "%s in front of it, either on the Editor or the "
+            "Console.%s")
+        intro_message_dif = _(
+            "Here you can get help of any object by pressing "
+            "%s in front of it on the Editor, or %s in front "
+            "of it on the Console.%s")
+        intro_message_common = _(
+            "Help can also be shown automatically after writing "
+            "a left parenthesis next to an object. You can "
+            "activate this behavior in %s.")
         prefs = _("Preferences > Help")
+        shortcut_editor = self.get_option('editor/inspect current object',
+                                          section='shortcuts')
+        shortcut_console = self.get_option('console/inspect current object',
+                                           section='shortcuts')
+
         if sys.platform == 'darwin':
-            shortcut = "Cmd+I"
-        else:
-            shortcut = "Ctrl+I"
+            shortcut_editor = shortcut_editor.replace('Ctrl', 'Cmd')
+            shortcut_console = shortcut_console.replace('Ctrl', 'Cmd')
 
         if self.is_rich_text_mode():
             title = _("Usage")
             tutorial_message = _("New to Spyder? Read our")
             tutorial = _("tutorial")
-            intro_message = intro_message % ("<b>"+shortcut+"</b>", "<br><br>",
-                                             "<i>"+prefs+"</i>")
+            if shortcut_editor == shortcut_console:
+                intro_message = (intro_message_eq + intro_message_common) % (
+                    "<b>"+shortcut_editor+"</b>", "<br><br>",
+                    "<i>"+prefs+"</i>")
+            else:
+                intro_message = (intro_message_dif + intro_message_common) % (
+                    "<b>"+shortcut_editor+"</b>",
+                    "<b>"+shortcut_console+"</b>",
+                    "<br><br>", "<i>"+prefs+"</i>")
+
             self.set_rich_text_html(usage(title, intro_message,
                                           tutorial_message, tutorial,
                                           css_path=self.css_path),
@@ -419,7 +437,13 @@ def show_intro_message(self):
             install_sphinx = "\n\n%s" % _("Please consider installing Sphinx "
                                           "to get documentation rendered in "
                                           "rich text.")
-            intro_message = intro_message % (shortcut, "\n\n", prefs)
+            if shortcut_editor == shortcut_console:
+                intro_message = (intro_message_eq + intro_message_common) % (
+                    shortcut_editor, "\n\n", prefs)
+            else:
+                intro_message = (intro_message_dif + intro_message_common) % (
+                    shortcut_editor, shortcut_console, "\n\n", prefs)
+
             intro_message += install_sphinx
             self.set_plain_text(intro_message, is_code=False)
 


Test patch: