22conversational.py
33
44Copyright (C) 2019 - 2024 Phillip A Carter
5- Copyright (C) 2020 - 2024 Gregory D Carl
5+ Copyright (C) 2020 - 2025 Gregory D Carl
66
77This program is free software; you can redistribute it and/or modify it
88under the terms of the GNU General Public License as published by the
@@ -87,18 +87,22 @@ def conv_setup(P, W):
8787 P .ySaved = '0.000'
8888 P .convBlock = [False , False ]
8989 if not P .oldConvButton :
90- conv_shape_request (P , W , 'conv_line' , True )
90+ conv_shape_request (P , W , 'conv_line' )
9191 else :
92- conv_shape_request (P , W , P .oldConvButton , True )
92+ conv_shape_request (P , W , P .oldConvButton )
9393
9494
9595def conv_new_pressed (P , W , button ):
96- if button and (W .conv_save .isEnabled () or W .conv_send .isEnabled () or P .convPreviewActive ):
96+ if button and (W .conv_save .isEnabled () or W .conv_send .isEnabled () or P .convPreviewActive or P . oldConvButton == 'conv_block' ):
9797 head = _translate ('HandlerClass' , 'Unsaved Shape' )
9898 btn1 = _translate ('HandlerClass' , 'CONTINUE' )
9999 btn2 = _translate ('HandlerClass' , 'CANCEL' )
100- msg0 = _translate ('HandlerClass' , 'You have an unsaved, unsent, or active previewed shape' )
101- msg1 = _translate ('HandlerClass' , 'If you continue it will be deleted' )
100+ if P .oldConvButton == 'conv_block' :
101+ msg0 = _translate ('HandlerClass' , 'A loaded file from the MAIN tab is being previewed' )
102+ msg1 = _translate ('HandlerClass' , 'If you continue it will be removed from the Conversational preview' )
103+ else :
104+ msg0 = _translate ('HandlerClass' , 'You have an unsaved, unsent, or active previewed shape' )
105+ msg1 = _translate ('HandlerClass' , 'If you continue it will be deleted' )
102106 if not P .dialog_show_yesno (QMessageBox .Warning , f'{ head } ' , f'{ msg0 } \n \n { msg1 } \n ' , f'{ btn1 } ' , f'{ btn2 } ' ):
103107 return
104108 if P .oldConvButton == 'conv_line' :
@@ -124,6 +128,8 @@ def conv_new_pressed(P, W, button):
124128 P .validShape = False
125129 conv_preview_button (P , W , False )
126130 conv_enable_tabs (P , W )
131+ if P .oldConvButton == 'conv_block' :
132+ conv_shape_request (P , W , 'conv_line' )
127133
128134
129135def conv_save_pressed (P , W ):
@@ -152,6 +158,7 @@ def conv_save_pressed(P, W):
152158
153159
154160def conv_settings_pressed (P , W ):
161+ W .conv_material .hide ()
155162 P .color_item (P .oldConvButton , P .foreColor , 'button' )
156163 W [P .oldConvButton ].setStyleSheet (f'QPushButton {{ background: { P .backColor } }} \
157164 QPushButton:pressed {{ background: { P .backColor } }}' )
@@ -193,10 +200,10 @@ def conv_block_pressed(P, W):
193200 # return
194201 elif 'M3' in line or 'm3' in line :
195202 break
196- conv_shape_request (P , W , W .sender ().objectName (), False )
203+ conv_shape_request (P , W , W .sender ().objectName ())
197204
198205
199- def conv_shape_request (P , W , shape , material ):
206+ def conv_shape_request (P , W , shape ):
200207 if shape == 'conv_line' :
201208 module = CONVLINE
202209 elif shape == 'conv_circle' :
@@ -229,10 +236,10 @@ def conv_shape_request(P, W, shape, material):
229236 if P .convPreviewActive and not conv_active_shape (P , W ):
230237 return
231238 conv_preview_button (P , W , False )
232- if material :
233- W .conv_material .show ()
234- else :
239+ if shape == 'conv_block' :
235240 W .conv_material .hide ()
241+ else :
242+ W .conv_material .show ()
236243 # we use exception handlers here as there may be no signals connected
237244 try :
238245 W .conv_material .currentTextChanged .disconnect ()
0 commit comments