haybale-haystack 0.3.4__tar.gz → 0.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/.gitignore +2 -0
  2. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/PKG-INFO +4 -4
  3. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/README.md +2 -0
  4. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/OVERVIEW.md +2 -0
  5. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/QUICKREF.md +3 -1
  6. haybale_haystack-0.4.1/haybale_haystack/docs/haybale-haystack.panel.HaystackSettingsPanel.md +14 -0
  7. haybale_haystack-0.4.1/haybale_haystack/docs/haybale-haystack.setting.FlowMeterSettings.md +9 -0
  8. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/editors/haystack_editor.py +65 -0
  9. haybale_haystack-0.4.1/haybale_haystack/flow_meter.py +146 -0
  10. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/haybale.toml +1 -1
  11. haybale_haystack-0.4.1/haybale_haystack/panels/haystack_settings_panel.py +32 -0
  12. haybale_haystack-0.4.1/haybale_haystack/settings/flow_meter_settings.py +19 -0
  13. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/pyproject.toml +4 -4
  14. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/__init__.py +0 -0
  15. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/docs/haybale-haystack.editor.HaystackEditor.md +0 -0
  16. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/docs/haybale-haystack.farmhand.close_graph.md +0 -0
  17. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/docs/haybale-haystack.farmhand.compile_graph.md +0 -0
  18. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/docs/haybale-haystack.farmhand.create_graph.md +0 -0
  19. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/docs/haybale-haystack.farmhand.list_graphs.md +0 -0
  20. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/docs/haybale-haystack.farmhand.open_graph.md +0 -0
  21. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/docs/haybale-haystack.farmhand.rename_graph.md +0 -0
  22. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/docs/haybale-haystack.farmhand.save_graph.md +0 -0
  23. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/docs/haybale-haystack.farmhand.start_graph.md +0 -0
  24. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/docs/haybale-haystack.farmhand.stop_graph.md +0 -0
  25. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/docs/haybale-haystack.panel.EditMacroMenuPanel.md +0 -0
  26. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/docs/haybale-haystack.panel.GraphRunSettingsPanel.md +0 -0
  27. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/docs/haybale-haystack.panel.OpenInHaystackMenuPanel.md +0 -0
  28. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/docs/haybale-haystack.panel.UpdateMacroMenuPanel.md +0 -0
  29. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/docs/haybale-haystack.setting.HaystackSettings.md +0 -0
  30. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/docs/haybale-haystack.state.HaystackState.md +0 -0
  31. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/editors/__init__.py +0 -0
  32. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/farmhands/__init__.py +0 -0
  33. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/farmhands/graph_tools.py +0 -0
  34. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/graph_entry.py +0 -0
  35. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/panels/__init__.py +0 -0
  36. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/panels/file_browser/menu/file.py +0 -0
  37. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/panels/graph/menu/macro.py +0 -0
  38. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/panels/properties/introspect/graph_run_settings_panel.py +0 -0
  39. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/persistence.py +0 -0
  40. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/settings/__init__.py +0 -0
  41. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/settings/graph_run_settings.py +0 -0
  42. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/settings/haystack_settings.py +0 -0
  43. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/signals.py +0 -0
  44. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/state/__init__.py +0 -0
  45. {haybale_haystack-0.3.4 → haybale_haystack-0.4.1}/haybale_haystack/state/haystack_state.py +0 -0
