qupath / qupath-extension-wsinfer

QuPath extension to work with WSInfer - https://wsinfer.readthedocs.io/
Apache License 2.0
22 stars 7 forks source link

Update message label on object selection #18

Closed petebankhead closed 1 year ago

petebankhead commented 1 year ago

Not the prettiest code... but this tries to maintain counts of selected detections and annotations, and use these (alongside other bindings) to show sensible messages to the user.

If things are in an invalid state, then the run button will be disabled and a warning should be shown (by default in red). Otherwise, the run button will be enabled and a count of the relevant selected objects shown.

This also solves the issue of empty space appearing in the dialog if there is no warning to display.

alanocallaghan commented 1 year ago

Not sure entirely why, but the change from warning to regular message isn't handled properly. I think the listener here isn't firing for some reason, so the warning/message config only happens on init.

For me, the following workflows should have the same outcome, but they currently differ

  1. open qupath + open extension
  2. open image
  3. add annotation
  4. select model

Text is still error/red even though all is well

  1. qupath
  2. extension
  3. image
  4. model
  5. annotation

error/red

  1. qupath
  2. image
  3. annotation
  4. extension
  5. model

grey text

petebankhead commented 1 year ago

Ah thanks, I saw that once but couldn't replicate it so figured it was accidentally fixed.

Seems to be a garbage collection thing related to the listener you mention. It was working for me, but breaks if I run a script with System.gc().

Added a commit now that I think fixes it.