/usr/share/cain/gui/Help.py is in cain 1.10+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | """Implements the help window."""
# If we are running the unit tests.
if __name__ == '__main__':
import sys
sys.path.insert(1, '..')
resourcePath = '../'
else:
from resourcePath import resourcePath
import os.path
import wx
from HtmlWindow import HtmlWindow
data = ['Acknowledgments',
'License',
'Introduction',
'Installation',
'Platform-Specific Information',
["User's Guide",
['Overview',
'Quick Start',
'Model List',
'Method Editor',
'Recorder',
'Launcher',
'Simulation Output',
'Species Editor',
'Reaction Editor',
'Parameter Editor',
'Compartment Editor',
'Tool Bar',
'Mathematical Expressions']],
['Examples',
['Birth-Death',
'Immigration-Death']],
['Simulation Methods',
['Discrete Stochastic Simulations',
'Direct Method',
'First Reaction Method',
'Next Reaction Method',
'Tau-Leaping',
'Direct Method with Time-Dependent Propensities',
'Hybrid Direct/Tau-Leaping',
'ODE Integration']],
['Performance',
['Exact Methods']],
["Developer's Guide",
['Command Line Solvers',
'File Formats',
'Adding New Solvers']],
['Cain XML File Format',
['Top-Level Elements',
'Models',
'Methods',
'Output',
'Random Numbers']],
'FAQ',
'Links',
'Bibliography',
'Known Issues',
'To Do']
class Help(wx.Frame):
"""The help window."""
def __init__(self, parent=None, title='Cain help'):
"""Read and render the HTML help file."""
wx.Frame.__init__(self, parent, -1, title, size=(1100,750))
splitter = wx.SplitterWindow(self)
self.contents = wx.TreeCtrl(splitter,
style=wx.TR_HIDE_ROOT|wx.TR_DEFAULT_STYLE)
root = self.contents.AddRoot('Cain Help')
self.addTreeNodes(root, data)
self.Bind(wx.EVT_TREE_SEL_CHANGED, self.onActivated, self.contents)
self.html = HtmlWindow(splitter)
if "gtk2" in wx.PlatformInfo:
self.html.SetStandardFonts()
# The window title.
self.html.SetRelatedFrame(self, self.GetTitle() + " -- %s")
# Status bar.
self.CreateStatusBar()
self.html.SetRelatedStatusBar(0)
splitter.SetMinimumPaneSize(10)
splitter.SplitVertically(self.contents, self.html, 200)
self.html.LoadPage(os.path.join(resourcePath, 'gui/help.html'))
def addTreeNodes(self, parent, items):
for item in items:
if type(item) == str:
self.contents.AppendItem(parent, item)
else:
newItem = self.contents.AppendItem(parent, item[0])
self.addTreeNodes(newItem, item[1])
def onActivated(self, event):
label = self.contents.GetItemText(event.GetItem())
self.html.OnLinkClicked(wx.html.HtmlLinkInfo('#' + label))
def main():
app = wx.PySimpleApp()
frame = Help()
frame.Show()
app.MainLoop()
if __name__ == '__main__':
main()
|