@@ -223,5 +223,7 @@ packages/haywire-core/src/haywire/_baked_docs/*
223
223
  # Local symlinks to external dev projects (machine-specific paths)
224
224
  barn/haybale-visiongraph
225
225
  barn/haybale-spandrel
226
+ barn/haybale-stream
227
+ barn/haybale-comfyui
226
228
 
227
229
  assets/*
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: haybale-haystack
3
- Version: 0.3.4
3
+ Version: 0.4.1
4
4
  Summary: File-centric multi-graph manager
5
5
  License: MIT
6
6
  Keywords: graph-management
7
7
  Requires-Python: >=3.12
8
- Requires-Dist: haybale-graph-editor>=0.3.4
9
- Requires-Dist: haybale-studio>=0.3.4
10
- Requires-Dist: haywire-core>=0.3.4
8
+ Requires-Dist: haybale-graph-editor>=0.4.1
9
+ Requires-Dist: haybale-studio>=0.4.1
10
+ Requires-Dist: haywire-core>=0.4.1
11
11
  Requires-Dist: nicegui>=3.18.0
12
12
  Requires-Dist: toml>=0.10.2
@@ -7,6 +7,7 @@
7
7
  File-centric multi-graph manager
8
8
 
9
9
  ## Settings
10
+ - **Flow meters** — Meters on the rows of running graphs
10
11
  - **Haystack** — Per-workspace settings for haystack scalars.
11
12
 
12
13
  ## Farmhands
@@ -26,6 +27,7 @@ File-centric multi-graph manager
26
27
  ## Panels
27
28
  - **Edit Macro** — Open the document behind a macro placement, in its own editor tab.
28
29
  - **Graph Settings** — Renders the GraphRunSettings for the currently active graph.
30
+ - **Haystack** — Settings of the haystack library.
29
31
  - **Load into Haystack** — Load a .haywire graph file into the Haystack (does not open an editor tab).
30
32
  - **Update Macro** — Send a modified instance's changes back to the macro it came from.
31
33
 
@@ -3,6 +3,7 @@
3
3
  File-centric multi-graph manager
4
4
 
5
5
  ## Settings
6
+ - **Flow meters** — Meters on the rows of running graphs
6
7
  - **Haystack** — Per-workspace settings for haystack scalars.
7
8
 
8
9
  ## Farmhands
@@ -22,6 +23,7 @@ File-centric multi-graph manager
22
23
  ## Panels
23
24
  - **Edit Macro** — Open the document behind a macro placement, in its own editor tab.
24
25
  - **Graph Settings** — Renders the GraphRunSettings for the currently active graph.
26
+ - **Haystack** — Settings of the haystack library.
25
27
  - **Load into Haystack** — Load a .haywire graph file into the Haystack (does not open an editor tab).
26
28
  - **Update Macro** — Send a modified instance's changes back to the macro it came from.
27
29
 
@@ -1,6 +1,7 @@
1
- # haybale-haystack — component index (v0.3.4)
1
+ # haybale-haystack — component index (v0.4.1)
2
2
 
3
3
  ## setting
4
+ - `haybale-haystack:setting:FlowMeterSettings` — Flow meters — Meters on the rows of running graphs
4
5
  - `haybale-haystack:setting:HaystackSettings` — Haystack — Per-workspace settings for haystack scalars.
5
6
 
6
7
  ## farmhand
@@ -20,6 +21,7 @@
20
21
  ## panel
21
22
  - `haybale-haystack:panel:EditMacroMenuPanel` — Edit Macro — Open the document behind a macro placement, in its own editor tab.
22
23
  - `haybale-haystack:panel:GraphRunSettingsPanel` — Graph Settings — Renders the GraphRunSettings for the currently active graph.
24
+ - `haybale-haystack:panel:HaystackSettingsPanel` — Haystack — Settings of the haystack library.
23
25
  - `haybale-haystack:panel:OpenInHaystackMenuPanel` — Load into Haystack — Load a .haywire graph file into the Haystack (does not open an editor tab).
24
26
  - `haybale-haystack:panel:UpdateMacroMenuPanel` — Update Macro — Send a modified instance's changes back to the macro it came from.
25
27
 
@@ -0,0 +1,14 @@
1
+ # Haystack
2
+
3
+ `haybale-haystack:panel:HaystackSettingsPanel` · kind: panel
4
+
5
+ Settings of the haystack library.
6
+
7
+ ## Details
8
+
9
+ - **surface**: `barns`
10
+ - **order**: `20`
11
+
12
+ ## Notes
13
+
14
+ Settings of the haystack library; today whether running graphs show flow meters.
@@ -0,0 +1,9 @@
1
+ # Flow meters
2
+
3
+ `haybale-haystack:setting:FlowMeterSettings` · kind: setting
4
+
5
+ Meters on the rows of running graphs
6
+
7
+ ## Notes
8
+
9
+ Whether a running graph's row shows how well its flows keep up.
@@ -34,12 +34,18 @@ from haybale_graph_editor.state.graph_app_state import GraphAppState
34
34
  from haybale_graph_editor.editors.graph_editor import GraphEditor, definition_path
35
35
  from haybale_graph_editor.editors.graph_save_as import open_graph_save_as_dialog
36
36
 
37
+ from haywire.core.execution.flow_metrics import FlowMeterSampler
38
+
39
+ from haybale_haystack.flow_meter import FlowMeterView
37
40
  from haybale_haystack.signals import HaystackReloaded, HaystackTeardown
38
41
  from haybale_haystack.state.haystack_state import HaystackState
39
42
  from haybale_haystack.graph_entry import EntryKind, GraphEntry
40
43
 
41
44
  logger = logging.getLogger(__name__)
42
45
 
46
+ #: Seconds between samples of the running graphs for the flow meters.
47
+ METER_INTERVAL_S = 0.5
48
+
43
49
 
44
50
  def _refused(context: "SessionContext", required: AccessTier, action: str) -> bool:
45
51
  """Return whether the principal lacks ``required``, telling them ``"<action> needs <tier> access"``."""
@@ -79,6 +85,9 @@ class HaystackEditor(BaseEditor):
79
85
  self._list_container = None
80
86
  self._dismissed_notices: set[tuple[str, str]] = set()
81
87
  self._notice_popups: list[Popup] = []
88
+ self._meters: dict[str, FlowMeterView] = {}
89
+ self._samplers: dict[str, FlowMeterSampler] = {}
90
+ self._meter_timer: ui.timer | None = None
82
91
 
83
92
  # ------------------------------------------------------------------
84
93
  # Signal-bus subscriptions / draw
@@ -166,6 +175,9 @@ class HaystackEditor(BaseEditor):
166
175
  self._render_header(context)
167
176
  with ui.scroll_area().classes("flex-1 w-full"):
168
177
  self._list_container = ui.column().classes("w-full gap-0 p-1")
178
+ self._meter_timer = ui.timer(
179
+ METER_INTERVAL_S, lambda: self._sample_meters(context), active=False
180
+ )
169
181
  self._render_list(context)
170
182
 
171
183
  # ------------------------------------------------------------------
@@ -232,6 +244,7 @@ class HaystackEditor(BaseEditor):
232
244
  return
233
245
  self._list_container.clear()
234
246
  self._delete_notice_popups()
247
+ self._meters = {}
235
248
 
236
249
  app = context.app
237
250
  if app is None:
@@ -261,6 +274,10 @@ class HaystackEditor(BaseEditor):
261
274
  if context.can_edit():
262
275
  self._render_add_bar(context)
263
276
 
277
+ self._samplers = {eid: s for eid, s in self._samplers.items() if eid in self._meters}
278
+ if self._meter_timer is not None:
279
+ self._meter_timer.active = bool(self._meters)
280
+
264
281
  def _render_entry(self, entry: "GraphEntry", context: "SessionContext") -> None:
265
282
  is_active = entry.graph is context.data[EditState].active_graph
266
283
  can_edit = context.can_edit()
@@ -341,6 +358,16 @@ class HaystackEditor(BaseEditor):
341
358
  on_click=lambda eid=eid: self._on_entry_save(eid, context),
342
359
  )
343
360
 
361
+ # Flow meter — where the overflow menu is while the graph runs.
362
+ if is_executing and self._flow_meters_enabled():
363
+
364
+ def name_of(node_id: str, entry_: "GraphEntry" = entry) -> str:
365
+ return self._flow_name(entry_, node_id)
366
+
367
+ view = FlowMeterView(name_of)
368
+ view.build()
369
+ self._meters[eid] = view
370
+
344
371
  # Overflow menu — hidden during execution
345
372
  if can_edit and not is_executing:
346
373
  with (
@@ -373,6 +400,41 @@ class HaystackEditor(BaseEditor):
373
400
  on_click=lambda eid=eid: self._on_entry_delete(eid, context),
374
401
  )
375
402
 
403
+ # ------------------------------------------------------------------
404
+ # flow meters
405
+ # ------------------------------------------------------------------
406
+
407
+ def _flow_meters_enabled(self) -> bool:
408
+ """Return whether the library setting shows flow meters; on when the setting cannot be read."""
409
+ from haybale_haystack.settings.flow_meter_settings import FlowMeterSettings
410
+
411
+ try:
412
+ return bool(FlowMeterSettings().show)
413
+ except Exception:
414
+ return True
415
+
416
+ @staticmethod
417
+ def _flow_name(entry: "GraphEntry", node_id: str) -> str:
418
+ """Return the name of the EVENT node that roots a Flow, or its id when the node is gone."""
419
+ try:
420
+ wrapper = entry.graph.get_node_wrapper(node_id)
421
+ return wrapper.node.display_label if wrapper is not None else node_id
422
+ except Exception:
423
+ return node_id
424
+
425
+ def _sample_meters(self, context: "SessionContext") -> None:
426
+ """Read the running graphs' flow counters and update their meters; runs on the editor's timer."""
427
+ for eid, view in list(self._meters.items()):
428
+ entry = self._resolve_entry(eid, context)
429
+ interpreter = entry.interpreter if entry is not None else None
430
+ if interpreter is None or not interpreter.is_executing:
431
+ continue
432
+ try:
433
+ sampler = self._samplers.setdefault(eid, FlowMeterSampler())
434
+ view.update(sampler.update(interpreter.flow_metrics()))
435
+ except Exception:
436
+ logger.debug("Flow meter sample failed for %s", eid, exc_info=True)
437
+
376
438
  # ------------------------------------------------------------------
377
439
  # graph notices
378
440
  # ------------------------------------------------------------------
@@ -992,4 +1054,7 @@ class HaystackEditor(BaseEditor):
992
1054
 
993
1055
  def cleanup(self) -> None:
994
1056
  self._delete_notice_popups()
1057
+ self._meters = {}
1058
+ self._samplers = {}
1059
+ self._meter_timer = None
995
1060
  self._list_container = None
@@ -0,0 +1,146 @@
1
+ """The flow meter drawn on a running graph's haystack row.
2
+
3
+ ``FlowMeterView`` shows one bar for the worst Flow. A click opens a strip of one bar per Flow, grouped
4
+ by execution group, worst nearest the row's end. Everything the browser needs travels only when a bar
5
+ changes colour or step; the details of a Flow are written into its tooltip when the tooltip opens.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from collections.abc import Callable
11
+
12
+ from haywire.core.execution.flow_metrics import FlowReading, MeterReading, Severity
13
+ from nicegui import ui
14
+
15
+ #: Fill steps of a bar; a bar is redrawn only when its step or colour changes.
16
+ STEPS = 10
17
+
18
+ _COLOURS = {
19
+ Severity.OK: "var(--hw-success)",
20
+ Severity.WARN: "var(--hw-warning)",
21
+ Severity.ALERT: "var(--hw-danger)",
22
+ }
23
+
24
+ _BAR_STYLE = "width: 5px; height: 14px; flex: none; border-radius: 1px; overflow: hidden;"
25
+ _BAR_STYLE += " background: var(--hw-border); display: flex; align-items: flex-end;"
26
+
27
+
28
+ def fill_step(load: float) -> int:
29
+ """Return the number of filled steps, 0 to ``STEPS``, for a load from 0 to 1."""
30
+ return max(0, min(STEPS, round(load * STEPS)))
31
+
32
+
33
+ def bar_signature(flow: FlowReading) -> tuple[Severity, int]:
34
+ """Return what a bar shows; two readings with the same signature draw the same bar."""
35
+ return flow.severity, fill_step(max(flow.load, flow.group_load))
36
+
37
+
38
+ def strip_signature(reading: MeterReading) -> tuple:
39
+ """Return what the whole strip shows: its Flows in order, each with its group and bar."""
40
+ return tuple((f.flow_id, f.group_id, bar_signature(f)) for f in reading.flows)
41
+
42
+
43
+ def describe(flow: FlowReading, name: str) -> str:
44
+ """Return the tooltip text for ``flow``, which is shown as ``name``."""
45
+ mode = "drops by design" if flow.drop_mode else "blocks when full"
46
+ lines = [
47
+ f"{name} ({mode})",
48
+ f"load {flow.load:.0%}, runner {flow.group_load:.0%}",
49
+ f"{flow.frame_rate:.1f} frames/s",
50
+ ]
51
+ if flow.drop_mode:
52
+ lines.append(f"dropped {flow.drop_rate:.0%} of triggers ({flow.dropped_total} in total)")
53
+ else:
54
+ lines.append(f"queue {flow.queue_depth}/{flow.queue_max}")
55
+ lines.append(f"dropped {flow.dropped_total}" + (" (just now)" if flow.recently_dropped else ""))
56
+ return "\n".join(lines)
57
+
58
+
59
+ class FlowMeterView:
60
+ """The meter elements of one row; call ``update`` with each new reading.
61
+
62
+ ``name_of`` maps a Flow's entry node id to the name shown in tooltips.
63
+ """
64
+
65
+ def __init__(self, name_of: Callable[[str], str]) -> None:
66
+ self._name_of = name_of
67
+ self._reading: MeterReading | None = None
68
+ self._expanded = False
69
+ self._bar_signature: tuple[Severity, int] | None = None
70
+ self._strip_signature: tuple | None = None
71
+ self._bar_fill: ui.element | None = None
72
+ self._strip: ui.element | None = None
73
+ self._tips: dict[str, ui.tooltip] = {}
74
+
75
+ def build(self) -> None:
76
+ """Draw the collapsed bar and the (empty) strip into the current container."""
77
+ self._strip = ui.row().classes("items-center gap-0 no-wrap")
78
+ self._strip.style("flex: 0 1000 auto; min-width: 0; overflow: hidden; flex-direction: row-reverse;")
79
+ self._strip.set_visibility(False)
80
+ with (
81
+ ui.element("div").style(_BAR_STYLE + " cursor: pointer;").props("data-hw-mark=flow-meter") as bar
82
+ ):
83
+ self._bar_fill = ui.element("div").style("width: 100%; height: 0%;")
84
+ self._tip = ui.tooltip("")
85
+ self._tip.on("before-show", self._write_worst_tip)
86
+ bar.on("click.stop", self._toggle)
87
+
88
+ def update(self, reading: MeterReading) -> None:
89
+ """Take a new reading; elements are touched only where the picture changed."""
90
+ self._reading = reading
91
+ worst = reading.worst
92
+ signature = bar_signature(worst) if worst is not None else None
93
+ if signature != self._bar_signature and self._bar_fill is not None:
94
+ self._bar_signature = signature
95
+ severity, step = signature or (Severity.OK, 0)
96
+ self._bar_fill.style(
97
+ f"width: 100%; height: {step * 100 // STEPS}%; background: {_COLOURS[severity]};"
98
+ )
99
+ if self._expanded:
100
+ self._draw_strip()
101
+
102
+ def _toggle(self) -> None:
103
+ self._expanded = not self._expanded
104
+ if self._strip is not None:
105
+ self._strip.set_visibility(self._expanded)
106
+ if self._expanded:
107
+ self._strip_signature = None
108
+ self._draw_strip()
109
+
110
+ def _draw_strip(self) -> None:
111
+ reading = self._reading
112
+ if reading is None or self._strip is None:
113
+ return
114
+ signature = strip_signature(reading)
115
+ if signature == self._strip_signature:
116
+ return
117
+ self._strip_signature = signature
118
+ self._strip.clear()
119
+ self._tips = {}
120
+ previous_group = None
121
+ with self._strip:
122
+ for flow in reading.flows:
123
+ gap = "margin-right: 5px;" if previous_group not in (None, flow.group_id) else ""
124
+ previous_group = flow.group_id
125
+ severity, step = bar_signature(flow)
126
+ with ui.element("div").style(_BAR_STYLE + gap).props("data-hw-mark=flow-bar"):
127
+ ui.element("div").style(
128
+ f"width: 100%; height: {step * 100 // STEPS}%; background: {_COLOURS[severity]};"
129
+ )
130
+ tip = ui.tooltip("")
131
+ tip.on("before-show", lambda _e, fid=flow.flow_id: self._write_tip(fid))
132
+ self._tips[flow.flow_id] = tip
133
+
134
+ def _write_tip(self, flow_id: str) -> None:
135
+ """Fill a bar's tooltip from the latest reading, once, when it opens."""
136
+ flow = (
137
+ next((f for f in self._reading.flows if f.flow_id == flow_id), None) if self._reading else None
138
+ )
139
+ tip = self._tips.get(flow_id)
140
+ if flow is not None and tip is not None:
141
+ tip.set_text(describe(flow, self._name_of(flow.entry_node_id)))
142
+
143
+ def _write_worst_tip(self, _event: object = None) -> None:
144
+ worst = self._reading.worst if self._reading else None
145
+ if worst is not None:
146
+ self._tip.set_text(describe(worst, self._name_of(worst.entry_node_id)))
@@ -3,7 +3,7 @@
3
3
  # Edited in the studio's library overview — no reinstall, no reload.
4
4
 
5
5
  name = "haybale-haystack"
6
- version = "0.3.4"
6
+ version = "0.4.1"
7
7
  label = "Haystack"
8
8
  description = "File-centric multi-graph manager"
9
9
  tags = ["graph-management"]
@@ -0,0 +1,32 @@
1
+ """Library settings panel for the haystack library, on the ``Barns`` surface."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import TYPE_CHECKING
6
+
7
+ from haywire.barn.builtin.surfaces import Barns
8
+ from haywire.ui import elements as hui
9
+ from haywire.ui.panel import BasePanel, PanelLayout
10
+ from haywire.ui.panel.decorator import panel
11
+ from haywire.ui.panel.render_utils import render_schema
12
+
13
+ from haybale_haystack.settings.flow_meter_settings import FlowMeterSettings
14
+
15
+ if TYPE_CHECKING:
16
+ from haywire.core.session.context import SessionContext
17
+
18
+
19
+ @panel(
20
+ surface=Barns,
21
+ label="Haystack",
22
+ description="Settings of the haystack library.",
23
+ icon=hui.icon.haystack,
24
+ order=20,
25
+ default_open=False,
26
+ )
27
+ class HaystackSettingsPanel(BasePanel):
28
+ """Settings of the haystack library; today whether running graphs show flow meters."""
29
+
30
+ def draw(self, ctx: "SessionContext", layout: PanelLayout) -> None:
31
+ registry = ctx.app.library_service.get_settings_registry()
32
+ render_schema(ctx, FlowMeterSettings, registry)
@@ -0,0 +1,19 @@
1
+ """FlowMeterSettings — whether the haystack rows of running graphs show flow meters."""
2
+
3
+ from haywire.barn.builtin.types import BOOL
4
+ from haywire.core.settings import LibrarySettings, setting, settings
5
+
6
+
7
+ @settings(namespace="flow_meters", label="Flow meters", description="Meters on the rows of running graphs")
8
+ class FlowMeterSettings(LibrarySettings):
9
+ """Whether a running graph's row shows how well its flows keep up."""
10
+
11
+ show = setting[BOOL](
12
+ True,
13
+ label="Show flow meters",
14
+ description=(
15
+ "Show how well each running graph's flows keep up, as bars on its row. "
16
+ "Applies the next time a graph is started or stopped."
17
+ ),
18
+ category="Flow meters",
19
+ )
@@ -1,14 +1,14 @@
1
1
  [project]
2
2
  name = "haybale-haystack"
3
- version = "0.3.4"
3
+ version = "0.4.1"
4
4
  description = "File-centric multi-graph manager"
5
5
  requires-python = ">=3.12"
6
6
  license = {text = "MIT"}
7
7
 
8
8
  dependencies = [
9
- "haywire-core>=0.3.4",
10
- "haybale-studio>=0.3.4",
11
- "haybale-graph-editor>=0.3.4",
9
+ "haywire-core>=0.4.1",
10
+ "haybale-studio>=0.4.1",
11
+ "haybale-graph-editor>=0.4.1",
12
12
  "nicegui>=3.18.0",
13
13
  "toml>=0.10.2",
14
14
  ]