From 36516fd5946d2079bcb14b391b93a94a60b03908 Mon Sep 17 00:00:00 2001 From: Ciro Mattia Gonano Date: Wed, 6 Mar 2013 23:17:22 +0100 Subject: [PATCH] Convert button disabled if no file is on the list --- kcc/gui.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kcc/gui.py b/kcc/gui.py index 097e8cd..7e619fc 100644 --- a/kcc/gui.py +++ b/kcc/gui.py @@ -28,6 +28,7 @@ import comic2ebook import kindlestrip from image import ProfileData from subprocess import call +from subprocess import check_call import os import shutil import stat @@ -65,6 +66,13 @@ class MainWindow: for afile in self.filelist: self.filelocation.insert(END, afile) self.filelocation.config(state=DISABLED) + try: + if len(self.filelist) > 0: + self.submit['state'] = NORMAL + else: + self.submit['state'] = DISABLED + except AttributeError: + pass def initialize(self): self.filelocation = Listbox(self.master) @@ -124,7 +132,7 @@ class MainWindow: self.aEntry['state'] = DISABLED self.aEntry.grid(column=3, row=(self.master.grid_size()[1] - 1), sticky=W + N + S) - self.submit = Button(self.master, text="CONVERT", command=self.start_conversion, fg="red") + self.submit = Button(self.master, text="CONVERT", command=self.start_conversion, fg="red", state=DISABLED) self.submit.grid(columnspan=4, sticky=W + E + N + S) aLabel = Label(self.master, text="File progress:", anchor=W, justify=LEFT) aLabel.grid(column=0, sticky=E) @@ -134,7 +142,7 @@ class MainWindow: aLabel.grid(column=0, sticky=E) self.progress_overall = ttk.Progressbar(orient=HORIZONTAL, length=200, mode='determinate') self.progress_overall.grid(column=1, columnspan=3, row=(self.master.grid_size()[1] - 1), sticky=W + E + N + S) - + retcode = call("kindlegen", shell=True) if retcode == 1: self.optionsButtons['Aepub_only'].select()