A new approach for the Mac FileBrowse with file_type crash that doesn't use the system settings.
This commit is contained in:
parent
fc42b0d45c
commit
638cd0f97e
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
version = __version__ = "4.60.0.16 Unreleased"
|
||||
version = __version__ = "4.60.0.17 Unreleased"
|
||||
|
||||
_change_log = """
|
||||
Changelog since 4.60.0 released to PyPI on 8-May-2022
|
||||
|
@ -44,6 +44,8 @@ _change_log = """
|
|||
Fix for continuous Graph element mouse up events when reading with a timeout=0. Big thank you to @davesmivers (THANKS DAVE!!) for finding and fixing
|
||||
4.60.0.16
|
||||
Added platform (Windows, Mac, Linux) and platform version information to the get_versions function
|
||||
4.60.0.17
|
||||
Added a fix for the file_types Mac problem that doesn't require the system settings to be used... let's give it a go!
|
||||
"""
|
||||
|
||||
__version__ = version.split()[0] # For PEP 396 and PEP 345
|
||||
|
@ -4840,10 +4842,16 @@ class Button(Element):
|
|||
should_submit_window = False
|
||||
elif self.BType == BUTTON_TYPE_BROWSE_FILE:
|
||||
if running_mac():
|
||||
if _mac_allow_filetypes():
|
||||
file_name = tk.filedialog.askopenfilename(initialdir=self.InitialFolder, filetypes=filetypes) # show the 'get file' dialog box
|
||||
# Workaround for the "*.*" issue on Mac
|
||||
is_all = [(x, y) for (x, y) in filetypes if y == "*" or y == "*.*" or y == "*.* *"]
|
||||
if not len(set(filetypes)) > 1 and (not len(is_all) == 0 or filetypes == FILE_TYPES_ALL_FILES):
|
||||
file_name = tk.filedialog.askopenfilename(initialdir=self.InitialFolder)
|
||||
else:
|
||||
file_name = tk.filedialog.askopenfilename(initialdir=self.InitialFolder) # show the 'get file' dialog box
|
||||
file_name = tk.filedialog.askopenfilename(initialdir=self.InitialFolder, filetypes=filetypes) # show the 'get file' dialog box
|
||||
# elif _mac_allow_filetypes():
|
||||
# file_name = tk.filedialog.askopenfilename(initialdir=self.InitialFolder, filetypes=filetypes) # show the 'get file' dialog box
|
||||
# else:
|
||||
# file_name = tk.filedialog.askopenfilename(initialdir=self.InitialFolder) # show the 'get file' dialog box
|
||||
else:
|
||||
file_name = tk.filedialog.askopenfilename(filetypes=filetypes, initialdir=self.InitialFolder, parent=self.ParentForm.TKroot) # show the 'get file' dialog box
|
||||
|
||||
|
@ -4859,10 +4867,16 @@ class Button(Element):
|
|||
self.TKStringVar.set(color)
|
||||
elif self.BType == BUTTON_TYPE_BROWSE_FILES:
|
||||
if running_mac():
|
||||
if _mac_allow_filetypes():
|
||||
file_name = tk.filedialog.askopenfilenames(filetypes=filetypes, initialdir=self.InitialFolder)
|
||||
else:
|
||||
# Workaround for the "*.*" issue on Mac
|
||||
is_all = [(x, y) for (x, y) in filetypes if y == "*" or y == "*.*" or y == "*.* *"]
|
||||
if not len(set(filetypes)) > 1 and (not len(is_all) == 0 or filetypes == FILE_TYPES_ALL_FILES):
|
||||
file_name = tk.filedialog.askopenfilenames(initialdir=self.InitialFolder)
|
||||
else:
|
||||
file_name = tk.filedialog.askopenfilenames(filetypes=filetypes, initialdir=self.InitialFolder)
|
||||
# elif _mac_allow_filetypes():
|
||||
# file_name = tk.filedialog.askopenfilenames(filetypes=filetypes, initialdir=self.InitialFolder)
|
||||
# else:
|
||||
# file_name = tk.filedialog.askopenfilenames(initialdir=self.InitialFolder)
|
||||
else:
|
||||
file_name = tk.filedialog.askopenfilenames(filetypes=filetypes, initialdir=self.InitialFolder, parent=self.ParentForm.TKroot)
|
||||
|
||||
|
@ -4875,10 +4889,16 @@ class Button(Element):
|
|||
elif self.BType == BUTTON_TYPE_SAVEAS_FILE:
|
||||
# show the 'get file' dialog box
|
||||
if running_mac():
|
||||
if _mac_allow_filetypes():
|
||||
file_name = tk.filedialog.asksaveasfilename(filetypes=filetypes, defaultextension=self.DefaultExtension, initialdir=self.InitialFolder)
|
||||
else:
|
||||
# Workaround for the "*.*" issue on Mac
|
||||
is_all = [(x, y) for (x, y) in filetypes if y == "*" or y == "*.*" or y == "*.* *"]
|
||||
if not len(set(filetypes)) > 1 and (not len(is_all) == 0 or filetypes == FILE_TYPES_ALL_FILES):
|
||||
file_name = tk.filedialog.asksaveasfilename(defaultextension=self.DefaultExtension, initialdir=self.InitialFolder)
|
||||
else:
|
||||
file_name = tk.filedialog.asksaveasfilename(filetypes=filetypes, defaultextension=self.DefaultExtension, initialdir=self.InitialFolder)
|
||||
# elif _mac_allow_filetypes():
|
||||
# file_name = tk.filedialog.asksaveasfilename(filetypes=filetypes, defaultextension=self.DefaultExtension, initialdir=self.InitialFolder)
|
||||
# else:
|
||||
# file_name = tk.filedialog.asksaveasfilename(defaultextension=self.DefaultExtension, initialdir=self.InitialFolder)
|
||||
else:
|
||||
file_name = tk.filedialog.asksaveasfilename(filetypes=filetypes, defaultextension=self.DefaultExtension, initialdir=self.InitialFolder, parent=self.ParentForm.TKroot)
|
||||
|
||||
|
@ -25018,4 +25038,4 @@ if __name__ == '__main__':
|
|||
exit(0)
|
||||
main()
|
||||
exit(0)
|
||||
def get_signature(): return b'Q\xd8-\xff\xfbBQ\xb6\xe1HmJ\xa07\xd2~9\x8f\xf7\xc7>%\xca\x0e D!\x8e\x9e\xab_\xb1b\x95\x0b\x7f\xc9\xc1h\t\xb0\xc9\xcb\x90ZR\xebG\xb2O\x12\x12\xfc\x06\xb0xq\xc6T\x03\xf9\xba$]\xe7\xec\xe2@\nDmv\x11\xcc~\xf8\x88r\xb7\x0f\xa4\x1ce\xf8\x9b"\xed\xddy\xa9\x11[\x94\xf3,j\xa8\xa6\xe8N\x9aZ5/\xd9d\x95\xac\x15t\x85\xb64uV`\xecy\xc6\xda\xbf(\xd2A\xe7\xf1S\xcc'
|
||||
def get_signature(): return b":R2p\xdf\xb9\xbf\xa2\xaf\xc8x\xf4\x95\x1f\x8e\xf38\xd2\x11\x15\x05v\xf9\xfa\xa2\xcf\xfb\xfb\x80 \x84fD\xb4\xe0\xf4\xa1\x88\xc1v\xd1\xa7|Y\x14\xef\x86q\xf6\t\x8br\xd4\xe6\x01\x19\xb9\xba:\xbc'\xfa1\x1c$mW35\x87\xee\xb5\xd2H$eTK\x9b\xbcMY3\x03\xfb\x1fO]\x87W}3\xee\xb57\xda\x17\x9dX\x98\xe9t\xaf\xdf(\x1a.\x9e\x973)\x11\xe5\xeap\x10So\x9b5\xab\xfaFe\x08U\xc4\xdf"
|
Loading…
Reference in New Issue