labelImg icon indicating copy to clipboard operation
labelImg copied to clipboard

Deleting an image resets the file list without going to next image [suggested fix included]

Open CrucialDrew opened this issue 2 years ago • 5 comments

In the latest version, when I delete an image, it resets my selection back to the first image.

This change seems to work:

def delete_image(self):

    delete_path = self.file_path

    if delete_path is not None:

        idx = self.cur_img_idx

        if os.path.exists(delete_path):

            os.remove(delete_path)

        self.import_dir_images(self.last_open_dir)

        self.cur_img_idx = idx

        self.cur_img_idx -= 1

        self.open_next_image()

CrucialDrew avatar Nov 24 '21 19:11 CrucialDrew

Many tanks for your time, the current behavior is really annoying.

levipereira avatar Nov 25 '21 03:11 levipereira

def delete_image(self):

delete_path = self.file_path

if delete_path is not None:

    idx = self.cur_img_idx

    if os.path.exists(delete_path):

        os.remove(delete_path)

    self.import_dir_images(self.last_open_dir)

    self.cur_img_idx = idx

    self.cur_img_idx -= 1

    self.open_next_image()

Apidwalinz avatar Nov 26 '21 04:11 Apidwalinz

Observed behavior

When deleting an image the selection in the image list jumps back to the first image.

Expected behavior

When deleting an image the selection in the image list should remain on the same position.

Steps to reproduce

  1. Load a directory containing some images, e.g. 10.
  2. Navigate to the fourth image, i.e. by pressing 'd' shortcut four times.
  3. Delete the current image, i.e. by pressing CTRL+SHIFT+d.
  4. Observe that the first image is selected, and not the expected fourth image.

nine avatar Mar 27 '22 13:03 nine

@levipereira, @CrucialDrew please check the bugfix introduced with #861 and add the results here - thanks!

nine avatar Mar 28 '22 18:03 nine

Is this repo still under maintenance?

khewdev avatar Feb 22 '23 10:02 khewdev