Commit 39c9c9f5 authored by Tiago Sarmento's avatar Tiago Sarmento

small improvements

parent 1feef9c3
Pipeline #972 failed
......@@ -27,13 +27,13 @@ class alarmList(QtWidgets.QWidget):
self.alarmList.addItem("alarm the ring")
self.vlayout.addWidget(self.alarmList)
self.setLayout(self.vlayout)
self.alarmList.itemClicked.connect(self.selected)
# self.alarmList.itemClicked.connect(self.selected)
def selected(self):
items = self.test.selectedItems()
for item in items:
item.setText("newtestText")
item.setIcon(self.regularBell)
# def selected(self):
# items = self.test.selectedItems()
# for item in items:
# item.setText("newtestText")
# item.setIcon(self.regularBell)
def acknowledge_all(self):
for x in range(self.alarmList.count() - 1):
......
......@@ -2,7 +2,7 @@ from PySide2 import QtWidgets, QtGui, QtCore
from global_widgets.global_typeval_popup import TypeValuePopup
class signallingSpinBox(QtWidgets.QSpinBox):
class signallingSpinBox(QtWidgets.QDoubleSpinBox):
manualChanged = QtCore.Signal()
def __init__(self, NativeUI):
......@@ -47,7 +47,11 @@ class labelledSpin(QtWidgets.QWidget):
self.NativeUI = NativeUI
self.template = template
self.cmd_type, self.cmd_code = "", ""
if len(infoArray) == 5:
self.min, self.max, self.step = 0,10000,0.3
self.decPlaces = 2
if len(infoArray) == 9:
self.label, self.units, self.tag, self.cmd_type, self.cmd_code, self.min, self.max, self.step, self.decPlaces = infoArray
elif len(infoArray) == 5:
self.label, self.units, self.tag, self.cmd_type, self.cmd_code = infoArray
elif len(infoArray) == 3:
self.label, self.units, self.tag = infoArray
......@@ -63,14 +67,17 @@ class labelledSpin(QtWidgets.QWidget):
widgetList.append(self.nameLabel)
self.simpleSpin = signallingSpinBox(NativeUI)
self.simpleSpin.setRange(self.min, self.max)
self.simpleSpin.setSingleStep(self.step)
self.simpleSpin.setDecimals(self.decPlaces)
self.simpleSpin.setStyleSheet(
"""QSpinBox{ width:100px; font:16pt}
QSpinBox[bgColour="0"]{background-color:white; }
QSpinBox[bgColour="1"]{background-color:grey; }
QSpinBox[textColour="0"]{color:black}
QSpinBox[textColour="1"]{color:red}
QSpinBox::up-button{width:20; border:solid white; color:black }
QSpinBox::down-button{width:20; }
"""QDoubleSpinBox{ width:100px; font:16pt}
QDoubleSpinBox[bgColour="0"]{background-color:white; }
QDoubleSpinBox[bgColour="1"]{background-color:grey; }
QDoubleSpinBox[textColour="0"]{color:black}
QDoubleSpinBox[textColour="1"]{color:red}
QDoubleSpinBox::up-button{width:20; border:solid white; color:black }
QDoubleSpinBox::down-button{width:20; }
"""
)
self.simpleSpin.setProperty("textColour", "0")
......@@ -101,7 +108,6 @@ class labelledSpin(QtWidgets.QWidget):
self.template.liveUpdating = False
self.manuallyUpdated = True
self.simpleSpin.setProperty("textColour", "1")
# self.expertButton.style().unpolish(self.expertButton)
self.simpleSpin.style().polish(self.simpleSpin)
def update_readback_value(self):
......
......@@ -194,7 +194,7 @@ class TemplateSetValues(QtWidgets.QWidget):
setVal = self.spinDict[widget].simpleSpin.value()
message.append("set" + widget + " to " + str(setVal))
command.append(
[self.spinDict[widget].cmd_type, self.spinDict[widget].cmd_code, 10]
[self.spinDict[widget].cmd_type, self.spinDict[widget].cmd_code, setVal]
)
self.popup = SetConfirmPopup(self, self.NativeUI, message, command)
self.popup.okButton.pressed.connect(self.commandSent)
......
......@@ -3,12 +3,14 @@ import sys
from PySide2 import QtCore, QtGui, QtWidgets
from global_widgets.global_typeval_popup import TypeValuePopup
from global_widgets.global_ok_cancel_buttons import okButton, cancelButton
from global_widgets.global_spinbox import signallingSpinBox
class SpinButton(QtWidgets.QFrame):
def __init__(self, NativeUI):
super().__init__()
self.liveUpdating = True
# self.setStyleSheet("background-color:blue;")
self.currentVal = 0
......@@ -29,10 +31,11 @@ class SpinButton(QtWidgets.QFrame):
self.label.setAlignment(QtCore.Qt.AlignCenter)
self.layout.addWidget(self.label)
self.doubleSpin = QtWidgets.QDoubleSpinBox()
self.doubleSpin.lineEdit().installEventFilter(
self
) # override is defined in 'eventFilter'. ensures lineEdit responds to double mouse click
self.doubleSpin = signallingSpinBox(NativeUI)
# self.doubleSpin = QtWidgets.QDoubleSpinBox()
# self.doubleSpin.lineEdit().installEventFilter(
# self
# ) # override is defined in 'eventFilter'. ensures lineEdit responds to double mouse click
self.doubleSpin.lineEdit().setStyleSheet("border:blue;")
boxStyleString = """QDoubleSpinBox{
......@@ -76,6 +79,7 @@ class SpinButton(QtWidgets.QFrame):
)
# self.doubleSpin.setStyleSheet("QDoubleSpinBox::up-button{ height:30; width:100;")
self.doubleSpin.setAlignment(QtCore.Qt.AlignCenter)
self.doubleSpin.manualChanged.connect(self.manualChanged)
self.layout.addWidget(self.doubleSpin)
self.setLayout(self.layout)
self.setStyleSheet("border:2px solid white; border-radius:4px; padding:0px; ")
......@@ -84,6 +88,10 @@ class SpinButton(QtWidgets.QFrame):
self.popUp.okButton.clicked.connect(self.okButtonPressed)
self.popUp.cancelButton.clicked.connect(self.cancelButtonPressed)
def manualChanged(self):
self.liveUpdating = False
def eventFilter(self, source, event):
if (
source is self.doubleSpin.lineEdit()
......@@ -125,26 +133,24 @@ class TabSpinButtons(QtWidgets.QWidget):
self.__spins = [self.spinInsp, self.spinRR, self.spinFIo2, self.spinInhaleT]
self.__labels = [
"inspiratory_pressure",
"inhalation_pressure",
"respiratory_rate",
"fiO2_percent",
"inhale_time",
"lung_compliance",
]
for spin in self.__spins:
for spin,label in zip(self.__spins,self.__labels):
spin.label.setText(label)
self.layout.addWidget(spin)
self.buttonLayout = QtWidgets.QVBoxLayout()
self.buttonLayout.setSpacing(5)
self.okButton = QtWidgets.QPushButton()
self.okButton.setStyleSheet(
"height:50; width:40;background-image:url('buttonIcons/settings1.jpeg')"
)
self.okButton = okButton(self.NativeUI)
self.okButton.pressed.connect(self.ok_button_pressed)
self.buttonLayout.addWidget(self.okButton)
self.cancelButton = QtWidgets.QPushButton()
self.cancelButton.setStyleSheet(
"height:50; width:40;background-image:url('buttonIcons/settings1.jpeg')"
)
self.cancelButton = cancelButton(self.NativeUI)
self.cancelButton.pressed.connect(self.cancel_button_pressed)
self.buttonLayout.addWidget(self.cancelButton)
self.layout.addLayout(self.buttonLayout)
......@@ -153,15 +159,36 @@ class TabSpinButtons(QtWidgets.QWidget):
self.timer = QtCore.QTimer()
self.timer.setInterval(160)
self.timer.timeout.connect(self.updateTargets)
self.timer.timeout.connect(self.updateCycle)
self.timer.start()
def updateTargets(self):
targets = self.NativeUI.get_targets_db()
if targets == {}:
def updateCycle(self):
cycle = self.NativeUI.get_cycle_db()
if cycle == {}:
return
for spin, label in zip(self.__spins, self.__labels):
if spin.doubleSpin.value() != float(targets[label]):
spin.setTextColour("0")
if spin.doubleSpin.value() != float(cycle[label]):
if spin.liveUpdating:
spin.doubleSpin.setValue(float(cycle[label]))
spin.setTextColour("2")
else:
spin.setTextColour("0")
else:
spin.setTextColour("2")
def ok_button_pressed(self):
for spin in self.__spins:
spin.liveUpdating = True
spin.setTextColour("2")
def cancel_button_pressed(self):
self.liveUpdating = True
# targets = self.NativeUI.get_targets_db()
# if targets == {}:
# return
# for spin, label in zip(self.__spins, self.__labels):
# if spin.doubleSpin.value() != float(targets[label]):
# spin.setTextColour("0")
# else:
# spin.setTextColour("2")
......@@ -20,6 +20,7 @@ class TabExpert(TemplateSetValues):
"duration_calibration",
"SET_DURATION",
"CALIBRATION",
0,1000,50, 0
],
["Purge", "ms", "duration_buff_purge", "SET_DURATION", "BUFF_PURGE"],
["Flush", "ms", "duration_buff_flush", "SET_DURATION", "BUFF_FLUSH"],
......
{
"version": 182,
"timestamp": 815111,
"timestamp": 544077,
"payload_type": "TARGET",
"mode": "CURRENT",
"inspiratory_pressure": 17.0,
......@@ -17,4 +17,4 @@
"exhale_trigger_threshold": 25.0,
"buffer_upper_pressure": 300.0,
"buffer_lower_pressure": 285.0
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment