2828_translate = QCoreApplication .translate
2929
3030def 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-
124120def 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
196193def 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
205203def 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
215214def 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
227228def 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
239242def 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 :
0 commit comments