#NEWLINE# def on_close( self , view ) : #NEWLINE# #INDENT# '\n        When a sketch is closed, temp files are deleted\n\n        Arguments: view {ST object} -- Sublime Text Object\n        ' #NEWLINE# monitor_module = Serial #NEWLINE# if Messages . isMonitorView ( view ) : #NEWLINE# #INDENT# name = view . name ( ) #NEWLINE# serial_port = name . split ( '-' ) [ 1 ] . strip ( ) #NEWLINE# if ( serial_port in monitor_module . serials_in_use ) : #NEWLINE# #INDENT# cur_serial_monitor = monitor_module . serial_monitor_dict . get ( serial_port , None ) #NEWLINE# if cur_serial_monitor : #NEWLINE# #INDENT# cur_serial_monitor . stop ( ) #NEWLINE# #UNINDENT# monitor_module . serials_in_use . remove ( serial_port ) #NEWLINE# #UNINDENT# #UNINDENT# keep_cache = Preferences ( ) . get ( 'keep_cache' , False ) #NEWLINE# if keep_cache : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# file_path = Tools . getPathFromView ( view ) #NEWLINE# if ( not file_path ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# file_name = Tools . getFileNameFromPath ( file_path , ext = False ) #NEWLINE# tmp_path = Paths . getTempPath ( ) #NEWLINE# tmp_all = os . path . join ( tmp_path , '*' ) #NEWLINE# tmp_all = glob . glob ( tmp_all ) #NEWLINE# for content in tmp_all : #NEWLINE# #INDENT# if ( file_name in content ) : #NEWLINE# #INDENT# tmp_path = os . path . join ( tmp_path , content ) #NEWLINE# rmtree ( tmp_path , ignore_errors = False ) #NEWLINE# Preferences ( ) . set ( 'builded_sketch' , False ) #NEWLINE# #UNINDENT# #UNINDENT# Menu ( ) . createEnvironmentMenu ( empty = True )