49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
from model.project import Project
|
|
|
|
class ProjectManager(object):
|
|
|
|
def __init__(self, appDataStorage):
|
|
self.__appDataStorage = appDataStorage
|
|
self.__recentProjects = None
|
|
|
|
def getRecentProjects(self):
|
|
if self.__recentProjects is None:
|
|
self.__recentProjects = {}
|
|
for item in self.__appDataStorage.readRecentProjects():
|
|
self.__recentProjects[item['path']] = item
|
|
|
|
return self.__recentProjects.values()
|
|
|
|
def pinRecentProject(self, entry, isPinned = True):
|
|
entry['pinned'] = isPinned
|
|
self.__appDataStorage.writeRecentProjects(self.__recentProjects.values())
|
|
|
|
def deleteRecentProject(self, entry):
|
|
self.__recentProjects.pop(entry['path'], None)
|
|
self.__appDataStorage.writeRecentProjects(self.__recentProjects.values())
|
|
|
|
def debug_populateRecentProjects(self):
|
|
self.__recentProjects['/home/tibi/Videos/project.pro'] = {
|
|
'name' : 'Debug project',
|
|
'path' : '/home/tibi/Videos/project.pro',
|
|
'pinned' : True,
|
|
'date' : 1
|
|
}
|
|
self.__recentProjects['/home/tibi/Videos/project2.pro'] = {
|
|
'name' : 'Debug project 2',
|
|
'path' : '/home/tibi/Videos/project2.pro',
|
|
'pinned' : False,
|
|
'date' : 2
|
|
}
|
|
self.__recentProjects['/home/tibi/Videos/project3.pro'] = {
|
|
'name' : 'Debug project 3',
|
|
'path' : '/home/tibi/Videos/project3.pro',
|
|
'pinned' : False,
|
|
'date' : 3
|
|
}
|
|
self.__recentProjects['/home/tibi/Videos/project4.pro'] = {
|
|
'name' : 'Debug project 4',
|
|
'path' : '/home/tibi/Videos/project4.pro',
|
|
'pinned' : False,
|
|
'date' : 4
|
|
} |