added logic to account for starting without the pickled settings

This commit is contained in:
Dan
2021-05-29 14:20:24 -04:00
parent b163d1a9bf
commit 3e3be5c6a3

17
main.py
View File

@@ -20,12 +20,15 @@ class MangaReader:
master.title("Manga Reader") master.title("Manga Reader")
#Load settings #Load settings
settingLoad = pickle.load(open('manga.p', 'rb')) try:
self.dir = settingLoad['directory'] settingLoad = pickle.load(open('manga.p', 'rb'))
self.nextKey = settingLoad['nextKey'] self.dir = settingLoad['directory']
self.backKey = settingLoad['backKey'] self.nextKey = settingLoad['nextKey']
self.quitKey = settingLoad['quitKey'] self.backKey = settingLoad['backKey']
self.openKey = settingLoad['openKey'] self.quitKey = settingLoad['quitKey']
self.openKey = settingLoad['openKey']
except:
pass
# tk window size and allow resize # tk window size and allow resize
master.geometry("700x900") master.geometry("700x900")
@@ -54,7 +57,7 @@ class MangaReader:
# page counter # page counter
self.pgcount = Label(self.buttonFrame, text= str(self.page) + " of " + str(self.total)) self.pgcount = Label(self.buttonFrame, text= str(self.page) + " of " + str(self.total))
self.pgcount.grid(row=1, columns=1, columnspan=2) self.pgcount.grid(row=1, column=1, columnspan=2, pady=(20,20))
self.mangaTitle = Label(self.buttonFrame, text=os.path.basename(self.file)) self.mangaTitle = Label(self.buttonFrame, text=os.path.basename(self.file))
self.mangaTitle.grid(row=0, column=1) self.mangaTitle.grid(row=0, column=1)