Skip to content

Conversation

Rylern
Copy link
Contributor

@Rylern Rylern commented May 1, 2025

This PR aims at fixing this issue.

It is done by adding a button to keep the description pane of an image entry open:
image

If this button is on, then the description pane will stay visible, even if the selected image entry doesn't have any description.
A preference was added to save the button status when QuPath restarts.

An edit button was also added to easily edit the description. It is only shown when an image is currently selected.

The caret in the description pane is not visible anymore.

@Rylern Rylern requested a review from petebankhead May 1, 2025 12:28
@petebankhead
Copy link
Member

The PR looks good. Two very minor things:

  • The height of the 'Description' title is larger than the height of comparable titles in other panes (e.g. 'Associated images' under the 'Image' tab, or 'Annotation list' and 'Class list' under the 'Annotations' tab). I think these should be consistent - and preferably the smaller height.
  • When pressing the 'Edit' button, I think that the TextArea in the dialog should automatically receive the focus and/or also contain some prompt text, e.g.
	static boolean showDescriptionEditor(ProjectImageEntry<?> entry) {
		TextArea editor = new TextArea();
		editor.setWrapText(true);
		editor.setPromptText("Enter description for " + entry.getImageName());
		editor.setText(entry.getDescription());
		Dialog<ButtonType> dialog = new Dialog<>();
		dialog.getDialogPane().getButtonTypes().setAll(ButtonType.OK, ButtonType.CANCEL);
		dialog.setTitle("Image description");
		dialog.getDialogPane().setHeaderText(entry.getImageName());
		dialog.getDialogPane().setContent(editor);
		Platform.runLater(editor::requestFocus);
		Optional<ButtonType> result = dialog.showAndWait();
		if (result.isPresent() && result.get() == ButtonType.OK && editor.getText() != null) {	
			var text = editor.getText();
			entry.setDescription(text.isEmpty() ? null : text);
			return true;
		}
		return false;
	}

I suggest and/or because receiving the focus means the prompt text isn't visible anyway... so I don't have a strong opinion on which is preferable.

@Rylern
Copy link
Contributor Author

Rylern commented May 1, 2025

Both comments were addressed.

@petebankhead petebankhead merged commit b67a7c1 into qupath:main May 1, 2025
3 checks passed
@Rylern Rylern deleted the dock-description-pane branch May 1, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants