split into right and left clock menus

This commit is contained in:
N0\A
2025-10-22 13:29:12 +02:00
parent 1ba61bee46
commit f0290658c9

21
main.py
View File

@@ -59,17 +59,20 @@ class MainWindow(QtWidgets.QMainWindow):
self.tray = QtWidgets.QSystemTrayIcon(self) self.tray = QtWidgets.QSystemTrayIcon(self)
self.tray.setIcon(QtGui.QIcon(str(ASSET))) self.tray.setIcon(QtGui.QIcon(str(ASSET)))
# MENU # RIGHT MENU
menu = QtWidgets.QMenu() right_menu = QtWidgets.QMenu()
menu.addAction("Search Files", self.start_file_search)
if restart: if restart:
menu.addAction("Restart", self.restart_application) right_menu.addAction("Restart", self.restart_application)
menu.addAction("Hide/Show", self.toggle_visible) right_menu.addAction("Hide/Show", self.toggle_visible)
menu.addSeparator() right_menu.addSeparator()
menu.addAction("Quit", QtWidgets.QApplication.quit) right_menu.addAction("Quit", QtWidgets.QApplication.quit)
self.tray.setContextMenu(menu) self.tray.setContextMenu(right_menu)
self.tray.show() self.tray.show()
# LEFT MENU
self.left_menu = QtWidgets.QMenu()
self.left_menu.addAction("Search Files", self.start_file_search)
# self._drag_pos = None # self._drag_pos = None
# Timer to ensure window stays on top # Timer to ensure window stays on top
@@ -92,7 +95,7 @@ class MainWindow(QtWidgets.QMainWindow):
def mousePressEvent(self, event: QtGui.QMouseEvent): def mousePressEvent(self, event: QtGui.QMouseEvent):
if event.button() == QtCore.Qt.LeftButton: #type: ignore if event.button() == QtCore.Qt.LeftButton: #type: ignore
self.tray.contextMenu().popup(event.globalPosition().toPoint()) self.left_menu.popup(event.globalPosition().toPoint())
# self._drag_pos = event.globalPosition().toPoint() - self.frameGeometry().topLeft() # self._drag_pos = event.globalPosition().toPoint() - self.frameGeometry().topLeft()
# event.accept() # event.accept()
elif event.button() == QtCore.Qt.RightButton: #type: ignore elif event.button() == QtCore.Qt.RightButton: #type: ignore