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
fabb9426
Commit
fabb9426
authored
May 26, 2021
by
Benjamin Mummery
💻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Blue highlight colour for selected buttons
parent
f0201954
Pipeline
#1587
failed with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
51 deletions
+46
-51
colors.json
NativeUI/configs/colors.json
+10
-10
page_buttons_widget.py
NativeUI/widget_library/page_buttons_widget.py
+23
-33
plot_widget.py
NativeUI/widget_library/plot_widget.py
+7
-7
switchable_stack_widget.py
NativeUI/widget_library/switchable_stack_widget.py
+6
-1
No files found.
NativeUI/configs/colors.json
View file @
fabb9426
...
...
@@ -5,22 +5,22 @@
"button_background_disabled"
:[
100
,
100
,
100
],
"button_foreground_enabled"
:[
200
,
200
,
200
],
"button_foreground_disabled"
:[
30
,
30
,
30
],
"button_background_highlight"
:[
30
,
93
,
248
],
"button_foreground_highlight"
:[
200
,
200
,
200
],
"label_background"
:[
0
,
0
,
0
],
"label_foreground"
:[
200
,
200
,
200
],
"display_background"
:[
200
,
200
,
200
],
"display_foreground"
:[
0
,
0
,
0
],
"display_foreground_changed"
:[
0
,
200
,
0
],
"display_foreground_red"
:[
200
,
0
,
0
],
"plot_pressure"
:[
0
,
114
,
178
],
"plot_volume"
:[
0
,
158
,
115
],
"plot_flow"
:[
240
,
228
,
66
],
"plot_pressure_flow"
:[
230
,
159
,
0
],
"plot_flow_volume"
:[
204
,
121
,
167
],
"plot_volume_pressure"
:[
86
,
180
,
233
],
"highligh"
:[
30
,
93
,
248
],
"baby_blue"
:[
144
,
231
,
211
],
"red"
:[
200
,
0
,
0
],
"green"
:[
0
,
200
,
0
],
"pressure_plot"
:[
0
,
114
,
178
],
"volume_plot"
:[
0
,
158
,
115
],
"flow_plot"
:[
240
,
228
,
66
],
"pressure_flow_plot"
:[
230
,
159
,
0
],
"flow_volume_plot"
:[
204
,
121
,
167
],
"volume_pressure_plot"
:[
86
,
180
,
233
],
"red"
:[
255
,
0
,
0
],
"green"
:[
0
,
255
,
0
],
"baby-blue"
:[
0
,
0
,
200
]
"green"
:[
0
,
200
,
0
]
}
NativeUI/widget_library/page_buttons_widget.py
View file @
fabb9426
...
...
@@ -36,10 +36,7 @@ class PageButtonsWidget(QtWidgets.QWidget):
layout
=
QtWidgets
.
QVBoxLayout
()
self
.
main_button
=
PageButton
(
NativeUI
,
""
,
signal_value
=
"main_page"
,
icon
=
NativeUI
.
icons
[
"button_main_page"
],
""
,
signal_value
=
"main_page"
,
icon
=
NativeUI
.
icons
[
"button_main_page"
]
)
self
.
alarms_button
=
PageButton
(
""
,
signal_value
=
"alarms_page"
,
icon
=
NativeUI
.
icons
[
"button_alarms_page"
]
...
...
@@ -64,17 +61,20 @@ class PageButtonsWidget(QtWidgets.QWidget):
"QPushButton{"
" border:none"
"}"
"QPushButton
:disabled
{"
"QPushButton
[selected='0']
{"
" background-color:"
+
NativeUI
.
colors
[
"button_background_
dis
abled"
]
.
name
()
+
NativeUI
.
colors
[
"button_background_
en
abled"
]
.
name
()
+
";"
" border:none"
"}"
"QPushButton
:enabled
{"
"QPushButton
[selected='1']
{"
" background-color:"
+
NativeUI
.
colors
[
"button_background_enabled"
]
.
name
()
+
NativeUI
.
colors
[
"button_background_highlight"
]
.
name
()
+
";"
"}"
"QPushButton:disabled{"
" background-color:"
+
NativeUI
.
colors
[
"button_background_disabled"
]
.
name
()
+
";"
" border:none"
"}"
)
...
...
@@ -82,19 +82,14 @@ class PageButtonsWidget(QtWidgets.QWidget):
# set button appearance
button
.
setStyleSheet
(
stylesheet
)
button
.
setIconColor
(
NativeUI
.
colors
[
"page_foreground"
])
button
.
pressed
.
connect
(
lambda
i
=
button
:
self
.
set_pressed
(
i
))
layout
.
addWidget
(
button
)
self
.
setLayout
(
layout
)
self
.
set_pressed
(
self
.
buttons
[
0
])
# Connect the buttons so that pressing one enables all of the others
for
pressed_button
in
self
.
buttons
:
for
unpressed_button
in
self
.
buttons
:
if
pressed_button
==
unpressed_button
:
continue
pressed_button
.
pressed
.
connect
(
unpressed_button
.
enable
)
def
set_pressed
(
self
,
pressed
:
str
)
->
int
:
def
set_pressed
(
self
,
button_pressed
)
->
int
:
"""
Set the specified buttons to enabled (unpressed) or disabled (pressed) states.
By default, all buttons in self.buttons will be made enabled except those in the
...
...
@@ -102,13 +97,13 @@ class PageButtonsWidget(QtWidgets.QWidget):
pressed can be str or list of str.
"""
if
isinstance
(
pressed
,
str
):
pressed
=
[
pressed
]
for
button
in
self
.
buttons
:
button
.
setEnabled
(
True
)
for
button_name
in
pressed
:
button
=
getattr
(
self
,
button_name
)
button
.
setEnabled
(
False
)
if
button
==
button_pressed
:
button
.
setProperty
(
"selected"
,
"1"
)
else
:
button
.
setProperty
(
"selected"
,
"0"
)
button
.
style
()
.
unpolish
(
button
)
button
.
style
()
.
polish
(
button
)
return
0
def
set_size
(
self
,
x
:
int
,
y
:
int
,
spacing
:
int
=
10
)
->
int
:
...
...
@@ -165,9 +160,7 @@ class PageButtonsWidget(QtWidgets.QWidget):
class
PageButton
(
QtWidgets
.
QPushButton
):
PageButtonPressed
=
Signal
(
str
)
def
__init__
(
self
,
NativeUI
,
*
args
,
signal_value
:
str
=
None
,
icon
:
str
=
None
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
signal_value
:
str
=
None
,
icon
:
str
=
None
,
**
kwargs
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
self
.
__signal_value
=
signal_value
self
.
__icon_path
=
icon
...
...
@@ -186,15 +179,12 @@ class PageButton(QtWidgets.QPushButton):
self
.
setIcon
(
QtGui
.
QIcon
(
pixmap
))
return
0
@
Slot
()
def
enable
(
self
):
self
.
setEnabled
(
True
)
return
0
def
on_press
(
self
):
"""
When the button is pressed, disable it and emit the PageButtonPressed signal.
"""
self
.
setEnabled
(
False
)
self
.
PageButtonPressed
.
emit
(
self
.
__signal_value
)
return
0
def
localise_text
(
self
,
*
args
,
**
kwargs
)
->
int
:
pass
NativeUI/widget_library/plot_widget.py
View file @
fabb9426
...
...
@@ -88,21 +88,21 @@ class TimePlotsWidget(QtWidgets.QWidget):
[
0
,
0
],
[
0
,
0
],
NativeUI
.
text
[
"plot_line_label_pressure"
],
NativeUI
.
colors
[
"p
ressure_plot
"
]
.
name
(),
NativeUI
.
colors
[
"p
lot_pressure
"
]
.
name
(),
)
self
.
flow_line
=
self
.
plot
(
self
.
flow_plot
,
[
0
,
0
],
[
0
,
0
],
NativeUI
.
text
[
"plot_line_label_flow"
],
NativeUI
.
colors
[
"
flow_plot
"
]
.
name
(),
NativeUI
.
colors
[
"
plot_flow
"
]
.
name
(),
)
self
.
volume_line
=
self
.
plot
(
self
.
volume_plot
,
[
0
,
0
],
[
0
,
0
],
NativeUI
.
text
[
"plot_line_label_volume"
],
NativeUI
.
colors
[
"
volume_plot
"
]
.
name
(),
NativeUI
.
colors
[
"
plot_volume
"
]
.
name
(),
)
self
.
setLayout
(
layout
)
...
...
@@ -227,21 +227,21 @@ class CirclePlotsWidget(QtWidgets.QWidget):
[
0
,
0
],
[
0
,
0
],
NativeUI
.
text
[
"plot_line_label_pressure_flow"
],
NativeUI
.
colors
[
"p
ressure_flow_plot
"
]
.
name
(),
NativeUI
.
colors
[
"p
lot_pressure_flow
"
]
.
name
(),
)
self
.
flow_volume_line
=
self
.
plot
(
self
.
flow_volume_plot
,
[
0
,
0
],
[
0
,
0
],
NativeUI
.
text
[
"plot_line_label_flow_volume"
],
NativeUI
.
colors
[
"
flow_volume_plot
"
]
.
name
(),
NativeUI
.
colors
[
"
plot_flow_volume
"
]
.
name
(),
)
self
.
volume_pressure_line
=
self
.
plot
(
self
.
volume_pressure_plot
,
[
0
,
0
],
[
0
,
0
],
NativeUI
.
text
[
"plot_line_label_volume_pressure"
],
NativeUI
.
colors
[
"
volume_pressure_plot
"
]
.
name
(),
NativeUI
.
colors
[
"
plot_volume_pressure
"
]
.
name
(),
)
self
.
setLayout
(
layout
)
...
...
@@ -332,7 +332,7 @@ class ChartsPlotWidget(QtWidgets.QWidget):
}
# Store the colors of the lines
self
.
colors
=
{
"pressure"
:
colors
[
"p
ressure_plot"
],
"flow"
:
colors
[
"flow_plot
"
]}
self
.
colors
=
{
"pressure"
:
colors
[
"p
lot_pressure"
],
"flow"
:
colors
[
"plot_flow
"
]}
self
.
graph_widget
.
setContentsMargins
(
0.0
,
0.0
,
0.0
,
0.0
)
self
.
graph_widget
.
setBackground
(
colors
[
"page_background"
])
...
...
NativeUI/widget_library/switchable_stack_widget.py
View file @
fabb9426
...
...
@@ -125,7 +125,12 @@ class SelectorButtonWidget(QtWidgets.QPushButton):
" border:none"
"}"
"QPushButton[selected='1']{"
" color: "
+
colors
[
"button_foreground_disabled"
]
.
name
()
+
";"
" color: "
+
colors
[
"button_foreground_highlight"
]
.
name
()
+
";"
" background-color:"
+
colors
[
"button_background_highlight"
]
.
name
()
+
";"
" border:none"
"}"
"QPushButton:disabled{"
" color:"
+
colors
[
"button_foreground_disabled"
]
.
name
()
+
";"
" background-color:"
+
colors
[
"button_background_disabled"
]
.
name
()
+
";"
" border:none"
"}"
...
...
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