-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.py
executable file
·61 lines (45 loc) · 1.56 KB
/
options.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (QFrame, QApplication,
QLabel, QCheckBox,
QVBoxLayout)
class Options(QFrame):
"""Classe représentant les options de configuration de GRUB"""
def __init__(self, parent=None):
QFrame.__init__(self, parent)
# Création des éléments
# Label
label = QLabel("Options", self)
label.setAlignment(Qt.AlignHCenter)
# Check Box
self.permanentCB = QCheckBox("Permanent", self)
self.permanentCB.stateChanged.connect(self._setPermanent)
# Layouts
vbox = QVBoxLayout()
vbox.addWidget(label)
vbox.addWidget(self.permanentCB)
# Création des variables
self.permanent = False
# Affichage de l'interface
self.setLayout(vbox)
self.setFrameShape(6)
def _setPermanent(self, state):
if state == Qt.Checked:
self.permanent = True
else:
self.permanent = False
def getPermanent(self):
"""Renvoie l'état du boutton "permanent" """
return self.permanent
def disablePerm(self):
self.permanentCB.setDisabled(True)
def enablePerm(self):
self.permanentCB.setEnabled(True)
if __name__ == "__main__":
app = QApplication(sys.argv)
win = Options()
win.setWindowTitle("Options")
win.show()
sys.exit(app.exec_())