13 |
"""Show a file selection dialog and import a file. |
"""Show a file selection dialog and import a file. |
14 |
""" |
""" |
15 |
|
|
16 |
file = selectFile("Select PS/PDF file to import") |
file = selectFile("Select PS/PDF file to import, or directory for all files in it") |
17 |
p("ps/pdf to be added: ",file) |
p("ps/pdf to be added: ",file) |
18 |
if file == None: return None |
if file == None or not file.exists(): return None |
19 |
|
|
20 |
return importPDF(fen, treetime, file) |
lastFile = None |
21 |
|
if file.isDirectory(): |
22 |
|
for f in file.listFiles(): |
23 |
|
try: |
24 |
|
if f.isDirectory(): continue |
25 |
|
importPDF(fen, treetime, f) |
26 |
|
except exception: |
27 |
|
print "EXCEPTION LOADING",f,":",sys.exc_info() |
28 |
|
else: |
29 |
|
return importPDF(fen, treetime, file) |
30 |
|
|
31 |
def selectFile(string): |
def selectFile(string): |
32 |
"""Select a file using an AWT dialog, with the given prompt. |
"""Select a file using an AWT dialog, with the given prompt. |