Aller à la documentation de ce fichier.00001
00002
00003
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
00033
00034
00035
00036
00037
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 self.v.setScene(sceneWithUsage(self.v, QRectF(5,5,230,230), percent))
00050 self.total.setText(QApplication.translate("diskFull","Place totale : %1 kilo-octets",None, QApplication.UnicodeUTF8).arg(total))
00051 self.used.setText(QApplication.translate("diskFull","Place utilisée : %1 kilo-octets",None, QApplication.UnicodeUTF8).arg(used))
00052
00053
00054
00055
00056
00057
00058
00059
00060 def sceneWithUsage(parent, rect, percent):
00061 scene=QGraphicsScene(parent)
00062 scene.addEllipse ( rect, QPen(), QBrush(QColor("lightyellow")) )
00063 usedEllipse=scene.addEllipse (rect, QPen(), QBrush(QColor("slateblue")) )
00064 usedEllipse.setStartAngle(0)
00065 usedEllipse.setSpanAngle(360 * 16 * percent / 100)
00066 return scene
00067