Project/Project.py

changeset 7
c679fb30c8f3
parent 4
ed9829a5fe55
child 12
1d8dd9706f46
equal deleted inserted replaced
6:52e8c820d0dd 7:c679fb30c8f3
434 Private method to load the recently opened project filenames. 434 Private method to load the recently opened project filenames.
435 """ 435 """
436 self.recent = [] 436 self.recent = []
437 Preferences.Prefs.rsettings.sync() 437 Preferences.Prefs.rsettings.sync()
438 rp = Preferences.Prefs.rsettings.value(recentNameProject) 438 rp = Preferences.Prefs.rsettings.value(recentNameProject)
439 if rp.isValid(): 439 if rp is not None:
440 for f in rp.toStringList(): 440 for f in rp:
441 if QFileInfo(f).exists(): 441 if QFileInfo(f).exists():
442 self.recent.append(f) 442 self.recent.append(f)
443 443
444 def __saveRecent(self): 444 def __saveRecent(self):
445 """ 445 """
446 Private method to save the list of recently opened filenames. 446 Private method to save the list of recently opened filenames.
447 """ 447 """
448 Preferences.Prefs.rsettings.setValue(recentNameProject, QVariant(self.recent)) 448 Preferences.Prefs.rsettings.setValue(recentNameProject, self.recent)
449 Preferences.Prefs.rsettings.sync() 449 Preferences.Prefs.rsettings.sync()
450 450
451 def getMostRecent(self): 451 def getMostRecent(self):
452 """ 452 """
453 Public method to get the most recently opened project. 453 Public method to get the most recently opened project.
3791 else: 3791 else:
3792 formatStr = '%d. %s' 3792 formatStr = '%d. %s'
3793 act = self.recentMenu.addAction(\ 3793 act = self.recentMenu.addAction(\
3794 formatStr % (idx, 3794 formatStr % (idx,
3795 Utilities.compactPath(rp, self.ui.maxMenuFilePathLen))) 3795 Utilities.compactPath(rp, self.ui.maxMenuFilePathLen)))
3796 act.setData(QVariant(rp)) 3796 act.setData(rp)
3797 act.setEnabled(QFileInfo(rp).exists()) 3797 act.setEnabled(QFileInfo(rp).exists())
3798 idx += 1 3798 idx += 1
3799 3799
3800 self.recentMenu.addSeparator() 3800 self.recentMenu.addSeparator()
3801 self.recentMenu.addAction(self.trUtf8('&Clear'), self.__clearRecent) 3801 self.recentMenu.addAction(self.trUtf8('&Clear'), self.__clearRecent)
3804 """ 3804 """
3805 Private method to open a project from the list of rencently opened projects. 3805 Private method to open a project from the list of rencently opened projects.
3806 3806
3807 @param act reference to the action that triggered (QAction) 3807 @param act reference to the action that triggered (QAction)
3808 """ 3808 """
3809 file = act.data().toString() 3809 file = act.data()
3810 if file: 3810 if file:
3811 self.openProject(file) 3811 self.openProject(file)
3812 3812
3813 def __clearRecent(self): 3813 def __clearRecent(self):
3814 """ 3814 """

eric ide

mercurial