Skip to content

Commit 7f259df

Browse files
committed
qtplasmac: conv_line: fix start point
1 parent 1301fb1 commit 7f259df

4 files changed

Lines changed: 36 additions & 26 deletions

File tree

lib/python/qtvcp/lib/qtplasmac/conv_line.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
_translate = QCoreApplication.translate
2929

3030
def preview(P, W, Conv):
31+
if P.xLineEnd != Conv.conv_is_float(W.entry1.text())[1] or \
32+
P.yLineEnd != Conv.conv_is_float(W.entry2.text())[1]:
33+
P.convAddSegment = 0
3134
if W.lType.currentText() == _translate('Conversational', 'LINE POINT ~ POINT'):
3235
reply = LINE.do_line_point_to_point(Conv, W.entry1.text(), W.entry2.text(), W.entry3.text(), \
3336
W.entry4.text())
@@ -83,6 +86,8 @@ def preview(P, W, Conv):
8386
if P.convAddSegment == 1:
8487
LINE.next_segment(P.fTmp, P.fNgc)
8588
else:
89+
valid, P.xLineStart = Conv.conv_is_float(W.entry1.text())
90+
valid, P.yLineStart = Conv.conv_is_float(W.entry2.text())
8691
LINE.first_segment(P.fTmp, P.fNgc, P.fNgcBkp, P.preAmble, \
8792
W.lType.currentText(), P.xLineStart, P.yLineStart, \
8893
int(W.conv_material.currentText().split(':')[0]), \
@@ -112,15 +117,6 @@ def auto_preview(P, W, Conv):
112117
(W.lType.currentText() == _translate('Conversational', 'ARC ANGLE +RADIUS') and W.entry5.text()):
113118
preview(P, W, Conv)
114119

115-
def entry_changed(P, W, Conv, widget, entry):
116-
if widget == W.entry4 and \
117-
(W.lType.currentText() == _translate('Conversational', 'LINE BY ANGLE') or \
118-
W.lType.currentText() == _translate('Conversational', 'ARC ANGLE +RADIUS')):
119-
widget.setObjectName('aEntry')
120-
else:
121-
widget.setObjectName(None)
122-
Conv.conv_entry_changed(P, W, widget)
123-
124120
def line_type_changed(P, W, refresh):
125121
W.entry3.setFocus()
126122
if W.lType.currentText() == _translate('Conversational', 'LINE POINT ~ POINT'):
@@ -192,6 +188,7 @@ def set_line_point_to_point(P, W):
192188
for n in '34':
193189
W['entry{}'.format(n)].setText('')
194190
W['entry{}'.format(n)].show()
191+
W.entry3.setObjectName('neg')
195192

196193
def set_line_by_angle(P, W):
197194
clear_widgets(P, W, P.conv_line_angle)
@@ -201,6 +198,7 @@ def set_line_by_angle(P, W):
201198
for n in '34':
202199
W['entry{}'.format(n)].setText('')
203200
W['entry{}'.format(n)].show()
201+
W.entry3.setObjectName(None)
204202

205203
def set_arc_3_points(P, W):
206204
clear_widgets(P, W, P.conv_line_3p)
@@ -211,6 +209,7 @@ def set_arc_3_points(P, W):
211209
for n in '3456':
212210
W['entry{}'.format(n)].setText('')
213211
W['entry{}'.format(n)].show()
212+
W['entry{}'.format(n)].setObjectName('neg')
214213

215214
def set_arc_2_points_radius(P, W):
216215
clear_widgets(P, W, P.conv_line_2pr)
@@ -223,6 +222,8 @@ def set_arc_2_points_radius(P, W):
223222
for n in '345':
224223
W['entry{}'.format(n)].setText('')
225224
W['entry{}'.format(n)].show()
225+
W.entry3.setObjectName('neg')
226+
W.entry5.setObjectName(None)
226227

227228
def set_arc_by_angle_radius(P, W):
228229
clear_widgets(P, W, P.conv_arc_angle)
@@ -235,6 +236,8 @@ def set_arc_by_angle_radius(P, W):
235236
for n in '345':
236237
W['entry{}'.format(n)].setText('')
237238
W['entry{}'.format(n)].show()
239+
W.entry3.setObjectName(None)
240+
W.entry5.setObjectName(None)
238241

239242
def set_arc_widgets(P, W):
240243
W.entries.removeWidget(W.g23Arc)
@@ -279,8 +282,8 @@ def widgets(P, W, Conv):
279282
P.convAddSegment = 0
280283
P.conv_gcodeLine = ''
281284
P.conv_gcodeSave = ''
282-
P.xLineStart = 0.000
283-
P.yLineStart = 0.000
285+
P.xLineStart = P.xLineEnd = 0.000
286+
P.yLineStart = P.yLineEnd = 0.000
284287
#connections
285288
W.conv_material.currentTextChanged.connect(lambda:auto_preview(P, W, Conv))
286289
W.preview.pressed.connect(lambda:preview(P, W, Conv))
@@ -290,7 +293,7 @@ def widgets(P, W, Conv):
290293
W.g23Arc.toggled.connect(lambda:auto_preview(P, W, Conv))
291294
entries = ['entry1', 'entry2', 'entry3', 'entry4', 'entry5', 'entry6']
292295
for entry in entries:
293-
W[entry].textChanged.connect(lambda w:entry_changed(P, W, Conv, W.sender(), w))
296+
W[entry].textChanged.connect(lambda w:Conv.conv_entry_changed(P, W, W.sender()))
294297
W[entry].returnPressed.connect(lambda:preview(P, W, Conv))
295298
#add to layout
296299
if P.landscape:

lib/python/qtvcp/lib/qtplasmac/conversational.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def conv_setup(P, W):
5050
P.validShape = False
5151
P.savedSettings = {'origin':None, 'intext':None, 'in':None, 'out':None}
5252
P.invalidLeads = 0
53-
W.preview = QPushButton(_translate('Conversational', 'PREVIEW'))
54-
W.undo = QPushButton(_translate('Conversational', 'RELOAD'))
53+
if not P.convWidgetsLoaded or P.developmentPin.get():
54+
conv_widgets(P, W)
5555
if not ACTION.prefilter_path:
5656
W.undo.setEnabled(False)
5757
conv_preview_button(P, W, False)
@@ -85,8 +85,6 @@ def conv_setup(P, W):
8585
P.xSaved = '0.000'
8686
P.ySaved = '0.000'
8787
P.convBlock = [False, False]
88-
if not P.convWidgetsLoaded or P.developmentPin.get():
89-
conv_widgets(P, W)
9088
if not P.oldConvButton:
9189
conv_shape_request(P, W, 'conv_line', True)
9290
else:
@@ -112,6 +110,8 @@ def conv_new_pressed(P, W, button):
112110
CONVLINE.set_arc_2_points_radius(P, W)
113111
elif W.lType.currentText() == _translate('Conversational', 'ARC ANGLE +RADIUS'):
114112
CONVLINE.set_arc_by_angle_radius(P, W)
113+
W.entry1.setText('0.000')
114+
W.entry2.setText('0.000')
115115
with open(P.fNgc, 'w') as outNgc:
116116
outNgc.write('(new conversational file)\nM2\n')
117117
COPY(P.fNgc, P.fTmp)
@@ -376,7 +376,7 @@ def conv_entry_changed(P, W, widget, circleType=False):
376376
if value:
377377
if name in ['intEntry', 'hsEntry', 'cnEntry', 'rnEntry']:
378378
good = '0123456789'
379-
elif name in ['xsEntry', 'ysEntry', 'aEntry', 'coEntry', 'roEntry']:
379+
elif name in ['xsEntry', 'ysEntry', 'aEntry', 'coEntry', 'roEntry', 'neg']:
380380
good = '-.0123456789'
381381
else:
382382
good = '.0123456789'
@@ -539,20 +539,22 @@ def conv_auto_preview_button(P, W, button):
539539
# create all required widgets without showing them
540540
def conv_widgets(P, W):
541541
# common
542+
W.preview = QPushButton(_translate('Conversational', 'PREVIEW'))
543+
W.undo = QPushButton(_translate('Conversational', 'RELOAD'))
542544
W.centLeft = QPushButton(_translate('Conversational', 'BTM LEFT'), objectName='centLeft')
543545
W.centLeft.setCheckable(True)
544546
W.intExt = QPushButton(_translate('Conversational', 'EXTERNAL'), objectName='intExt')
545547
W.intExt.setCheckable(True)
546548
W.liLabel = QLabel(_translate('Conversational', 'LEAD IN'))
547-
W.liEntry = QLineEdit(str(P.leadIn), objectName='liEntry')
549+
W.liEntry = QLineEdit(objectName='liEntry')
548550
W.loLabel = QLabel(_translate('Conversational', 'LEAD OUT'))
549-
W.loEntry = QLineEdit(str(P.leadOut), objectName='loEntry')
551+
W.loEntry = QLineEdit(objectName='loEntry')
550552
W.ctLabel = QLabel(_translate('Conversational', 'CUT TYPE'))
551553
W.spLabel = QLabel(_translate('Conversational', 'START'))
552554
W.xsLabel = QLabel(_translate('Conversational', 'X ORIGIN'))
553-
W.xsEntry = QLineEdit(str(P.xSaved), objectName='xsEntry')
555+
W.xsEntry = QLineEdit(objectName='xsEntry')
554556
W.ysLabel = QLabel(_translate('Conversational', 'Y ORIGIN'))
555-
W.ysEntry = QLineEdit(str(P.ySaved), objectName='ysEntry')
557+
W.ysEntry = QLineEdit(objectName='ysEntry')
556558
W.overcut = QPushButton(_translate('Conversational', 'OVER CUT'))
557559
W.overcut.setEnabled(False)
558560
W.overcut.setCheckable(True)
@@ -641,17 +643,17 @@ def conv_widgets(P, W):
641643
# lines and arcs
642644
W.lType = QComboBox()
643645
W.label1 = QLabel()
644-
W.entry1 = QLineEdit()
646+
W.entry1 = QLineEdit(objectName='neg')
645647
W.label2 = QLabel()
646-
W.entry2 = QLineEdit()
648+
W.entry2 = QLineEdit(objectName='neg')
647649
W.label3 = QLabel()
648650
W.entry3 = QLineEdit()
649651
W.label4 = QLabel()
650-
W.entry4 = QLineEdit()
652+
W.entry4 = QLineEdit(objectName='neg')
651653
W.label5 = QLabel()
652654
W.entry5 = QLineEdit()
653655
W.label6 = QLabel()
654-
W.entry6 = QLineEdit()
656+
W.entry6 = QLineEdit(objectName='neg')
655657
W.g23Arc = QPushButton('CW - G2')
656658
W.g23Arc.setCheckable(True)
657659
# settings

share/qtvcp/screens/qtplasmac/qtplasmac_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = '1.227.215'
1+
VERSION = '1.227.216'
22

33
'''
44
qtplasmac_handler.py

share/qtvcp/screens/qtplasmac/versions.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ <h2>QtPlasmaC Version History</h2>
3030
</table>
3131
<br>
3232
<!--- ****** ADD NEXT VERSION BELOW THIS LINE ****** --->
33+
<br><b><u>v1.227.216 2022 July 08</u></b>
34+
<ul style="margin:0;">
35+
<li>conv_line: fix start point</li>
36+
</ul>
37+
3338
<br><b><u>v1.227.215 2022 July 08</u></b>
3439
<ul style="margin:0;">
3540
<li>update to make use of new motion.jog-stop pin</li>

0 commit comments

Comments
 (0)