"""
import sys
import os
-from PyQt4 import QtGui
+from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import SIGNAL
from qmenutooltip import QMenuToolTip
#profile manager component
self.addProfile = QtGui.QAction(" Add &Profile ", self,
- triggered=self.addProfile, icon=QtGui.QIcon(appconf.icon))
+ triggered=self.addProfile)
def createTrayIcon(self):
if reason in (QtGui.QSystemTrayIcon.Trigger, QtGui.QSystemTrayIcon.DoubleClick):
self.menuProfiles = QMenuToolTip()
self.menuProfiles.setTitle("Profiles")
+ QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_DontShowIconsInMenus, False)
#Get profiles from the ProfHandler embedded in the gui
profiles = self.profileManager.getProfilesList()
- for pr in profiles:
- #pr is a profile path
- receiver = self.activateProfileAction(pr)
- pr = os.path.basename(pr)
+ for prpath in profiles:
+ pr = os.path.basename(prpath)
+ receiver = self.activateProfileAction(prpath)
menuItem_Profile = self.menuProfiles.addAction(pr)
+ if self.profileManager.isCurrentProfile(prpath):
+ menuItem_Profile.setIcon(QtGui.QIcon(appconf.cpicon))
+
#Using lambda function to pass additional arguments to the function, in this case the path of the profile
self.connect(menuItem_Profile, SIGNAL('triggered()'), receiver)
#set menu item ToolTip
raise AppError('Profile Name not valid')
print("Profile "+profileName+" created.")
+ def isCurrentProfile(self, ppath):
+ """ Returns true if the current profile path is currently activated """
+
+ pl = platform.system()
+ if pl in ('Linux','Darwin'):
+ if os.path.exists(self.getDropboxDirectory()):
+ return True if os.readlink(self.getDropboxDirectory()) == ppath else False
+ else:
+ return False
+
def isValidProfileName(self, pname):
+
if self.reg.match(pname) is not None:
return True
else: