bugfix, toggle button

This commit is contained in:
Wang Yinghao 2018-03-01 23:05:57 -06:00
parent 201a54d0f9
commit 180d25a2d7
4 changed files with 7 additions and 3 deletions

BIN
icons/format_voc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 786 B

BIN
icons/format_yolo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 675 B

View File

@ -237,7 +237,7 @@ class MainWindow(QMainWindow, WindowMixin):
'Ctrl+S', 'save', u'Save labels to file', enabled=False) 'Ctrl+S', 'save', u'Save labels to file', enabled=False)
save_format = action('&Format', self.change_format, save_format = action('&Format', self.change_format,
'Ctrl+', 'format', u'Change save format', enabled=True) 'Ctrl+', 'format_voc', u'Change save format', enabled=True)
saveAs = action('&Save As', self.saveFileAs, saveAs = action('&Save As', self.saveFileAs,
'Ctrl+Shift+S', 'save-as', u'Save labels to a different file', enabled=False) 'Ctrl+Shift+S', 'save-as', u'Save labels to a different file', enabled=False)
@ -475,17 +475,19 @@ class MainWindow(QMainWindow, WindowMixin):
def set_format(self, save_format): def set_format(self, save_format):
if save_format == 'PascalVOC': if save_format == 'PascalVOC':
self.actions.save_format.setText("PascalVOC") self.actions.save_format.setText("PascalVOC")
self.actions.save_format.setIcon(newIcon("format_voc"))
self.usingPascalVocFormat = True self.usingPascalVocFormat = True
self.usingYoloFormat = False self.usingYoloFormat = False
elif save_format == 'YOLO': elif save_format == 'YOLO':
if self.usingYoloFormat: self.actions.save_format.setText("YOLO") self.actions.save_format.setText("YOLO")
self.actions.save_format.setIcon(newIcon("format_yolo"))
self.usingPascalVocFormat = False self.usingPascalVocFormat = False
self.usingYoloFormat = True self.usingYoloFormat = True
def change_format(self): def change_format(self):
if self.usingPascalVocFormat: self.set_format("YOLO") if self.usingPascalVocFormat: self.set_format("YOLO")
if self.usingYoloFormat: self.set_format("PascalVOC") elif self.usingYoloFormat: self.set_format("PascalVOC")
def noShapes(self): def noShapes(self):
return not self.itemsToShapes return not self.itemsToShapes

View File

@ -18,6 +18,8 @@
<file alias="edit">icons/edit.png</file> <file alias="edit">icons/edit.png</file>
<file alias="open">icons/open.png</file> <file alias="open">icons/open.png</file>
<file alias="save">icons/save.png</file> <file alias="save">icons/save.png</file>
<file alias="format_voc">icons/format_voc.png</file>
<file alias="format_yolo">icons/format_yolo.png</file>
<file alias="save-as">icons/save-as.png</file> <file alias="save-as">icons/save-as.png</file>
<file alias="color">icons/color.png</file> <file alias="color">icons/color.png</file>
<file alias="color_line">icons/color_line.png</file> <file alias="color_line">icons/color_line.png</file>