aboutsummaryrefslogtreecommitdiffstats
path: root/src/emc/usr_intf/qtplasmac/qtplasmac-materials.py
blob: a1b4e71d497f08b6b651f2d07365768c2cc5d426 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558

'''
qtplasmac-materials.py

Copyright (C) 2020, 2021 Phillip A Carter
Copyright (C) 2020, 2021  Gregory D Carl

This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
'''

import os
import sys
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *

class MaterialConverter(QMainWindow, object):

    def __init__(self, parent=None):
        super(MaterialConverter, self).__init__(parent)
        wid = QWidget(self)
        self.setCentralWidget(wid)
        self.layout = QHBoxLayout()
        wid.setLayout(self.layout)
        self.iconPath = 'share/icons/hicolor/scalable/apps/linuxcnc_alt/linuxcncicon_plasma.svg'
        appPath = os.path.realpath(os.path.dirname(sys.argv[0]))
        self.iconBase = '/usr' if appPath == '/usr/bin' else appPath.replace('/bin', '/debian/extras/usr')
        self.setWindowIcon(QIcon(os.path.join(self.iconBase, self.iconPath)))
        self.setWindowTitle('QtPlasmaC Material File Creator')
        self.create_widgets()
        self.inButton.setEnabled(False)
        self.inFile.setEnabled(False)
        self.outUnits.hide()
        self.outMetric.hide()
        self.outImperial.hide()
        self.inButton.pressed.connect(self.on_in_button_pressed)
        self.outButton.pressed.connect(self.on_out_button_pressed)
        self.unitsGroup.buttonClicked.connect(self.units_group_clicked)
        self.modeGroup.buttonClicked.connect(self.mode_group_clicked)
        self.convert.pressed.connect(self.on_convert_clicked)
        self.cancel.pressed.connect(self.on_cancel_clicked)
        self.divisor = 1
        self.precision = 2
        self.inFileName = ''
        self.outFileName = ''
        self.fNUM = '1'
        self.fNAM = '0'
        self.fKW = '0'
        self.fPH = '0'
        self.fPD = '0'
        self.fPJH = '0'
        self.fPJD = '0'
        self.fCH = '0'
        self.fCS = '0'
        self.fCA = '0'
        self.fCV = '0'
        self.fPE = '0'
        self.fGP = '0'
        self.fCM = '1'
        wid.setStyleSheet('* {color: #ffee06; background: #16160e; font: 12pt DejaVuSans} \
                          QLabel {height: 20; width: 120} \
                          QPushButton {border: 1px solid #ffee06; border-radius: 4; height: 20; width: 120} \
                          QPushButton:disabled {color: #16160e; border: none} \
                          QPushButton:pressed {color: #16160e; background: #ffee06} \
                          QLineEdit {border: 1px solid #ffee06; border-radius: 4; height: 20; width: 360} \
                          QLineEdit:disabled {color: #16160e; border: none} \
                          QRadioButton::indicator {border: 1px solid #ffee06; border-radius: 4; height: 20; width: 20} \
                          QRadioButton::indicator:checked {background: #ffee06}' \
                         )

    def create_widgets(self):
        self.T = QGridLayout()
        self.layout.addLayout(self.T)
        self.modeGroup = QButtonGroup()
        self.inManual = QRadioButton('Manual')
        self.inManual.setChecked(True)
        self.T.addWidget(self.inManual, 0, 0, 1, 1)
        self.modeGroup.addButton(self.inManual)
        self.inSheetcam = QRadioButton('SheetCam')
        self.T.addWidget(self.inSheetcam, 1, 0, 1, 1)
        self.modeGroup.addButton(self.inSheetcam)
        self.inFusion = QRadioButton('Fusion 360')
        self.T.addWidget(self.inFusion, 2, 0, 1, 1)
        self.modeGroup.addButton(self.inFusion)
        self.outUnits = QLabel('OUTPUT UNITS:')
        self.T.addWidget(self.outUnits, 0, 2, 1, 1)
        self.unitsGroup = QButtonGroup()
        self.outMetric = QRadioButton('METRIC')
        self.outMetric.setChecked(True)
        self.T.addWidget(self.outMetric, 0, 3, 1, 1)
        self.unitsGroup.addButton(self.outMetric)
        self.outImperial = QRadioButton('IMPERIAL')
        self.T.addWidget(self.outImperial, 1, 3, 1, 1)
        self.unitsGroup.addButton(self.outImperial)
        v2 = QLabel('')
        self.T.addWidget(v2, 3, 0)
        self.inButton = QPushButton('INPUT:')
        self.T.addWidget(self.inButton, 4, 0, 1, 1)
        self.inFile = QLineEdit()
        self.T.addWidget(self.inFile, 4, 1, 1, 3)
        self.outButton = QPushButton('OUTPUT:')
        self.T.addWidget(self.outButton, 5, 0, 1, 1)
        self.outFile = QLineEdit()
        self.T.addWidget(self.outFile, 5, 1, 1, 3)
        self.msgLabel = QLabel('')
        self.msgLabel.setAlignment(Qt.AlignCenter)
        self.T.addWidget(self.msgLabel, 6, 0, 1, 4)
        self.convert = QPushButton('CREATE')
        self.convert.setFixedWidth(120)
        self.T.addWidget(self.convert, 7, 0, 1, 1)
        h1 = QLabel('')
        self.T.addWidget(h1, 7, 1, 1, 1)
        h2 = QLabel('')
        self.T.addWidget(h2, 7, 2, 1, 1)
        h3 = QLabel('')
        self.T.addWidget(h3, 7, 3, 1, 1)
        self.cancel = QPushButton('EXIT')
        self.T.addWidget(self.cancel, 7, 3, 1, 1)

    def on_in_button_pressed(self):
        self.msgLabel.setText('')
        if self.inSheetcam.isChecked():
            capt = 'Select SheetCam Tool File'
            filt = 'Tool Files (*.[Tt][Oo][Oo][Ll][Ss]);;All Files (*)'
        elif self.inFusion.isChecked():
            capt = 'Select Fusion360 Tool File'
            filt = 'Tool Files (*.[Jj][Ss][Oo][Nn]);;All Files (*)'
