Skip to content

Commit a924b84

Browse files
Sync
1 parent 341ef39 commit a924b84

4 files changed

Lines changed: 33661 additions & 7 deletions

File tree

hp7475a.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def sendToHp7475a(hpglfile, port = 'COM6', baud = 9600):
151151

152152
bufsz = plotter_cmd(tty, b'\033.B', True)
153153
if bufsz < 256:
154-
sg.Print(f'Only {bufsz} bytes free. :-(', end='\r')
154+
# sg.Print(f'Only {bufsz} bytes free. :-(', end='\r')
155155
sys.stdout.flush()
156156
time.sleep(0.25)
157157
continue
@@ -166,9 +166,11 @@ def sendToHp7475a(hpglfile, port = 'COM6', baud = 9600):
166166
if input_bytes != None:
167167
percent = 100.0 * total_bytes_written/input_bytes
168168
sg.Print(
169-
f'{percent:.2f}%, {total_bytes_written} byte written. Adding {bufsz_read} ({bufsz} free).')
169+
# f'{percent:.2f}%, {total_bytes_written} byte written. Adding {bufsz_read} ({bufsz} free).')
170+
f'{percent:.2f}%, {total_bytes_written} byte written. \n')
170171
else:
171172
sg.Print(
172-
f'{total_bytes_written} byte written. Adding {bufsz_read} ({bufsz} free).')
173+
# f'{total_bytes_written} byte written. Adding {bufsz_read} ({bufsz} free).')
174+
f'{percent:.2f}%, {bufsz_read} byte added. \n')
173175
tty.write(data)
174176
total_bytes_written += bufsz_read

input.jpg

363 KB
Loading

main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def main():
3535
[sg.Text('-- HPGL --')],
3636
[
3737
sg.Text('Page Size', size=(15, 1)), sg.Combo(['tight', 'a6', 'a5', 'a4', 'a3', 'letter', 'legal', 'executive', 'tabloid'], default_value='a4', size=(15, 1), key="utility_pageSize"),
38-
sg.Text('Page Orientation', size=(15, 1)), sg.Combo(['vertical', 'landscape'], default_value='vertical', size=(15, 1), key="utility_pageOrientation")
38+
sg.Text('Page Orientation', size=(15, 1)), sg.Combo(['portrait', 'landscape'], default_value='portrait', size=(15, 1), key="utility_pageOrientation")
3939
],
4040
[sg.Button('SVG to HPGL', size=(25, 1), key='utility_convertHPGL')],
4141
]
@@ -94,7 +94,7 @@ def main():
9494
if event == 'utility_scaleA4':
9595
if values['inputSVG']:
9696
outputFile = values['inputSVG'][:-4] + '-A4Scaled.svg'
97-
subprocess.Popen('vpype read "' + str(values['inputSVG']) + '" scale --to 21cm 29cm write --page-format a4 --center "' + str(outputFile) + '"')
97+
subprocess.Popen('vpype read "' + str(values['inputSVG']) + '" scaleto 20cm 28cm write --page-size a4 --center "' + str(outputFile) + '"')
9898
else:
9999
sg.popup_error('Please select a valid .svg file')
100100
if event == 'utility_visualizeSVG':
@@ -113,9 +113,9 @@ def main():
113113
if values['inputSVG']:
114114
outputFile = values['inputSVG'][:-4] + '-Converted.hpgl'
115115
if (values['utility_pageOrientation'] == 'landscape'):
116-
subprocess.Popen('vpype read "' + str(values['inputSVG']) + '" write --device hp7475a --page-format ' + str(values['utility_pageSize']) + ' --landscape --center "' + str(outputFile) + '"')
116+
subprocess.Popen('vpype read "' + str(values['inputSVG']) + '" write --device hp7475a --page-size ' + str(values['utility_pageSize']) + ' --landscape --center "' + str(outputFile) + '"')
117117
else:
118-
subprocess.Popen('vpype read "' + str(values['inputSVG']) + '" write --device hp7475a --page-format ' + str(values['utility_pageSize']) + ' --center "' + str(outputFile) + '"')
118+
subprocess.Popen('vpype read "' + str(values['inputSVG']) + '" write --device hp7475a --page-size ' + str(values['utility_pageSize']) + ' --center "' + str(outputFile) + '"')
119119
else:
120120
sg.popup_error('Please select a valid .svg file')
121121

0 commit comments

Comments
 (0)