Skip to content

Commit 76b6d81

Browse files
committed
Start integrating functions into options areas. This includes two functions for setting the entry values to the selected file/folder and the widgets.
1 parent 672b048 commit 76b6d81

File tree

1 file changed

+42
-2
lines changed

1 file changed

+42
-2
lines changed

pdf_toolbox/gui/extract_pdf.py

+42-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,24 @@ def init_window(self):
3030
self.scrapy_download.pack(fill="both", expand=1)
3131
# Adobe API options.
3232
self.adobe_api = Frame(self.extract_options, relief="groove", borderwidth=5)
33-
self.adobe_some_text = Label(self.adobe_api, text="This is the Adobe options area.")
34-
self.adobe_some_text.pack(fill="x", expand=1)
33+
self.adobe_request = Frame(self.adobe_api, relief="groove", borderwidth=3)
34+
self.adobe_request.pack(fill="both", expand=1)
35+
self.adobe_request_lbl = Label(self.adobe_request, text="Adobe PDF Extract API")
36+
self.adobe_request_lbl.pack(fill="x", expand=1)
37+
self.adobe_request_ent_multi_val = StringVar()
38+
self.adobe_request_ent_multi = Entry(self.adobe_request, textvariable=self.adobe_request_ent_multi_val)
39+
self.adobe_request_ent_multi.pack(fill="x", expand=1, side="left")
40+
self.adobe_request_btn_multi = Button(self.adobe_request, text="Select Folder", command=self.adobe_browse_folder)
41+
self.adobe_request_btn_multi.pack(fill="x", expand=1, side="left")
42+
self.adobe_request_ent_single_val = StringVar()
43+
self.adobe_request_ent_single = Entry(self.adobe_request, textvariable=self.adobe_request_ent_single_val)
44+
self.adobe_request_ent_single.pack(fill="x", expand=1, side="left")
45+
self.adobe_request_btn_single = Button(self.adobe_request, text="Select File", command=self.adobe_browse_file)
46+
self.adobe_request_btn_single.pack(fill="x", expand=1, side="left")
47+
self.adobe_request_btn_send = Button(self.adobe_request, text="Send Request(s)")
48+
self.adobe_request_btn_send.pack(fill="x", expand=1, side="bottom")
49+
# self.adobe_some_text = Label(self.adobe_api, text="This is the Adobe options area.")
50+
# self.adobe_some_text.pack(fill="x", expand=1)
3551
self.adobe_api.pack(fill="both", expand=1)
3652
# PyMuPDF options. (Manual/Auto Extraction)
3753
self.pymupdf_extract = Frame(self.extract_options, relief="groove", borderwidth=5)
@@ -218,6 +234,30 @@ def toggle_zoom(self):
218234
self.pdf_page_data = PhotoImage(data=self.data)
219235
self.pdf_page_img.configure(image=self.pdf_page_data, text=None)
220236

237+
def adobe_browse_folder(self):
238+
"""Browse for a folder and set the Entry field to the chosen folder."""
239+
pdf_dir = filedialog.askdirectory(title="PDF Toolbox Document Browser", initialdir=constants.src_dir)
240+
self.adobe_request_ent_multi_val.set(pdf_dir)
241+
self.adobe_request_ent_single_val.set("")
242+
243+
def adobe_browse_file(self):
244+
"""Browse for a file and set the Entry field to the chosen file."""
245+
pdf_file = filedialog.askopenfilename(
246+
title="PDF Toolbox Document Browser",
247+
initialdir=constants.src_dir,
248+
filetypes=(
249+
("PDF Files", "*.pdf"),
250+
("XPS Files", "*.*xps"),
251+
("Epub Files", "*.epub"),
252+
("Fiction Books", "*.fb2"),
253+
("Comic Books", "*.cbz"),
254+
("HTML", "*.htm*")
255+
)
256+
)
257+
self.adobe_request_ent_single_val.set(pdf_file)
258+
self.adobe_request_ent_multi_val.set("")
259+
260+
221261
# ------------------------------------------------------------------------------
222262
# Run standalone.
223263
# ------------------------------------------------------------------------------

0 commit comments

Comments
 (0)