#        name, _ = QFileDialog.getOpenFileName(self, capt, '~/', filt, filt, QFileDialog.DontUseNativeDialog)
        name, _ = QFileDialog.getOpenFileName(self, capt, '~/', filt, filt)
        if name:
            self.inFile.setText(name)
            self.inFileName = name
        else:
            self.inFile.setText('')
            self.inFileName = ''

    def on_out_button_pressed(self):
        self.msgLabel.setText('')
        capt = 'QtPlasmaC Material File'
        filt = 'Material Files (*.cfg);;All Files (*)'
#        name, _ = QFileDialog.getSaveFileName(self, capt, '~/', filt, filt, QFileDialog.DontUseNativeDialog)
        name, _ = QFileDialog.getSaveFileName(self, capt, '~/', filt, filt)
        if name:
            self.outFile.setText(name)
            self.outFileName = name
        else:
            self.outFile.setText('')
            self.outFileName = ''

    def units_group_clicked(self, button):
        self.msgLabel.setText('')
        if button.isChecked():
            if button.text() == 'Metric':
                self.divisor = 1
                self.precision = 2
            else:
                self.divisor = 25.4
                self.precision = 3

    def mode_group_clicked(self, button):
        self.msgLabel.setText('')
        if button.isChecked():
            if button.text() == 'Manual':
                self.outUnits.hide()
                self.outMetric.hide()
                self.outImperial.hide()
                self.inButton.setEnabled(False)
                self.inFile.setEnabled(False)
                self.convert.setText('CREATE')
            elif button.text() == 'SheetCam':
                self.outUnits.show()
                self.outMetric.show()
                self.outImperial.show()
                self.inButton.setEnabled(True)
                self.inFile.setEnabled(True)
                self.convert.setText('CONVERT')
            elif button.text() == 'Fusion360':
                self.outUnits.hide()
                self.outMetric.hide()
                self.outImperial.hide()
                self.inButton.setEnabled(True)
                self.inFile.setEnabled(True)
                self.convert.setText('CONVERT')

    def on_convert_clicked(self):
        self.msgLabel.setText('')
        if self.convert.text() != 'ADD':
            if not self.inManual.isChecked():
                if not self.inFileName:
                    self.msgLabel.setText('missing input filename')
                    return
                if not os.path.exists(self.inFileName):
                    self.msgLabel.setText('{} missing'.format(self.inFileName))
                    return
            if not self.outFileName:
                self.msgLabel.setText('missing output filename')
                return
            self.msgLabel.setText('converting...')
