rose icon indicating copy to clipboard operation
rose copied to clipboard

Rose Edit: Format Widget

Open wxtim opened this issue 3 months ago • 0 comments

  1. This widget is not (as far as I can see) well documented, or tested.
  2. My best efforts at testing it, suggest that it's broken.

Replicate

# rose-app.conf
[env]
biscuit="Rich Tea"
# meta/rose-meta.conf
[env=biscuit]
values="Rich Tea","Nice","Malted Milk"
widget[rose-config-edit]=rose.config_editor.valuewidget.format.FormatsChooserValueWidget

> rose edit -C ./meta/
tim.pillinger@cazldf000086:/home/users/tim.pillinger/cylc-src/rose-apps/meta> [FAIL] Could not import widget: free variable 'meta' referenced before assignment in enclosing scope

## Possible fix

```diff
+++ b/metomi/rose/config_editor/valuewidget/format.py
@@ -40,8 +40,10 @@ class FormatsChooserValueWidget(Gtk.Box):
         self.set_value = set_value
         self.hook = hook
 
+        meta = self.metadata
+
         if "values_getter" in self.metadata:
-            meta = self.metadata
             self.values_getter = meta["values_getter"]
         else:
             self.values_getter = lambda: meta.get("values", [])

wxtim avatar Oct 14 '25 14:10 wxtim