-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #234 from Leviaria/main
GUI
- Loading branch information
Showing
15 changed files
with
634 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from PyQt6.QtCore import QEasingCurve | ||
from PyQt6.QtCore import QPropertyAnimation | ||
from PyQt6.QtCore import Qt | ||
from PyQt6.QtWidgets import QGraphicsDropShadowEffect | ||
|
||
|
||
def start_play_button_animation(self): | ||
self.glow_effect = QGraphicsDropShadowEffect(self) | ||
self.glow_effect.setBlurRadius( | ||
10 | ||
) # Initial blur radius for the glow effect | ||
self.glow_effect.setColor(Qt.GlobalColor.cyan) | ||
self.glow_effect.setOffset( | ||
0, 0 | ||
) # Center the shadow to create the glow effect | ||
self.start_stop_button.setGraphicsEffect(self.glow_effect) | ||
|
||
_start_glow_animation(self) | ||
|
||
|
||
def _start_glow_animation(self): | ||
"""Create a glow effect animation.""" | ||
self.glow_animation = QPropertyAnimation(self.glow_effect, b"blurRadius") | ||
self.glow_animation.setStartValue(0) | ||
self.glow_animation.setEndValue(25) | ||
self.glow_animation.setDuration(2000) | ||
self.glow_animation.setEasingCurve(QEasingCurve.Type.SineCurve) | ||
self.glow_animation.setLoopCount(-1) | ||
self.glow_animation.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from PyQt6.QtGui import QImage | ||
from PyQt6.QtGui import QPixmap | ||
from PyQt6.QtWidgets import QLabel | ||
from PyQt6.QtWidgets import QVBoxLayout | ||
from PyQt6.QtWidgets import QWidget | ||
|
||
|
||
class ImageStreamWindow(QWidget): | ||
def __init__(self): | ||
super().__init__() | ||
|
||
self.image = QLabel(self) | ||
self.inactiveIndicator = QLabel(self) | ||
self.inactiveIndicator.setText( | ||
"The visualizer is disabled. Enable it in the Settings tab." | ||
) | ||
self.inactiveIndicator.setStyleSheet( | ||
"background-color: #FFA500; color: white; padding: 5px; height: fit-content; width: fit-content;" | ||
) | ||
self.inactiveIndicator.setMaximumHeight(30) | ||
layout = QVBoxLayout() | ||
layout.addWidget(self.inactiveIndicator) | ||
layout.addWidget(self.image) | ||
self.setLayout(layout) | ||
|
||
def update_frame(self, annotated_image): | ||
height, width, channel = annotated_image.shape | ||
bytes_per_line = 3 * width | ||
q_image = QImage( | ||
annotated_image.data.tobytes(), | ||
width, | ||
height, | ||
bytes_per_line, | ||
QImage.Format.Format_RGB888, | ||
) | ||
|
||
pixmap = QPixmap.fromImage(q_image) | ||
self.image.setPixmap(pixmap) | ||
|
||
def update_active_state(self, active): | ||
if not active: | ||
self.inactiveIndicator.show() | ||
else: | ||
self.inactiveIndicator.hide() | ||
self.image.clear() |
Oops, something went wrong.