Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Object Inspector plugin to Help #2873

Merged
merged 24 commits into from
Dec 19, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
33efd6d
Rename plugins/inspector to plugins/help
ccordoba12 Dec 16, 2015
1ba70a0
Help: Rename several variables according to this new plugin name
ccordoba12 Dec 16, 2015
328da87
Main Window: Rename "inspector" attr to "help"
ccordoba12 Dec 16, 2015
8326707
rope_patch: Remove references to the Object Inspector
ccordoba12 Dec 17, 2015
21ffb89
Rename conf section from "inspector" to "help"
ccordoba12 Dec 17, 2015
e75725e
Intro tour: Remove references to the Object Inspector
ccordoba12 Dec 17, 2015
6e99a61
Rename file to save results from searches in the Help pane
ccordoba12 Dec 17, 2015
fa2b333
Introspection: Rename signal referring to the Object Inspector
ccordoba12 Dec 17, 2015
2e82410
Rename inspector icon to help
ccordoba12 Dec 17, 2015
658574a
Remove several references to the Object Inspector in utils
ccordoba12 Dec 18, 2015
deeb85d
Rename utils/inspector to utils/help
ccordoba12 Dec 18, 2015
6f91260
IPython console: Remove several references to the Object Inspector
ccordoba12 Dec 18, 2015
b836cc8
Editor: Remove references to the Object Inspector
ccordoba12 Dec 18, 2015
5328d39
Testing: Fix error when running sphinxify
ccordoba12 Dec 18, 2015
4ac2a66
Help: Rename another reference to inspector
ccordoba12 Dec 19, 2015
40491c4
External Console: Rename several references to inspector
ccordoba12 Dec 19, 2015
fe312d0
Fix more references to the Object Inspector
ccordoba12 Dec 19, 2015
e2c49a2
Remove last references to the Object inspector
ccordoba12 Dec 19, 2015
215d4bc
Spyplugins: Fix outdated references to the Object Inspector
ccordoba12 Dec 19, 2015
800f9ac
Help: Tabify it next to the Variable Explorer
ccordoba12 Dec 19, 2015
244a674
Docs: Replace references to the Object Inspector for Help
ccordoba12 Dec 19, 2015
e156f1f
Readme: Remove reference to the Object Inspector
ccordoba12 Dec 19, 2015
94ed287
LICENSE: Fix it after renaming inspector png icon
ccordoba12 Dec 19, 2015
5b5e9a6
Testing: Skip utils/help from testing
ccordoba12 Dec 19, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Help: Rename several variables according to this new plugin name
  • Loading branch information
ccordoba12 committed Dec 16, 2015
commit 1ba70a04bb80386fdeafb446c45e821a96a99d4c
43 changes: 21 additions & 22 deletions spyderlib/plugins/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)

"""Object Inspector Plugin"""
"""Help Plugin"""

