CTKFileDialog-plus 2.1.1__py3-none-any.whl → 2.2.1__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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -122,11 +122,29 @@ class DrawApp:
122
122
 
123
123
  def close_app(self) -> None:
124
124
  if self.method in ("asksaveasfilename", "asksaveasfile"):
125
- if not os.path.isdir(self.PathEntry.get()):
126
- self.selected_file = self.PathEntry.get()
127
- self.protocol_windows()
128
- self.app.destroy()
125
+ filename = self.FileNameEntry.get().strip()
126
+ if not filename:
127
+ return
128
+ path = os.path.expanduser(os.path.expandvars(filename))
129
+ if not os.path.isabs(path):
130
+ path = os.path.join(self.current_path, path)
131
+ path = os.path.abspath(path)
132
+ if os.path.isdir(path):
129
133
  return
134
+ if os.path.exists(path):
135
+ msg = CTkMessagebox(
136
+ message="This file exists. Do you want to overwrite it?",
137
+ icon="warning",
138
+ title="Warning",
139
+ option_1="Yes",
140
+ option_2="No",
141
+ )
142
+ if msg.get() == "No":
143
+ return
144
+ self.selected_file = path
145
+ self.protocol_windows()
146
+ self.app.destroy()
147
+ return
130
148
 
131
149
  if self._temp_item:
132
150
  self.protocol_windows()
@@ -194,17 +212,10 @@ class DrawApp:
194
212
  return
195
213
 
196
214
  if self.method in ("asksaveasfile", "asksaveasfilename"):
197
- if os.path.isfile(path):
198
- msg = CTkMessagebox(
199
- message="This file exists. Do you want to overwrite it?",
200
- icon="warning",
201
- title="Warning",
202
- option_1="Yes",
203
- option_2="No",
204
- )
205
- if msg.get() == "No":
206
- return
207
- self._temp_item = path
215
+ self.current_path = os.path.dirname(path)
216
+ self.update_entry(path=self.current_path)
217
+ self.FileNameEntry.delete(0, ctk.END)
218
+ self.FileNameEntry.insert(0, os.path.basename(path))
208
219
  self.close_app()
209
220
  return
210
221
 
@@ -313,6 +324,18 @@ class DrawApp:
313
324
  )
314
325
  self.PathEntry.bind("<Alt-Left>", lambda e: self.btn_back(master=master))
315
326
 
327
+ if self.method in ("asksaveasfilename", "asksaveasfile"):
328
+ filename_frame = ctk.CTkFrame(master=master, fg_color="transparent")
329
+ filename_frame.pack(side="bottom", fill="x", padx=10, pady=10)
330
+ ctk.CTkLabel(filename_frame, text="File name:").pack(
331
+ side="left", padx=(0, 10)
332
+ )
333
+ self.FileNameEntry = ctk.CTkEntry(
334
+ master=filename_frame, placeholder_text="Enter file name..."
335
+ )
336
+ self.FileNameEntry.pack(side="left", fill="x", expand=True)
337
+ self.FileNameEntry.bind("<Return>", lambda _: self.close_app())
338
+
316
339
  ctk.CTkButton(
317
340
  master=top,
318
341
  text="",
@@ -143,6 +143,18 @@ class MiniDialog:
143
143
  side=ctk.RIGHT, padx=10
144
144
  )
145
145
 
146
+ if self.method in ("asksaveasfilename", "asksaveasfile"):
147
+ filename_frame = ctk.CTkFrame(self.frame)
148
+ filename_frame.pack(side=ctk.BOTTOM, fill=ctk.X, padx=10, pady=(0, 10))
149
+ ctk.CTkLabel(filename_frame, text="File name:").pack(
150
+ side=ctk.LEFT, padx=(0, 10)
151
+ )
152
+ self.filename_entry = ctk.CTkEntry(
153
+ filename_frame, placeholder_text="Enter file name..."
154
+ )
155
+ self.filename_entry.pack(expand=True, fill=ctk.X, side=ctk.LEFT)
156
+ self.filename_entry.bind("<Return>", lambda _: self._on_select())
157
+
146
158
  def _build_center(self) -> None:
147
159
  self.tree_frame = ctk.CTkFrame(self.frame)
148
160
  self.tree_frame.pack(fill=ctk.BOTH, expand=True, padx=10, pady=5)
@@ -326,7 +338,18 @@ class MiniDialog:
326
338
  self.master.destroy()
