ScolaSync  1.0
help.py
Aller à la documentation de ce fichier.
00001 #!/usr/bin/python
00002 # -*- coding: utf-8 -*-
00003 #       $Id: help.py 47 2011-06-13 10:20:14Z georgesk $ 
00004 
00005 licence={}
00006 licence['en']="""
00007     file help.py
00008     this file is part of the project scolasync
00009     
00010     Copyright (C) 2010 Georges Khaznadar <georgesk@ofset.org>
00011 
00012     This program is free software: you can redistribute it and/or modify
00013     it under the terms of the GNU General Public License as published by
00014     the Free Software Foundation, either version3 of the License, or
00015     (at your option) any later version.
00016 
00017     This program is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020     GNU General Public License for more details.
00021 
00022     You should have received a copy of the GNU General Public License
00023     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00024 """
00025 
00026 from PyQt4.QtCore import *
00027 from PyQt4.QtGui import *
00028 import version
00029 from globaldef import _dir
00030 from xml.dom.minidom import parse
00031 
00032 class helpWindow(QDialog):
00033     ##
00034     # 
00035     #         Le constructeur
00036     #         
00037     def __init__(self, parent=None):
00038         QDialog.__init__(self, parent)
00039         from Ui_help import Ui_Aide
00040         self.ui=Ui_Aide()
00041         self.ui.setupUi(self)
00042         self.ui.labelVersion.setText(QApplication.translate("Main","Version numéro %1.%2",None, QApplication.UnicodeUTF8).arg(version.major(), version.minor()))
00043         self.loadBrowsers(_dir("help"),self.parent().locale)
00044         QObject.connect(self.ui.closeButton, SIGNAL("clicked()"), self.close)
00045 
00046     ##
00047     # 
00048     #         met en place les textes dans les afficheurs, en fonction de la locale.
00049     #         le répertoire où sont les textes au format HTML est \b dir.
00050     #         @param dir le répertoire où sont les fichiers HTML
00051     #         @param locale la langue choisie
00052     #         
00053     def loadBrowsers(self, dir, locale):
00054         self.ui.usageBrowser.setHtml(QUrl("file://"+dir+"/usage_"+locale+".html"))
00055         self.ui.authorsBrowser.setHtml(QUrl("file://"+dir+"/authors_"+locale+".html"))
00056         self.ui.licenseBrowser.setHtml(QUrl("file://"+dir+"/license_"+locale+".html"))
00057         self.ui.languagesBrowser.setHtml(QUrl("file://"+dir+"/languages_"+locale+".html"))
00058         # parses the manual-tab's text to include the custom
00059         # manual's URL.
00060         manuals=parse(dir+"/manual_"+locale+".html")
00061         dl=manuals.documentElement.getElementsByTagName("dl")[0]
00062         dd=dl.getElementsByTagName("dd")[1]
00063         a=dd.getElementsByTagName("a")[0]
00064         a.setAttribute("href", self.parent().manFileLocation)
00065         # then sets the manual-tab's contents
00066         self.ui.manualBrowser.setText(manuals.toxml())
00067 
 Tout Classes Espaces de nommage Fichiers Fonctions Variables