PhonologicalCorpusTools / SLPAA

5 stars 0 forks source link

Deleting signs #245

Closed brdiep113 closed 9 months ago

brdiep113 commented 9 months ago

Issue #78 - Deleting signs now highlights correctly according to expected behaviour

Case 1: There is more than 1 sign in the list, sign to be deleted is not the first in the corpus Before deletion: image After deletion: (preceding sign is now highlighted) image

Case 2: There is more than 1 sign in the list, sign to be deleted is the first in the corpus Before deletion: image After deletion: (following sign is now highlighted) image

Case 3: There is only 1 sign left in the corpus that is to be deleted. Before deletion: image After deletion: (no signs are left in the corpus) image

brdiep113 commented 9 months ago

Fixed! Last sign before deletion: image

After deleting: image

brdiep113 commented 9 months ago

From the perspective of the GUI, everything looks good. That said, I'm still getting a ValueError (see terminal output below). It appears to be due to Corpus.get_previous_sign() returning None when there is only one gloss in the list.

Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2022.3.1\plugins\python-ce\helpers\pydev\pydevd.py", line 2195, in <module>
    main()
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2022.3.1\plugins\python-ce\helpers\pydev\pydevd.py", line 2177, in main
    globals = debugger.run(setup['file'], None, None, is_module)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2022.3.1\plugins\python-ce\helpers\pydev\pydevd.py", line 1489, in run
    return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2022.3.1\plugins\python-ce\helpers\pydev\pydevd.py", line 1496, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2022.3.1\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:\Users\kvesik\Documents\School\RA-KCH\GitHub\SLPAA\src\main\python\main.py", line 8, in <module>
    exit_code = appctxt.run()
                ^^^^^^^^^^^^^
  File "C:\Users\kvesik\Documents\School\RA-KCH\GitHub\SLPAA\src\main\python\gui\app.py", line 15, in run
    return self.app.exec_()
           ^^^^^^^^^^^^^^^^
  File "C:\Users\kvesik\Documents\School\RA-KCH\GitHub\SLPAA\src\main\python\gui\main_window.py", line 946, in on_action_delete_sign
    self.select_sign([previous])
  File "C:\Users\kvesik\Documents\School\RA-KCH\GitHub\SLPAA\src\main\python\gui\main_window.py", line 956, in select_sign
    indices.append(list(self.corpus.signs).index(sign))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: None is not in list

My bad I think I forgot to push the last commit I made to fix that. I don't get any ValueErrors in my terminal now when I delete the last sign.

kvesik commented 9 months ago

Thanks! Looks good with additional commit.