Skip to content

Commit

Permalink
Supported double click entry field.
Browse files Browse the repository at this point in the history
  • Loading branch information
bookfere committed Jun 8, 2022
1 parent a0d8b24 commit 0556a1b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions fix_kindle_ebook_cover_gui.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ class Application(ttk.Frame):
self.insert_log('A Kindle root directory was detected: %s' % root)


def get_kindle_root(self):
self.entryvalue.set(filedialog.askdirectory())
def get_kindle_root(self, event=None):
value = filedialog.askdirectory()
if value != '':
self.entryvalue.set(value)


def reset_kindle_root(self, event):
Expand Down Expand Up @@ -72,10 +74,13 @@ class Application(ttk.Frame):
def create_widgets(self):
self.entry = ttk.Entry(self, width=40, textvariable=self.entryvalue)
self.entry.bind('<FocusOut>', self.reset_kindle_root)
self.entry.bind('<FocusOut>', self.reset_kindle_root)
self.choose = ttk.Button(self, text='Choose the Kindle root directory', command=self.get_kindle_root)
self.fix = ttk.Button(self, text='Fix Cover', command=self.fix_ebook_cover)
self.progress = ttk.Progressbar(self, length=580, mode='determinate', maximum=100)
self.entry.bind('<Double-1>', self.get_kindle_root)
self.choose = ttk.Button(self, text='Choose the Kindle root directory',
command=self.get_kindle_root)
self.fix = ttk.Button(self, text='Fix Cover',
command=self.fix_ebook_cover)
self.progress = ttk.Progressbar(self, length=580, mode='determinate',
maximum=100)
self.log = scrolledtext.ScrolledText(self)


Expand Down

0 comments on commit 0556a1b

Please sign in to comment.