/usr/share/pyshared/Eikazo/Help.py is in eikazo 0.5.2-8.
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 | """
Copyright (c) Abel Deuring 2006 <adeuring@gmx.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
help widget and help window
"""
# FIXME: a decent url parser should be used instead of the wuickly
# hacked stuff.
import os, sys, traceback
import gtk
import webkit # FIXME: use try/except!!
import I18n
t = I18n.get_translation('eikazo')
if t:
_ = t.gettext
else:
_ = lambda x: x
class Help:
def __init__(self):
self.window = None
def show(self, content=None):
dir = os.path.abspath(os.path.split(__file__)[0])
self.dir = os.path.join(dir, 'doc')
fname = os.path.join(self.dir, 'index.html')
fname = "file://" + fname # webkit expects an URI
if not self.window:
self.window = gtk.Window()
self.window.set_title(_('Eikazo Help'))
self.widget = gtk.ScrolledWindow()
self.view = webkit.WebView()
self.widget.add(self.view)
self.view.show()
self.window.add(self.widget)
self.widget.show()
self.window.connect("destroy", self.cb_destroy)
self.window.set_default_size(600, 400)
self.window.show_all()
self.view.load_uri(fname)
def cb_destroy(self, w):
self.window = None
del self.widget
del self.view
if __name__ == '__main__':
h = Help()
h.show()
h.window.show_all()
gtk.main()
|