Skip to content

Commit

Permalink
Show menu on left click
Browse files Browse the repository at this point in the history
  • Loading branch information
anaynayak committed Dec 13, 2020
1 parent c5a858d commit 3c79342
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions buildnotifylib/app_ui.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from time import strftime

from PyQt5 import QtCore
from PyQt5.QtGui import QCursor
from PyQt5.QtWidgets import QWidget, QSystemTrayIcon, QApplication

from buildnotifylib.app_menu import AppMenu
Expand All @@ -21,6 +22,11 @@ def __init__(self, parent: QApplication, conf: Config, build_icons: BuildIcons):
self.app_menu = AppMenu(self.widget, conf, self.build_icons)
self.app_menu.reload_data.connect(self.reload_data) # type: ignore
self.tray.setContextMenu(self.app_menu.menu)
self.tray.activated.connect(self.show_menu)

def show_menu(self, reason):
if reason == QSystemTrayIcon.Trigger:
self.app_menu.menu.popup(QCursor.pos())

def update_projects(self, integration_status: OverallIntegrationStatus):
count = len(integration_status.get_failing_builds())
Expand Down

0 comments on commit 3c79342

Please sign in to comment.