X-Git-Url: https://v.licheni.net/stack/code/dboxswitch.git/blobdiff_plain/86b7bff5277f8681b1dcb4d722481e5173fe590f..d06f73c1045d0a4b526f4662869bb2cd121eabde:/gui.py diff --git a/gui.py b/gui.py index 5f16273..61de2f1 100755 --- a/gui.py +++ b/gui.py @@ -1,4 +1,3 @@ -#!/usr/bin/python # -*- coding: utf-8 -*- """ @@ -36,6 +35,7 @@ import sys import os from PyQt4 import QtGui from PyQt4.QtCore import SIGNAL +from qmenutooltip import QMenuToolTip from apperror import AppError from settings import appconf @@ -89,6 +89,10 @@ class Gui(QtGui.QDialog): self.quitAction = QtGui.QAction("&Quit", self, triggered=QtGui.qApp.quit) + #profile manager component + self.addProfile = QtGui.QAction(" Add &Profile ", self, + triggered=self.addProfile, icon=QtGui.QIcon(appconf.icon)) + def createTrayIcon(self): """ Builds a new tray icon with a context menu and an action for the profile manager menu """ @@ -114,7 +118,7 @@ class Gui(QtGui.QDialog): action to add a new One """ if reason in (QtGui.QSystemTrayIcon.Trigger, QtGui.QSystemTrayIcon.DoubleClick): - self.menuProfiles = QtGui.QMenu() + self.menuProfiles = QMenuToolTip() self.menuProfiles.setTitle("Profiles") #Get profiles from the ProfHandler embedded in the gui @@ -127,15 +131,14 @@ class Gui(QtGui.QDialog): #Using lambda function to pass additional arguments to the function, in this case the path of the profile receiver = lambda pr=pr: self.profileManager.activateProfile(pr) self.connect(menuItem_Profile, SIGNAL('triggered()'), receiver) + #set menu item ToolTip + menuItem_Profile.setToolTip("Activate profile: "+pr) self.menuProfiles.addAction(menuItem_Profile) - #menuItem_Profile = self.menuProfiles.addAction("") - #self.menuProfiles.addAction(menuItem_Profile) self.menuProfiles.addSeparator() - menuItem_Profile = QtGui.QAction(" Add &Profile ", self, - triggered=self.addProfile, icon=QtGui.QIcon(appconf.icon)) - self.menuProfiles.addAction(menuItem_Profile) + #action and menu item for adding a New Profile + self.menuProfiles.addAction(self.addProfile) self.menuProfiles.activateWindow() self.menuProfiles.popup(QtGui.QCursor.pos())