Create screen for Rx/Tx

This commit is contained in:
alessandro90
2019-03-30 22:52:26 +01:00
parent 2c7c9b9447
commit 432116a13d
8 changed files with 885 additions and 4923 deletions

37
switchable_label.py Normal file
View File

@@ -0,0 +1,37 @@
from PyQt5.QtWidgets import QLabel
class SwitchableLabel(QLabel):
def __init__(self, parent = None):
super().__init__(parent)
self.switch_on_color = None
self.switch_off_color = None
def set_colors(self, on, off):
self.switch_on_color = on
self.switch_off_color = off
def switch_on(self):
self.setStyleSheet(f"background-color: {self.switch_on_color}")
def switch_off(self):
self.setStyleSheet(f"background-color: {self.switch_off_color}")
class SwitchableLabelIterable(object):
def __init__(self, *labels):
self.labels = labels
def __iter__(self):
for lab in self.labels:
yield lab
def switch_on(label):
for lab in self.labels:
if lab == label:
lab.switch_on()
else:
lab.switch_off()
def switch_off_all(self):
for lab in self.labels:
lab.switch_off()