added profhandler.getProfileBaseName
authorstack <stack@inventati.org>
Tue, 10 Jul 2012 23:10:34 +0000 (01:10 +0200)
committerstack <stack@inventati.org>
Tue, 10 Jul 2012 23:11:44 +0000 (01:11 +0200)
now the path story is somewhat more abstracted

gui.py
profhandler.py

diff --git a/gui.py b/gui.py
index 7b7fd57..920ee85 100644 (file)
--- a/gui.py
+++ b/gui.py
@@ -126,7 +126,7 @@ class Gui(QtGui.QDialog):
             profiles = self.profileManager.getProfilesList()
 
             for prpath in profiles:
             profiles = self.profileManager.getProfilesList()
 
             for prpath in profiles:
-                pr = os.path.basename(prpath)
+                pr = self.profileManager.getBaseProfileName(prpath)
                 receiver = self.activateProfileAction(prpath)
                 menuItem_Profile = self.menuProfiles.addAction(pr)
                 if self.profileManager.isCurrentProfile(prpath):
                 receiver = self.activateProfileAction(prpath)
                 menuItem_Profile = self.menuProfiles.addAction(pr)
                 if self.profileManager.isCurrentProfile(prpath):
index c1a30e8..5afefaa 100644 (file)
@@ -140,11 +140,16 @@ class ProfHandler():
                 else:
                     raise NotImplementedError, "Not implemented yet."
             except IOError as e:
                 else:
                     raise NotImplementedError, "Not implemented yet."
             except IOError as e:
-                raise AppError('Error on activating Profile: '+ os.path.basename(ppath))
+                raise AppError('Error on activating Profile: '+ self.getBaseProfileName(ppath))
             self.startDropbox()
         else:
             raise AppError("Trying to acrivate non existant profile")
 
             self.startDropbox()
         else:
             raise AppError("Trying to acrivate non existant profile")
 
+    def getBaseProfileName(self, ppath):
+        """ Returns the base name given a profile returned by getProfilesList """
+
+        return os.path.basename(ppath)
+
     def getDropboxDirectory(self):
         pl = platform.system()
         if pl in ('Linux', 'Darwin'):
     def getDropboxDirectory(self):
         pl = platform.system()
         if pl in ('Linux', 'Darwin'):