interactiveTutorial package¶
An interactive tutorial viewer and editor based on PyQt4.
Submodules¶
interactiveTutorial.CreateTutorial module¶
-
class
interactiveTutorial.CreateTutorial.
CreateTutorial
(openFunction, saveFunction, tutorialFolder=None, readonly=False, parent=None)¶ Bases:
PyQt4.QtGui.QWidget
Window to create new and modify saved interactive tutorials running within the describing program
>>> from _TestProgram import TestProgram >>> app = QtGui.QApplication([])
Our test gui:
>>> win = TestProgram() >>> win.show()
The tutorial editor:
>>> createTut = CreateTutorial(win.open, win.save, tutorialFolder='testTutorials', readonly=False) >>> createTut.show()
>>> app.exec_() 0
-
__init__
(openFunction, saveFunction, tutorialFolder=None, readonly=False, parent=None)¶ Argument Description openFunction Function used to open saved session of a program through calling openFunction([filePath]) saveFunction Function used to save a session of a program through calling saveFunction([filePath]) [OPTIONAL] tutorialFolder Root directory of the tutorial files readonly [True/False] True: tutorials within [tutorialFolder] cannot be modified parent Parent of this QWidget
-
closeEvent
(evt)¶ deactivate current widget when widget is closed
-
load
(path, rootDir)¶ Load a saved tutorial for editing
-
new
()¶ start new tutorial (delete old tabs)
-
removeTab
(index)¶ remove a step of the tutorial
-
save
()¶ save this tutorial to file
-
interactiveTutorial.RunTutorial module¶
-
class
interactiveTutorial.RunTutorial.
RunTutorial
(path, openFunction, parent=None)¶ Bases:
PyQt4.QtGui.QWidget
,interactiveTutorial._TutorialBase.TutorialBase
Always-on-top-window to control (Restart, Next, Previous) the chosen tutorial
>>> from _TestProgram import TestProgram >>> app = QtGui.QApplication([])
Our test gui:
>>> win = TestProgram() >>> win.show()
First tutorial file in tutorial folder:
>>> p = PathStr('testTutorials') >>> tut_file = p.join(p.listdir()[0])
The Tutorial widget:
>>> tut = RunTutorial(tut_file, win.open) >>> tut.show()
>>> app.exec_() 0
-
__init__
(path, openFunction, parent=None)¶ Argument Description path Path of the tutorial file to open openFunction Function used to open saved session of a program through calling openFunction([filePath]) [OPTIONAL] parent Parent of this QWidget
-
closeEvent
(evt)¶
-
nextStep
()¶ go to the next tutorial step
-
previousStep
()¶ go one step back in the tutorial
-
restart
()¶ restart the tutorial
-
unpackFile
(path)¶ unpack [path].pyz file to path should be PYZ file with the following content:
File Description tutorial.txt stores widget positions and tutorial texts session.pyz the initial session from where the tutorial starts [optional] if this file is not given the tutorial starts with a new session end.pyz TODO: the final state of the tutorial
-
interactiveTutorial.TutorialMenu module¶
-
class
interactiveTutorial.TutorialMenu.
TutorialMenu
(tutorialFolder, openFunction, saveFunction, title='Tutorial', readonly=False, **kwargs)¶ Bases:
PyQt4.QtGui.QMenu
A QMenu containing- ‘Run’ - listing all saved tutorials to run
- ‘Create/Edit’ - open the tutorial editor
>>> from _TestProgram import TestProgram >>> app = QtGui.QApplication([])
Our test gui:
>>> win = TestProgram()
Add a tutorial menu the the menubar of our gui: [Note: If you use this within a class you have to attach the menu to e.g. self!]
>>> menu = TutorialMenu( tutorialFolder='testTutorials', openFunction=win.open, saveFunction=win.save ) >>> _ = win.menuBar().addMenu(menu)
>>> win.show() >>> app.exec_() 0
-
__init__
(tutorialFolder, openFunction, saveFunction, title='Tutorial', readonly=False, **kwargs)¶ Argument Description tutorialFolder Root directory of the tutorial files openFunction Function used to open saved session of a program through calling openFunction([filePath]) saveFunction Function used to save a session of a program through calling saveFunction([filePath]) [OPTIONAL] title the name of the QMenu readonly [True/False] True: tutorials within [tutorialFolder] cannot be modified
-
createTutorial
()¶ Close old tutorial and open tutorial editor
-
runTutorial
(path)¶ Close old and run a new tutorial