Fix PySide6 enum access for Windows compatibility
- Import QStyle from PySide6.QtWidgets - Use QStyle.StandardPixmap.SP_ComputerIcon instead of self.style().SP_ComputerIcon - Use QSystemTrayIcon.ActivationReason.DoubleClick instead of QSystemTrayIcon.DoubleClick PySide6 requires fully qualified enum paths unlike PyQt5. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,7 @@ from PySide6.QtWidgets import (
|
|||||||
QMainWindow, QWidget, QVBoxLayout, QHBoxLayout,
|
QMainWindow, QWidget, QVBoxLayout, QHBoxLayout,
|
||||||
QLabel, QPushButton, QTabWidget, QGridLayout,
|
QLabel, QPushButton, QTabWidget, QGridLayout,
|
||||||
QScrollArea, QFrame, QMenu, QMenuBar, QStatusBar,
|
QScrollArea, QFrame, QMenu, QMenuBar, QStatusBar,
|
||||||
QMessageBox, QApplication, QSystemTrayIcon
|
QMessageBox, QApplication, QSystemTrayIcon, QStyle
|
||||||
)
|
)
|
||||||
from PySide6.QtCore import Qt, Signal, QTimer, QSize
|
from PySide6.QtCore import Qt, Signal, QTimer, QSize
|
||||||
from PySide6.QtGui import QIcon, QPixmap, QAction, QFont
|
from PySide6.QtGui import QIcon, QPixmap, QAction, QFont
|
||||||
@@ -299,7 +299,7 @@ class MainWindow(QMainWindow):
|
|||||||
self.tray_icon.setIcon(QIcon(icon_path))
|
self.tray_icon.setIcon(QIcon(icon_path))
|
||||||
self.setWindowIcon(QIcon(icon_path))
|
self.setWindowIcon(QIcon(icon_path))
|
||||||
else:
|
else:
|
||||||
self.tray_icon.setIcon(self.style().standardIcon(self.style().SP_ComputerIcon))
|
self.tray_icon.setIcon(self.style().standardIcon(QStyle.StandardPixmap.SP_ComputerIcon))
|
||||||
|
|
||||||
# Tray menu
|
# Tray menu
|
||||||
tray_menu = QMenu()
|
tray_menu = QMenu()
|
||||||
@@ -314,7 +314,7 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
def on_tray_activated(self, reason):
|
def on_tray_activated(self, reason):
|
||||||
"""Handle tray icon activation."""
|
"""Handle tray icon activation."""
|
||||||
if reason == QSystemTrayIcon.DoubleClick:
|
if reason == QSystemTrayIcon.ActivationReason.DoubleClick:
|
||||||
self.show()
|
self.show()
|
||||||
self.activateWindow()
|
self.activateWindow()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user