MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / loadFile

Method loadFile

tests/test_locale/file_dialog.py:33–77  ·  view source on GitHub ↗
(self, event)

Source from the content-addressed store, hash-verified

31
32 # ----------------------------------------------------------------------
33 def loadFile(self, event):
34 with wx.FileDialog(
35 self, "Open", "", "",
36 "Python files (*.py)|*.py",
37 wx.FD_OPEN | wx.FD_FILE_MUST_EXIST
38 ) as dlg:
39 dlg.ShowModal()
40 path = dlg.GetPath()
41 try:
42 os_walk_without_codec = GetPath(path)
43 except (UnicodeEncodeError, UnicodeTranslateError, UnicodeError, UnicodeDecodeError, UnicodeWarning, TypeError) as e:
44 os_walk_without_codec = e
45
46 try:
47 os_walk_with_system_codec = GetPath(path, None, sys.getdefaultencoding())
48 except (UnicodeEncodeError, UnicodeTranslateError, UnicodeError, UnicodeDecodeError, UnicodeWarning, TypeError) as e:
49 os_walk_with_system_codec = e
50
51 try:
52 os_walk_unicode_without_codec = GetUnicodePath(path)
53 except (UnicodeEncodeError, UnicodeTranslateError, UnicodeError, UnicodeDecodeError, UnicodeWarning, TypeError) as e:
54 os_walk_unicode_without_codec = e
55
56 try:
57 os_walk_unicode_with_system_codec = GetUnicodePath(path, None, sys.getdefaultencoding())
58 except (UnicodeEncodeError, UnicodeTranslateError, UnicodeError, UnicodeDecodeError, UnicodeWarning, TypeError) as e:
59 os_walk_unicode_with_system_codec = e
60
61 print("Simple print:")
62 print(path)
63
64 print("Type:")
65 print((type(path)))
66
67 print("OS Walk: No Codec:")
68 print(os_walk_without_codec)
69
70 print("OS Walk: Default System Codec:")
71 print(os_walk_with_system_codec)
72
73 print("OS Unicode Walk: No Codec:")
74 print(os_walk_unicode_without_codec)
75
76 print("OS Unicode Walk: Default System Codec:")
77 print(os_walk_unicode_with_system_codec)
78
79 # ----------------------------------------------------------------------
80 def saveFile(self, event):

Callers

nothing calls this directly

Calls 2

GetPathFunction · 0.90
GetUnicodePathFunction · 0.90

Tested by

no test coverage detected