ScolaSync  5.1
diskFull.py
Aller à la documentation de ce fichier.
1 #!/usr/bin/python
2 # $Id: diskFull.py 33 2010-12-12 00:39:46Z georgesk $
3 
4 licence={}
5 licence['en']="""
6  file diskFull.py
7  this file is part of the project scolasync
8 
9  Copyright (C) 2010 Georges Khaznadar <georgesk@ofset.org>
10 
11  This program is free software: you can redistribute it and/or modify
12  it under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version3 of the License, or
14  (at your option) any later version.
15 
16  This program is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with this program. If not, see <http://www.gnu.org/licenses/>.
23 """
24 
25 from PyQt5.QtCore import *
26 from PyQt5.QtWidgets import *
27 from PyQt5.QtGui import *
28 
30 
37 
38  def __init__(self, parent, percent, total=0, used=0, title="Disk"):
39  QMainWindow.__init__(self)
40  QWidget.__init__(self, parent)
41  from Ui_diskFull import Ui_MainWindow
42  self.ui = Ui_MainWindow()
43  self.ui.setupUi(self)
44  self.setWindowTitle(title)
45  self.v=self.ui.graphicsView
46  self.total=self.ui.label_total
47  self.used=self.ui.label_used
48  self.v.setScene(sceneWithUsage(self.v, QRectF(5,5,230,230), percent))
49  self.total.setText(QApplication.translate("diskFull","Place totale : {size} kilo-octets",None).format(size=total))
50  self.used.setText(QApplication.translate("diskFull","Place utilisée : {size} kilo-octets",None).format(size=used))
51 
52 
57 
58 def sceneWithUsage(parent, rect, percent):
59  scene=QGraphicsScene(parent)
60  scene.addEllipse ( rect, QPen(), QBrush(QColor("lightyellow")) )
61  usedEllipse=scene.addEllipse (rect, QPen(), QBrush(QColor("slateblue")) )
62  usedEllipse.setStartAngle(0)
63  usedEllipse.setSpanAngle(360 * 16 * percent / 100)
64  return scene
src.diskFull.mainWindow.ui
ui
Definition: diskFull.py:42
src.diskFull.mainWindow
Definition: diskFull.py:29
QMainWindow
src.diskFull.mainWindow.used
used
Definition: diskFull.py:47
QtCore
src.diskFull.sceneWithUsage
def sceneWithUsage(parent, rect, percent)
Definition: diskFull.py:58
QtGui
src.diskFull.mainWindow.total
total
Definition: diskFull.py:46
QtWidgets
src.diskFull.mainWindow.v
v
Definition: diskFull.py:45
src.diskFull.mainWindow.__init__
def __init__(self, parent, percent, total=0, used=0, title="Disk")
Le constructeur.
Definition: diskFull.py:38