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

Multiple rst tutorial menu #2225

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions spyderlib/plugins/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,10 +773,10 @@ def show_plain_text(self, text):
self.set_plain_text(text, is_code=False)

@Slot()
def show_tutorial(self):
tutorial_path = get_module_source_path('spyderlib.utils.inspector')
def show_tutorial(self, tutorial_name, source_path='spyderlib.utils.inspector'):
tutorial_path = get_module_source_path(source_path)
img_path = osp.join(tutorial_path, 'static', 'images')
tutorial = osp.join(tutorial_path, 'tutorial.rst')
tutorial = osp.join(tutorial_path, tutorial_name)
text = open(tutorial).read()
if sphinxify is not None:
self.show_rich_text(text, collapse=True, img_path=img_path)
Expand Down
13 changes: 11 additions & 2 deletions spyderlib/spyder.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,16 @@ def create_edit_action(text, tr_text, icon_name):
triggered=lambda : programs.start_file(spyder_doc))

tut_action = create_action(self, _("Spyder tutorial"),
triggered=self.inspector.show_tutorial)
triggered=lambda: self.inspector.show_tutorial('tutorial.rst'))

#----- Other interactive tutorials
# tutorials are located in the spyderlib.utils.inspector directory
self.tutorials_menu = QMenu(_("Scientific tutorials"))
self.tutorials_menu_actions = []
interactive_git_action = create_action(self, _("Version Control System tutorial"),
triggered=lambda: self.inspector.show_tutorial('git_tutorial.rst'))
self.tutorials_menu_actions.append(interactive_git_action)
self.tutorials_menu.addActions(self.tutorials_menu_actions)

#----- Tours
self.tour = tour.AnimatedTour(self)
Expand All @@ -972,7 +981,7 @@ def trigger(i=i, self=self): # closure needed!
if not DEV:
self.tours_menu = None

self.help_menu_actions = [doc_action, tut_action, self.tours_menu,
self.help_menu_actions = [doc_action, tut_action, self.tutorials_menu, self.tours_menu,
None,
report_action, dep_action, support_action,
None]
Expand Down
8 changes: 8 additions & 0 deletions spyderlib/utils/inspector/git_tutorial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
======================================================
Introduction To Control Version System Using Git
======================================================

authored by `Enrico Giampieri <https://github.com/EnricoGiampieri>`_.