diff --git a/.gitea/workflows/run-mucapy.yml b/.gitea/workflows/run-mucapy.yml index 2585420..82f72d9 100644 --- a/.gitea/workflows/run-mucapy.yml +++ b/.gitea/workflows/run-mucapy.yml @@ -9,6 +9,7 @@ on: jobs: build-and-package: runs-on: ubuntu-latest + steps: - name: Checkout repository uses: actions/checkout@v3 @@ -27,10 +28,13 @@ jobs: run: pip install pyinstaller - name: Build executable with PyInstaller - run: pyinstaller --onefile --windowed mucapy/main.py + run: | + pyinstaller --onefile --windowed mucapy/main.py \ + --add-data "mucapy/styling:mucapy/styling" - name: Upload executable artifact uses: actions/upload-artifact@v3 with: name: mucapy-executable - path: dist/ \ No newline at end of file + path: dist/ + diff --git a/mucapy/main.py b/mucapy/main.py index 80a5961..1555cd3 100644 --- a/mucapy/main.py +++ b/mucapy/main.py @@ -851,39 +851,9 @@ class AboutWindow(QDialog): close_btn.setFixedWidth(100) layout.addWidget(close_btn, alignment=Qt.AlignCenter) - self.setStyleSheet(""" - QDialog { - background-color: #2D2D2D; - color: #DDD; - } - QLabel { - color: #DDD; - } - QGroupBox { - border: 1px solid #555; - border-radius: 6px; - margin-top: 10px; - padding: 4px; - background-color: #252525; - } - QGroupBox::title { - subcontrol-origin: margin; - left: 10px; - padding: 0 3px; - color: #DDD; - } - QPushButton { - background-color: #3A3A3A; - color: #DDD; - border: 1px solid #555; - border-radius: 4px; - padding: 5px; - min-width: 80px; - } - QPushButton:hover { - background-color: #4A4A4A; - } - """) + # Set Styling for About Section + with open("styling/about.qss","r") as aboutstyle: + self.setStyleSheet(aboutstyle.read()) self.setLayout(layout) @@ -1455,86 +1425,8 @@ class MainWindow(QMainWindow): self.hw_timer.start(1000) # Update every second # Set dark theme style - self.setStyleSheet(""" - QMainWindow, QWidget { - background-color: #2D2D2D; - color: #DDD; - } - QLabel { - color: #DDD; - } - QPushButton { - background-color: #3A3A3A; - color: #DDD; - border: 1px solid #555; - border-radius: 4px; - padding: 5px; - } - QPushButton:hover { - background-color: #4A4A4A; - } - QPushButton:pressed { - background-color: #2A2A2A; - } - QPushButton:disabled { - background-color: #2A2A2A; - color: #777; - } - QComboBox, QSpinBox { - background-color: #3A3A3A; - color: #DDD; - border: 1px solid #555; - border-radius: 4px; - padding: 3px; - } - QGroupBox { - border: 1px solid #555; - border-radius: 4px; - margin-top: 10px; - padding-top: 15px; - background-color: #252525; - } - QGroupBox::title { - subcontrol-origin: margin; - left: 10px; - padding: 0 3px; - color: #DDD; - } - QMenuBar { - background-color: #252525; - color: #DDD; - } - QMenuBar::item { - background-color: transparent; - padding: 5px 10px; - } - QMenuBar::item:selected { - background-color: #3A3A3A; - } - QMenu { - background-color: #252525; - border: 1px solid #444; - color: #DDD; - } - QMenu::item:selected { - background-color: #3A3A3A; - } - QScrollArea { - border: none; - } - QDockWidget { - titlebar-close-icon: url(none); - titlebar-normal-icon: url(none); - } - QDockWidget::title { - background: #252525; - padding-left: 5px; - } - QToolButton { - background-color: transparent; - border: none; - } - """) + with open("styling/mainwindow.qss", "r") as mainstyle: + self.setStyleSheet(mainstyle.read()) # Set palette for better dark mode support palette = self.palette() @@ -2047,18 +1939,11 @@ class MainWindow(QMainWindow): self.cpu_progress.setRange(0, 100) self.cpu_progress.setTextVisible(True) self.cpu_progress.setFormat("%p%") - self.cpu_progress.setStyleSheet(""" - QProgressBar { - border: 1px solid #555; - border-radius: 2px; - text-align: center; - background-color: #2A2A2A; - } - QProgressBar::chunk { - background-color: #3A6EA5; - width: 1px; - } - """) + + # Set Styling from cpu progress QSS file + with open("styling/cpu_progress.qss","r") as cpu_progress_style: + self.cpu_progress.setStyleSheet(cpu_progress_style.read()) + cpu_layout.addWidget(self.cpu_progress) hw_monitor_layout.addLayout(cpu_layout) @@ -2072,19 +1957,10 @@ class MainWindow(QMainWindow): core_bar.setRange(0, 100) core_bar.setTextVisible(True) core_bar.setFormat("%p%") - core_bar.setStyleSheet(""" - QProgressBar { - border: 1px solid #555; - border-radius: 2px; - text-align: center; - background-color: #2A2A2A; - max-height: 12px; - } - QProgressBar::chunk { - background-color: #3A6EA5; - width: 1px; - } - """) + + with open("styling/core_bar.qss","r") as core_bar_styling: + core_bar.setStyleSheet(core_bar_styling.read()) + cores_layout.addWidget(core_label, i, 0) cores_layout.addWidget(core_bar, i, 1) self.core_bars.append(core_bar) @@ -2314,44 +2190,17 @@ class MainWindow(QMainWindow): for bar in [self.cpu_progress] + self.core_bars: value = bar.value() if value < 60: - bar.setStyleSheet(""" - QProgressBar { - border: 1px solid #555; - border-radius: 2px; - text-align: center; - background-color: #2A2A2A; - } - QProgressBar::chunk { - background-color: #3A6EA5; - width: 1px; - } - """) + with open("styling/bar/u60.qss","r") as u60_style: + bar.setStyleSheet(u60_style.read()) + elif value < 85: - bar.setStyleSheet(""" - QProgressBar { - border: 1px solid #555; - border-radius: 2px; - text-align: center; - background-color: #2A2A2A; - } - QProgressBar::chunk { - background-color: #E5A823; - width: 1px; - } - """) + with open("styling/bar/a85.qss","r") as a85_styling: + bar.setStyleSheet(a85_styling.read()) + else: - bar.setStyleSheet(""" - QProgressBar { - border: 1px solid #555; - border-radius: 2px; - text-align: center; - background-color: #2A2A2A; - } - QProgressBar::chunk { - background-color: #A23535; - width: 1px; - } - """) + with open("styling/bar/else.qss", "r") as else_style: + bar.setStyleSheet(else_style.read()) + def toggle_detection(self): """Toggle detection enabled/disabled""" diff --git a/mucapy/styling/about.qss b/mucapy/styling/about.qss new file mode 100644 index 0000000..bd97f57 --- /dev/null +++ b/mucapy/styling/about.qss @@ -0,0 +1,36 @@ +QDialog { + background-color: #2D2D2D; + color: #DDD; +} + +QLabel { + color: #DDD; +} + +QGroupBox { + border: 1px solid #555; + border-radius: 6px; + margin-top: 10px; + padding: 4px; + background-color: #252525; +} + +QGroupBox::title { + subcontrol-origin: margin; + left: 10px; + padding: 0 3px; + color: #DDD; +} + +QPushButton { + background-color: #3A3A3A; + color: #DDD; + border: 1px solid #555; + border-radius: 4px; + padding: 5px; + min-width: 80px; +} + +QPushButton:hover { + background-color: #4A4A4A; +} \ No newline at end of file diff --git a/mucapy/styling/bar/a85.qss b/mucapy/styling/bar/a85.qss new file mode 100644 index 0000000..0406012 --- /dev/null +++ b/mucapy/styling/bar/a85.qss @@ -0,0 +1,11 @@ + QProgressBar { + border: 1px solid #555; + border-radius: 2px; + text-align: center; + background-color: #2A2A2A; +} + +QProgressBar::chunk { + background-color: #E5A823; + width: 1px; +} \ No newline at end of file diff --git a/mucapy/styling/bar/else.qss b/mucapy/styling/bar/else.qss new file mode 100644 index 0000000..850302f --- /dev/null +++ b/mucapy/styling/bar/else.qss @@ -0,0 +1,11 @@ +QProgressBar { + border: 1px solid #555; + border-radius: 2px; + text-align: center; + background-color: #2A2A2A; +} + +QProgressBar::chunk { + background-color: #A23535; + width: 1px; +} \ No newline at end of file diff --git a/mucapy/styling/bar/u60.qss b/mucapy/styling/bar/u60.qss new file mode 100644 index 0000000..87a39eb --- /dev/null +++ b/mucapy/styling/bar/u60.qss @@ -0,0 +1,11 @@ +QProgressBar { + border: 1px solid #555; + border-radius: 2px; + text-align: center; + background-color: #2A2A2A; +} + +QProgressBar::chunk { + background-color: #3A6EA5; + width: 1px; +} \ No newline at end of file diff --git a/mucapy/styling/core_bar.qss b/mucapy/styling/core_bar.qss new file mode 100644 index 0000000..3158400 --- /dev/null +++ b/mucapy/styling/core_bar.qss @@ -0,0 +1,12 @@ +QProgressBar { + border: 1px solid #555; + border-radius: 2px; + text-align: center; + background-color: #2A2A2A; + max-height: 12px; +} + +QProgressBar::chunk { + background-color: #3A6EA5; + width: 1px; +} \ No newline at end of file diff --git a/mucapy/styling/cpu_progress.qss b/mucapy/styling/cpu_progress.qss new file mode 100644 index 0000000..87a39eb --- /dev/null +++ b/mucapy/styling/cpu_progress.qss @@ -0,0 +1,11 @@ +QProgressBar { + border: 1px solid #555; + border-radius: 2px; + text-align: center; + background-color: #2A2A2A; +} + +QProgressBar::chunk { + background-color: #3A6EA5; + width: 1px; +} \ No newline at end of file diff --git a/mucapy/styling/mainwindow.qss b/mucapy/styling/mainwindow.qss new file mode 100644 index 0000000..b8b9464 --- /dev/null +++ b/mucapy/styling/mainwindow.qss @@ -0,0 +1,95 @@ +QMainWindow, QWidget { + background-color: #2D2D2D; + color: #DDD; +} + +QLabel { + color: #DDD; +} + +QPushButton { + background-color: #3A3A3A; + color: #DDD; + border: 1px solid #555; + border-radius: 4px; + padding: 5px; +} + +QPushButton:hover { + background-color: #4A4A4A; +} + +QPushButton:pressed { + background-color: #2A2A2A; +} + +QPushButton:disabled { + background-color: #2A2A2A; + color: #777; +} + +QComboBox, QSpinBox { + background-color: #3A3A3A; + color: #DDD; + border: 1px solid #555; + border-radius: 4px; + padding: 3px; +} + +QGroupBox { + border: 1px solid #555; + border-radius: 4px; + margin-top: 10px; + padding-top: 15px; + background-color: #252525; +} + +QGroupBox::title { + subcontrol-origin: margin; + left: 10px; + padding: 0 3px; + color: #DDD; +} + +QMenuBar { + background-color: #252525; + color: #DDD; +} + +QMenuBar::item { + background-color: transparent; + padding: 5px 10px; +} + +QMenuBar::item:selected { + background-color: #3A3A3A; +} + +QMenu { + background-color: #252525; + border: 1px solid #444; + color: #DDD; +} + +QMenu::item:selected { + background-color: #3A3A3A; +} + +QScrollArea { + border: none; +} + +QDockWidget { + titlebar-close-icon: url(none); + titlebar-normal-icon: url(none); +} + +QDockWidget::title { + background: #252525; + padding-left: 5px; +} + +QToolButton { + background-color: transparent; + border: none; +} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 612d51d..5bb096b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ opencv-python==4.11.0.86 numpy==2.2.6 PyQt5==5.15.11 requests==2.32.3 -psutil==5.9.8 \ No newline at end of file +psutil==7.0.0 \ No newline at end of file