Commit b26d2ba0 authored by Tiago Sarmento's avatar Tiago Sarmento

merged

parents 09713e56 e9592490
Pipeline #1573 canceled with stages
......@@ -99,7 +99,7 @@ class NativeUI(HEVClient, QMainWindow):
q_send_personal (Slot) - send personal information to the MCU.
"""
def __init__(self, resolution: list, *args, **kwargs):
def __init__(self, resolution: list, *args, skip_startup=False, **kwargs):
super().__init__(*args, **kwargs)
# Set the resolution of the display window
......@@ -208,7 +208,10 @@ class NativeUI(HEVClient, QMainWindow):
self.__define_connections()
# Update page buttons to match the shown view
self.display_stack.setCurrentWidget(self.startupWidget)
if skip_startup:
self.display_stack.setCurrentWidget(self.main_display)
else:
self.display_stack.setCurrentWidget(self.startupWidget)
self.widgets.page_buttons.buttons[0].on_press()
def __find_localisation_files(self, config_path: str) -> list:
......@@ -300,15 +303,6 @@ class NativeUI(HEVClient, QMainWindow):
lambda: self.display_stack.setCurrentWidget(self.main_display)
)
# self.widgets.skipButton.pressed.connect(
# self.widgets.startup_handler.handle_sendbutton
# )
# self.widgets.backButton.pressed.connect(
# lambda i=self.widgets.startup_stack: self.widgets.startup_handler.handle_backbutton(
# i
# )
# )
# Battery Display should update when we get battery info
self.battery_handler.UpdateBatteryDisplay.connect(
self.widgets.battery_display.update_status
......@@ -389,10 +383,6 @@ class NativeUI(HEVClient, QMainWindow):
spin_widget.simpleSpin.manualChanged.connect(
lambda i=key: self.mode_handler.handle_manual_change(i)
)
# if 'clinical' in key:
# spin_widget.simpleSpin.manualChanged.connect(
# lambda i=spin_widget, j=key: self.clinical_handler.setpoint_changed(i,j)
# )
for key, spin_widget in self.mode_handler.mainSpinDict.items():
spin_widget.simpleSpin.manualChanged.connect(
......@@ -518,8 +508,21 @@ class NativeUI(HEVClient, QMainWindow):
# self.timer.timeout.connect(self.expert_handler.update_values)
self.timer.start()
# self.widgets.startup_handler.settingToggle.connect(self.widgets.spin_buttons.setStackWidget)
# self.mode_handler.settingToggle.connect(self.widgets.spin_buttons.setStackWidget)
# Localisation needs to update widgets
for widget in [
self.widgets.normal_measurements,
self.widgets.detailed_measurements,
self.widgets.normal_plots,
self.widgets.detailed_plots,
self.widgets.circle_plots,
self.widgets.ventilator_start_stop_buttons_widget,
# self.widgets.charts_widget,
# self.widgets.spin_buttons,
# self.widgets.mode_personal_tab,
]:
self.widgets.localisation_button.SetLocalisation.connect(
widget.localise_text
)
self.alarm_handler.UpdateAlarm.connect(self.alarm_handler.handle_newAlarm)
self.alarm_handler.NewAlarm.connect(self.widgets.alarm_popup.addAlarm)
......@@ -663,6 +666,12 @@ def parse_command_line_arguments() -> argparse.Namespace:
parser.add_argument(
"-r", "--resolution", action="store", dest="resolution", type=str
)
parser.add_argument(
"--no-startup",
action="store_true",
default=False,
help="Run the UI without the startup sequence",
)
return parser.parse_args()
......@@ -735,12 +744,14 @@ def set_window_size(window, resolution: str = None, windowed: bool = False) -> i
if __name__ == "__main__":
# parse args and setup logging
command_line_args = parse_command_line_arguments()
print(command_line_args)
set_logging_level(command_line_args.debug)
# setup pyqtplot widget
app = QApplication(sys.argv)
dep = NativeUI(interpret_resolution(command_line_args.resolution))
dep = NativeUI(
interpret_resolution(command_line_args.resolution),
skip_startup=command_line_args.no_startup,
)
set_window_size(
dep,
resolution=command_line_args.resolution,
......
{
"language_name": "English",
"start_button": "START",
"stop_button": "STOP",
"standby_button": "STANDBY",
"plot_axis_label_pressure": "Pressure [cmH<sub>2</sub>O]",
"plot_axis_label_flow": "Flow [L/min]",
"plot_axis_label_volume": "Volume [mL]",
......@@ -24,5 +27,16 @@
"measurement_label_mean_airway_pressure": "P<sub>MEAN</sub> [cmH<sub>2</sub>O]",
"measurement_label_inhaled_tidal_volume": "VTI [mL]",
"measurement_label_inhaled_minute_volume": "MVI [L/min]",
"measurement_label_peak_inspiratory_pressure": "P<sub>PEAK</sub> [cmH<sub>2</sub>O]"
"measurement_label_peak_inspiratory_pressure": "P<sub>PEAK</sub> [cmH<sub>2</sub>O]",
"spin_box_label_Inhale_Pressure": "Inhale Pressure",
"spin_box_label_Respiratory_Rate": "Respiratory Rate",
"spin_box_label_Inhale_Time": "Inhale Time",
"spin_box_label_IE_Ratio": "IE Ratio",
"spin_box_label_Percentage_O2": "Percentage O2",
"personal_tab_name": "Name",
"personal_tab_patientid": "Patient ID",
"personal_tab_age": "Age",
"personal_tab_sex": "Sex",
"personal_tab_weight": "Weight",
"personal_tab_height": "Height"
}
{
"language_name": "Português",
"plot_axis_label_pressure": "Pressure [cmH<sub>2</sub>O]",
"plot_axis_label_flow": "Flow [L/min]",
"language_name": "Portugues",
"start_button": "INICIAR",
"stop_button": "PARAR",
"standby_button": "ESPERAR",
"plot_axis_label_pressure": "Pressao [cmH<sub>2</sub>O]",
"plot_axis_label_flow": "Fluxo [L/min]",
"plot_axis_label_volume": "Volume [mL]",
"plot_axis_label_time": "Time [s]",
"plot_line_label_pressure": "Airway Pressure",
"plot_line_label_flow": "Flow",
"plot_axis_label_time": "Tempo [s]",
"plot_line_label_pressure": "Pressao de Ar",
"plot_line_label_flow": "Fluxo",
"plot_line_label_volume": "Volume",
"plot_line_label_pressure_flow": "Airway Pressure - Flow",
"plot_line_label_flow_volume": "Flow - Volume",
"plot_line_label_volume_pressure": "Volume - Airway Pressure",
"layout_label_measurements": "Measurements",
"plot_line_label_pressure_flow": "Pressao de Ar - Fluxo",
"plot_line_label_flow_volume": "Fluxo - Volume",
"plot_line_label_volume_pressure": "Volume - Pressao de Ar",
"layout_label_measurements": "Medicoes",
"button_label_main_normal": "Normal",
"button_label_main_detailed": "Detailed",
"button_label_main_detailed": "Detalhado",
"ui_window_title": "HEV NativeUI v{version}",
"measurement_label_plateau_pressure": "TRANSLATE",
"measurement_label_respiratory_rate": "TRANSLATE",
"measurement_label_fio2_percent": "TRANSLATE",
"measurement_label_exhaled_tidal_volume": "TRANSLATE",
"measurement_label_exhaled_minute_volume": "TRANSLATE",
"measurement_label_plateau_pressure": "P<sub>Plato</sub> [cmH<sub>2</sub>O]",
"measurement_label_respiratory_rate": "FREQ<sub>RESP</sub>",
"measurement_label_fio2_percent": "FIO<sub>2</sub> [%]",
"measurement_label_exhaled_tidal_volume": "VOL<sub>EXAL</sub> [mL]",
"measurement_label_exhaled_minute_volume": "MVE [<sup>L</sup>/<sub>min</sub>]",
"measurement_label_peep": "PEEP [cmH<sub>2</sub>O]",
"measurement_label_inhale_exhale_ratio": "I:E",
"measurement_label_mean_airway_pressure": "P<sub>MEAN</sub> [cmH<sub>2</sub>O]",
"measurement_label_mean_airway_pressure": "P<sub>MEDIO</sub> [cmH<sub>2</sub>O]",
"measurement_label_inhaled_tidal_volume": "VTI [mL]",
"measurement_label_inhaled_minute_volume": "MVI [L/min]",
"measurement_label_peak_inspiratory_pressure": "P<sub>PEAK</sub> [cmH<sub>2</sub>O]"
"measurement_label_peak_inspiratory_pressure": "P<sub>PICO</sub> [cmH<sub>2</sub>O]",
"spin_box_label_Inhale_Pressure": "Pressao inspiracao",
"spin_box_label_Respiratory_Rate": "Frequencia Respiratoria",
"spin_box_label_Inhale_Time": "Tempo Inspiracao",
"spin_box_label_IE_Ratio": "Razao I/E",
"spin_box_label_Percentage_O2": "Porcetagem O<sub>2</sub>",
"personal_tab_name": "Nome",
"personal_tab_patientid": "ID do paciente",
"personal_tab_age": "Idade",
"personal_tab_sex": "Sexo",
"personal_tab_weight": "Peso",
"personal_tab_height": "Altura"
}
......@@ -36,6 +36,16 @@ class TabPersonal(TemplateSetValues):
self.addButtons()
self.finaliseLayout()
@QtCore.Slot(dict)
def localise_text(self, text: dict) -> int:
self.spinDict["Name"].nameLabel.setText(text["personal_tab_name"])
self.spinDict["Patient ID"].nameLabel.setText(text["personal_tab_patientid"])
self.spinDict["Age"].nameLabel.setText(text["personal_tab_age"])
self.spinDict["Sex"].nameLabel.setText(text["personal_tab_sex"])
self.spinDict["Weight"].nameLabel.setText(text["personal_tab_weight"])
self.spinDict["Height"].nameLabel.setText(text["personal_tab_height"])
return 0
if __name__ == "__main__":
# sys.path.append("../")
......
......@@ -131,6 +131,30 @@ class TimePlotsWidget(QtWidgets.QWidget):
plot.enableAutoRange("y", True)
return 0
@QtCore.Slot(dict)
def localise_text(self, text: dict) -> int:
"""
Update the text displayed on the axis' and legend of time plots.
"""
self.pressure_plot.setLabel("left", text["plot_axis_label_pressure"])
self.pressure_plot.legend.clear()
self.pressure_plot.legend.addItem(
self.pressure_line, text["plot_line_label_pressure"]
)
self.flow_plot.setLabel("left", text["plot_axis_label_flow"])
self.flow_plot.legend.clear()
self.flow_plot.legend.addItem(self.flow_line, text["plot_line_label_flow"])
self.volume_plot.setLabel("left", text["plot_axis_label_volume"])
self.volume_plot.setLabel("bottom", text["plot_axis_label_time"])
self.volume_plot.legend.clear()
self.volume_plot.legend.addItem(
self.volume_line, text["plot_line_label_volume"]
)
return 0
class CirclePlotsWidget(QtWidgets.QWidget):
def __init__(self, NativeUI, port=54322, *args, **kwargs):
......@@ -238,6 +262,34 @@ class CirclePlotsWidget(QtWidgets.QWidget):
)
return 0
@QtCore.Slot(dict)
def localise_text(self, text: dict) -> int:
"""
Update the text displayed on the axis' and legend of circle plots.
"""
self.pressure_flow_plot.setLabel("left", text["plot_axis_label_pressure"])
self.pressure_flow_plot.setLabel("bottom", text["plot_axis_label_flow"])
self.pressure_flow_plot.legend.clear()
self.pressure_flow_plot.legend.addItem(
self.pressure_flow_line, text["plot_line_label_pressure_flow"]
)
self.flow_volume_plot.setLabel("left", text["plot_axis_label_flow"])
self.flow_volume_plot.setLabel("bottom", text["plot_axis_label_volume"])
self.flow_volume_plot.legend.clear()
self.flow_volume_plot.legend.addItem(
self.flow_volume_line, text["plot_line_label_flow_volume"]
)
self.volume_pressure_plot.setLabel("left", text["plot_axis_label_volume"])
self.volume_pressure_plot.setLabel("bottom", text["plot_axis_label_pressure"])
self.volume_pressure_plot.legend.clear()
self.volume_pressure_plot.legend.addItem(
self.volume_pressure_line, text["plot_line_label_volume_pressure"]
)
return 0
class ChartsPlotWidget(QtWidgets.QWidget):
def __init__(self, port=54322, *args, colors: dict = {}, **kwargs):
......@@ -335,3 +387,16 @@ class ChartsPlotWidget(QtWidgets.QWidget):
"""
self.lines[key].setPen(pg.mkPen(color=(0, 0, 0, 0), width=0))
return 0
@QtCore.Slot(dict)
def localise_text(self, text: dict) -> int:
"""
Update the text displayed on the axis' and legend of time plots.
"""
self.pressure_plot.setLabel("left", text["plot_axis_label_pressure"])
self.pressure_plot.legend.clear()
self.pressure_plot.legend.addItem(
self.pressure_line, text["plot_line_label_pressure"]
)
return 0
......@@ -21,7 +21,8 @@ from global_widgets.global_typeval_popup import TypeValuePopup
# from global_widgets.global_ok_cancel_buttons import okButton, cancelButton
from widget_library.ok_cancel_buttons_widget import OkButtonWidget, CancelButtonWidget
from global_widgets.global_spinbox import signallingSpinBox
#from global_widgets.global_send_popup import SetConfirmPopup
# from global_widgets.global_send_popup import SetConfirmPopup
class SpinButton(QtWidgets.QFrame):
......@@ -57,19 +58,19 @@ class SpinButton(QtWidgets.QFrame):
self.label.setStyleSheet(
"color:white;"
"background-color:" + labelBgColour + ";"
""#border-radius:4px;"
""#border: 2px solid white"
"" # border-radius:4px;"
"" # border: 2px solid white"
)
self.label.setAlignment(QtCore.Qt.AlignCenter)
# self.label.setFixedHeight(45)
# self.label.setFont(NativeUI.text_font)
# self.label.setFixedHeight(45)
# self.label.setFont(NativeUI.text_font)
self.layout.addWidget(self.label)
#self.setFont(NativeUI.text_font)
# self.setFont(NativeUI.text_font)
self.simpleSpin = signallingSpinBox(NativeUI, popup, self.label_text, self.min, self.max, self.initVal, self.step, self.decPlaces)
self.simpleSpin.lineEdit().setStyleSheet("border:blue;")
# self.simpleSpin.setFixedHeight(100)
# self.simpleSpin.setFont(NativeUI.text_font)
# self.simpleSpin.setFixedHeight(100)
# self.simpleSpin.setFont(NativeUI.text_font)
boxStyleString = (
"QDoubleSpinBox{"
......@@ -86,7 +87,7 @@ class SpinButton(QtWidgets.QFrame):
" color:red;"
"}"
)
# self.setFont(NativeUI.text_font)
# self.setFont(NativeUI.text_font)
upButtonStyleString = "QDoubleSpinBox::up-button{" "height:50;" "width:50;" "}"
# upButtonPressedStyleString = (
......@@ -109,11 +110,12 @@ class SpinButton(QtWidgets.QFrame):
self.simpleSpin.manualChanged.connect(self.manualChanged)
self.simpleSpin.programmaticallyChanged.connect(self.manualChanged)
self.simpleSpin.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed
)
self.layout.addWidget(self.simpleSpin)
self.setLayout(self.layout)
self.setFixedWidth(300)
#self.setStyleSheet("border:2px solid white; border-radius:4px; padding:0px;")
# self.setStyleSheet("border:2px solid white; border-radius:4px; padding:0px;")
def update_value(self, db):
newVal = db
......@@ -138,7 +140,7 @@ class SpinButton(QtWidgets.QFrame):
def manualChanged(self):
print('manually changed' + self.label.text())
print("manually changed" + self.label.text())
"""Called when user manually makes a change. Stops value from updating and changes colour"""
self.manuallyUpdated = True
self.setTextColour(2)
......
......@@ -15,6 +15,7 @@ __status__ = "Prototype"
import logging
from PySide2 import QtGui, QtWidgets
from PySide2.QtCore import QSize
from PySide2 import QtCore
from global_widgets.tab_hold_buttons import holdButton
......@@ -40,7 +41,7 @@ class VentilatorStartStopButtonsWidget(QtWidgets.QWidget):
self.button_standby = holdButton(NativeUI) # QtWidgets.QPushButton()
self.__buttons = [self.button_start, self.button_stop, self.button_standby]
self.__buttontext = ["START", "STOP", "STANDBY"]
self.localise_text(NativeUI.text)
self.__buttoncommand = [""]
for button, text in zip(self.__buttons, self.__buttontext):
......@@ -122,3 +123,17 @@ class VentilatorStartStopButtonsWidget(QtWidgets.QWidget):
for button in self.__buttons:
button.setFont(font)
return 0
@QtCore.Slot(dict)
def localise_text(self, text: dict):
self.__buttontext = [
text["start_button"],
text["stop_button"],
text["standby_button"],
]
self.button_start.setText(text["start_button"])
self.button_stop.setText(text["stop_button"])
self.button_standby.setText(text["standby_button"])
return 0
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