SldwrksExporter/gui.py

24 lines
746 B
Python
Raw Normal View History

2023-02-06 10:26:05 +00:00
import PySimpleGUI as sg
2023-02-06 18:09:29 +00:00
import subprocess
import sys, os
2023-02-06 10:26:05 +00:00
2023-02-06 18:09:29 +00:00
if len(sys.argv) > 1:
cmd = "python scripts/run.py " + str(sys.argv[1] )
print(cmd)
p = subprocess.Popen(cmd, shell=True)
2023-02-06 10:26:05 +00:00
else:
2023-02-06 18:09:29 +00:00
fname = sg.Window('Files exporter',
[[sg.Text('Folder to export')],
[sg.In(), sg.FolderBrowse()],
[sg.Open(), sg.Cancel()]]).read(close=True)[1][0]
2023-02-06 10:26:05 +00:00
2023-02-06 18:09:29 +00:00
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.Popen(cmd, shell=True)