# diskFull.py

Aller à la documentation de ce fichier.

    00001 #!/usr/bin/python
    00002 # -*- coding: utf-8 -*-
    00003 #       $Id: diskFull.py 33 2010-12-12 00:39:46Z georgesk $
    00004
    00005 licence={}
    00006 licence['en']="""
    00007     file diskFull.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
    00029 class mainWindow(QMainWindow):
    00030     ##
    00031     #
    00032     #         Le constructeur
    00033     #         @param parent un QWidget
    00034     #         @param percent un pourcentage de remplissage de disque
    00035     #         @param total place totale en kilo-octets
    00036     #         @param used place utilisée en kilo-octets
    00037     #         @param title le titre pour la fenêtre
    00038     #
    00039     def __init__(self, parent, percent, total=0, used=0, title="Disk"):
    00040         QMainWindow.__init__(self)
    00041         QWidget.__init__(self, parent)
    00042         from Ui_diskFull  import Ui_MainWindow
    00043         self.ui = Ui_MainWindow()
    00044         self.ui.setupUi(self)
    00045         self.setWindowTitle(title)
    00046         self.v=self.ui.graphicsView
    00047         self.total=self.ui.label_total
    00048         self.used=self.ui.label_used
    00049         scene=QGraphicsScene(self.ui.graphicsView)
    00050         rect=QRectF(5,5,230,230)
    00051         scene.addEllipse ( rect, QPen(), QBrush(QColor("lightyellow")) )
    00052         usedEllipse=scene.addEllipse (rect, QPen(), QBrush(QColor("slateblue")) )
    00053         usedEllipse.setStartAngle(0)
    00054         usedEllipse.setSpanAngle(360 * 16 * percent / 100)
    00055         self.v.setScene(scene)
    00056         self.total.setText(QApplication.translate("diskFull","Place totale : %1 kilo-octets",None, QApplication.UnicodeUTF8).arg(total))
    00057         self.used.setText(QApplication.translate("diskFull","Place utilisée : %1 kilo-octets",None, QApplication.UnicodeUTF8).arg(used))
    00058
    00059