#            try:
            with open(self.outFileName, 'w') as f_out:
                f_out.write('#plasmac material file\n'\
                            '# example only, may be deleted\n'\
                            '# items marked * are mandatory\n'\
                            '# other items are optional and will default to 0\n'\
                            '#[MATERIAL_NUMBER_1]  \n'\
                            '#NAME               = \n'\
                            '#KERF_WIDTH         = \n'\
                            '#PIERCE_HEIGHT      = *\n'\
                            '#PIERCE_DELAY       = *\n'\
                            '#PUDDLE_JUMP_HEIGHT = \n'\
                            '#PUDDLE_JUMP_DELAY  = \n'\
                            '#CUT_HEIGHT         = *\n'\
                            '#CUT_SPEED          = *\n'\
                            '#CUT_AMPS           = \n'\
                            '#CUT_VOLTS          = \n'\
                            '#PAUSE_AT_END       = \n'
                            '#GAS_PRESSURE       = \n'\
                            '#CUT_MODE           = \n'\
                            '\n')
#            except:
#                self.msgLabel.setText('WRITE ERROR!!!')
        else:
            self.fNUM = str(int(self.fNUM) + 1)
        if self.inManual.isChecked():
            getParams = self.fusion_dialog()
            if not getParams:
                self.msgLabel.setText('')
                return
            self.materialNum = '[MATERIAL_NUMBER_{}]'.format(self.fNUM)
            self.materialName = 'NAME               = {}'.format(self.fNAM)
            self.materialKerf = "{id:}{val:.{i}f}".format(id='KERF_WIDTH         = ',
                                 i=self.precision, val=float(self.fKW) / self.divisor)
            self.materialPierceH = "{id:}{val:.{i}f}".format(id='PIERCE_HEIGHT      = ',
                                    i=self.precision, val=float(self.fPH) / self.divisor)
            self.materialPierceD = 'PIERCE_DELAY       = {}'.format(self.fPD)
            self.materialPuddleH = "{id:}{val:.{i}f}".format(id='PUDDLE_JUMP_HEIGHT = ',
                                    i=self.precision, val=float(self.fPJH) / self.divisor)
            self.materialPuddleD = 'PUDDLE_JUMP_DELAY  = {}'.format(self.fPJD)
            self.materialCutH = "{id:}{val:.{i}f}".format(id='CUT_HEIGHT         = ',
                                 i=self.precision, val=float(self.fCH) / self.divisor)
            self.materialCutS = "{id:}{val:.{i}f}".format(id='CUT_SPEED          = ',
                                 i=0, val=float(self.fCS) / self.divisor)
            self.materialCutA = 'CUT_AMPS           = {}'.format(self.fCA)
            self.materialCutV = 'CUT_VOLTS          = {}'.format(self.fCV)
            self.materialPauseE = 'PAUSE_AT_END       = {}'.format(self.fPE)
            self.materialGasP = 'GAS_PRESSURE       = {}'.format(self.fGP)
            self.materialCutM = 'CUT_MODE           = {}'.format(self.fCM)
            self.output()
            self.convert.setText('ADD')
        elif self.inSheetcam.isChecked():