from spyderlib.qt import PYQT5
from spyderlib.qt.QtGui import (QHBoxLayout, QVBoxLayout, QLabel, QSizePolicy,
Expand Down Expand Up @@ -55,7 +55,7 @@

# To add sphinx dependency to the Dependencies dialog
SPHINX_REQVER = '>=0.6.6'
dependencies.add("sphinx", _("Rich text help on the Object Inspector"),
dependencies.add("sphinx", _("Rich text help"),
required_version=SPHINX_REQVER)


Expand All @@ -68,29 +68,29 @@ class ObjectComboBox(EditableComboBox):

def __init__(self, parent):
EditableComboBox.__init__(self, parent)
self.object_inspector = parent
self.help = parent
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.tips = {True: '', False: ''}

def is_valid(self, qstr=None):
"""Return True if string is valid"""
if not self.object_inspector.source_is_console():
if not self.help.source_is_console():
return True
if qstr is None:
qstr = self.currentText()
if not re.search('^[a-zA-Z0-9_\.]*$', str(qstr), 0):
return False
objtxt = to_text_string(qstr)
if self.object_inspector.get_option('automatic_import'):
shell = self.object_inspector.internal_shell
if self.help.get_option('automatic_import'):
shell = self.help.internal_shell
if shell is not None:
return shell.is_defined(objtxt, force_import=True)
shell = self.object_inspector.get_shell()
shell = self.help.get_shell()
if shell is not None:
try:
return shell.is_defined(objtxt)
except socket.error:
shell = self.object_inspector.get_shell()
shell = self.help.get_shell()
try:
return shell.is_defined(objtxt)
except socket.error:
Expand All @@ -116,7 +116,7 @@ def validate(self, qstr, editing=True):
self.valid.emit(False, False)


class ObjectInspectorConfigPage(PluginConfigPage):
class HelpConfigPage(PluginConfigPage):
def setup_page(self):
# Fonts group
plain_text_font_group = self.create_fontgroup(option=None,
Expand All @@ -127,7 +127,7 @@ def setup_page(self):

# Connections group
connections_group = QGroupBox(_("Automatic connections"))
connections_label = QLabel(_("The Object Inspector can automatically "
connections_label = QLabel(_("This pane can automatically "
"show an object's help information after "
"a left parenthesis is written next to it. "
"Below you can decide to which plugin "
Expand Down Expand Up @@ -348,12 +348,12 @@ def run(self):
self.html_ready.emit(html_text)


class ObjectInspector(SpyderPluginWidget):
class Help(SpyderPluginWidget):
"""
Docstrings viewer widget
"""
CONF_SECTION = 'inspector'
CONFIGWIDGET_CLASS = ObjectInspectorConfigPage
CONFIGWIDGET_CLASS = HelpConfigPage
LOG_PATH = get_conf_path(CONF_SECTION)
focus_changed = Signal()

Expand Down Expand Up @@ -515,7 +515,7 @@ def __init__(self, parent):
#------ SpyderPluginWidget API ---------------------------------------------
def get_plugin_title(self):
"""Return widget title"""
return _('Object inspector')
return _('Help')

def get_plugin_icon(self):
"""Return widget icon"""
Expand Down Expand Up @@ -741,7 +741,7 @@ def show_intro_message(self):
"Help can also be shown automatically after writing "
"a left parenthesis next to an object. You can "
"activate this behavior in %s.")
prefs = _("Preferences > Object Inspector")
prefs = _("Preferences > Help")
if sys.platform == 'darwin':
shortcut = "Cmd+I"
else:
Expand Down Expand Up @@ -810,7 +810,7 @@ def force_refresh(self):
self.set_editor_doc(self._last_editor_doc, force_refresh=True)

def set_object_text(self, text, force_refresh=False, ignore_unknown=False):
"""Set object analyzed by Object Inspector"""
"""Set object analyzed by Help"""
if (self.locked and not force_refresh):
return
self.switch_to_console_source()
Expand All @@ -831,13 +831,13 @@ def set_object_text(self, text, force_refresh=False, ignore_unknown=False):

if self.dockwidget is not None:
self.dockwidget.blockSignals(True)
self.__eventually_raise_inspector(text, force=force_refresh)
self.__eventually_raise_help(text, force=force_refresh)
if self.dockwidget is not None:
self.dockwidget.blockSignals(False)

def set_editor_doc(self, doc, force_refresh=False):
"""
Use the object inspector to show docstring dictionary computed
Use the help plugin to show docstring dictionary computed
with introspection plugin from the Editor plugin
"""
if (self.locked and not force_refresh):
Expand All @@ -853,12 +853,11 @@ def set_editor_doc(self, doc, force_refresh=False):

if self.dockwidget is not None:
self.dockwidget.blockSignals(True)
self.__eventually_raise_inspector(doc['docstring'],
force=force_refresh)
self.__eventually_raise_help(doc['docstring'], force=force_refresh)
if self.dockwidget is not None:
self.dockwidget.blockSignals(False)

def __eventually_raise_inspector(self, text, force=False):
def __eventually_raise_help(self, text, force=False):
index = self.source_combo.currentIndex()
if hasattr(self.main, 'tabifiedDockWidgets'):
# 'QMainWindow.tabifiedDockWidgets' was introduced in PyQt 4.5
Expand Down Expand Up @@ -949,7 +948,7 @@ def set_shell(self, shell):
self.shell = shell

def get_shell(self):
"""Return shell which is currently bound to object inspector,
"""Return shell which is currently bound to Help,
or another running shell if it has been terminated"""
if not isinstance(self.shell, ExtPythonShellWidget) \
or not self.shell.externalshell.is_running():
Expand Down Expand Up @@ -978,7 +977,7 @@ def _on_sphinx_thread_error_msg(self, error_msg):
self._sphinx_thread.wait()
self.plain_text_action.setChecked(True)
QMessageBox.critical(self,
_('Object inspector'),
_('Help'),
_("The following error occured when calling "
"<b>Sphinx %s</b>. <br>Incompatible Sphinx "
"version or doc string decoding failed."
Expand Down
6 changes: 3 additions & 3 deletions spyderlib/spyder.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,9 +836,9 @@ def create_edit_action(text, tr_text, icon):

# Object inspector plugin
if CONF.get('inspector', 'enable'):
self.set_splash(_("Loading object inspector..."))
from spyderlib.plugins.help import ObjectInspector
self.inspector = ObjectInspector(self)
self.set_splash(_("Loading help..."))
from spyderlib.plugins.help import Help
self.inspector = Help(self)
self.inspector.register_plugin()

# Outline explorer widget
Expand Down