Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Module 4
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Service
Module 4
Commits
168946b5
Commit
168946b5
authored
10 months ago
by
DMIbragimov
Browse files
Options
Downloads
Patches
Plain Diff
Update app.py
parent
cb11ffe4
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
Add new directory
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kontur/web/app.py
+41
-6
41 additions, 6 deletions
kontur/web/app.py
with
41 additions
and
6 deletions
kontur/web/app.py
+
41
−
6
View file @
168946b5
...
...
@@ -23,7 +23,7 @@ class MainWindow(QWidget):
def
initUI
(
self
):
self
.
setWindowTitle
(
'
Multi-Input PyQt Application
'
)
self
.
setGeometry
(
100
,
100
,
1
60
0
,
90
0
)
self
.
setGeometry
(
100
,
100
,
1
92
0
,
108
0
)
layout
=
QVBoxLayout
()
self
.
setLayout
(
layout
)
...
...
@@ -33,7 +33,7 @@ class MainWindow(QWidget):
# RTSP input
self
.
rtsp_input
=
QLineEdit
(
self
)
self
.
rtsp_input
.
setPlaceholderText
(
'
Enter RTSP URL
'
)
self
.
rtsp_input
.
setPlaceholderText
(
'
rtsp://192.168.0.103:8554/
'
)
self
.
rtsp_button
=
QPushButton
(
'
Stream Video
'
,
self
)
self
.
rtsp_button
.
clicked
.
connect
(
self
.
handle_rtsp
)
...
...
@@ -42,7 +42,7 @@ class MainWindow(QWidget):
# WS input
self
.
ws_input
=
QLineEdit
(
self
)
self
.
ws_input
.
setPlaceholderText
(
'
Enter WS URL
'
)
self
.
ws_input
.
setPlaceholderText
(
'
ws://192.168.0.103:8555/ws/
'
)
self
.
ws_button
=
QPushButton
(
'
Get Metrics
'
,
self
)
self
.
ws_button
.
clicked
.
connect
(
self
.
handle_ws
)
...
...
@@ -68,20 +68,21 @@ class MainWindow(QWidget):
# Map display
self
.
map_view
=
QWebEngineView
()
video_map_layout
.
addWidget
(
self
.
map_view
)
layout
.
addLayout
(
video_map_layout
)
self
.
showMaximized
()
self
.
setStyleSheet
(
self
.
dark_theme_stylesheet
())
@pyqtSlot
()
def
handle_rtsp
(
self
):
rtsp_url
=
self
.
rtsp_input
.
text
()
rtsp_url
=
self
.
rtsp_input
.
text
()
if
self
.
rtsp_input
.
text
()
else
"
rtsp://192.168.0.103:8554/
"
logger
.
debug
(
f
"
RTSP URL received:
{
rtsp_url
}
"
)
asyncio
.
create_task
(
self
.
stream_rtsp
(
rtsp_url
))
@pyqtSlot
()
def
handle_ws
(
self
):
ws_url
=
self
.
ws_input
.
text
()
ws_url
=
self
.
ws_input
.
text
()
if
self
.
ws_input
.
text
()
else
"
ws://192.168.0.103:8555/ws/
"
logger
.
debug
(
f
"
WebSocket URL received:
{
ws_url
}
"
)
asyncio
.
create_task
(
self
.
fetch_ws_metrics
(
ws_url
))
...
...
@@ -157,6 +158,40 @@ class MainWindow(QWidget):
self
.
map_view
.
setHtml
(
map_data
)
logger
.
debug
(
"
Map updated with new markers
"
)
def
dark_theme_stylesheet
(
self
):
return
"""
QWidget {
background-color: #2b2b2b;
color: #ffffff;
}
QLineEdit, QPushButton {
background-color: #3c3c3c;
border: 1px solid #555555;
color: #ffffff;
}
QLineEdit:focus, QPushButton:pressed {
border: 1px solid #0078d7;
}
QLineEdit {
padding: 5px;
}
QPushButton {
padding: 5px;
margin: 5px;
}
QLabel {
color: #ffffff;
}
QFileDialog {
background-color: #2b2b2b;
color: #ffffff;
}
QWebEngineView {
border: 1px solid #555555;
background-color: #2b2b2b;
color: #ffffff;
}
"""
if
__name__
==
'
__main__
'
:
app
=
QApplication
(
sys
.
argv
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment