SafePDF 1.0.11__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. SafePDF/__init__.py +10 -0
  2. SafePDF/ctrl/__init__.py +0 -0
  3. SafePDF/ctrl/language_manager.py +69 -0
  4. SafePDF/ctrl/safe_pdf_controller.py +469 -0
  5. SafePDF/logger/__init__.py +0 -0
  6. SafePDF/logger/logging_config.py +94 -0
  7. SafePDF/ops/__init__.py +0 -0
  8. SafePDF/ops/license_manager.py +247 -0
  9. SafePDF/ops/pdf2docx.py +157 -0
  10. SafePDF/ops/pdf2jpeg.py +116 -0
  11. SafePDF/ops/pdf_compress.py +282 -0
  12. SafePDF/ops/pdf_merge.py +104 -0
  13. SafePDF/ops/pdf_operations.py +563 -0
  14. SafePDF/ops/pdf_rotate.py +102 -0
  15. SafePDF/ops/pdf_split.py +178 -0
  16. SafePDF/ops/updates.py +308 -0
  17. SafePDF/safe_pdf_app.py +121 -0
  18. SafePDF/test/__init__.py +0 -0
  19. SafePDF/test/test_compression.py +79 -0
  20. SafePDF/test/test_pro_dialog.py +45 -0
  21. SafePDF/text/de/help_content.txt +58 -0
  22. SafePDF/text/de/pro_features.txt +9 -0
  23. SafePDF/text/de/ui.json +260 -0
  24. SafePDF/text/de/welcome_content.txt +24 -0
  25. SafePDF/text/en/help_content.txt +42 -0
  26. SafePDF/text/en/pro_features.txt +8 -0
  27. SafePDF/text/en/ui.json +260 -0
  28. SafePDF/text/en/welcome_content.txt +25 -0
  29. SafePDF/text/tr/help_content.txt +53 -0
  30. SafePDF/text/tr/pro_features.txt +8 -0
  31. SafePDF/text/tr/ui.json +260 -0
  32. SafePDF/text/tr/welcome_content.txt +24 -0
  33. SafePDF/ui/__init__.py +11 -0
  34. SafePDF/ui/common_elements.py +40 -0
  35. SafePDF/ui/help_ui.py +233 -0
  36. SafePDF/ui/language_elements.py +9 -0
  37. SafePDF/ui/operation_settings.py +377 -0
  38. SafePDF/ui/safe_pdf_ui.py +3497 -0
  39. SafePDF/ui/settings_ui.py +394 -0
  40. SafePDF/ui/tabs_manager.py +235 -0
  41. SafePDF/ui/update_ui.py +717 -0
  42. SafePDF/version.txt +34 -0
  43. safepdf-1.0.11.dist-info/METADATA +162 -0
  44. safepdf-1.0.11.dist-info/RECORD +48 -0
  45. safepdf-1.0.11.dist-info/WHEEL +5 -0
  46. safepdf-1.0.11.dist-info/entry_points.txt +2 -0
  47. safepdf-1.0.11.dist-info/licenses/LICENSE +674 -0
  48. safepdf-1.0.11.dist-info/top_level.txt +1 -0
