Skip to content

Comments

Split view user label#639

Merged
knabar merged 8 commits intoome:masterfrom
Rdornier:split-view-user-label
Feb 6, 2026
Merged

Split view user label#639
knabar merged 8 commits intoome:masterfrom
Rdornier:split-view-user-label

Conversation

@Rdornier
Copy link
Contributor

Hello @knabar, @will-moore,

Small contribution on Split_View_Figure plugin, asked by one of our users. I added support to enter a custom label, which enable users to also not put any labels.

image

The corresponding python script will be updated accordingly in another PR

@Rdornier
Copy link
Contributor Author

Linked PR ome/omero-scripts#229

Copy link
Member

@will-moore will-moore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes work fine with the updated script (and will also work without the updated script if you don't choose the Custom option). 👍

@Rdornier
Copy link
Contributor Author

Thanks👍
I'm also on the way to add a different label for each image. Currently, the same custom label is applied to all images. I should finish the fix this week

@Rdornier
Copy link
Contributor Author

Should be fine now

@sbesson sbesson requested a review from will-moore November 25, 2025 14:28
@will-moore
Copy link
Member

The layout gets a bit messy if the images have long names:

Screenshot 2025-11-26 at 15 07 16

Either need to restrict the width of that chooser, or put it on it's own row.

@Rdornier
Copy link
Contributor Author

Thanks @will-moore for the review.
I've put the custom label in a new row, to not interfere with the above table.

Copy link
Member

@will-moore will-moore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine and layout is fixed.

Good to merge, but need to be sure we don't release this before the corresponding script is released, as you get an error if you try to export the figure without the updated script.

@sbesson
Copy link
Member

sbesson commented Dec 7, 2025

need to be sure we don't release this before the corresponding script is released, as you get an error if you try to export the figure without the updated script.

Is there a mechanism to be defensive about this? Specifically, in a scenario where the new script parameters is not available server side, could the functionality be disabled in the UI or could the script execution fallback to supported parameters?

@will-moore
Copy link
Member

@sbesson I don't know of a way to achieve that with regular scripts. I've just added functionality into OMERO.figure for the app to check the version of the script, but there's nothing like that for webclient.

The error is Invalid parameters: VALUE LIST for "Image_Labels": Custom not in ['Image Name', 'Datasets', 'Tags']. It's pretty hard for the webclient to handle that and to pass different arguments to the script or give the user a message that they must update the script etc.

However, you only get this error IF you choose the new 'Custom' option, so I think that this is quite limited exposure to this issue for most users. If users continue to export as before then this PR will continue to work with the old script (just tested):

Screenshot 2025-12-08 at 09 26 39

@sbesson
Copy link
Member

sbesson commented Dec 8, 2025

Since

scriptService = conn.getScriptService()
scriptId = scriptService.getScriptID(scriptPath)
if scriptId < 0:
raise AttributeError("No script found for path '%s'" % scriptPath)
is already retrieving the script ID to store it in the context, I would think the script parameters retrievable via IScript.getParams could give the information either using the script version or by checking the input parameters?

@will-moore
Copy link
Member

Ah, yes - that's a good idea to handle it in the script UI rather than in the run_script() handling...

@Rdornier This works for me to only show "Custom" options if they're supported in the script...

--- a/omeroweb/webclient/templates/webclient/scripts/split_view_figure.html
+++ b/omeroweb/webclient/templates/webclient/scripts/split_view_figure.html
@@ -199,7 +199,9 @@
                     <option value="Image Name"  selected="True"  >Image Name</option>
                     <option value="Datasets"  >Datasets</option>
                     <option value="Tags"  >Tags</option>
-                    <option value="Custom"  >Custom</option>
+                    {% if custom_labels_supported %}
+                      <option value="Custom"  >Custom</option>
+                    {% endif %}
                 </select>
             </td>
         {% for c in channels %}
@@ -225,6 +227,7 @@
                 </table>
             </td>
         </tr>
+        {% if custom_labels_supported %}
         <tr>
             <td>
                 <div title="Custom label" class="customLabelInput" style="display:none">
@@ -233,6 +236,8 @@
                 </div>
             </td>
         </tr>
+        {% endif %}
+        custom_labels_supported {{ custom_labels_supported }}
     </table>
     {% endblock %}
 


diff --git a/omeroweb/webclient/views.py b/omeroweb/webclient/views.py
index 3b2d9fb78..78a876da7 100755
--- a/omeroweb/webclient/views.py
+++ b/omeroweb/webclient/views.py
@@ -4410,6 +4410,11 @@ def figure_script(request, scriptName, conn=None, **kwargs):
     if scriptId < 0:
         raise AttributeError("No script found for path '%s'" % scriptPath)
 
+    if scriptName == "SplitView":
+        # Check we have script that supports custom labels
+        params = scriptService.getParams(scriptId)
+        context["custom_labels_supported"] = "All_labels" in params.inputs
+
     context["template"] = template
     context["scriptId"] = scriptId

@Rdornier
Copy link
Contributor Author

@will-moore Thanks for the code changes. It should check the script now

<input type="text" name="All_labels" value="" />
</div>
{% endif %}
custom_labels_supported {{ custom_labels_supported }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that line was just for debugging in my example - can be removed

@knabar knabar added this to the 5.31.0 milestone Feb 2, 2026
@knabar knabar merged commit c29dc79 into ome:master Feb 6, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants