Fix deletion of image caused selection of the first image (#742)

Also removed the call to self.import_dir_images method that reloaded all
of the images in directory.
This commit is contained in:
Denis 2021-04-28 17:22:14 +03:00 committed by GitHub
parent 6b5c3c634b
commit 4bf5c4528c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1428,12 +1428,15 @@ class MainWindow(QMainWindow, WindowMixin):
def delete_image(self): def delete_image(self):
delete_path = self.file_path delete_path = self.file_path
if delete_path is not None: if delete_path is not None:
self.open_next_image() del self.m_img_list[self.cur_img_idx]
self.cur_img_idx -= 1 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.img_count -= 1
self.open_next_image()
if os.path.exists(delete_path): if os.path.exists(delete_path):
os.remove(delete_path) os.remove(delete_path)
self.import_dir_images(self.last_open_dir)
def reset_all(self): def reset_all(self):
self.settings.reset() self.settings.reset()