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
8e8f0423
Commit
8e8f0423
authored
May 10, 2021
by
Benjamin Mummery
💻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrected bug where text sizes weren't passed to alarm popups
parent
50c9a5d3
Pipeline
#1494
failed with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
7 deletions
+20
-7
alarm_popup.py
NativeUI/alarm_widgets/alarm_popup.py
+18
-6
ui_layout.py
NativeUI/ui_layout.py
+2
-1
No files found.
NativeUI/alarm_widgets/alarm_popup.py
View file @
8e8f0423
...
...
@@ -21,11 +21,12 @@ class AlarmWidget(QtWidgets.QWidget):
"""Object containing information particular to one alarm.
Created when alarm received from microcontroller, timeout after alarm signal stops.
Is contained within alarmPopup"""
def
__init__
(
self
,
NativeUI
,
abstractAlarm
,
alarmCarrier
,
*
args
,
**
kwargs
):
super
(
AlarmWidget
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
NativeUI
=
NativeUI
self
.
alarmCarrier
=
alarmCarrier
# Needs to refer to its containing object
self
.
alarmCarrier
=
alarmCarrier
# Needs to refer to its containing object
self
.
layout
=
QtWidgets
.
QHBoxLayout
()
self
.
layout
.
setSpacing
(
0
)
...
...
@@ -41,10 +42,11 @@ class AlarmWidget(QtWidgets.QWidget):
self
.
layout
.
addWidget
(
iconLabel
)
self
.
textLabel
=
QtWidgets
.
QLabel
()
self
.
textLabel
.
setText
(
self
.
alarmPayload
[
'alarm_type'
]
+
' - '
+
self
.
alarmPayload
[
"alarm_code"
])
self
.
textLabel
.
setText
(
self
.
alarmPayload
[
"alarm_type"
]
+
" - "
+
self
.
alarmPayload
[
"alarm_code"
]
)
self
.
textLabel
.
setFixedWidth
(
400
)
self
.
textLabel
.
setAlignment
(
QtCore
.
Qt
.
AlignCenter
)
self
.
textLabel
.
setStyleSheet
(
"font-size: "
+
NativeUI
.
text_size
+
";"
)
self
.
layout
.
addWidget
(
self
.
textLabel
)
self
.
setFixedHeight
(
40
)
...
...
@@ -61,11 +63,18 @@ class AlarmWidget(QtWidgets.QWidget):
# self.installEventFilter(self)
def
eventFilter
(
self
,
source
,
event
):
if
(
event
.
type
()
==
QtCore
.
QEvent
.
MouseButtonPress
)
:
if
event
.
type
()
==
QtCore
.
QEvent
.
MouseButtonPress
:
self
.
NativeUI
.
leftBar
.
tab_page_buttons
.
button_alarms
.
click
()
self
.
NativeUI
.
alarms_view
.
alarmButton
.
click
()
return
False
def
setFont
(
self
,
font
)
->
int
:
"""
Set the font for textLabel.
"""
self
.
textLabel
.
setFont
(
font
)
return
0
# def checkAlarm(self):
# """Check alarm still exists in ongoingAlarms object. If present do nothing, otherwise delete."""
# self.ongoingAlarms = self.NativeUI.ongoingAlarms
...
...
@@ -80,9 +89,10 @@ class AlarmWidget(QtWidgets.QWidget):
class
AlarmPopup
(
QtWidgets
.
QDialog
):
"""Container class for alarm widgets. Handles ordering and positioning of alarms.
Needs to adjust its size whenever a widget is deleted"""
def
__init__
(
self
,
NativeUI
,
*
args
,
**
kwargs
):
super
(
AlarmPopup
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
setParent
(
NativeUI
)
# ensures popup closes when main UI does
self
.
setParent
(
NativeUI
)
# ensures popup closes when main UI does
self
.
alarmDict
=
{}
self
.
NativeUI
=
NativeUI
...
...
@@ -93,7 +103,9 @@ class AlarmPopup(QtWidgets.QDialog):
self
.
location_on_window
()
self
.
setWindowFlags
(
QtCore
.
Qt
.
FramelessWindowHint
|
QtCore
.
Qt
.
Dialog
|
QtCore
.
Qt
.
WindowStaysOnTopHint
QtCore
.
Qt
.
FramelessWindowHint
|
QtCore
.
Qt
.
Dialog
|
QtCore
.
Qt
.
WindowStaysOnTopHint
)
# no window title
self
.
shadow
=
QtWidgets
.
QGraphicsDropShadowEffect
()
...
...
NativeUI/ui_layout.py
View file @
8e8f0423
...
...
@@ -60,7 +60,8 @@ class Layout:
self
.
construct_page_widgets
()
# self.startup_layout()
# Popups
NativeUI
.
widgets
.
alarm_popup
.
setFont
(
self
.
NativeUI
.
text_font
)
def
construct_page_widgets
(
self
)
->
int
:
"""
...
...
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