Skip to content

Commit 36abc5a

Browse files
committed
Merge branch 'feature/quickscroll-panel' into release/1.8.0
2 parents 5b13cc1 + bc63fa1 commit 36abc5a

File tree

21 files changed

+2432
-1440
lines changed

21 files changed

+2432
-1440
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Python bytecode
2+
__pycache__/*
3+
4+
# Test credentials & signed files for PDF signature
5+
credentials/*
6+
signatures/*
7+
utility-apps/signature-key-server/key-files/*
8+
9+
# Sample documents
10+
samples/*
11+
*.pdf

Utility Apps/tamper_check.py

Lines changed: 0 additions & 75 deletions
This file was deleted.

app.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
"""
2-
Author: lefkovitj (https://lefkovitzj.github.io)
3-
File Last Modified: 1/4/2025
4-
Project Name: PyPdfApp
5-
File Name: app.py
6-
"""
7-
8-
# Project Imports.
9-
import pypdfgui
10-
11-
if __name__ == "__main__":
12-
""" Run the PyPdfApp application. """
13-
pypdfgui.App()
1+
"""
2+
Author: lefkovitj (https://lefkovitzj.com)
3+
File Last Modified: 8/28/2025
4+
Project Name: PyPdfApp
5+
File Name: app.py
6+
"""
7+
8+
# Project Imports.
9+
import pypdfgui
10+
11+
if __name__ == "__main__":
12+
# Run the PyPdfApp application.
13+
pypdfgui.App()

app.pyw

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Author: lefkovitj (https://lefkovitzj.com)
3+
File Last Modified: 8/28/2025
4+
Project Name: PyPdfApp
5+
File Name: app.py
6+
"""
7+
8+
# Project Imports.
9+
import pypdfgui
10+
11+
if __name__ == "__main__":
12+
# Run the PyPdfApp application.
13+
pypdfgui.App()

extract.py

Lines changed: 0 additions & 47 deletions
This file was deleted.

gui.py

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,43 @@
1-
"""
2-
Author: lefkovitj (https://lefkovitzj.github.io)
3-
File Last Modified: 8/15/2024
4-
Project Name: PyPdfApp
5-
File Name: gui.py
6-
"""
7-
8-
import customtkinter as ctk
9-
10-
class GUI_Menu():
11-
def __init__(self, menu_name, tk_parent, button_texts, button_binds, button_statuses):
12-
if len(button_texts) != len(button_binds):
13-
raise ValueError(f"Lists button_text and button_binds must be of the same size. Got lists of length {len(button_texts)} and {len(button_binds)} instead.")
14-
15-
self.name = menu_name
16-
self.buttons = []
17-
self.texts = button_texts
18-
self.binds = button_binds
19-
self.states = button_statuses
20-
def get_button_texts(self):
21-
return self.texts
22-
def get_button_commands(self):
23-
return self.binds
24-
def get_button_states(self):
25-
return_list = []
26-
for item in self.states:
27-
if item == True:
28-
return_list.append("normal")
29-
else:
30-
return_list.append("disabled")
31-
return return_list
32-
def get_name(self):
33-
return self.name
34-
35-
def gui_get_file(initial_directory="", limit_filetypes=[]):
36-
""" Open file explorer (using tkinter) to select a file. """
37-
root = Tk() # Create the GUI window.
38-
root.withdraw()
39-
complete_file_path = filedialog.askopenfilename(title="File Select", initialdir = os.getcwd() + "/" + initial_directory, filetypes = limit_filetypes) # Select the file.
40-
root.destroy()
41-
file_path, file_name = os.path.split(complete_file_path) # Get the filepath and filename to return to the user.
42-
return complete_file_path, file_name
1+
"""
2+
Author: lefkovitj (https://lefkovitzj.com)
3+
File Last Modified: 8/29/2025
4+
Project Name: PyPdfApp
5+
File Name: gui.py
6+
"""
7+
8+
class GuiMenu():
9+
"""Represent a menu that can be selected via the menus dropdown"""
10+
def __init__(self, menu_name, button_texts, button_binds, button_statuses):
11+
if len(button_texts) != len(button_binds):
12+
raise ValueError(
13+
("Lists button_text and button_binds must be of the same size. "
14+
f"Got lists of length {len(button_texts)} and {len(button_binds)} instead.")
15+
)
16+
17+
self.name = menu_name
18+
self.buttons = []
19+
self.texts = button_texts
20+
self.binds = button_binds
21+
self.states = button_statuses
22+
23+
def get_button_texts(self):
24+
"""Getter for .texts"""
25+
return self.texts
26+
27+
def get_button_commands(self):
28+
"""Getter for .binds"""
29+
return self.binds
30+
31+
def get_button_states(self):
32+
"""Reformatted getter for .states"""
33+
return_list = []
34+
for item in self.states:
35+
if item is True:
36+
return_list.append("normal")
37+
else:
38+
return_list.append("disabled")
39+
return return_list
40+
41+
def get_name(self):
42+
"""Getter for .name"""
43+
return self.name

license.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 Joseph Lefkovitz
3+
Copyright (c) 2025 Joseph Lefkovitz
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

link_icon.png

2.87 KB
Loading

links.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

load.py

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
11
"""
2-
Author: lefkovitj (https://lefkovitzj.github.io)
3-
File Last Modified: 1/4/2025
2+
Author: lefkovitj (https://lefkovitzj.com)
3+
File Last Modified: 8/31/2025
44
Project Name: PyPdfApp
55
File Name: load.py
66
"""
77

88
# Python Standard Library Imports.
9-
import os
109
import sys
11-
from tkinter import *
12-
from tkinter import filedialog
1310
import traceback
1411

1512
# Third-party Module Imports.
16-
from PIL import Image, ImageTk
1713
import fitz
1814
import customtkinter as ctk
1915

20-
def gui_get_file(initial_directory="", limit_filetypes=[]):
21-
""" Open file explorer (using tkinter) to select a file. """
22-
root = Tk() # Create the GUI window.
23-
root.withdraw()
24-
complete_file_path = filedialog.askopenfilename(title="File Select", initialdir = os.getcwd() + "/" + initial_directory, filetypes = limit_filetypes) # Select the file.
25-
root.destroy()
26-
file_path, file_name = os.path.split(complete_file_path) # Get the filepath and filename to return to the user.
27-
return complete_file_path, file_name
16+
# Project imports.
17+
from manipulate import gui_get_file
2818

2919
def open_pdf():
20+
"""Open and load a PDF via the system filedialog"""
3021
if len(sys.argv) == 1: # No argument provided, request file path.
3122
file_path = gui_get_file(limit_filetypes=[("PDF",".pdf")])[0]
3223
if file_path == "":
@@ -38,13 +29,14 @@ def open_pdf():
3829
fitz_doc = fitz.open(file_path)
3930
doc_password = ""
4031
while fitz_doc.is_encrypted:
41-
if doc_password==None:
32+
if doc_password is None:
4233
return None
4334
pass_dialog = ctk.CTkInputDialog(text="Password", title="Open PDF")
4435
doc_password = pass_dialog.get_input()
4536
fitz_doc.authenticate(doc_password)
4637
return file_path, fitz_doc, doc_password
4738

48-
except Exception: # Handle any application errors by returning them to the user without crashing.
49-
print(f"Error Message: \"{traceback.format_exc()}\"")
50-
return None
39+
# Handle any application errors by returning them to the user without crashing.
40+
except Exception:
41+
print(f"Error Message: \"{traceback.format_exc()}\"")
42+
return None

0 commit comments

Comments
 (0)