@@ -374,7 +374,7 @@ def __init__(self, defaultFilename=None, defaultPrefdefClassFile=None, defaultSa
374374 self .paintLabelsOption = QAction ("Paint Labels" , self )
375375 self .paintLabelsOption .setShortcut ("Ctrl+Shift+P" )
376376 self .paintLabelsOption .setCheckable (True )
377- self .paintLabelsOption .setChecked (False )
377+ self .paintLabelsOption .setChecked (settings . get ( SETTING_PAINT_LABEL , False ) )
378378 self .paintLabelsOption .triggered .connect (self .togglePaintLabelsOption )
379379
380380 addActions (self .menus .file ,
@@ -482,23 +482,23 @@ def xbool(x):
482482
483483 ## Support Functions ##
484484 def set_format (self , save_format ):
485- if save_format == 'PascalVOC' :
486- self .actions .save_format .setText ("PascalVOC" )
485+ if save_format == FORMAT_PASCALVOC :
486+ self .actions .save_format .setText (FORMAT_PASCALVOC )
487487 self .actions .save_format .setIcon (newIcon ("format_voc" ))
488488 self .usingPascalVocFormat = True
489489 self .usingYoloFormat = False
490490 LabelFile .suffix = XML_EXT
491491
492- elif save_format == 'YOLO' :
493- self .actions .save_format .setText ("YOLO" )
492+ elif save_format == FORMAT_YOLO :
493+ self .actions .save_format .setText (FORMAT_YOLO )
494494 self .actions .save_format .setIcon (newIcon ("format_yolo" ))
495495 self .usingPascalVocFormat = False
496496 self .usingYoloFormat = True
497497 LabelFile .suffix = TXT_EXT
498498
499499 def change_format (self ):
500- if self .usingPascalVocFormat : self .set_format ("YOLO" )
501- elif self .usingYoloFormat : self .set_format ("PascalVOC" )
500+ if self .usingPascalVocFormat : self .set_format (FORMAT_YOLO )
501+ elif self .usingYoloFormat : self .set_format (FORMAT_PASCALVOC )
502502
503503 def noShapes (self ):
504504 return not self .itemsToShapes
@@ -778,7 +778,7 @@ def format_shape(s):
778778 # Can add differrent annotation formats here
779779 try :
780780 if self .usingPascalVocFormat is True :
781- if str (annotationFilePath [- 4 :]) != ".xml" :
781+ if ustr (annotationFilePath [- 4 :]) != ".xml" :
782782 annotationFilePath += XML_EXT
783783 print ('Img: ' + self .filePath + ' -> Its xml: ' + annotationFilePath )
784784 self .labelFile .savePascalVocFormat (annotationFilePath , shapes , self .filePath , self .imageData ,
@@ -951,7 +951,7 @@ def loadFile(self, filePath=None):
951951 filePath = self .settings .get (SETTING_FILENAME )
952952
953953 # Make sure that filePath is a regular python string, rather than QString
954- filePath = str (filePath )
954+ filePath = ustr (filePath )
955955
956956 unicodeFilePath = ustr (filePath )
957957 # Tzutalin 20160906 : Add file list and dock to move faster
@@ -1098,6 +1098,7 @@ def closeEvent(self, event):
10981098
10991099 settings [SETTING_AUTO_SAVE ] = self .autoSaving .isChecked ()
11001100 settings [SETTING_SINGLE_CLASS ] = self .singleClassMode .isChecked ()
1101+ settings [SETTING_PAINT_LABEL ] = self .paintLabelsOption .isChecked ()
11011102 settings .save ()
11021103 ## User Dialogs ##
11031104
@@ -1289,7 +1290,7 @@ def saveFileDialog(self):
12891290 dlg .selectFile (filenameWithoutExtension )
12901291 dlg .setOption (QFileDialog .DontUseNativeDialog , False )
12911292 if dlg .exec_ ():
1292- fullFilePath = dlg .selectedFiles ()[0 ]
1293+ fullFilePath = ustr ( dlg .selectedFiles ()[0 ])
12931294 return os .path .splitext (fullFilePath )[0 ] # Return file path without the extension.
12941295 return ''
12951296
@@ -1387,7 +1388,7 @@ def loadPascalXMLByFilename(self, xmlPath):
13871388 if os .path .isfile (xmlPath ) is False :
13881389 return
13891390
1390- self .set_format ("PascalVOC" )
1391+ self .set_format (FORMAT_PASCALVOC )
13911392
13921393 tVocParseReader = PascalVocReader (xmlPath )
13931394 shapes = tVocParseReader .getShapes ()
@@ -1400,7 +1401,7 @@ def loadYOLOTXTByFilename(self, txtPath):
14001401 if os .path .isfile (txtPath ) is False :
14011402 return
14021403
1403- self .set_format ("YOLO" )
1404+ self .set_format (FORMAT_YOLO )
14041405 tYoloParseReader = YoloReader (txtPath , self .image )
14051406 shapes = tYoloParseReader .getShapes ()
14061407 print (shapes )
0 commit comments