File: help.py

package info (click to toggle)
releaseforge 1.1-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,088 kB
  • ctags: 1,239
  • sloc: python: 13,801; makefile: 68; sh: 32
file content (55 lines) | stat: -rwxr-xr-x 1,177 bytes parent folder | download
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
#  help.py: -*- Python -*-  DESCRIPTIVE TEXT.

from qt import *
import xpm
import os
import sys
from helpBA import HelpBA


def getAppPath():
    fullpath = os.path.abspath(sys.argv[0])
    path = os.path.dirname(fullpath)
    return path


def findFile(filename):
    dirs = [getAppPath(),
            os.path.join("/", "usr", "share", "releaseforge"),
            os.path.join("/", "usr", "local", "releaseforge")]

    for d in dirs:
        path = os.path.join(d, filename)
        if os.access(path, os.R_OK): return path


    
                

class Help(HelpBA):
    def __init__(self, parent, filename):
        HelpBA.__init__(self, None)
        self.setGeometry(100, 50, 800, 600)
        self.setIcon(QPixmap(xpm.helpIcon))

        absPath = self.getHelpFile(filename)

        self.helpTextBrowser.setSource(absPath)
        self.show()


    def back_slot(self):
        self.helpTextBrowser.backward()

    def home_slot(self):
        self.helpTextBrowser.home()

    def forward_slot(self):
        self.helpTextBrowser.forward()
    
    def getHelpFile(self, filename):
        f = findFile(os.path.join("help", filename))
        return f