-
Notifications
You must be signed in to change notification settings - Fork 7
/
widget.py
42 lines (32 loc) · 1.15 KB
/
widget.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
from Qt import QtWidgets
class CustomBoxLayout(QtWidgets.QBoxLayout):
""" Custom layout with less spacing between widgets """
def __init__(self, parent=None):
super(CustomBoxLayout, self).__init__(parent)
self.setSpacing(2)
self.setContentsMargins(2, 2, 2, 2)
class CustomLabel(QtWidgets.QLabel):
""" Custom QLabel to show green/red color """
def __init__(self, parent=None):
super(CustomLabel, self).__init__(parent)
def toRed(self):
self.setStyleSheet("""
background-color: darkred;
border-radius: 4px;
border-width: 1px;
border-color: gray;
border-style: solid""")
def toGreen(self):
self.setStyleSheet("""
background-color: green;
border-radius: 4px;
border-width: 1px;
border-color: gray;
border-style: solid""")
def toDefault(self):
self.setStyleSheet("""
background-color:;
border-radius: 4px;
border-width: 1px;
border-color: gray;
border-style: solid""")