@@ -412,20 +412,13 @@ def close_block(self):
412412 self .block_closing = True
413413
414414 def write (self ):
415- pattern = self .pattern
416- f = self .f
417- settings = self .settings
418-
419- if settings is None :
420- return
421-
422415 # DOCUMENT STATISTICS
423416 self .set_document_statistics ()
424417
425418 self .open_pattern ()
426419 if self .metadata_entry is not None :
427- for i , key in enumerate (pattern .extras ):
428- value = pattern .extras [key ]
420+ for i , key in enumerate (self . pattern .extras ):
421+ value = self . pattern .extras [key ]
429422 self .format_dictionary .update ({
430423 "metadata_index" : i ,
431424 "metadata_key" : str (key ),
@@ -436,7 +429,7 @@ def write(self):
436429 )
437430
438431 if self .thread_entry is not None :
439- for i , thread in enumerate (pattern .threadlist ):
432+ for i , thread in enumerate (self . pattern .threadlist ):
440433 self .format_dictionary .update ({
441434 "thread_index" : i ,
442435 "thread_color" : thread .hex_color (),
@@ -453,7 +446,7 @@ def write(self):
453446 write_string_utf8 (
454447 self .f , self .thread_entry .format_map (self .format_dictionary )
455448 )
456- for self .command_index in range (0 , len (pattern .stitches )):
449+ for self .command_index in range (0 , len (self . pattern .stitches )):
457450 self .update_command ()
458451 write_segment = self .get_write_segment (self .cmd )
459452
@@ -462,7 +455,7 @@ def write(self):
462455 if isinstance (write_segment , dict ):
463456 key , default = write_segment [None ]
464457 key = key .format_map (self .format_dictionary )
465- write_segment = write_segment .get (key ,default )
458+ write_segment = write_segment .get (key , default )
466459 self .update_positions (self .x , self .y , self .cmd )
467460 if self .cmd == SEQUIN_MODE :
468461 self .open_document ()
0 commit comments