mirror of
https://github.com/KenanZhu/AutoLibrary.git
synced 2026-08-01 21:59:36 +08:00
fix(bulletin): 修复托盘消息点击冲突,增加公告入口,移除托盘公告选项
This commit is contained in:
+13
-2
@@ -65,6 +65,7 @@ class ALMainWindow(MsgBase, QMainWindow, Ui_ALMainWindow):
|
||||
self._output_queue,
|
||||
self.__config_paths
|
||||
)
|
||||
self.__notification_type = ""
|
||||
|
||||
self.setupUi(self)
|
||||
self.modifyUi()
|
||||
@@ -137,13 +138,12 @@ class ALMainWindow(MsgBase, QMainWindow, Ui_ALMainWindow):
|
||||
self.TrayMenu = QMenu()
|
||||
self.TrayMenu.addAction("显示主窗口", self.showNormal)
|
||||
self.TrayMenu.addAction("显示定时窗口", self.onTimerTaskManageWidgetButtonClicked)
|
||||
self.TrayMenu.addAction("公告栏", self.onBulletinActionTriggered)
|
||||
self.TrayMenu.addAction("最小化到托盘", self.hideToTray)
|
||||
self.TrayMenu.addSeparator()
|
||||
self.TrayMenu.addAction("退出", self.close)
|
||||
self.TrayIcon.setContextMenu(self.TrayMenu)
|
||||
self.TrayIcon.activated.connect(self.onTrayIconActivated)
|
||||
self.TrayIcon.messageClicked.connect(self.onBulletinActionTriggered)
|
||||
self.TrayIcon.messageClicked.connect(self.onTrayMessageClicked)
|
||||
self.TrayIcon.show()
|
||||
|
||||
def hideToTray(
|
||||
@@ -264,6 +264,7 @@ class ALMainWindow(MsgBase, QMainWindow, Ui_ALMainWindow):
|
||||
|
||||
if not hasattr(self, "TrayIcon"):
|
||||
return
|
||||
self.__notification_type = "bulletin"
|
||||
self.TrayIcon.showMessage(
|
||||
"公告栏 - AutoLibrary",
|
||||
f"有 {count} 条新公告,点击查看详情。",
|
||||
@@ -348,6 +349,15 @@ class ALMainWindow(MsgBase, QMainWindow, Ui_ALMainWindow):
|
||||
self.setControlButtons(True, None, None)
|
||||
self._showLog("配置窗口已关闭,配置文件路径已更新")
|
||||
|
||||
@Slot()
|
||||
def onTrayMessageClicked(
|
||||
self
|
||||
):
|
||||
|
||||
if self.__notification_type == "bulletin":
|
||||
self.__notification_type = ""
|
||||
self.onBulletinActionTriggered()
|
||||
|
||||
@Slot()
|
||||
def onBulletinActionTriggered(
|
||||
self
|
||||
@@ -370,6 +380,7 @@ class ALMainWindow(MsgBase, QMainWindow, Ui_ALMainWindow):
|
||||
if self.__ALSettingsWidget is None:
|
||||
self.__ALSettingsWidget = ALSettingsWidget(self)
|
||||
self.__ALSettingsWidget.settingsWidgetIsClosed.connect(self.onSettingsWidgetClosed)
|
||||
self.__ALSettingsWidget.openBulletinRequested.connect(self.onBulletinActionTriggered)
|
||||
self.__ALSettingsWidget.show()
|
||||
self.__ALSettingsWidget.raise_()
|
||||
self.__ALSettingsWidget.activateWindow()
|
||||
|
||||
@@ -91,6 +91,7 @@ def _restartApp(
|
||||
class ALSettingsWidget(CenterOnParentMixin, QWidget, Ui_ALSettingsWidget):
|
||||
|
||||
settingsWidgetIsClosed = Signal()
|
||||
openBulletinRequested = Signal()
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -189,6 +190,7 @@ class ALSettingsWidget(CenterOnParentMixin, QWidget, Ui_ALSettingsWidget):
|
||||
self.CustomThemeComboBox.currentIndexChanged.connect(self.onCustomThemeComboBoxChanged)
|
||||
self.ResetCustomThemeButton.clicked.connect(self.onResetCustomThemeButtonClicked)
|
||||
self.BulletinTestButton.clicked.connect(self.onBulletinTestButtonClicked)
|
||||
self.BulletinOpenButton.clicked.connect(self.openBulletinRequested.emit)
|
||||
self.CancelButton.clicked.connect(self.onCancelButtonClicked)
|
||||
self.ApplyButton.clicked.connect(self.onApplyButtonClicked)
|
||||
self.ConfirmButton.clicked.connect(self.onConfirmButtonClicked)
|
||||
|
||||
@@ -632,6 +632,25 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="BulletinOpenButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>查看公告栏</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user