@@ -370,13 +370,20 @@ def __init__(self, defaultFilename=None, defaultPrefdefClassFile=None, defaultSa
370
370
self .singleClassMode .setCheckable (True )
371
371
self .singleClassMode .setChecked (settings .get (SETTING_SINGLE_CLASS , False ))
372
372
self .lastLabel = None
373
+ # Add option to enable/disable labels being painted at the top of bounding boxes
374
+ self .paintLabelsOption = QAction ("Paint Labels" , self )
375
+ self .paintLabelsOption .setShortcut ("Ctrl+Shift+P" )
376
+ self .paintLabelsOption .setCheckable (True )
377
+ self .paintLabelsOption .setChecked (False )
378
+ self .paintLabelsOption .triggered .connect (self .togglePaintLabelsOption )
373
379
374
380
addActions (self .menus .file ,
375
381
(open , opendir , changeSavedir , openAnnotation , self .menus .recentFiles , save , save_format , saveAs , close , resetAll , quit ))
376
382
addActions (self .menus .help , (help , showInfo ))
377
383
addActions (self .menus .view , (
378
384
self .autoSaving ,
379
385
self .singleClassMode ,
386
+ self .paintLabelsOption ,
380
387
labels , advancedMode , None ,
381
388
hideAll , showAll , None ,
382
389
zoomIn , zoomOut , zoomOrg , None ,
@@ -709,6 +716,7 @@ def shapeSelectionChanged(self, selected=False):
709
716
self .actions .shapeFillColor .setEnabled (selected )
710
717
711
718
def addLabel (self , shape ):
719
+ shape .paintLabel = self .paintLabelsOption .isChecked ()
712
720
item = HashableQListWidgetItem (shape .label )
713
721
item .setFlags (item .flags () | Qt .ItemIsUserCheckable )
714
722
item .setCheckState (Qt .Checked )
@@ -1399,7 +1407,10 @@ def loadYOLOTXTByFilename(self, txtPath):
1399
1407
self .loadLabels (shapes )
1400
1408
self .canvas .verified = tYoloParseReader .verified
1401
1409
1402
-
1410
+ def togglePaintLabelsOption (self ):
1411
+ paintLabelsOptionChecked = self .paintLabelsOption .isChecked ()
1412
+ for shape in self .canvas .shapes :
1413
+ shape .paintLabel = paintLabelsOptionChecked
1403
1414
1404
1415
def inverted (color ):
1405
1416
return QColor (* [255 - v for v in color .getRgb ()])
0 commit comments