Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
HEV - High Energy Ventilator
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
HEV - High Energy Ventilator
Commits
14a93e9f
Commit
14a93e9f
authored
Jun 16, 2021
by
Benjamin Mummery
💻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
error handling in lock button to allow for unused widgets
parent
b4698554
Pipeline
#1797
failed with stages
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
25 deletions
+61
-25
NativeUI.py
NativeUI/NativeUI.py
+20
-5
global_typeval_popup.py
NativeUI/global_widgets/global_typeval_popup.py
+2
-2
ui_layout.py
NativeUI/ui_layout.py
+30
-17
localisation_button_widget.py
NativeUI/widget_library/localisation_button_widget.py
+7
-1
startup_calibration_widget.py
NativeUI/widget_library/startup_calibration_widget.py
+2
-0
No files found.
NativeUI/NativeUI.py
View file @
14a93e9f
...
...
@@ -754,8 +754,12 @@ class NativeUI(HEVClient, QMainWindow):
return
0
def
toggle_editability
(
self
):
"""Set all widgets disabled to lock screen"""
print
(
"toggling"
)
"""
Set all widgets disabled to lock screen.
Handles RuntimeErrors to deal with widgets that are created but are not used in
the final layout.
"""
self
.
q_send_cmd
(
"DO_CALIBRATION"
,
"DO_CALIBRATIONING"
)
self
.
q_send_cmd
(
"MUTE_ALARM"
,
"TRUE"
)
# self.q_send_cmd("GENERAL", "START")
...
...
@@ -765,7 +769,12 @@ class NativeUI(HEVClient, QMainWindow):
for
attribute
in
dir
(
self
.
widgets
):
widg
=
self
.
widgets
.
get_widget
(
attribute
)
if
isinstance
(
widg
,
QWidget
):
self
.
saveStateDict
[
attribute
]
=
widg
.
isEnabled
()
try
:
self
.
saveStateDict
[
attribute
]
=
widg
.
isEnabled
()
except
KeyError
as
e
:
logging
.
warning
(
e
)
except
RuntimeError
as
e
:
logging
.
warning
(
e
)
if
self
.
enableState
:
self
.
alt_palette
.
setColor
(
QPalette
.
Window
,
self
.
colors
[
"page_background"
])
...
...
@@ -776,9 +785,15 @@ class NativeUI(HEVClient, QMainWindow):
widg
=
self
.
widgets
.
get_widget
(
attribute
)
if
isinstance
(
widg
,
QWidget
):
if
self
.
enableState
:
widg
.
setEnabled
(
self
.
saveStateDict
[
attribute
])
try
:
widg
.
setEnabled
(
self
.
saveStateDict
[
attribute
])
except
KeyError
as
e
:
logging
.
warning
(
e
)
else
:
widg
.
setEnabled
(
self
.
enableState
)
try
:
widg
.
setEnabled
(
self
.
enableState
)
except
RuntimeError
as
e
:
logging
.
warning
(
e
)
self
.
widgets
.
lock_button
.
setEnabled
(
True
)
@
Slot
(
str
)
...
...
NativeUI/global_widgets/global_typeval_popup.py
View file @
14a93e9f
...
...
@@ -39,7 +39,7 @@ class AbstractTypeValPopup(QtWidgets.QDialog):
# self.label_text, self.min, self.max, self.initVal, self.step, self.decPlaces = 'Enter Password', 0, 10000, 0, 0, 0
self
.
setStyleSheet
(
"b
order-radius:4px; b
ackground-color:black"
)
self
.
setStyleSheet
(
"background-color:black"
)
self
.
characterType
=
characterType
self
.
label
=
QtWidgets
.
QLabel
()
# self.label_text)
self
.
label
.
setFont
(
NativeUI
.
value_font
)
...
...
@@ -51,7 +51,7 @@ class AbstractTypeValPopup(QtWidgets.QDialog):
self
.
lineEdit
.
setStyleSheet
(
"QLineEdit{"
" background-color: white;"
" border-radius: 4px;"
#
" border-radius: 4px;"
"}"
"QLineEdit[colour = '0']{"
" color: green;"
...
...
NativeUI/ui_layout.py
View file @
14a93e9f
...
...
@@ -210,32 +210,37 @@ class Layout:
hlayout
.
addWidget
(
self
.
widgets
.
page_stack
)
# Populate the Top Bar
vlayout
.
addWidget
(
self
.
layout_top_bar
(
[
self
.
widgets
.
tab_modeswitch
,
self
.
widgets
.
personal_display
,
self
.
widgets
.
localisation_button
,
self
.
widgets
.
battery_display
,
self
.
widgets
.
alarm_control
,
self
.
widgets
.
lock_button
,
]
)
)
topbar_widgets
=
[
self
.
widgets
.
tab_modeswitch
,
self
.
widgets
.
localisation_button
,
self
.
widgets
.
personal_display
,
self
.
widgets
.
alarm_control
,
self
.
widgets
.
lock_button
,
self
.
widgets
.
battery_display
,
]
vlayout
.
addWidget
(
self
.
layout_top_bar
(
topbar_widgets
))
self
.
widgets
.
tab_modeswitch
.
set_size
(
mode_display_width
,
self
.
top_bar_height
,
spacing
=
self
.
widget_spacing
)
self
.
widgets
.
tab_modeswitch
.
setFont
(
self
.
NativeUI
.
text_font
)
self
.
widgets
.
tab_modeswitch
.
setButtonSize
(
None
,
self
.
min_button_height
)
self
.
widgets
.
personal_display
.
set_size
(
personal_display_width
,
self
.
top_bar_height
,
spacing
=
self
.
widget_spacing
self
.
widgets
.
tab_modeswitch
.
setButtonSize
(
mode_display_width
-
self
.
widget_spacing
,
self
.
min_button_height
)
self
.
widgets
.
personal_display
.
setFont
(
self
.
NativeUI
.
text_font
)
self
.
widgets
.
localisation_button
.
set_size
(
localisation_display_width
,
self
.
top_bar_height
,
spacing
=
self
.
widget_spacing
)
self
.
widgets
.
localisation_button
.
setFont
(
self
.
NativeUI
.
text_font
)
self
.
widgets
.
localisation_button
.
setButtonSize
(
localisation_display_width
-
self
.
widget_spacing
,
self
.
min_button_height
)
self
.
widgets
.
personal_display
.
set_size
(
personal_display_width
,
self
.
top_bar_height
)
self
.
widgets
.
personal_display
.
setFont
(
self
.
NativeUI
.
text_font
)
self
.
widgets
.
battery_display
.
set_size
(
battery_display_width
,
self
.
top_bar_height
,
spacing
=
self
.
widget_spacing
)
...
...
@@ -246,7 +251,15 @@ class Layout:
self
.
widgets
.
lock_button
.
setFixedWidth
(
lock_display_width
)
self
.
widgets
.
lock_button
.
setFixedHeight
(
self
.
top_bar_height
)
self
.
widgets
.
lock_button
.
setStyleSheet
(
"background-color: "
+
self
.
NativeUI
.
colors
[
"display_foreground"
]
.
name
()
"QPushButton{"
" background-color:"
+
self
.
NativeUI
.
colors
[
"page_background"
]
.
name
()
+
";"
" border:none;"
"}"
"QPushButton::pressed{"
" background-color:"
+
self
.
NativeUI
.
colors
[
"highlight"
]
.
name
()
+
";"
"}"
)
vlayout
.
addLayout
(
hlayout
)
return
vlayout
...
...
NativeUI/widget_library/localisation_button_widget.py
View file @
14a93e9f
...
...
@@ -58,7 +58,6 @@ class LocalisationButtonWidget(QtWidgets.QWidget):
def
set_size
(
self
,
x
:
int
,
y
:
int
,
spacing
:
int
=
10
)
->
int
:
self
.
setFixedSize
(
x
,
y
)
self
.
localisation_button
.
setFixedSize
(
x
-
spacing
,
y
-
spacing
)
return
0
def
setFont
(
self
,
font
:
QtGui
.
QFont
)
->
int
:
...
...
@@ -91,6 +90,13 @@ class LocalisationButtonWidget(QtWidgets.QWidget):
self
.
SetLocalisation
.
emit
(
self
.
__localisation_dict
)
return
0
def
setButtonSize
(
self
,
x
:
int
,
y
:
int
)
->
int
:
if
x
is
not
None
:
self
.
localisation_button
.
setFixedWidth
(
x
)
if
y
is
not
None
:
self
.
localisation_button
.
setFixedHeight
(
y
)
return
0
def
__import_localisation_config
(
self
)
->
int
:
"""
Read in the current configuration
...
...
NativeUI/widget_library/startup_calibration_widget.py
View file @
14a93e9f
...
...
@@ -36,6 +36,8 @@ class calibrationWidget(QtWidgets.QWidget):
" background-color:"
+
NativeUI
.
colors
[
"button_background_enabled"
]
.
name
()
+
";"
" color:"
+
NativeUI
.
colors
[
"page_foreground"
]
.
name
()
+
";"
" text-align: center;"
"}"
"QProgressBar::chunk{"
" background-color:"
+
NativeUI
.
colors
[
"highlight"
]
.
name
()
+
";"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment