Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[a37b2b]: plugins / help.py Maximize Restore History

Download this file

help.py    61 lines (45 with data), 1.7 kB

 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
'''
This software is licensed under the GPL (GNU General Public License) version 2
as it appears here: http://www.gnu.org/copyleft/gpl.html
It is also included with this archive as `gpl.txt <gpl.txt>`_.
'''
import wx
import wx.html as html
import sys
import os
import webbrowser
a = _pype.runpath + '/readme.html'
class MyHtmlWindow(html.HtmlWindow):
def __init__(self, parent):
html.HtmlWindow.__init__(self, parent,
style=wx.NO_FULL_REPAINT_ON_RESIZE|wx.SUNKEN_BORDER)
if "gtk2" in wx.PlatformInfo:
self.SetStandardFonts()
wx.CallAfter(self.LoadPage, a)
def OnLinkClicked(self, link):
a = link.GetHref()
if a.startswith('#'):
self.base_OnLinkClicked(link)
else:
webbrowser.open(a)
def LoadPage(self, fn):
self.SetPage(open(fn).read().replace('; charset=utf-8', ''))
class HtmlHelpDialog(wx.Dialog):
def __init__(self, parent):
wx.Dialog.__init__(self, parent, title="PyPE Help",
style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER, pos=(0,0))
w, h = parent.GetSizeTuple()
self.SetSize((3*w//4, 3*h//4))
self.CentreOnParent()
p = self
s = wx.BoxSizer(wx.VERTICAL)
self.html = MyHtmlWindow(p)
s.Add(self.html, 1, wx.EXPAND|wx.ALL, 5)
s2 = wx.BoxSizer(wx.HORIZONTAL)
s2.Add(wx.StaticText(p, -1, ""), 1, wx.EXPAND)
s2.Add(wx.Button(p, wx.ID_OK, "OK"), 0, wx.EXPAND)
s2.Add(wx.StaticText(p, -1, ""), 1, wx.EXPAND)
s.Add(s2, 0, wx.EXPAND|wx.ALL, 5)
p.SetSizer(s)
p.SetAutoLayout(1)
p.Layout()