Skip to content

Commit 472fa29

Browse files
committed
Routine updates.
1 parent 947c7e4 commit 472fa29

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# EBook Extractor
1+
# Ebook Extractor
22

33
Export ebooks from any platform as PDF files or images.
44

ebook_extractor_cli/__entry__.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from threading import Thread as _Thread
2+
from time import sleep as _sleep
23
from tkinter import Event as _Event
34

45
from customtkinter import CTk as _CTk, StringVar as _StringVar, CTkLabel as _CTkLabel, CTkEntry as _CTkEntry, \
@@ -55,23 +56,24 @@ def size(self) -> tuple[int, int]:
5556
return abs(self._x1 - self._x0), abs(self._y1 - self._y0)
5657

5758

58-
class EBookTerminator(object):
59+
class EbookTerminator(object):
5960
def __init__(self, padx: int = 4, pady: int = 2) -> None:
6061
self._px: int = padx
6162
self._py: int = pady
6263
self._root: _CTk = _CTk()
63-
self._root.title("EBook Extractor")
64+
self._root.title("Ebook Extractor")
6465
self._root.geometry("580x80")
6566
self._root.resizable(False, False)
6667
self._from_page: _StringVar = _StringVar(self._root, "1")
6768
self._to_page: _StringVar = _StringVar(self._root, "2")
6869
self._path: _StringVar = _StringVar(self._root, "output.pdf")
6970
self._format: _StringVar = _StringVar(self._root, "PDF")
71+
self._instruction: _StringVar = _StringVar(self._root, "Press <shift>+<f4> to continue")
7072
self._region: Region = Region()
7173
self._extraction_thread = _Thread(target=self.extract, daemon=True)
7274

7375
def select_region(self) -> None:
74-
self._root.withdraw()
76+
self._instruction.set("Click to start selection")
7577
dialog = _CTkToplevel(self._root)
7678
dialog.overrideredirect(True)
7779
dialog.attributes("-top", True)
@@ -118,13 +120,23 @@ def confirm(_) -> None:
118120
dialog.bind("<KeyPress-Return>", confirm)
119121

120122
def extract(self, book: _Book) -> None:
123+
self._instruction.set("Click on your ebook application to yield focus (3)")
124+
_sleep(1)
125+
self._instruction.set("Click on your ebook application to yield focus (2)")
126+
_sleep(1)
127+
self._instruction.set("Click on your ebook application to yield focus (1)")
128+
_sleep(1)
129+
self._instruction.set("Exporting...")
121130
match self._format.get():
122131
case "PDF":
123132
_save_as_pdf(book, self._path.get())
124133
case "Text PDF":
125134
_save_as_pdf(book, self._path.get(), True)
126135
case "Images":
127136
_save_as_images(book, self._path.get())
137+
book.close()
138+
self._instruction.set(f"File saved at {self._path.get()}")
139+
_sleep(1)
128140
self._root.destroy()
129141

130142
def run(self) -> None:
@@ -139,7 +151,7 @@ def run(self) -> None:
139151
save_as_option = _CTkOptionMenu(self._root, width=96, variable=self._format,
140152
values=["PDF", "Text PDF", "Images"])
141153
save_as_entry = _CTkEntry(self._root, width=96, textvariable=self._path, justify="center")
142-
instruction_label = _CTkLabel(self._root, text="Press <shift>+<f4> to Continue")
154+
instruction_label = _CTkLabel(self._root, textvariable=self._instruction)
143155
from_page_label.grid(row=0, column=0, sticky="NSEW", ipadx=self._px, ipady=self._py, padx=self._px,
144156
pady=self._py)
145157
from_page_entry.grid(row=0, column=1, sticky="NSEW", ipadx=self._px, ipady=self._py, padx=self._px,
@@ -160,4 +172,4 @@ def run(self) -> None:
160172

161173

162174
def __entry__() -> None:
163-
EBookTerminator().run()
175+
EbookTerminator().run()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ packages = ["ebook_extractor"]
2727
[project.urls]
2828
Homepage = "https://ebook-extractor.projectneura.org"
2929
Documentation = "https://ebook-extractor.projectneura.org"
30-
Repository = "https://github.com/ProjectNeura/EBookExtractor"
30+
Repository = "https://github.com/ProjectNeura/EbookExtractor"
3131

3232
[project.gui-scripts]
3333
leads-vec = "ebook_extractor:__entry__"

0 commit comments

Comments
 (0)