# mytextbrowser.py

Aller à la documentation de ce fichier.

    00001 #!/usr/bin/python
    00002 # -*- coding: utf-8 -*-
    00003 #       $Id: mytextbrowser.py 8 2010-10-11 10:03:05Z georgesk $
    00004
    00005 licence={}
    00006 licence['en']="""
    00007     file mytextbrowser.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 subprocess
    00029
    00030 ##
    00031 #
    00032 #     Une classe qui ouvre Firefox quand on clique sur un lien externe
    00033 #
    00034 class myTextBrowser(QTextBrowser):
    00035     ##
    00036     #
    00037     #         lance Firefox en tâche de fond.
    00038     #         @param url l'adresse à ouvrir.
    00039     #
    00040     def setSource(self,url):
    00041         subprocess.call("(firefox %s &)"%url.toString(),shell=True)
    00042
    00043     ##
    00044     #
    00045     #         lien vers la méthode setSource originale
    00046     #         @param url l'adresse à ouvrir.
    00047     #
    00048     def setHtml(self,url):
    00049         QTextBrowser.setSource(self,url)
    00050