#            try:
            with open(self.inFileName, 'r') as f_in:
                count = 0
                valid = False
                for line in f_in:
                    if line.startswith('[Tool') and not 'Custom' in line:
                        if count and valid:
                            self.output()
                        valid = False
                        self.materialNum = ''
                        self.materialName = 'NAME               = '
                        self.materialKerf = 'KERF_WIDTH         = '
                        self.materialPierceH = 'PIERCE_HEIGHT      = '
                        self.materialPierceD = 'PIERCE_DELAY       = '
                        self.materialPuddleH = 'PUDDLE_JUMP_HEIGHT = 0'
                        self.materialPuddleD = 'PUDDLE_JUMP_DELAY  = 0'
                        self.materialCutH = 'CUT_HEIGHT         = '
                        self.materialCutS = 'CUT_SPEED          = '
                        self.materialCutA = 'CUT_AMPS           = 0'
                        self.materialCutV = 'CUT_VOLTS          = 0'
                        self.materialPauseE = 'PAUSE_AT_END       = 0'
                        self.materialGasP = 'GAS_PRESSURE       = 0'
                        self.materialCutM = 'CUT_MODE           = 1'
                    elif 'PlasmaTool' in line:
                        valid = True
                    elif line.startswith('Tool\ number'):
                        a,b = line.split('=')
                        self.materialNum = '[MATERIAL_NUMBER_{}]'.format(b.strip().replace(']',''))
                    elif line.startswith('Name='):
                        a,b = line.split('=',1)
                        self.materialName = 'NAME               = {}'.format(b.strip())
                    elif line.startswith('Kerf\ width'):
                        a,b = line.split('=',1)
                        self.materialKerf = "{id:}{val:.{i}f}".format(id='KERF_WIDTH         = ',
                                             i=self.precision, val=float(b.strip()) / self.divisor)
                    elif line.startswith('Pierce\ height'):
                        a,b = line.split('=',1)
                        self.materialPierceH = "{id:}{val:.{i}f}".format(id='PIERCE_HEIGHT      = ',
                                                i=self.precision, val=float(b.strip()) / self.divisor)
                    elif line.startswith('Pierce\ delay'):
                        a,b = line.split('=',1)
                        self.materialPierceD = 'PIERCE_DELAY       = {}'.format(b.strip())
                    elif line.startswith('Cut\ height'):
                        a,b = line.split('=',1)
                        self.materialCutH = "{id:}{val:.{i}f}".format(id='CUT_HEIGHT         = ',
                                             i=self.precision, val=float(b.strip()) / self.divisor)
                    elif line.startswith('Feed\ rate'):
                        a,b = line.split('=',1)
                        self.materialCutS = "{id:}{val:.{i}f}".format(id='CUT_SPEED          = ',
                                             i=0, val=float(b.strip()) / self.divisor)
                    elif line.startswith('Cut\ current') or (line.startswith('Preset\ current') and self.materialCutA == 'CUT_AMPS           = 0'):
                        a,b = line.split('=',1)
                        self.materialCutA = 'CUT_AMPS           = {}'.format(b.strip())
                    elif line.startswith('Cut\ voltage') or (line.startswith('Preset\ volts') and self.materialCutV == 'CUT_VOLTS          = 0'):
                        a,b = line.split('=',1)
                        self.materialCutV = 'CUT_VOLTS          = {}'.format(b.strip())
                    elif line.startswith('Pause\ at\ end\ of\ cut'):
                        a,b = line.split('=',1)
                        self.materialPauseE = 'PAUSE_AT_END       = {}'.format(b.strip())
                    elif line.startswith('Gas\ pressure') or (line.startswith('Preset\ Air\ Pressure') and self.materialGasP == 'GAS_PRESSURE       = 0'):
                        a,b = line.split('=',1)
                        self.materialGasp = 'GAS_PRESSURE       = {}'.format(b.strip())
                    elif line.startswith('Cut\ mode') or (line.startswith('Preset\ mode') and self.materialCutM == 'CUT_MODE           = 1'):
                        a,b = line.split('=',1)
                        self.materialCutM = 'CUT_MODE           = {}'.format(b.strip())
                    count += 1
                if valid:
                    self.output()
#            except:
#                self.msgLabel.setText('READ ERROR!!!')
            self.msgLabel.setText('FINISHED')
        elif self.inFusion.isChecked():
            import json
            #            try:
            with open(self.inFileName, 'r') as f_in:
                jdata = json.load(f_in)
                f_in.close()
            for t in jdata['data']:
                self.fNUM = str(t['post-process']['number'])
                self.fNAM = t['description']
                lCS = self.find_key(t, 'v_f')
                lKW = t['geometry']['CW']
                getParams = self.fusion_dialog()
                if not getParams:
                    self.msgLabel.setText('')
                    return
                self.materialNum = '[MATERIAL_NUMBER_{}]'.format(self.fNUM)
                self.materialName = 'NAME               = {}'.format(self.fNAM)
                self.materialKerf = "{id:}{val:.{i}f}".format(id='KERF_WIDTH         = ',
                                     i=self.precision, val=float(lKW) / self.divisor)
                self.materialPierceH = "{id:}{val:.{i}f}".format(id='PIERCE_HEIGHT      = ',
                                        i=self.precision, val=float(self.fPH) / self.divisor)
                self.materialPierceD = 'PIERCE_DELAY       = {}'.format(self.fPD)
                self.materialPuddleH = "{id:}{val:.{i}f}".format(id='PUDDLE_JUMP_HEIGHT = ',
                                        i=self.precision, val=float(self.fPJH) / self.divisor)
                self.materialPuddleD = 'PUDDLE_JUMP_DELAY  = {}'.format(self.fPJD)
                self.materialCutH = "{id:}{val:.{i}f}".format(id='CUT_HEIGHT         = ',
                                     i=self.precision, val=float(self.fCH) / self.divisor)
                self.materialCutS = "{id:}{val:.{i}f}".format(id='CUT_SPEED          = ',
                                     i=0, val=float(lCS) / self.divisor)
                self.materialCutA = 'CUT_AMPS           = {}'.format(self.fCA)
                self.materialCutV = 'CUT_VOLTS          = {}'.format(self.fCV)
                self.materialPauseE = 'PAUSE_AT_END       = {}'.format(self.fPE)
                self.materialGasP = 'GAS_PRESSURE       = {}'.format(self.fGP)
                self.materialCutM = 'CUT_MODE           = {}'.format(self.fCM)
                self.output()
