8000 Fix deletion of image caused selection of the first image (#742) · HumanSignal/labelImg@4bf5c45 · GitHub
[go: up one dir, main page]

Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Fix deletion of image caused selection of the first image (#742)
Browse files Browse the repository at this point in the history
Also removed the call to self.import_dir_images method that reloaded all
of the images in directory.
  • Loading branch information
Ledorub authored Apr 28, 2021
1 parent 6b5c3c6 commit 4bf5c45
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions labelImg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1428,12 +1428,15 @@ def close_file(self, _value=False):
def delete_image(self):
delete_path = self.file_path
if delete_path is not None:
self.open_next_image()
self.cur_img_idx -= 1
del self.m_img_list[self.cur_img_idx]
self.file_list_widget.takeItem(self.cur_img_idx)

self.cur_img_idx -= 1 # self.open_next_img will increment idx.
self.img_count -= 1
self.open_next_image()

if os.path.exists(delete_path):
os.remove(delete_path)
self.import_dir_images(self.last_open_dir)

def reset_all(self):
self.settings.reset()
Expand Down

0 comments on commit 4bf5c45

Please sign in to comment.
0