SldwrksExporter/gui.py
2023-02-06 23:04:56 +01:00

25 lines
756 B
Python

import PySimpleGUI as sg
import subprocess
import sys, os
if len(sys.argv) > 1:
cmd = "python scripts/run.py " + str(sys.argv[1] )
print(cmd)
p = subprocess.run(cmd, shell=True)
else:
fname = sg.Window('Files exporter',
[[sg.Text('Folder to export')],
[sg.In(), sg.FolderBrowse()],
[sg.Open(), sg.Cancel()]]).read(close=True)[1][0]
if not fname:
sg.popup("Cancel", "No filename supplied")
raise SystemExit("Cancelling: no filename supplied")
else:
# sg.popup('The filename you chose was', fname)
print(fname)
cmd = "python scripts/run.py " + str(fname)
print(cmd)
p = subprocess.run(cmd, shell=True)
print("Done")