#            except:
#                self.msgLabel.setText('READ ERROR!!!')
            self.msgLabel.setText('FINISHED')
        else:
            self.msgLabel.setText('Invalid Conversion')

    def find_key(self, obj, key):
        if key in obj: return obj[key]
        for k, v in obj.items():
            if isinstance(v,dict):
                item = self.find_key(v, key)
                if item is not None:
                    return item
            elif isinstance(v,list):
                for list_item in v:
                    item = self.find_key(list_item, key)
                    if item is not None:
                        return item

    def on_cancel_clicked(self):
        sys.exit()

    def output(self):
#        try:
        with open(self.outFileName, 'a') as f_out:
            f_out.write(self.materialNum + '\n' + \
                        self.materialName + '\n' + \
                        self.materialKerf + '\n' + \
                        self.materialPierceH + '\n' + \
                        self.materialPierceD + '\n' + \
                        self.materialPuddleH + '\n' + \
                        self.materialPuddleD + '\n' + \
                        self.materialCutH + '\n' + \
                        self.materialCutS + '\n' + \
                        self.materialCutA + '\n' + \
                        self.materialCutV + '\n' + \
                        self.materialPauseE + '\n' +\
                        self.materialGasP + '\n' + \
                        self.materialCutM + '\n' + \
                        '\n')
