From ff69de437b1a9263a74c8fe125807bca459be7e0 Mon Sep 17 00:00:00 2001 From: Odizinne Date: Thu, 15 Aug 2024 14:13:55 +0200 Subject: [PATCH] use qgroupbox instead of frame. removed now useless utils and colorutils] --- src/color_utils.py | 27 --- src/designer/ui_mainwindow.ui | 408 +++++++++++++--------------------- src/headsetcontrol-qt.py | 36 +-- src/ui_mainwindow.py | 199 +++++++---------- src/utils.py | 7 - 5 files changed, 243 insertions(+), 434 deletions(-) delete mode 100644 src/color_utils.py delete mode 100644 src/utils.py diff --git a/src/color_utils.py b/src/color_utils.py deleted file mode 100644 index a85c389..0000000 --- a/src/color_utils.py +++ /dev/null @@ -1,27 +0,0 @@ -from PyQt6.QtGui import QColor, QPalette, QBrush - - -def set_frame_color_based_on_window(window, frame): - def adjust_color(color, factor): - r, g, b, a = color.red(), color.green(), color.blue(), color.alpha() - r = min(max(int(r * factor), 0), 255) - g = min(max(int(g * factor), 0), 255) - b = min(max(int(b * factor), 0), 255) - return QColor(r, g, b, a) - - def is_dark_mode(color): - r, g, b = color.red(), color.green(), color.blue() - brightness = (r + g + b) / 3 - return brightness < 127 - - main_bg_color = window.palette().color(QPalette.ColorRole.Window) - - if is_dark_mode(main_bg_color): - frame_bg_color = adjust_color(main_bg_color, 1.5) - else: - frame_bg_color = adjust_color(main_bg_color, 0.95) - - palette = frame.palette() - palette.setBrush(QPalette.ColorRole.Window, QBrush(frame_bg_color)) - frame.setAutoFillBackground(True) - frame.setPalette(palette) diff --git a/src/designer/ui_mainwindow.ui b/src/designer/ui_mainwindow.ui index 8a6721b..09f9004 100644 --- a/src/designer/ui_mainwindow.ui +++ b/src/designer/ui_mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 487 - 376 + 433 + 351 @@ -20,7 +20,7 @@ HeadsetControl-Qt - + 9 @@ -33,173 +33,17 @@ 9 - - - - - 0 - 0 - - - - No supported headset found. - - - Qt::AlignmentFlag::AlignCenter - - - - - - - QFrame::Shape::StyledPanel - - - QFrame::Shadow::Raised - - - - 9 - - - 9 - - - 9 - - - 9 - - - 9 - - - - - Qt::Orientation::Horizontal - - - - 40 - 20 - - - - - - - - - 100 - 25 - - - - - - - - - 0 - 25 - - - - Icon theme - - - - - - - - 0 - 25 - - - - Run at startup - - - - - - - - 0 - 25 - - - - Qt::LayoutDirection::RightToLeft - - - - - - - - - - - - - QFrame::Shape::StyledPanel + + + + + true + - - QFrame::Shadow::Plain + + GroupBox - - - 9 - - - 9 - - - 9 - - - 9 - - - 9 - - - - - - 0 - 25 - - - - Qt::LayoutDirection::RightToLeft - - - - - - true - - - false - - - - - - - - 0 - 25 - - - - Lights - - - + @@ -230,7 +74,7 @@ 50 - false + true @@ -265,6 +109,41 @@ + + + + + 0 + 25 + + + + Lights + + + + + + + + 0 + 25 + + + + Qt::LayoutDirection::RightToLeft + + + + + + true + + + false + + + @@ -278,6 +157,25 @@ + + + + + 0 + 25 + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + @@ -287,7 +185,7 @@ - false + true 0 @@ -322,7 +220,7 @@ - false + true 0 @@ -332,8 +230,42 @@ - - + + + + + + + + 0 + 0 + + + + GroupBox + + + + + + + 0 + 25 + + + + Icon theme + + + + + + + + 0 + 25 + + Qt::Orientation::Horizontal @@ -345,97 +277,67 @@ + + + + + 100 + 25 + + + + + + + + + 0 + 25 + + + + Run at startup + + + + + + + + 0 + 25 + + + + Qt::LayoutDirection::RightToLeft + + + + + + - - - - 3 - - - 3 - - - 3 - - - 3 - - - - - - 0 - 0 - - - - - 0 - 25 - - - - - true - - - - TextLabel - - - Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter - - - - - - - - 0 - 0 - - - - - 0 - 25 - - - - - true - - - - Qt::LayoutDirection::LeftToRight - - - TextLabel - - - Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter - - - - - - + + + + 0 + 0 + + 0 25 - - - true - - - General settings + No supported headset found. + + + Qt::AlignmentFlag::AlignCenter diff --git a/src/headsetcontrol-qt.py b/src/headsetcontrol-qt.py index 7f13054..706e539 100644 --- a/src/headsetcontrol-qt.py +++ b/src/headsetcontrol-qt.py @@ -8,8 +8,6 @@ from PyQt6.QtGui import QIcon, QAction from PyQt6.QtCore import QTimer, QTranslator, QLocale from ui_mainwindow import Ui_HeadsetControlQt -from color_utils import set_frame_color_based_on_window -from utils import is_windows_10 if sys.platform == "win32": import winshell @@ -50,14 +48,6 @@ def __init__(self): self.on_ledBox_state_changed() def init_ui(self): - if app.style().objectName() != "windows11": - self.ui.lightBatterySpinbox.setFrame(True) - self.ui.notificationBatterySpinbox.setFrame(True) - self.ui.themeComboBox.setFrame(True) - if app.style().objectName() == "fusion": - set_frame_color_based_on_window(self, self.ui.frame) - set_frame_color_based_on_window(self, self.ui.settingsFrame) - self.ui.ledBox.stateChanged.connect(self.on_ledBox_state_changed) self.ui.lightBatterySpinbox.valueChanged.connect(self.save_settings) self.ui.notificationBatterySpinbox.valueChanged.connect(self.save_settings) @@ -207,28 +197,25 @@ def update_ui_with_headset_info(self, headset_info): capabilities = headset_info.get("capabilities_str", []) battery_info = headset_info.get("battery", {}) - self.ui.deviceLabel.setText(f"{device_name}") + self.ui.deviceGroupBox.setTitle(f"{device_name}") battery_status = battery_info.get("status", "UNKNOWN") if battery_status == "BATTERY_AVAILABLE": battery_level = battery_info.get("level", 0) - self.ui.batteryBar.setEnabled(True) self.ui.batteryBar.setValue(battery_level) - self.ui.statusLabel.setText(f"{battery_level}%") + self.ui.batteryBar.setFormat(f"{battery_level}%") self.tray_icon.setToolTip(f"Battery Level: {battery_level}%") icon_path = self.get_battery_icon(battery_level, charging=False) elif battery_status == "BATTERY_CHARGING": - self.ui.batteryBar.setEnabled(True) self.ui.batteryBar.setValue(0) - self.ui.statusLabel.setText("Charging") + self.ui.batteryBar.setFormat("Charging") self.tray_icon.setToolTip("Battery Charging") icon_path = self.get_battery_icon(battery_level=None, charging=True) else: - self.ui.batteryBar.setEnabled(False) self.ui.batteryBar.setValue(0) - self.ui.statusLabel.setText("Off") + self.ui.batteryBar.setFormat("Off") self.tray_icon.setToolTip("Battery Unavailable") icon_path = self.get_battery_icon(battery_level=None, missing=True) @@ -256,7 +243,6 @@ def update_ui_with_headset_info(self, headset_info): def get_battery_icon(self, battery_level, charging=False, missing=False): theme = None - print(self.ui.themeComboBox.currentIndex()) if self.ui.themeComboBox.currentIndex() == 0: if sys.platform == "win32": dark_mode = darkdetect.isDark() @@ -274,7 +260,6 @@ def get_battery_icon(self, battery_level, charging=False, missing=False): if missing: icon_name = f"battery-missing-{theme}" - print(icon_name) elif charging: icon_name = f"battery-100-charging-{theme}" else: @@ -333,12 +318,12 @@ def set_sidetone(self): self.save_settings() def toggle_ui_elements(self, show): - self.ui.deviceLabel.setVisible(show) - self.ui.statusLabel.setVisible(show) - self.ui.frame.setVisible(show) - self.ui.settingsFrame.setVisible(show) - self.ui.settingsLabel.setVisible(show) + self.ui.deviceGroupBox.setVisible(show) + self.ui.generalGroupBox.setVisible(show) self.ui.notFoundLabel.setVisible(not show) + self.setMinimumSize(0, 0) + self.adjustSize() + self.setFixedSize(self.size()) def show_window(self): self.show() @@ -411,7 +396,6 @@ def check_startup_checkbox(self): if file_name and translator.load(file_name): app.installTranslator(translator) - if is_windows_10(): - app.setStyle("fusion") + app.setStyle("fusion") window = HeadsetControlApp() sys.exit(app.exec()) diff --git a/src/ui_mainwindow.py b/src/ui_mainwindow.py index b09d8bb..39970de 100644 --- a/src/ui_mainwindow.py +++ b/src/ui_mainwindow.py @@ -1,4 +1,4 @@ -# Form implementation generated from reading ui file '.\src\designer\ui_mainwindow.ui' +# Form implementation generated from reading ui file '.\designer\ui_mainwindow.ui' # # Created by: PyQt6 UI code generator 6.7.0 # @@ -12,7 +12,7 @@ class Ui_HeadsetControlQt(object): def setupUi(self, HeadsetControlQt): HeadsetControlQt.setObjectName("HeadsetControlQt") - HeadsetControlQt.resize(487, 376) + HeadsetControlQt.resize(433, 351) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) @@ -23,153 +23,111 @@ def setupUi(self, HeadsetControlQt): self.gridLayout_2 = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout_2.setContentsMargins(9, 9, 9, 9) self.gridLayout_2.setObjectName("gridLayout_2") - self.notFoundLabel = QtWidgets.QLabel(parent=self.centralwidget) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.notFoundLabel.sizePolicy().hasHeightForWidth()) - self.notFoundLabel.setSizePolicy(sizePolicy) - self.notFoundLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) - self.notFoundLabel.setObjectName("notFoundLabel") - self.gridLayout_2.addWidget(self.notFoundLabel, 6, 0, 1, 2) - self.settingsFrame = QtWidgets.QFrame(parent=self.centralwidget) - self.settingsFrame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel) - self.settingsFrame.setFrameShadow(QtWidgets.QFrame.Shadow.Raised) - self.settingsFrame.setObjectName("settingsFrame") - self.gridLayout = QtWidgets.QGridLayout(self.settingsFrame) - self.gridLayout.setContentsMargins(9, 9, 9, 9) - self.gridLayout.setSpacing(9) - self.gridLayout.setObjectName("gridLayout") - spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) - self.gridLayout.addItem(spacerItem, 0, 1, 1, 1) - self.themeComboBox = QtWidgets.QComboBox(parent=self.settingsFrame) - self.themeComboBox.setMinimumSize(QtCore.QSize(100, 25)) - self.themeComboBox.setObjectName("themeComboBox") - self.gridLayout.addWidget(self.themeComboBox, 0, 2, 1, 1) - self.label = QtWidgets.QLabel(parent=self.settingsFrame) - self.label.setMinimumSize(QtCore.QSize(0, 25)) - self.label.setObjectName("label") - self.gridLayout.addWidget(self.label, 0, 0, 1, 1) - self.startupLabel = QtWidgets.QLabel(parent=self.settingsFrame) - self.startupLabel.setMinimumSize(QtCore.QSize(0, 25)) - self.startupLabel.setObjectName("startupLabel") - self.gridLayout.addWidget(self.startupLabel, 1, 0, 1, 1) - self.startupCheckbox = QtWidgets.QCheckBox(parent=self.settingsFrame) - self.startupCheckbox.setMinimumSize(QtCore.QSize(0, 25)) - self.startupCheckbox.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) - self.startupCheckbox.setText("") - self.startupCheckbox.setObjectName("startupCheckbox") - self.gridLayout.addWidget(self.startupCheckbox, 1, 2, 1, 1) - self.gridLayout_2.addWidget(self.settingsFrame, 5, 0, 1, 2) - self.frame = QtWidgets.QFrame(parent=self.centralwidget) - self.frame.setFrameShape(QtWidgets.QFrame.Shape.StyledPanel) - self.frame.setFrameShadow(QtWidgets.QFrame.Shadow.Plain) - self.frame.setObjectName("frame") - self.gridLayout_5 = QtWidgets.QGridLayout(self.frame) - self.gridLayout_5.setContentsMargins(9, 9, 9, 9) - self.gridLayout_5.setSpacing(9) - self.gridLayout_5.setObjectName("gridLayout_5") - self.ledBox = QtWidgets.QCheckBox(parent=self.frame) - self.ledBox.setMinimumSize(QtCore.QSize(0, 25)) - self.ledBox.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) - self.ledBox.setText("") - self.ledBox.setChecked(True) - self.ledBox.setTristate(False) - self.ledBox.setObjectName("ledBox") - self.gridLayout_5.addWidget(self.ledBox, 1, 2, 1, 1) - self.ledLabel = QtWidgets.QLabel(parent=self.frame) - self.ledLabel.setMinimumSize(QtCore.QSize(0, 25)) - self.ledLabel.setObjectName("ledLabel") - self.gridLayout_5.addWidget(self.ledLabel, 1, 0, 1, 2) + self.deviceGroupBox = QtWidgets.QGroupBox(parent=self.centralwidget) + font = QtGui.QFont() + font.setBold(True) + self.deviceGroupBox.setFont(font) + self.deviceGroupBox.setObjectName("deviceGroupBox") + self.gridLayout_4 = QtWidgets.QGridLayout(self.deviceGroupBox) + self.gridLayout_4.setObjectName("gridLayout_4") self.gridLayout_7 = QtWidgets.QGridLayout() self.gridLayout_7.setSpacing(9) self.gridLayout_7.setObjectName("gridLayout_7") - self.batteryLabel = QtWidgets.QLabel(parent=self.frame) + self.batteryLabel = QtWidgets.QLabel(parent=self.deviceGroupBox) self.batteryLabel.setMinimumSize(QtCore.QSize(0, 25)) self.batteryLabel.setObjectName("batteryLabel") self.gridLayout_7.addWidget(self.batteryLabel, 0, 0, 1, 1) - self.batteryBar = QtWidgets.QProgressBar(parent=self.frame) + self.batteryBar = QtWidgets.QProgressBar(parent=self.deviceGroupBox) self.batteryBar.setMinimumSize(QtCore.QSize(0, 25)) self.batteryBar.setProperty("value", 50) - self.batteryBar.setTextVisible(False) + self.batteryBar.setTextVisible(True) self.batteryBar.setObjectName("batteryBar") self.gridLayout_7.addWidget(self.batteryBar, 0, 1, 1, 1) - self.sidetoneLabel = QtWidgets.QLabel(parent=self.frame) + self.sidetoneLabel = QtWidgets.QLabel(parent=self.deviceGroupBox) self.sidetoneLabel.setMinimumSize(QtCore.QSize(0, 25)) self.sidetoneLabel.setObjectName("sidetoneLabel") self.gridLayout_7.addWidget(self.sidetoneLabel, 1, 0, 1, 1) - self.sidetoneSlider = QtWidgets.QSlider(parent=self.frame) + self.sidetoneSlider = QtWidgets.QSlider(parent=self.deviceGroupBox) self.sidetoneSlider.setMinimumSize(QtCore.QSize(0, 25)) self.sidetoneSlider.setMaximum(128) self.sidetoneSlider.setOrientation(QtCore.Qt.Orientation.Horizontal) self.sidetoneSlider.setObjectName("sidetoneSlider") self.gridLayout_7.addWidget(self.sidetoneSlider, 1, 1, 1, 1) - self.gridLayout_5.addLayout(self.gridLayout_7, 0, 0, 1, 3) - self.lightBatteryLabel = QtWidgets.QLabel(parent=self.frame) + self.gridLayout_4.addLayout(self.gridLayout_7, 0, 0, 1, 3) + self.ledLabel = QtWidgets.QLabel(parent=self.deviceGroupBox) + self.ledLabel.setMinimumSize(QtCore.QSize(0, 25)) + self.ledLabel.setObjectName("ledLabel") + self.gridLayout_4.addWidget(self.ledLabel, 1, 0, 1, 2) + self.ledBox = QtWidgets.QCheckBox(parent=self.deviceGroupBox) + self.ledBox.setMinimumSize(QtCore.QSize(0, 25)) + self.ledBox.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) + self.ledBox.setText("") + self.ledBox.setChecked(True) + self.ledBox.setTristate(False) + self.ledBox.setObjectName("ledBox") + self.gridLayout_4.addWidget(self.ledBox, 1, 2, 1, 1) + self.lightBatteryLabel = QtWidgets.QLabel(parent=self.deviceGroupBox) self.lightBatteryLabel.setMinimumSize(QtCore.QSize(0, 25)) self.lightBatteryLabel.setObjectName("lightBatteryLabel") - self.gridLayout_5.addWidget(self.lightBatteryLabel, 2, 0, 1, 1) - self.lightBatterySpinbox = QtWidgets.QSpinBox(parent=self.frame) + self.gridLayout_4.addWidget(self.lightBatteryLabel, 2, 0, 1, 1) + spacerItem = QtWidgets.QSpacerItem(0, 25, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + self.gridLayout_4.addItem(spacerItem, 2, 1, 1, 1) + self.lightBatterySpinbox = QtWidgets.QSpinBox(parent=self.deviceGroupBox) self.lightBatterySpinbox.setMinimumSize(QtCore.QSize(100, 25)) - self.lightBatterySpinbox.setFrame(False) + self.lightBatterySpinbox.setFrame(True) self.lightBatterySpinbox.setMinimum(0) self.lightBatterySpinbox.setMaximum(100) self.lightBatterySpinbox.setProperty("value", 20) self.lightBatterySpinbox.setObjectName("lightBatterySpinbox") - self.gridLayout_5.addWidget(self.lightBatterySpinbox, 2, 2, 1, 1) - self.notification_label = QtWidgets.QLabel(parent=self.frame) + self.gridLayout_4.addWidget(self.lightBatterySpinbox, 2, 2, 1, 1) + self.notification_label = QtWidgets.QLabel(parent=self.deviceGroupBox) self.notification_label.setMinimumSize(QtCore.QSize(0, 25)) self.notification_label.setObjectName("notification_label") - self.gridLayout_5.addWidget(self.notification_label, 3, 0, 1, 1) - self.notificationBatterySpinbox = QtWidgets.QSpinBox(parent=self.frame) + self.gridLayout_4.addWidget(self.notification_label, 3, 0, 1, 1) + self.notificationBatterySpinbox = QtWidgets.QSpinBox(parent=self.deviceGroupBox) self.notificationBatterySpinbox.setMinimumSize(QtCore.QSize(100, 25)) - self.notificationBatterySpinbox.setFrame(False) + self.notificationBatterySpinbox.setFrame(True) self.notificationBatterySpinbox.setMinimum(0) self.notificationBatterySpinbox.setProperty("value", 20) self.notificationBatterySpinbox.setObjectName("notificationBatterySpinbox") - self.gridLayout_5.addWidget(self.notificationBatterySpinbox, 3, 2, 1, 1) - spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) - self.gridLayout_5.addItem(spacerItem1, 2, 1, 1, 1) - self.gridLayout_2.addWidget(self.frame, 1, 0, 1, 2) - self.gridLayout_3 = QtWidgets.QGridLayout() - self.gridLayout_3.setContentsMargins(3, 3, 3, 3) + self.gridLayout_4.addWidget(self.notificationBatterySpinbox, 3, 2, 1, 1) + self.gridLayout_2.addWidget(self.deviceGroupBox, 0, 0, 1, 1) + self.generalGroupBox = QtWidgets.QGroupBox(parent=self.centralwidget) + self.generalGroupBox.setMinimumSize(QtCore.QSize(0, 0)) + self.generalGroupBox.setObjectName("generalGroupBox") + self.gridLayout_3 = QtWidgets.QGridLayout(self.generalGroupBox) self.gridLayout_3.setObjectName("gridLayout_3") - self.deviceLabel = QtWidgets.QLabel(parent=self.centralwidget) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.deviceLabel.sizePolicy().hasHeightForWidth()) - self.deviceLabel.setSizePolicy(sizePolicy) - self.deviceLabel.setMinimumSize(QtCore.QSize(0, 25)) - font = QtGui.QFont() - font.setBold(True) - self.deviceLabel.setFont(font) - self.deviceLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeading|QtCore.Qt.AlignmentFlag.AlignLeft|QtCore.Qt.AlignmentFlag.AlignVCenter) - self.deviceLabel.setObjectName("deviceLabel") - self.gridLayout_3.addWidget(self.deviceLabel, 0, 0, 1, 1) - self.statusLabel = QtWidgets.QLabel(parent=self.centralwidget) + self.label = QtWidgets.QLabel(parent=self.generalGroupBox) + self.label.setMinimumSize(QtCore.QSize(0, 25)) + self.label.setObjectName("label") + self.gridLayout_3.addWidget(self.label, 0, 0, 1, 1) + spacerItem1 = QtWidgets.QSpacerItem(0, 25, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + self.gridLayout_3.addItem(spacerItem1, 0, 1, 1, 1) + self.themeComboBox = QtWidgets.QComboBox(parent=self.generalGroupBox) + self.themeComboBox.setMinimumSize(QtCore.QSize(100, 25)) + self.themeComboBox.setObjectName("themeComboBox") + self.gridLayout_3.addWidget(self.themeComboBox, 0, 2, 1, 1) + self.startupLabel = QtWidgets.QLabel(parent=self.generalGroupBox) + self.startupLabel.setMinimumSize(QtCore.QSize(0, 25)) + self.startupLabel.setObjectName("startupLabel") + self.gridLayout_3.addWidget(self.startupLabel, 1, 0, 1, 1) + self.startupCheckbox = QtWidgets.QCheckBox(parent=self.generalGroupBox) + self.startupCheckbox.setMinimumSize(QtCore.QSize(0, 25)) + self.startupCheckbox.setLayoutDirection(QtCore.Qt.LayoutDirection.RightToLeft) + self.startupCheckbox.setText("") + self.startupCheckbox.setObjectName("startupCheckbox") + self.gridLayout_3.addWidget(self.startupCheckbox, 1, 2, 1, 1) + self.gridLayout_2.addWidget(self.generalGroupBox, 1, 0, 1, 1) + self.notFoundLabel = QtWidgets.QLabel(parent=self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.statusLabel.sizePolicy().hasHeightForWidth()) - self.statusLabel.setSizePolicy(sizePolicy) - self.statusLabel.setMinimumSize(QtCore.QSize(0, 25)) - font = QtGui.QFont() - font.setBold(True) - self.statusLabel.setFont(font) - self.statusLabel.setLayoutDirection(QtCore.Qt.LayoutDirection.LeftToRight) - self.statusLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter) - self.statusLabel.setObjectName("statusLabel") - self.gridLayout_3.addWidget(self.statusLabel, 0, 1, 1, 1) - self.gridLayout_3.setColumnStretch(0, 10) - self.gridLayout_2.addLayout(self.gridLayout_3, 0, 0, 1, 2) - self.settingsLabel = QtWidgets.QLabel(parent=self.centralwidget) - self.settingsLabel.setMinimumSize(QtCore.QSize(0, 25)) - font = QtGui.QFont() - font.setBold(True) - self.settingsLabel.setFont(font) - self.settingsLabel.setObjectName("settingsLabel") - self.gridLayout_2.addWidget(self.settingsLabel, 2, 0, 1, 1) + sizePolicy.setHeightForWidth(self.notFoundLabel.sizePolicy().hasHeightForWidth()) + self.notFoundLabel.setSizePolicy(sizePolicy) + self.notFoundLabel.setMinimumSize(QtCore.QSize(0, 25)) + self.notFoundLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.notFoundLabel.setObjectName("notFoundLabel") + self.gridLayout_2.addWidget(self.notFoundLabel, 2, 0, 1, 1) HeadsetControlQt.setCentralWidget(self.centralwidget) self.retranslateUi(HeadsetControlQt) @@ -178,14 +136,13 @@ def setupUi(self, HeadsetControlQt): def retranslateUi(self, HeadsetControlQt): _translate = QtCore.QCoreApplication.translate HeadsetControlQt.setWindowTitle(_translate("HeadsetControlQt", "HeadsetControl-Qt")) - self.notFoundLabel.setText(_translate("HeadsetControlQt", "No supported headset found.")) - self.label.setText(_translate("HeadsetControlQt", "Icon theme")) - self.startupLabel.setText(_translate("HeadsetControlQt", "Run at startup")) - self.ledLabel.setText(_translate("HeadsetControlQt", "Lights")) + self.deviceGroupBox.setTitle(_translate("HeadsetControlQt", "GroupBox")) self.batteryLabel.setText(_translate("HeadsetControlQt", "Battery")) self.sidetoneLabel.setText(_translate("HeadsetControlQt", "Sidetone")) + self.ledLabel.setText(_translate("HeadsetControlQt", "Lights")) self.lightBatteryLabel.setText(_translate("HeadsetControlQt", "Disable lights when battery goes below:")) self.notification_label.setText(_translate("HeadsetControlQt", "Send notification when battery goes below")) - self.deviceLabel.setText(_translate("HeadsetControlQt", "TextLabel")) - self.statusLabel.setText(_translate("HeadsetControlQt", "TextLabel")) - self.settingsLabel.setText(_translate("HeadsetControlQt", "General settings")) + self.generalGroupBox.setTitle(_translate("HeadsetControlQt", "GroupBox")) + self.label.setText(_translate("HeadsetControlQt", "Icon theme")) + self.startupLabel.setText(_translate("HeadsetControlQt", "Run at startup")) + self.notFoundLabel.setText(_translate("HeadsetControlQt", "No supported headset found.")) diff --git a/src/utils.py b/src/utils.py deleted file mode 100644 index cd27cb9..0000000 --- a/src/utils.py +++ /dev/null @@ -1,7 +0,0 @@ -import platform - - -def is_windows_10(): - os_release = platform.release() - os_name = platform.system() - return os_name == "Windows" and os_release == "10"