Skip to content

Commit

Permalink
skip delete file prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkarelov authored Jan 6, 2025
1 parent cbbd0e8 commit 18e520a
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions labelme/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2039,23 +2039,25 @@ def getLabelFile(self):
return label_file

def deleteFile(self):
mb = QtWidgets.QMessageBox
msg = self.tr(
"You are about to permanently delete this label file, " "proceed anyway?"
)
answer = mb.warning(self, self.tr("Attention"), msg, mb.Yes | mb.No)
if answer != mb.Yes:
return

label_file = self.getLabelFile()
if osp.exists(label_file):
os.remove(label_file)
logger.info("Label file is removed: {}".format(label_file))

item = self.fileListWidget.currentItem()
item.setCheckState(Qt.Unchecked)

self.resetState()
if False: # TODO: refactor and move to config option
mb = QtWidgets.QMessageBox
msg = self.tr(
"You are about to permanently delete this label file, " "proceed anyway?"
)
answer = mb.warning(self, self.tr("Attention"), msg, mb.Yes | mb.No)
if answer != mb.Yes:
return

else:
label_file = self.getLabelFile()
if osp.exists(label_file):
os.remove(label_file)
logger.info("Label file is removed: {}".format(label_file))

item = self.fileListWidget.currentItem()
item.setCheckState(Qt.Unchecked)

self.resetState()

# Message Dialogs. #
def hasLabels(self):
Expand Down

0 comments on commit 18e520a

Please sign in to comment.