#        except:
#            self.msgLabel.setText('WRITE ERROR!!!')

    def fusion_dialog(self):
        dialog = QDialog()
        dialog.setWindowTitle('Material Maker')
        dialog.setWindowIcon(QIcon(os.path.join(self.iconBase, self.iconPath)))
        dialog.setModal(True)
        topL = QLabel('Items with a *** are mandatory')
        infL = QLabel('For Material # {}\n{}'.format(self.fNUM,self.fNAM))
        dNUl = QLabel('Material Number ***')
        dNUl.setAlignment(Qt.AlignBottom|Qt.AlignRight)
        dNU = QLineEdit()
        dNU.setText(self.fNUM)
        dNU.setAlignment(Qt.AlignRight)
        dNAl = QLabel('Material Name')
        dNAl.setAlignment(Qt.AlignBottom|Qt.AlignRight)
        dNA = QLineEdit()
        dNA.setText(self.fNAM)
        dNA.setAlignment(Qt.AlignRight)
        dKWl = QLabel('Kerf Width')
        dKWl.setAlignment(Qt.AlignBottom|Qt.AlignRight)
        dKW = QLineEdit()
        dKW.setText(self.fKW)
        dKW.setAlignment(Qt.AlignRight)
        dPHl = QLabel('Pierce Height ***')
        dPHl.setAlignment(Qt.AlignBottom|Qt.AlignRight)
        dPH = QLineEdit()
        dPH.setText(self.fPH)
        dPH.setAlignment(Qt.AlignRight)
        dPDl = QLabel('Pierce Delay ***')
        dPDl.setAlignment(Qt.AlignBottom|Qt.AlignRight)
        dPD = QLineEdit()
        dPD.setText(self.fPD)
        dPD.setAlignment(Qt.AlignRight)
        dPJHl = QLabel('Puddle Jump Height')
        dPJHl.setAlignment(Qt.AlignBottom|Qt.AlignRight)
        dPJH = QLineEdit()
        dPJH.setText(self.fPJH)
        dPJH.setAlignment(Qt.AlignRight)
        dPJDl = QLabel('Puddle Jump Delay')
        dPJDl.setAlignment(Qt.AlignBottom|Qt.AlignRight)
        dPJD = QLineEdit()
        dPJD.setText(self.fPJD)
        dPJD.setAlignment(Qt.AlignRight)
        dCHl = QLabel('Cut Height ***')
        dCHl.setAlignment(Qt.AlignBottom|Qt.AlignRight)
        dCH = QLineEdit()
        dCH.setText(self.fCH)
        dCH.setAlignment(Qt.AlignRight)
        dCSl = QLabel('Cut Speed ***')
        dCSl.setAlignment(Qt.AlignBottom|Qt.AlignRight)
        dCS = QLineEdit()
        dCS.setText(self.fCS)
        dCS.setAlignment(Qt.AlignRight)
        dCAl = QLabel('Cut Amps')
        dCAl.setAlignment(Qt.AlignBottom|Qt.AlignRight)
        dCA = QLineEdit()
        dCA.setText(self.fCA)
        dCA.setAlignment(Qt.AlignRight)
        dCVl = QLabel('Cut Volts')
        dCVl.setAlignment(Qt.AlignBottom|Qt.AlignRight)
        dCV = QLineEdit()
        dCV.setText(self.fCV)
        dCV.setAlignment(Qt.AlignRight)
        dPEl = QLabel('Pause At End Of Cut')
        dPEl.setAlignment(Qt.AlignBottom|Qt.AlignRight)
        dPE = QLineEdit()
        dPE.setText(self.fPE)
        dPE.setAlignment(Qt.AlignRight)
        dGPl = QLabel('Gas Pressure')
        dGPl.setAlignment(Qt.AlignBottom|Qt.AlignRight)
        dGP = QLineEdit()
        dGP.setText(self.fGP)
        dGP.setAlignment(Qt.AlignRight)
        dCMl = QLabel('Cut Mode')
        dCMl.setAlignment(Qt.AlignBottom|Qt.AlignRight)
        dCM = QLineEdit()
        dCM.setText(self.fCM)
        dCM.setAlignment(Qt.AlignRight)
        vSpace1 = QSpacerItem(0, 25)
        buttons = QDialogButtonBox.Ok | QDialogButtonBox.Cancel
        buttonBox = QDialogButtonBox(buttons)
        buttonBox.accepted.connect(dialog.accept)
        buttonBox.rejected.connect(dialog.reject)
        layout = QVBoxLayout()
        dialog.setLayout(layout)
        layout.addWidget(topL)
        if self.inManual.isChecked():
            layout.addWidget(dNUl)
            layout.addWidget(dNU)
            layout.addWidget(dNAl)
            layout.addWidget(dNA)
            layout.addWidget(dKWl)
            layout.addWidget(dKW)
        else:
            layout.addWidget(infL)
        layout.addWidget(dPHl)
        layout.addWidget(dPH)
        layout.addWidget(dPDl)
        layout.addWidget(dPD)
        layout.addWidget(dPJHl)
        layout.addWidget(dPJH)
        layout.addWidget(dPJDl)
        layout.addWidget(dPJD)
        layout.addWidget(dCHl)
        layout.addWidget(dCH)
        if self.inManual.isChecked():
            layout.addWidget(dCSl)
            layout.addWidget(dCS)
        layout.addWidget(dCAl)
        layout.addWidget(dCA)
        layout.addWidget(dCVl)
        layout.addWidget(dCV)
        layout.addWidget(dPEl)
        layout.addWidget(dPE)
        layout.addWidget(dGPl)
        layout.addWidget(dGP)
        layout.addWidget(dCMl)
        layout.addWidget(dCM)
        layout.addItem(vSpace1)
        layout.addWidget(buttonBox, alignment=Qt.AlignCenter)
        dialog.setStyleSheet('* { color: #ffee06; background: #16160e; font: 10pt DejaVuSans } \
                             QLineEdit { border: 1px solid #ffee06; border-radius: 4 } \
                           QPushButton {border: 1px solid #ffee06; border-radius: 4; height: 20; width: 80} \
                           QPushButton:pressed {color: #16160e; background: #ffee06}')
        response = dialog.exec_()
        if self.inManual.isChecked():
            self.fNUM = dNU.text()
            self.fNAM = dNA.text()
            self.fKW = dKW.text()
        self.fPH = dPH.text()
        self.fPD = dPD.text()
        self.fPJH = dPJH.text()
        self.fPJD = dPJD.text()
        self.fCH = dCH.text()
        if self.inManual.isChecked():
            self.fCS = dCS.text()
        self.fCA = dCA.text()
        self.fCV = dCV.text()
        self.fPE = dPE.text()
        self.fGP = dGP.text()
        self.fCM = dCM.text()
        return response

if __name__ == '__main__':
    app = QApplication(sys.argv)
    w = MaterialConverter()
    w.show()
    sys.exit(app.exec_())
bues.ch cgit interface