@@ -193,7 +193,6 @@ def go_button_pressed(root, json_file_path, material_type) -> None:
193193 data [item ]["material" ] = material_type .get ()
194194 with open (json_file_path , "w" ) as f :
195195 json .dump (data , f )
196- print (material_type .get ())
197196 threading .Thread (
198197 target = upload_file , args = ["laser_parts_list_upload" , json_file_path ]
199198 ).start ()
@@ -206,15 +205,23 @@ def go_button_pressed(root, json_file_path, material_type) -> None:
206205
207206def make_quote_button_pressed (root , json_file_path , material_type ) -> None :
208207 """
209- This function writes "quote" to a file and destroys the root window.
208+ This function updates a JSON file with a selected material type and writes "quote" to a separate
209+ file before destroying the root window.
210210
211211 Args:
212- root: The root parameter is a reference to the main window or frame of the GUI application. It is
213- used to destroy the current window or frame when the quote button is pressed.
214- json_file_path: The file path to a JSON file.
215- material_type: The material_type parameter is not used in the given function. It is likely a
216- parameter that is used in other parts of the program.
212+ root: The root parameter is typically a reference to the main window or frame of a GUI
213+ application. It is used to access and modify the widgets and properties of the application.
214+ json_file_path: The file path to a JSON file that contains data to be modified.
215+ material_type: It is a variable that contains the selected material type. It is likely a tkinter
216+ StringVar() object that is used to store the value of a dropdown menu or radio button selection. The
217+ value of this variable is used to update the "material" field in a JSON file.
217218 """
219+ with open (json_file_path ) as f :
220+ data = json .load (f )
221+ for item in list (data .keys ()):
222+ data [item ]["material" ] = material_type .get ()
223+ with open (json_file_path , "w" ) as f :
224+ json .dump (data , f )
218225 with open (f"{ program_directory } /action" , "w" ) as f :
219226 f .write ("quote" )
220227 root .destroy ()
0 commit comments