@@ -0,0 +1,40 @@
1
+ # define color, font, size, and layout for common UI elements
2
+ from typing import ClassVar
3
+
4
+ class CommonElements:
5
+ # Colors
6
+ BG_COLOR = "#f0f0f0"
7
+ FG_COLOR = "#333333"
8
+ RED_COLOR = "#b62020"
9
+ BG_MAIN = "#f4f6fb"
10
+ BG_CARD = "#ffffff"
11
+ BG_FRAME = "#ffffff"
12
+ FG_TEXT = "#000000"
13
+ FG_SECONDARY = "#DBDBDB"
14
+ TAB_BG = "#e9ecef"
15
+ TAB_SELECTED = "#ffffff"
16
+ HIGHLIGHT_COLOR = "#f8f9fa"
17
+ TEXT_BG = "#f8f9fa"
18
+ TEXT_FG = "#222"
19
+ BUTTON_BG = "#e9ecef"
20
+ BUTTON_FG = "#000000"
21
+ ENTRY_BG = "#ffffff"
22
+ ENTRY_FG = "#000000"
23
+
24
+ URL_COLOR = "#27bf73"
25
+
26
+ # Font
27
+ FONT = "Century Gothic"
28
+ FONT_SIZE = 10
29
+
30
+ # Sizes
31
+ SIZE_STR = "1000x660"
32
+ SIZE_LIST = (1000, 660)
33
+ PADDING = 10
34
+
35
+ PRO_POPUP_SIZE = "550x550"
36
+ PRO_POPUP_SIZE_LIST = (550, 550)
37
+
38
+ # Default Language
39
+ DEFAULT_LANGUAGE = "en"
40
+ SELECTED_LANGUAGE: ClassVar[str] = "en"
SafePDF/ui/help_ui.py ADDED
@@ -0,0 +1,233 @@
1
+ import sys
2
+ import tkinter as tk
3
+ from pathlib import Path
4
+ from tkinter import messagebox, ttk
5
+ from webbrowser import open as webbrowser_open
6
+
7
+ from .common_elements import CommonElements
8
+ from .language_elements import LanguageElements
9
+
10
+
11
+ class HelpUI:
12
+ """
13
+ Help UI helper: encapsulates help tab construction and show_help dialog.
14
+ Designed to be independent to avoid circular imports.
15
+ """
16
+
17
+ def __init__(self, root, controller, font=CommonElements.FONT, lang_manager=None):
18
+ self.root = root
19
+ self.controller = controller
20
+ self.font = font
21
+ self.lang_manager = lang_manager
22
+
23
+ def _get_lang_text(self, key, default):
24
+ """Get localized text from language manager if available"""
25
+ try:
26
+ if self.lang_manager:
27
+ return self.lang_manager.get(key, default)
28
+ elif hasattr(self.controller, 'lang_manager') and self.controller.lang_manager:
29
+ return self.controller.lang_manager.get(key, default)
30
+ except Exception:
31
+ pass
32
+ return default
33
+
34
+ def _open_how_to_use_gif(self):
35
+ """Open the How to Use GIF in the default browser"""
36
+ gif_url = "https://raw.githubusercontent.com/mcagriaksoy/SafePDF/main/img/HowToUse.gif"
37
+ try:
38
+ webbrowser_open(gif_url)
39
+ except Exception as e:
40
+ try:
41
+ messagebox.showerror(
42
+ self._get_lang_text("error_title", "Error"),
43
+ self._get_lang_text(
44
+ "error_open_tutorial",
45
+ f"Could not open tutorial. Please visit:\n{gif_url}"
46
+ )
47
+ )
48
+ except Exception:
49
+ pass
50
+
51
+ def _open_contact_email(self):
52
+ """Open email client to contact SafePDF support"""
53
+ email = "info@safepdf.de"
54
+ subject = "SafePDF Support Request"
55
+ mailto_url = f"mailto:{email}?subject={subject}"
56
+ try:
57
+ webbrowser_open(mailto_url)
58
+ except Exception:
59
+ try:
60
+ messagebox.showinfo(
61
+ self._get_lang_text("contact_title", "Contact Us"),
62
+ self._get_lang_text(
63
+ "contact_email_info",
64
+ f"Please send your inquiries to:\n\n{email}"
65
+ )
66
+ )
67
+ except Exception:
68
+ pass
69
+
70
+ def _open_github_issues(self):
71
+ """Open GitHub issues page to report bugs or request features"""
72
+ github_issues_url = "https://github.com/mcagriaksoy/SafePDF/issues"
73
+ try:
74
+ webbrowser_open(github_issues_url)
75
+ except Exception:
76
+ try:
77
+ messagebox.showinfo(
78
+ self._get_lang_text("github_issues_title", "Report Issue"),
79
+ self._get_lang_text(
80
+ "github_issues_info",
81
+ f"Please visit:\n\n{github_issues_url}"
82
+ )
83
+ )
84
+ except Exception:
85
+ pass
86
+
87
+ def _load_help_text(self):
88
+ """Load help text from text/ folder with localization fallback"""
89
+ # Prefer the selected language from common elements; allow controller override
90
+ lang_code = CommonElements.SELECTED_LANGUAGE or "en"
91
+ try:
92
+ lang = getattr(self.controller, "language_var", None)
93
+ # If controller exposes language_var (tk.StringVar), try to read its value
94
+ if lang and hasattr(lang, "get"):
95
+ val = lang.get()
96
+ if val:
97
+ lang_code = val
98
+ except Exception:
99
+ lang_code = CommonElements.SELECTED_LANGUAGE or "en"
100
+
101
+ # Get base directory - handle both Python and PyInstaller
102
+ if getattr(sys, "frozen", False):
103
+ base_dir = Path(sys._MEIPASS) # type: ignore
104
+ else:
105
+ base_dir = Path(__file__).parent.parent
106
+
107
+ candidates = [
108
+ base_dir / "text" / lang_code / "help_content.txt",
109
+ base_dir / "text" / "en" / "help_content.txt", # Fallback to English
110
+ ]
111
+ help_text = None
112
+ for p in candidates:
113
+ try:
114
+ if p.exists():
115
+ with open(str(p), "r", encoding="utf-8") as f:
116
+ help_text = f.read()
117
+ break
118
+ except Exception:
119
+ continue
120
+
121
+ return help_text
122
+
123
+ def build_help_tab(self, parent_frame):
124
+ """Populate the provided notebook frame with help content"""
125
+ try:
126
+ # Clear parent frame (defensive)
127
+ for w in parent_frame.winfo_children():
128
+ try:
129
+ w.destroy()
130
+ except Exception:
131
+ pass
132
+
133
+ main_frame = ttk.Frame(parent_frame, style="TFrame")
134
+ main_frame.pack(fill="both", expand=True, padx=24, pady=24)
135
+
136
+ # Add "How to Use", "Contact", and "GitHub Issues" buttons at the top
137
+ button_frame = tk.Frame(main_frame, bg="#f8f9fa")
138
+ button_frame.pack(fill="x", pady=(0, 10))
139
+
140
+ how_to_btn = ttk.Button(
141
+ button_frame,
142
+ text=self._get_lang_text("btn_how_to_use", "📹 How to Use"),
143
+ command=self._open_how_to_use_gif,
144
+ style="Accent.TButton"
145
+ )
146
+ how_to_btn.pack(side="left", padx=5, pady=5)
147
+
148
+ contact_btn = ttk.Button(
149
+ button_frame,
150
+ text=self._get_lang_text("btn_contact_email", "📧 Contact: info@safepdf.de"),
151
+ command=self._open_contact_email,
152
+ style="TButton"
153
+ )
154
+ contact_btn.pack(side="left", padx=5, pady=5)
155
+
156
+ github_btn = ttk.Button(
157
+ button_frame,
158
+ text=self._get_lang_text("btn_github_issues", "🐛 Report Issue"),
159
+ command=self._open_github_issues,
160
+ style="TButton"
161
+ )
162
+ github_btn.pack(side="left", padx=5, pady=5)
163
+
164
+ help_text = self._load_help_text()
165
+
166
+ help_text_widget = tk.Text(
167
+ main_frame,
168
+ wrap=tk.WORD,
169
+ font=(self.font, 10),
170
+ bg="#f8f9fa",
171
+ fg="#222",
172
+ borderwidth=1,
173
+ relief=tk.FLAT,
174
+ )
175
+ help_text_widget.insert("1.0", help_text or "Help content unavailable.")
176
+ help_text_widget.config(state=tk.DISABLED)
177
+
178
+ sb = ttk.Scrollbar(main_frame, orient="vertical", command=help_text_widget.yview)
179
+ help_text_widget["yscrollcommand"] = sb.set
180
+
181
+ help_text_widget.pack(side="left", fill="both", expand=True)
182
+ sb.pack(side="right", fill="y")
183
+ except Exception:
184
+ # If we cannot build the tab, show minimal content
185
+ try:
186
+ lbl = ttk.Label(
187
+ parent_frame,
188
+ text=LanguageElements.HELP_UNAVAILABLE,
189
+ font=(self.font, 12),
190
+ )
191
+ lbl.pack(fill="both", expand=True, padx=24, pady=24)
192
+ except Exception:
193
+ pass
194
+
195
+ def show_help(self):
196
+ """Show a modal help dialog (same content as the tab but in a focused dialog)"""
197
+ help_text = self._load_help_text()
198
+ try:
199
+ dlg = tk.Toplevel(self.root)
200
+ dlg.title("SafePDF Help")
201
+ dlg.transient(self.root)
202
+ dlg.grab_set()
203
+ dlg.geometry("640x480")
204
+ dlg.resizable(False, False)
205
+
206
+ # Center the dialog relative to root, if possible
207
+ try:
208
+ x = self.root.winfo_x() + (self.root.winfo_width() // 2) - (640 // 2)
209
+ y = self.root.winfo_y() + (self.root.winfo_height() // 2) - (480 // 2)
210
+ dlg.geometry(f"+{x}+{y}")
211
+ except Exception:
212
+ pass
213
+
214
+ txt = tk.Text(dlg, wrap=tk.WORD, font=(self.font, 10), bg="#f8f9fa")
215
+ txt.insert("1.0", help_text or "Help content unavailable.")
216
+ txt.config(state=tk.DISABLED)
217
+
218
+ sb = ttk.Scrollbar(dlg, orient="vertical", command=txt.yview)
219
+ txt["yscrollcommand"] = sb.set
220
+
221
+ txt.pack(side="left", fill="both", expand=True, padx=(8, 0), pady=8)
222
+ sb.pack(side="right", fill="y")
223
+
224
+ dlg.wait_window()
225
+ except Exception:
226
+ # Fallback: show a messagebox with the help text
227
+ try:
228
+ messagebox.showinfo(
229
+ LanguageElements.HELP_TITLE,
230
+ help_text or LanguageElements.HELP_UNAVAILABLE,
231
+ )
232
+ except Exception:
233
+ pass
@@ -0,0 +1,9 @@
1
+ class LanguageElements:
2
+ """
3
+ This class contains language elements used for localization
4
+ and internationalization in the application.
5
+ """
6
+
7
+ # Help Page Texts
8
+ HELP_TITLE = "Help"
9
+ HELP_UNAVAILABLE = "Help content is unavailable."
@@ -0,0 +1,377 @@
1
+ """
2
+ SafePDF Operation Settings UI - Handles settings UI for specific PDF operations
3
+ """
4
+
5
+ import tkinter as tk
6
+ from tkinter import ttk
7
+
8
+ from SafePDF.ui.common_elements import CommonElements
9
+
10
+
11
+ class OperationSettingsUI:
12
+ """Helper class to manage operation-specific settings UI creation"""
13
+
14
+ def __init__(self, settings_container, lang_manager, controller):
15
+ """
16
+ Initialize operation settings manager.
17
+
18
+ Args:
19
+ settings_container: The ttk.Frame to populate with settings
20
+ lang_manager: LanguageManager instance for localized strings
21
+ controller: SafePDFController instance
22
+ """
23
+ self.settings_container = settings_container
24
+ self.lang_manager = lang_manager
25
+ self.controller = controller
26
+
27
+ # Settings variables (passed from main UI)
28
+ self.quality_var = None
29
+ self.rotation_var = None
30
+ self.img_quality_var = None
31
+ self.split_var = None
32
+ self.page_range_var = None
33
+ self.repair_var = None
34
+ self.merge_var = None
35
+ self.use_default_output = None
36
+ self.output_path_var = None
37
+
38
+ # UI state
39
+ self.compression_visual_frame = None
40
+ self.compression_indicator = None
41
+ self.custom_output_frame = None
42
+ self.ultra_radio = None
43
+
44
+ def create_compress_settings(self, quality_var, update_compression_visual_callback):
45
+ """Create settings for PDF compression"""
46
+ self.quality_var = quality_var
47
+
48
+ ttk.Label(
49
+ self.settings_container,
50
+ text=self.lang_manager.get("settings_compression", "Compression Quality:"),
51
+ ).pack(anchor="w", pady=5)
52
+
53
+ # Create quality frame with visual feedback
54
+ quality_frame = ttk.Frame(self.settings_container)
55
+ quality_frame.pack(anchor="w", pady=5, fill="x")
56
+
57
+ # Left side - radio buttons
58
+ radio_frame = ttk.Frame(quality_frame)
59
+ radio_frame.pack(side="left", fill="y")
60
+
61
+ ttk.Radiobutton(
62
+ radio_frame,
63
+ text=self.lang_manager.get("settings_low", "Low (Smaller file)"),
64
+ variable=self.quality_var,
65
+ value="low",
66
+ command=update_compression_visual_callback,
67
+ ).pack(anchor="w")
68
+ ttk.Radiobutton(
69
+ radio_frame,
70
+ text=self.lang_manager.get("settings_medium", "Medium (Balanced)"),
71
+ variable=self.quality_var,
72
+ value="medium",
73
+ command=update_compression_visual_callback,
74
+ ).pack(anchor="w")
75
+ ttk.Radiobutton(
76
+ radio_frame,
77
+ text=self.lang_manager.get("settings_high", "High (Better quality)"),
78
+ variable=self.quality_var,
79
+ value="high",
80
+ command=update_compression_visual_callback,
81
+ ).pack(anchor="w")
82
+
83
+ # Pro feature: Ultra quality
84
+ self.ultra_radio = ttk.Radiobutton(
85
+ radio_frame,
86
+ text=self.lang_manager.get("settings_ultra", "Ultra (Pro - Best quality)"),
87
+ variable=self.quality_var,
88
+ value="ultra",
89
+ command=update_compression_visual_callback,
90
+ )
91
+ self.ultra_radio.pack(anchor="w")
92
+ # Enable/disable based on pro status
93
+ self.ultra_radio.config(
94
+ state="normal" if self.controller.is_pro_activated else "disabled"
95
+ )
96
+
97
+ # Right side - visual indicator
98
+ self.compression_visual_frame = tk.Frame(
99
+ quality_frame, bg="#ffffff", relief=tk.RIDGE, bd=1
100
+ )
101
+ self.compression_visual_frame.pack(
102
+ side="right", padx=(20, 0), fill="both", expand=True
103
+ )
104
+
105
+ # Create visual indicator label
106
+ self.compression_indicator = tk.Label(
107
+ self.compression_visual_frame,
108
+ text=self.lang_manager.get("settings_preview", "📊 Compression Preview"),
109
+ font=(CommonElements.FONT, 10, "bold"),
110
+ bg="#ffffff",
111
+ fg=CommonElements.RED_COLOR,
112
+ pady=CommonElements.PADDING,
113
+ )
114
+ self.compression_indicator.pack(fill="both", expand=True)
115
+
116
+ # Initialize visual feedback
117
+ update_compression_visual_callback()
118
+
119
+ def update_compression_visual(self, quality_var):
120
+ """Update visual feedback for compression quality"""
121
+ quality = quality_var.get()
122
+ text = ""
123
+
124
+ if quality == "low":
125
+ text = "📊 Low Quality\n• 20-30% smaller\n• Noticeable loss\n• Fast processing"
126
+ elif quality == "medium":
127
+ text = "📊 Medium Quality\n• 30-50% smaller\n• Minimal loss\n• Balanced"
128
+ elif quality == "high":
129
+ text = "📊 High Quality\n• 50-70% smaller\n• Minor loss\n• Better quality"
130
+ elif quality == "ultra":
131
+ text = "📊 Ultra Quality (Pro)\n• 70-85% smaller\n• Barely noticeable\n• Best quality"
132
+
133
+ self.compression_indicator.config(text=text)
134
+ self.compression_visual_frame.config(bg=CommonElements.BG_COLOR)
135
+
136
+ def create_rotate_settings(self, rotation_var):
137
+ """Create settings for PDF rotation"""
138
+ self.rotation_var = rotation_var
139
+
140
+ ttk.Label(self.settings_container, text="Rotation Angle:").pack(
141
+ anchor="w", pady=5
142
+ )
143
+ rotation_frame = ttk.Frame(self.settings_container)
144
+ rotation_frame.pack(anchor="w", pady=5)
145
+
146
+ for angle in ["90", "180", "270"]:
147
+ ttk.Radiobutton(
148
+ rotation_frame, text=f"{angle}°", variable=self.rotation_var, value=angle
149
+ ).pack(anchor="w")
150
+
151
+ def create_to_jpg_settings(self, img_quality_var):
152
+ """Create settings for PDF to JPG conversion"""
153
+ self.img_quality_var = img_quality_var
154
+
155
+ ttk.Label(self.settings_container, text="Image Quality:").pack(
156
+ anchor="w", pady=5
157
+ )
158
+ img_quality_frame = ttk.Frame(self.settings_container)
159
+ img_quality_frame.pack(anchor="w", pady=5)
160
+
161
+ ttk.Radiobutton(
162
+ img_quality_frame,
163
+ text="Low (Smaller size)",
164
+ variable=self.img_quality_var,
165
+ value="low",
166
+ ).pack(anchor="w")
167
+ ttk.Radiobutton(
168
+ img_quality_frame,
169
+ text="Medium (Balanced)",
170
+ variable=self.img_quality_var,
171
+ value="medium",
172
+ ).pack(anchor="w")
173
+ ttk.Radiobutton(
174
+ img_quality_frame,
175
+ text="High (Better quality)",
176
+ variable=self.img_quality_var,
177
+ value="high",
178
+ ).pack(anchor="w")
179
+
180
+ def create_repair_settings(self, repair_var):
181
+ """Create settings for PDF repair"""
182
+ self.repair_var = repair_var
183
+
184
+ ttk.Label(self.settings_container, text="Repair Options:").pack(
185
+ anchor="w", pady=5
186
+ )
187
+ repair_frame = ttk.Frame(self.settings_container)
188
+ repair_frame.pack(anchor="w", pady=5)
189
+
190
+ ttk.Checkbutton(
191
+ repair_frame,
192
+ text="Attempt to recover corrupted structure",
193
+ variable=self.repair_var,
194
+ ).pack(anchor="w")
195
+
196
+ def create_merge_settings(self, merge_var, selected_files):
197
+ """Create settings for PDF merging"""
198
+ self.merge_var = merge_var
199
+
200
+ ttk.Label(self.settings_container, text="Merge Options:").pack(
201
+ anchor="w", pady=5
202
+ )
203
+ merge_frame = ttk.Frame(self.settings_container)
204
+ merge_frame.pack(anchor="w", pady=5)
205
+
206
+ ttk.Checkbutton(
207
+ merge_frame, text="Add page numbers to merged PDF", variable=self.merge_var
208
+ ).pack(anchor="w")
209
+
210
+ # Show selected files
211
+ files_frame = ttk.LabelFrame(
212
+ self.settings_container, text="Files to Merge (in order)", padding="10"
213
+ )
214
+ files_frame.pack(fill="x", pady=(8, 6))
215
+
216
+ if selected_files:
217
+ for file_path in selected_files:
218
+ ttk.Label(files_frame, text=f" • {file_path}", foreground="#666").pack(
219
+ anchor="w", padx=10
220
+ )
221
+ else:
222
+ ttk.Label(
223
+ files_frame, text="No files selected", foreground="#999", style="Gray.TLabel"
224
+ ).pack(anchor="w", padx=10)
225
+
226
+ def create_split_settings(self, split_var, page_range_var):
227
+ """Create settings for PDF splitting"""
228
+ self.split_var = split_var
229
+ self.page_range_var = page_range_var
230
+
231
+ ttk.Label(self.settings_container, text="Split Method:").pack(
232
+ anchor="w", pady=5
233
+ )
234
+ split_frame = ttk.Frame(self.settings_container)
235
+ split_frame.pack(anchor="w", pady=5)
236
+
237
+ ttk.Radiobutton(
238
+ split_frame, text="Split by pages", variable=self.split_var, value="pages"
239
+ ).pack(anchor="w")
240
+ ttk.Radiobutton(
241
+ split_frame, text="Split by range", variable=self.split_var, value="range"
242
+ ).pack(anchor="w")
243
+
244
+ # Add range entry for custom ranges
245
+ range_frame = ttk.Frame(self.settings_container)
246
+ range_frame.pack(anchor="w", pady=5, fill="x")
247
+
248
+ ttk.Label(range_frame, text="Page Range (e.g., 1-5,7,10-12):").pack(anchor="w")
249
+ range_entry = ttk.Entry(range_frame, textvariable=self.page_range_var)
250
+ range_entry.pack(anchor="w", fill="x", pady=2)
251
+
252
+ def create_to_word_settings(self):
253
+ """Create settings for PDF to Word conversion"""
254
+ ttk.Label(
255
+ self.settings_container,
256
+ text="Convert PDF to Microsoft Word document (.docx)",
257
+ ).pack(anchor="w", pady=5)
258
+
259
+ info_frame = ttk.Frame(self.settings_container)
260
+ info_frame.pack(anchor="w", pady=5, fill="x")
261
+
262
+ ttk.Label(
263
+ info_frame, text="• Extracts text content from PDF", foreground="#666"
264
+ ).pack(anchor="w")
265
+ ttk.Label(
266
+ info_frame,
267
+ text="• Attempts to preserve basic formatting",
268
+ foreground="#666",
269
+ ).pack(anchor="w")
270
+ ttk.Label(
271
+ info_frame, text="• Includes images where possible", foreground="#666"
272
+ ).pack(anchor="w")
273
+ ttk.Label(
274
+ info_frame, text="• Requires python-docx and pypdfium2", foreground="#666"
275
+ ).pack(anchor="w")
276
+
277
+ def create_to_txt_settings(self):
278
+ """Create settings for PDF to TXT conversion"""
279
+ ttk.Label(
280
+ self.settings_container,
281
+ text="Extract text content from PDF to plain text file",
282
+ ).pack(anchor="w", pady=5)
283
+
284
+ info_frame = ttk.Frame(self.settings_container)
285
+ info_frame.pack(anchor="w", pady=5, fill="x")
286
+
287
+ ttk.Label(
288
+ info_frame, text="• Extracts all readable text from PDF", foreground="#666"
289
+ ).pack(anchor="w")
290
+ ttk.Label(
291
+ info_frame,
292
+ text="• Preserves page breaks with line separators",
293
+ foreground="#666",
294
+ ).pack(anchor="w")
295
+ ttk.Label(info_frame, text="• UTF-8 encoded output", foreground="#666").pack(
296
+ anchor="w"
297
+ )
298
+
299
+ def create_extract_info_settings(self):
300
+ """Create settings for PDF information extraction"""
301
+ ttk.Label(
302
+ self.settings_container,
303
+ text="Extract hidden information and metadata from PDF",
304
+ ).pack(anchor="w", pady=5)
305
+
306
+ info_frame = ttk.Frame(self.settings_container)
307
+ info_frame.pack(anchor="w", pady=5, fill="x")
308
+
309
+ ttk.Label(
310
+ info_frame,
311
+ text="• Extracts PDF metadata (title, author, etc.)",
312
+ foreground="#666",
313
+ ).pack(anchor="w")
314
+ ttk.Label(
315
+ info_frame,
316
+ text="• Includes file properties and creation info",
317
+ foreground="#666",
318
+ ).pack(anchor="w")
319
+ ttk.Label(
320
+ info_frame,
321
+ text="• Saves detailed information to text file",
322
+ foreground="#666",
323
+ ).pack(anchor="w")
324
+
325
+ def create_output_path_selection(
326
+ self, is_directory, use_default_output, output_path_var, browse_callback
327
+ ):
328
+ """Create output path selection UI"""
329
+ # If an earlier output_frame exists (from previous settings render), destroy it
330
+ try:
331
+ self.custom_output_frame.destroy()
332
+ except Exception:
333
+ pass
334
+
335
+ output_frame = ttk.LabelFrame(
336
+ self.settings_container, text="Output Location", padding="10"
337
+ )
338
+ output_frame.pack(fill="x", pady=(10, 5))
339
+
340
+ # Default option
341
+ default_cb = ttk.Checkbutton(
342
+ output_frame,
343
+ text="Use default output location",
344
+ variable=use_default_output,
345
+ )
346
+ default_cb.pack(anchor="w", pady=2)
347
+
348
+ # Custom path selection
349
+ self.custom_output_frame = ttk.Frame(output_frame)
350
+ self.custom_output_frame.pack(fill="x", pady=5)
351
+
352
+ ttk.Label(self.custom_output_frame, text="Custom path:").pack(anchor="w")
353
+
354
+ path_frame = ttk.Frame(self.custom_output_frame)
355
+ path_frame.pack(fill="x", pady=2)
356
+
357
+ path_label = ttk.Label(
358
+ path_frame,
359
+ text=output_path_var.get() or "No path selected",
360
+ foreground="#666",
361
+ )
362
+ path_label.pack(side="left", fill="x", expand=True)
363
+
364
+ browse_btn = ttk.Button(
365
+ path_frame,
366
+ text="Browse..." if is_directory else "Browse File...",
367
+ command=browse_callback,
368
+ width=15,
369
+ )
370
+ browse_btn.pack(side="right", padx=(5, 0))
371
+
372
+ # Bind variable to update label
373
+ def update_label(*args):
374
+ path_label.config(text=output_path_var.get() or "No path selected")
375
+
376
+ output_path_var.trace("w", update_label)
377
+ self.output_path_var = output_path_var