327
339
 
328
340
  def _on_select(self) -> None:
329
- path = self.path_entry.get().strip() if hasattr(self, "path_entry") else ""
341
+ if self.method in ("asksaveasfilename", "asksaveasfile"):
342
+ filename = self.filename_entry.get().strip()
343
+ if not filename:
344
+ return
345
+ directory = self.path_entry.get().strip()
346
+ if os.path.isfile(directory):
347
+ directory = os.path.dirname(directory)
348
+ path = os.path.expanduser(os.path.expandvars(filename))
349
+ if not os.path.isabs(path):
350
+ path = os.path.join(directory or self.initial_dir, path)
351
+ else:
352
+ path = self.path_entry.get().strip() if hasattr(self, "path_entry") else ""
330
353
  if path:
331
354
  path = os.path.abspath(os.path.expandvars(os.path.expanduser(path)))
332
355
  if not os.path.dirname(path):
@@ -437,6 +460,10 @@ class MiniDialog:
437
460
  self.path_entry.insert(0, self.selected_item)
438
461
  self.list_files()
439
462
  return
463
+ if self.method in ("asksaveasfilename", "asksaveasfile"):
464
+ self.filename_entry.delete(0, ctk.END)
465
+ self.filename_entry.insert(0, os.path.basename(self.selected_item))
466
+ return
440
467
  self.path_entry.delete(0, ctk.END)
441
468
  self.path_entry.insert(0, self.selected_item)
442
469
 
@@ -1,12 +1,9 @@
1
1
  Metadata-Version: 2.4
2
- Name: CTkFileDialog-plus
3
- Version: 2.1.1
2
+ Name: CTKFileDialog-plus
3
+ Version: 2.2.1
4
4
  Summary: A modern file dialog for CustomTkinter
5
5
  Home-page: https://github.com/hmidani-abdelilah/CTkFileDialog-plus
6
6
  Author: abdelilah
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: License :: OSI Approved :: MIT License
9
- Classifier: Operating System :: OS Independent
10
7
  Requires-Python: >=3.7
11
8
  Description-Content-Type: text/markdown
12
9
  License-File: LICENSE
@@ -16,17 +13,18 @@ Requires-Dist: opencv-python
16
13
  Requires-Dist: CTkMessagebox
17
14
  Requires-Dist: CTkToolTip
18
15
  Requires-Dist: typeguard
19
- Dynamic: author
20
- Dynamic: classifier
21
- Dynamic: description
22
- Dynamic: description-content-type
23
16
  Dynamic: home-page
24
17
  Dynamic: license-file
25
- Dynamic: requires-dist
26
18
  Dynamic: requires-python
27
- Dynamic: summary
28
19
 
29
20
  <h1 align="center">CTkFileDialog</h1>
