ScolaSync: Fichier source de src/diskFull.py

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
29 class mainWindow(QMainWindow):
30 ##
31 #
32 # Le constructeur
33 # @param parent un QWidget
34 # @param percent un pourcentage de remplissage de disque
35 # @param total place totale en kilo-octets
36 # @param used place utilisée en kilo-octets
37 # @param title le titre pour la fenêtre
38 #
39 def __init__(self, parent, percent, total=0, used=0, title="Disk"):
40 QMainWindow.__init__(self)
41 QWidget.__init__(self, parent)
42 from Ui_diskFull import Ui_MainWindow
43 self.ui = Ui_MainWindow()
44 self.ui.setupUi(self)
45 self.setWindowTitle(title)
46 self.v=self.ui.graphicsView
47 self.total=self.ui.label_total
48 self.used=self.ui.label_used
49 self.v.setScene(sceneWithUsage(self.v, QRectF(5,5,230,230), percent))
50 self.total.setText(QApplication.translate("diskFull","Place totale : {size} kilo-octets",None).format(size=total))
51 self.used.setText(QApplication.translate("diskFull","Place utilisée : {size} kilo-octets",None).format(size=used))
52
53 ##
54 #
55 # @param parent le widget père
56 # @param rect le QRect contenant la scène
57 # @param percent pourcentage utilisé
58 # @return une QGraphicsScene avec un symbole d'occupation du disque
59 #
60 def sceneWithUsage(parent, rect, percent):
61 scene=QGraphicsScene(parent)
62 scene.addEllipse ( rect, QPen(), QBrush(QColor("lightyellow")) )
63 usedEllipse=scene.addEllipse (rect, QPen(), QBrush(QColor("slateblue")) )
64 usedEllipse.setStartAngle(0)
65 usedEllipse.setSpanAngle(360 * 16 * percent / 100)
66 return scene
src.diskFull.mainWindow.__init__
def __init__
Le constructeur.
Definition: diskFull.py:39
QtCore
QtWidgets
src.diskFull.mainWindow
Definition: diskFull.py:29
src.diskFull.mainWindow.ui
ui
Definition: diskFull.py:43
src.diskFull.sceneWithUsage
def sceneWithUsage(parent, rect, percent)
Definition: diskFull.py:60
src.diskFull.mainWindow.used
used
Definition: diskFull.py:48
QMainWindow
src.diskFull.mainWindow.v
v
Definition: diskFull.py:46
QtGui
src.diskFull.mainWindow.total
total
Definition: diskFull.py:47