ScolaSync  4.0
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
help.py
Aller à la documentation de ce fichier.
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # $Id: help.py 47 2011-06-13 10:20:14Z georgesk $
4 
5 licence={}
6 licence['en']="""
7  file help.py
8  this file is part of the project scolasync
9 
10  Copyright (C) 2010 Georges Khaznadar <georgesk@ofset.org>
11 
12  This program is free software: you can redistribute it and/or modify
13  it under the terms of the GNU General Public License as published by
14  the Free Software Foundation, either version3 of the License, or
15  (at your option) any later version.
16 
17  This program is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with this program. If not, see <http://www.gnu.org/licenses/>.
24 """
25 
26 python3safe=True
27 
28 from PyQt4.QtCore import *
29 from PyQt4.QtGui import *
30 import version
31 from globaldef import _dir
32 from xml.dom.minidom import parse
33 
35  ##
36  #
37  # Le constructeur
38  #
39  def __init__(self, parent=None):
40  QDialog.__init__(self, parent)
41  from Ui_help import Ui_Aide
42  self.ui=Ui_Aide()
43  self.ui.setupUi(self)
44  self.ui.labelVersion.setText(QApplication.translate("Main","Version numéro {major}.{minor}",None, QApplication.UnicodeUTF8).format(major=version.major(), minor=version.minor()))
45  self.loadBrowsers(_dir("help"),self.parent().locale)
46  QObject.connect(self.ui.closeButton, SIGNAL("clicked()"), self.close)
47 
48  ##
49  #
50  # met en place les textes dans les afficheurs, en fonction de la locale.
51  # le répertoire où sont les textes au format HTML est \b dir.
52  # @param dir le répertoire où sont les fichiers HTML
53  # @param locale la langue choisie
54  #
55  def loadBrowsers(self, dir, locale):
56  self.ui.usageBrowser.setHtml(QUrl("file://"+dir+"/usage_"+locale+".html"))
57  self.ui.authorsBrowser.setHtml(QUrl("file://"+dir+"/authors_"+locale+".html"))
58  self.ui.licenseBrowser.setHtml(QUrl("file://"+dir+"/license_"+locale+".html"))
59  self.ui.languagesBrowser.setHtml(QUrl("file://"+dir+"/languages_"+locale+".html"))
60  # parses the manual-tab's text to include the custom
61  # manual's URL.
62  manuals=parse(dir+"/manual_"+locale+".html")
63  dl=manuals.documentElement.getElementsByTagName("dl")[0]
64  dd=dl.getElementsByTagName("dd")[1]
65  a=dd.getElementsByTagName("a")[0]
66  a.setAttribute("href", self.parent().manFileLocation)
67  # then sets the manual-tab's contents
68  self.ui.manualBrowser.setText(manuals.toxml())
69