From b158a234fd37d1ff036f4f5fc24107ac8ff66fc8 Mon Sep 17 00:00:00 2001 From: EKNr1 Date: Fri, 20 Dec 2024 18:02:59 +0100 Subject: [PATCH] Added "Track Control" gui. --- .gitignore | 2 ++ wobuzz/gui.py | 10 ++++++++++ wobuzz/main.py | 17 +++++++++++++++++ wobuzz/ui/main_container.py | 17 +++++++++++++++++ wobuzz/ui/main_window.py | 19 +++++++++++++++++++ wobuzz/ui/track_control.py | 26 ++++++++++++++++++++++++++ 6 files changed, 91 insertions(+) create mode 100644 .gitignore create mode 100644 wobuzz/gui.py create mode 100644 wobuzz/main.py create mode 100644 wobuzz/ui/main_container.py create mode 100644 wobuzz/ui/main_window.py create mode 100644 wobuzz/ui/track_control.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f3f6814 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +__pycache__ +.idea/ \ No newline at end of file diff --git a/wobuzz/gui.py b/wobuzz/gui.py new file mode 100644 index 0000000..3dbf0c3 --- /dev/null +++ b/wobuzz/gui.py @@ -0,0 +1,10 @@ +#!/usr/bin/python3 + +from ui.main_window import MainWindow + + +class GUI: + def __init__(self): + self.window = MainWindow() + + self.window.show() diff --git a/wobuzz/main.py b/wobuzz/main.py new file mode 100644 index 0000000..17edae5 --- /dev/null +++ b/wobuzz/main.py @@ -0,0 +1,17 @@ +#!/usr/bin/python3 + +import sys +from PyQt6.QtWidgets import QApplication +from gui import GUI + + +class Wobuzz: + def __init__(self): + self.qt_app = QApplication(sys.argv) + + self.gui = GUI() + + +if __name__ == "__main__": + wobuzz = Wobuzz() + sys.exit(wobuzz.qt_app.exec()) diff --git a/wobuzz/ui/main_container.py b/wobuzz/ui/main_container.py new file mode 100644 index 0000000..f41f36b --- /dev/null +++ b/wobuzz/ui/main_container.py @@ -0,0 +1,17 @@ +#!/usr/bin/python3 + +from PyQt6.QtWidgets import QWidget, QGridLayout +from ui.track_control import TrackControl + + +class MainContainer(QWidget): + def __init__(self, parent=None): + super().__init__(parent) + + self.layout = QGridLayout() + + self.track_control = TrackControl(self) + self.layout.addWidget(self.track_control) + + self.setLayout(self.layout) + diff --git a/wobuzz/ui/main_window.py b/wobuzz/ui/main_window.py new file mode 100644 index 0000000..c279ec3 --- /dev/null +++ b/wobuzz/ui/main_window.py @@ -0,0 +1,19 @@ +#!/usr/bin/python3 + +from PyQt6.QtWidgets import QMainWindow, QMenu +from ui.main_container import MainContainer + + +class MainWindow(QMainWindow): + def __init__(self, parent=None): + super().__init__(parent) + + self.setWindowTitle("WoBuzz") + + self.menu_bar = self.menuBar() + self.menu_bar.addMenu(QMenu("&File", self)) + + self.main_container = MainContainer(self) + + self.setCentralWidget(self.main_container) + diff --git a/wobuzz/ui/track_control.py b/wobuzz/ui/track_control.py new file mode 100644 index 0000000..63e1d13 --- /dev/null +++ b/wobuzz/ui/track_control.py @@ -0,0 +1,26 @@ +#!/usr/bin/python3 + +from PyQt6.QtCore import Qt +from PyQt6.QtGui import QIcon +from PyQt6.QtWidgets import QToolBar, QSlider, QStyle + + +class TrackControl(QToolBar): + def __init__(self, parent=None): + super().__init__(parent) + + icon = QIcon.fromTheme(QIcon.ThemeIcon.MediaSkipBackward) + self.previous_button = self.addAction(icon, "Previous") + + icon = QIcon.fromTheme(QIcon.ThemeIcon.MediaPlaybackStart) + self.toggle_play_button = self.addAction(icon, "Play/Pause") + + icon = QIcon.fromTheme(QIcon.ThemeIcon.MediaPlaybackStop) + self.stop_button = self.addAction(icon, "Stop") + + icon = QIcon.fromTheme(QIcon.ThemeIcon.MediaSkipForward) + self.next_button = self.addAction(icon, "Next") + + self.play_position_slider = QSlider(Qt.Orientation.Horizontal, self) + self.addWidget(self.play_position_slider) +