This commit is contained in:
Lurenaud 2023-02-06 19:09:29 +01:00
parent 6f72497a24
commit d51d611905
11 changed files with 21 additions and 33 deletions

27
gui.py
View File

@ -1,16 +1,23 @@
import PySimpleGUI as sg
import sys
import subprocess
import sys, os
if len(sys.argv) == 1:
fname = sg.Window('My Script',
[[sg.Text('Document to open')],
[sg.In(), sg.FileBrowse()],
[sg.Open(), sg.Cancel()]]).read(close=True)[1][0]
if len(sys.argv) > 1:
cmd = "python scripts/run.py " + str(sys.argv[1] )
print(cmd)
p = subprocess.Popen(cmd, shell=True)
else:
fname = sys.argv[1]
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:
if not fname:
sg.popup("Cancel", "No filename supplied")
raise SystemExit("Cancelling: no filename supplied")
else:
sg.popup('The filename you chose was', fname)
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)

View File

@ -1,19 +0,0 @@
# example: .\run.py path\Part1
import os
import sys
import pathlib
import subprocess
# folder input
if(sys.argv[1]):
pass
files = sys.argv[1:] # take files given in input
currentPath = str(pathlib.Path().resolve())
for i in files:
input = str(i)
commandstep = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + "\export-step.ps1 " + input
commandPdfDxf = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + "\export-pdf-dxf.ps1 " + input
subprocess.run(commandstep)
subprocess.run(commandPdfDxf)

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -45,13 +45,13 @@ if not os.path.exists(outputFolder):
# part files
for i in track(partWithoutExention, description="Exporting step files..."):
input = str(i)
commandstep = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + '\export-step.ps1 "' + path + "\\" + input + '" "' + outputFolder + input + '"'
commandstep = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + '\scripts\export-step.ps1 "' + path + "\\" + input + '" "' + outputFolder + input + '"'
# print(commandstep)
subprocess.run(commandstep, capture_output=True)
# drawings files
for i in track(drwgWithoutExtension, description="Exporting PDF and DXF..."):
input = str(i)
commandPdfDxf = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + '\export-pdf-dxf.ps1 "' + path + "\\" + input + '" "' + outputFolder + input + '"'
commandPdfDxf = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + '\scripts\export-pdf-dxf.ps1 "' + path + "\\" + input + '" "' + outputFolder + input + '"'
# print(commandPdfDxf)
subprocess.run(commandPdfDxf, capture_output=True)