Worked on welcome dialog implementation.

This commit is contained in:
2018-08-01 00:02:18 +03:00
parent ac582a8b0b
commit 59cd033cad
6 changed files with 127 additions and 46 deletions

View File

@ -30,15 +30,20 @@ class AppDataStorage(object):
def writeSettings(self, settings):
pass # todo: finish this
def __parseRow(self, row):
row['date'] = int(row['date'])
row['pinned'] = row['pinned'].lower() in ['true', 'yes', '1', 'on']
return row
def readRecentProjects(self):
if (os.path.exists(self.__recentProjectsPath)):
with open(self.__recentProjectsPath, 'rb') as recentProjectsFile:
with open(self.__recentProjectsPath, 'r') as recentProjectsFile:
csvreader = csv.DictReader(recentProjectsFile, fieldnames=AppDataStorage.RECENT_PROJECTS_FIELDS)
for row in csvreader:
yield row
yield self.__parseRow(row)
def writeRecentProjects(self, items):
self.__createPath(self.__recentProjectsPath)
with open(self.__recentProjectsPath, 'wb') as recentProjectsFile:
with open(self.__recentProjectsPath, 'w') as recentProjectsFile:
csvwriter = csv.DictWriter(recentProjectsFile, AppDataStorage.RECENT_PROJECTS_FIELDS)
csvwriter.writerows(items)