From f043f9087232a416bf9fa7dbb0b8f9b6f4e0a04e Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 10 Oct 2012 03:59:01 +0900 Subject: fix for left-click on systray Closes #310 --- src/leap/app.py | 2 +- src/leap/baseapp/systray.py | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/leap/app.py b/src/leap/app.py index 341f6a6e..a1251ca8 100644 --- a/src/leap/app.py +++ b/src/leap/app.py @@ -36,7 +36,7 @@ def main(): console.setFormatter(formatter) logger.addHandler(console) - logger.debug(opts) + #logger.debug(opts) logger.info('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~') logger.info('LEAP client version %s', VERSION) logger.info('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~') diff --git a/src/leap/baseapp/systray.py b/src/leap/baseapp/systray.py index d5d44f61..cc5d89df 100644 --- a/src/leap/baseapp/systray.py +++ b/src/leap/baseapp/systray.py @@ -100,6 +100,10 @@ class StatusAwareTrayIconMixin(object): self.setIcon('disconnected') self.trayIcon.setContextMenu(self.trayIconMenu) + #self.trayIconMenu.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) + #self.trayIconMenu.customContextMenuRequested.connect( + #self.on_context_menu) + def bad(self): logger.error('this should not be called') @@ -178,12 +182,14 @@ class StatusAwareTrayIconMixin(object): handles left click, left double click showing the trayicon menu """ - #XXX there's a bug here! - #menu shows on (0,0) corner first time, - #until double clicked at least once. if reason in (QtGui.QSystemTrayIcon.Trigger, QtGui.QSystemTrayIcon.DoubleClick): - self.trayIconMenu.show() + context_menu = self.trayIcon.contextMenu() + # for some reason, context_menu.show() + # is failing in a way beyond my understanding. + # (not working the first time it's clicked). + # this works however. + context_menu.exec_(self.trayIcon.geometry().center()) @QtCore.pyqtSlot() def onTimerTick(self): -- cgit v1.2.3