21
+ <div align="center">
22
+
23
+ [![Python](https://img.shields.io/badge/Python-3.14-blueviolet.svg?logo=python&logoColor=white)](https://www.python.org/)
24
+ [![MIT License](https://img.shields.io/badge/License-MIT-orange.svg?logo=MIT)](https://github.com/hmidani-abdelilah/CTkFileDialog-plus?tab=MIT-1-ov-file)
25
+ [![PyPI](https://img.shields.io/badge/PyPI%20Project-775A9.svg?logo=PyPI)](https://pypi.org/project/CTkFileDialog-plus/)
26
+ [![PyPI Downloads](https://static.pepy.tech/personalized-badge/ctkfiledialog-plus?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLUE&right_color=GREEN&left_text=PyPI%20downloads)](https://pepy.tech/projects/ctkfiledialog-plus)
27
+ [![Bugs Report](https://img.shields.io/badge/Issues-Report%20a%20bug-important?logo=github&logoColor=white)](https://github.com/hmidani-abdelilah/CTkFileDialog-plus/issues) </div>
30
28
 
31
29
  <h3 align="center">A modern and fully customizable File Dialog for CustomTkinter — a must-have extension pack!</h3>
32
30
 
@@ -356,6 +354,9 @@ def save_as_filename():
356
354
  # You can also auto-append an extension if the user doesn't type one:
357
355
  # path = asksaveasfilename(autocomplete=True, defaultext=".txt")
358
356
 
357
+ # Save dialogs provide separate fields for the destination folder and file name
358
+ # in both Default and Mini styles.
359
+
359
360
  app = ctk.CTk()
360
361
  app.title("asksaveasfilename Demo")
361
362
  app.geometry("500x200")
@@ -0,0 +1,48 @@
1
+ CTkFileDialog/Dialog.py,sha256=Dg3ArOxZwDKPcbD1Q7ijfjXORHNCjaThvQOcC8r27II,665
2
+ CTkFileDialog/__init__.py,sha256=CBUhyErpTSIpnV_AJWnTa9H3vjAgJlSaNC29U01PTJI,926
3
+ CTkFileDialog/_functions.py,sha256=UQv62NLdTjBQH9fzUqWntR2iSnJQ7qaDpG3NiZaFJoU,17597
4
+ CTkFileDialog/_system.py,sha256=ARJTvtdqI7022jictZozim6ZkD8eAwmR6U5UYqqGWvA,162
5
+ CTkFileDialog/Constants/__init__.py,sha256=8rgZGeWf_JCWLfFWp8xB-YJMWE3PWNFI6_DBZeIUc1E,1673
6
+ CTkFileDialog/Constants/constants.py,sha256=U8FCd9TFSaLYyAjfHlKg79GsJN9ZGxH9Z33cQP3tWe0,1680
7
+ CTkFileDialog/core/__init__.py,sha256=Hq2N-_2CmeLM_-p6FsHyI1ofIenVXTK4sfViCY3ne9o,361
8
+ CTkFileDialog/core/filesystem.py,sha256=rCAufoC7W1zoNN82GE5mcNo5v_rEHuIIu5vpbnji-Aw,3093
9
+ CTkFileDialog/core/search.py,sha256=V51zf6kpghrUGdO09Q06XbQfQFK6NhGNZ5KTgDgH1AY,365
10
+ CTkFileDialog/core/sorting.py,sha256=1AaG3RfIP8MGPkDTAaRivrTp9Smk9s8qR3AuBZ3wr-E,1210
11
+ CTkFileDialog/icons/bash.png,sha256=XFnNE4o3002WT95lYUt6QzTfFmxJ_9aY9UI2Z0a7O0M,918
12
+ CTkFileDialog/icons/conf.png,sha256=cqUbrcOkymTOitI3DlHDadWLFyR5dfnTBh4lVBhWuuo,17811
13
+ CTkFileDialog/icons/css.png,sha256=0un53aRoy78wtj7GLtgd--oJnglVJjLUvolXCoSG7FA,12660
14
+ CTkFileDialog/icons/exe.png,sha256=_Dv3EKWQiLy7q2Ve_dM8DEw3FxUPYF4s4iD2wxeF2eU,9935
15
+ CTkFileDialog/icons/folder.png,sha256=54PxsJ-I0F9dq8NlxvCPrQRxORh0HrVv_zxsvaL7zQ0,3512
16
+ CTkFileDialog/icons/gz.png,sha256=pPIfhgwNliGThS5p9NgYuw_ZQ5mzWvnx2WW7ytI25kI,12054
17
+ CTkFileDialog/icons/html.png,sha256=3dRffX75ULKonaZQUCrdLtMl0anoLEVF2aqqpyWqKDI,13734
18
+ CTkFileDialog/icons/image.png,sha256=RGRRNiTrOOSFdv86nm2LlhNqYRIBeyWc6qNIeV0DxLA,9902
19
+ CTkFileDialog/icons/ini.png,sha256=1k030TMOoxkF529Eg-KObyZ-QNnFenhhnTk7PRMN63M,11768
20
+ CTkFileDialog/icons/javascript.png,sha256=MFWNfiJRY0-eRuvWOLgHSJijStBTa-7mxlVwcDlozTE,11139
21
+ CTkFileDialog/icons/js.png,sha256=MFWNfiJRY0-eRuvWOLgHSJijStBTa-7mxlVwcDlozTE,11139
22
+ CTkFileDialog/icons/json.png,sha256=6WNQY3e6sKyHTWJlnizFE1lVQIAog9ubv1zho9y9xAQ,19077
23
+ CTkFileDialog/icons/markdown.png,sha256=WyAZQMC8Y7mtW4iLsFpLLlbCTzeG13HSVXRLBn6yiKA,9595
24
+ CTkFileDialog/icons/odt.png,sha256=dfoRi9a_KodLyXVf1sxAW6jY3eEn8S7l7ajCzBIj5k4,16159
25
+ CTkFileDialog/icons/pdf.png,sha256=Xu25h6DSamBSeFRGDme7B2LeFS9Ftb5YDeWqIeUk0wk,8183
26
+ CTkFileDialog/icons/php.png,sha256=zF9fsZSN8JmgyHaX-8DCw8Va-pCnmNbPIpqhlrhO7FA,7784
27
+ CTkFileDialog/icons/python.png,sha256=tk7T2E_PTGt4E70iEKQ1IlLbzbVS_j_KouieamMYRYY,37415
28
+ CTkFileDialog/icons/text.png,sha256=93GUIQ_se7zCIIuFOzMtjv8Q2SqnANj0jnib7Cm_q4Q,894
29
+ CTkFileDialog/icons/video.png,sha256=ZxenlMzuhcHAgBJJcq_DETrvo0tPygMsZnil-IvypeM,6096
30
+ CTkFileDialog/icons/_IconsMini/file.png,sha256=etgA-7ovYS9MqZpOzuVr-ti1TF8iy3_ytqo1E2ZhepE,1724
31
+ CTkFileDialog/icons/_IconsMini/folder.png,sha256=q6lV_aqEW0-hhQfbn4qzXC-7bcyAkXhH9gBPVooyjbU,2025
32
+ CTkFileDialog/preview/__init__.py,sha256=dsw2QyO01IHdMpWICvWsrm2O_m_3ZNRYDDulPXZ2aiw,222
33
+ CTkFileDialog/preview/media.py,sha256=o7j6TGTChAX4SM8UMxG-MjW8g3ZApHzegiIKtjjVvzg,2955
34
+ CTkFileDialog/resources/__init__.py,sha256=wN99hJeXu6SIn2wwPLR2U05Slqbku9aWUYcsAyg2Yrw,258
35
+ CTkFileDialog/resources/icons.py,sha256=QdEf9X_ymJD3-JlIg4GQr-TMzpbY9E8nvOzUWkixl-Q,2454
36
+ CTkFileDialog/system/__init__.py,sha256=g5a0tNbBNLSyn7oiAZxq15b1CRxWTVvlH1uF_HzlNzU,110
37
+ CTkFileDialog/system/platform.py,sha256=PZgz_IERcgZwi9Q9Wq-FzyrRAzEN2OFWnGKo98PiPV8,2143
38
+ CTkFileDialog/ui/__init__.py,sha256=cBIQwkhviy7EbySbpmbLwIREtooswo52CyESugQPtNg,201
39
+ CTkFileDialog/ui/default_dialog.py,sha256=x0ii_-b9EHJyq6NhnQdRpEV16jJpf2o4i7q6uniqJts,36970
40
+ CTkFileDialog/ui/mini_dialog.py,sha256=h-oZnbU12LZ_wE-iBjTESx4SYL3aC7SiZV9sCjrOM0w,17398
41
+ CTkFileDialog/ui/tooltip.py,sha256=jYJdexJ8BuHjReXdlIQrF3aDeuOpU6JlzIENTSq7MYI,657
42
+ CTkFileDialog/utils/__init__.py,sha256=Rqmpg3kxA1Kd6yGZstg-HxUHxFwRfH_TDZnqBHExQc8,206
43
+ CTkFileDialog/utils/helpers.py,sha256=0fULuzBsMVBRGko2rAYz8xP1iph_KB57SY9Xi-sxBiE,1939
44
+ ctkfiledialog_plus-2.2.1.dist-info/licenses/LICENSE,sha256=-yP77ZlJiG2GIaFVx8f6KkUncC84D8RcW0lZEalE7og,1074
45
+ ctkfiledialog_plus-2.2.1.dist-info/METADATA,sha256=BA6M1VF4uqj6Nvo8_jB9MQGIqjORpNTLeW7SRMZIqcw,19635
46
+ ctkfiledialog_plus-2.2.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
47
+ ctkfiledialog_plus-2.2.1.dist-info/top_level.txt,sha256=ghUwgLRHcaJhcemQYVMRWwbJ8_sWqVyl4S8icnMBI1s,14
48
+ ctkfiledialog_plus-2.2.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (84.0.0)
2
+ Generator: setuptools (84.2.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,27 +0,0 @@
1
- CTkFileDialog/Dialog.py,sha256=Dg3ArOxZwDKPcbD1Q7ijfjXORHNCjaThvQOcC8r27II,665
2
- CTkFileDialog/__init__.py,sha256=CBUhyErpTSIpnV_AJWnTa9H3vjAgJlSaNC29U01PTJI,926
3
- CTkFileDialog/_functions.py,sha256=UQv62NLdTjBQH9fzUqWntR2iSnJQ7qaDpG3NiZaFJoU,17597
4
- CTkFileDialog/_system.py,sha256=ARJTvtdqI7022jictZozim6ZkD8eAwmR6U5UYqqGWvA,162
5
- CTkFileDialog/Constants/__init__.py,sha256=8rgZGeWf_JCWLfFWp8xB-YJMWE3PWNFI6_DBZeIUc1E,1673
6
- CTkFileDialog/Constants/constants.py,sha256=U8FCd9TFSaLYyAjfHlKg79GsJN9ZGxH9Z33cQP3tWe0,1680
7
- CTkFileDialog/core/__init__.py,sha256=Hq2N-_2CmeLM_-p6FsHyI1ofIenVXTK4sfViCY3ne9o,361
8
- CTkFileDialog/core/filesystem.py,sha256=rCAufoC7W1zoNN82GE5mcNo5v_rEHuIIu5vpbnji-Aw,3093
9
- CTkFileDialog/core/search.py,sha256=V51zf6kpghrUGdO09Q06XbQfQFK6NhGNZ5KTgDgH1AY,365
10
- CTkFileDialog/core/sorting.py,sha256=1AaG3RfIP8MGPkDTAaRivrTp9Smk9s8qR3AuBZ3wr-E,1210
11
- CTkFileDialog/preview/__init__.py,sha256=dsw2QyO01IHdMpWICvWsrm2O_m_3ZNRYDDulPXZ2aiw,222
12
- CTkFileDialog/preview/media.py,sha256=o7j6TGTChAX4SM8UMxG-MjW8g3ZApHzegiIKtjjVvzg,2955
13
- CTkFileDialog/resources/__init__.py,sha256=wN99hJeXu6SIn2wwPLR2U05Slqbku9aWUYcsAyg2Yrw,258
14
- CTkFileDialog/resources/icons.py,sha256=QdEf9X_ymJD3-JlIg4GQr-TMzpbY9E8nvOzUWkixl-Q,2454
15
- CTkFileDialog/system/__init__.py,sha256=g5a0tNbBNLSyn7oiAZxq15b1CRxWTVvlH1uF_HzlNzU,110
16
- CTkFileDialog/system/platform.py,sha256=PZgz_IERcgZwi9Q9Wq-FzyrRAzEN2OFWnGKo98PiPV8,2143
17
- CTkFileDialog/ui/__init__.py,sha256=cBIQwkhviy7EbySbpmbLwIREtooswo52CyESugQPtNg,201
18
- CTkFileDialog/ui/default_dialog.py,sha256=Mz6sHpVdeKcQ01HBhskDWnTSpHlKqIWrda78bhXpayk,35890
19
- CTkFileDialog/ui/mini_dialog.py,sha256=WIa1Nx-ZeDWejK2coMG9TNVpmdmrSGAIsENZz9p8wW4,16041
20
- CTkFileDialog/ui/tooltip.py,sha256=jYJdexJ8BuHjReXdlIQrF3aDeuOpU6JlzIENTSq7MYI,657
21
- CTkFileDialog/utils/__init__.py,sha256=Rqmpg3kxA1Kd6yGZstg-HxUHxFwRfH_TDZnqBHExQc8,206
22
- CTkFileDialog/utils/helpers.py,sha256=0fULuzBsMVBRGko2rAYz8xP1iph_KB57SY9Xi-sxBiE,1939
23
- ctkfiledialog_plus-2.1.1.dist-info/licenses/LICENSE,sha256=-yP77ZlJiG2GIaFVx8f6KkUncC84D8RcW0lZEalE7og,1074
24
- ctkfiledialog_plus-2.1.1.dist-info/METADATA,sha256=Ap8Ad-oLQYQw3wP9eQ2kfAQc-UgUEfWrVzrKJDvWcEM,18961
25
- ctkfiledialog_plus-2.1.1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
26
- ctkfiledialog_plus-2.1.1.dist-info/top_level.txt,sha256=ghUwgLRHcaJhcemQYVMRWwbJ8_sWqVyl4S8icnMBI1s,14
27
- ctkfiledialog_plus-2.1.1.dist-info/RECORD,,