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.") prefs = _("Preferences > Help") if sys.platform == 'darwin': shortcut = "Cmd+I" else: shortcut = "Ctrl+I" 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>") self.set_rich_text_html(usage(title, intro_message, tutorial_message, tutorial, css_path=self.css_path), QUrl.fromLocalFile(self.css_path)) else: install_sphinx = "\n\n%s" % _("Please consider installing Sphinx " "to get documentation rendered in " "rich text.") intro_message = intro_message % (shortcut, "\n\n", prefs) intro_message += install_sphinx self.set_plain_text(intro_message, is_code=False)
def show_intro_message(self): """Show message on Help with the right shortcuts.""" 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_conf('editor/inspect current object', section='shortcuts') shortcut_console = self.get_conf('console/inspect current object', section='shortcuts') if sys.platform == 'darwin': shortcut_editor = shortcut_editor.replace('Ctrl', 'Cmd') shortcut_console = shortcut_console.replace('Ctrl', 'Cmd') if self.get_conf('rich_mode'): title = _("Usage") tutorial_message = _("New to Spyder? Read our") tutorial = _("tutorial") 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), QUrl.fromLocalFile(self.css_path)) else: install_sphinx = "\n\n%s" % _("Please consider installing Sphinx " "to get documentation rendered in " "rich text.") 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)