feat: the cursors panel is a UI file
src/ui/cursors-panel.ui holds the panel's shape -- the header with the mode dropdown and the reset button, and the grid the two cursor times are read in. What is not in it is the grid's contents, which follow the cursor mode and the rows and are rebuilt whenever either changes. Panels need a builder that outlives them, unlike the dialogs, which are rebuilt on every opening: a widget belongs to the builder that built it, so App::ui_builders holds each panel's for the life of the window. ui_load() is that, in ui_widgets.cpp. make test-ui also checks that udpscope-ui.gresource.xml lists every .ui file now. That was the third trap of this refactor -- a file on disk but not in the resource is a Gtk-ERROR at load, which aborts -- and it is a compile-time mistake that nothing else in the build could see. Verified by unlisting the new file and watching the check fail, then restoring it. [cursors-probe] reads as it did: all four modes, pane=1, the timings and the drag cases.
This commit is contained in:
1 parent
7a982da6c4
commit
ed82abd405
8 files changed
+118
-25
No files matched your search
@@ -43,6 +43,7 @@ answering "fine" without having looked is the one answer it must not give.
|
||||
|
||||
import argparse
|
||||
import pathlib
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -113,6 +114,17 @@ def main() -> int:
|
||||
for line in messages:
|
||||
print(f" {line}")
|
||||
|
||||
# Every file has to be in the GResource. One that is not is a `Gtk-ERROR` at load -- an abort rather
|
||||
# than a window that fails to open -- and nothing else in the build notices, because the xml is what
|
||||
# `glib-compile-resources` reads and the file on disk is not it.
|
||||
gresource = directory / "udpscope-ui.gresource.xml"
|
||||
if gresource.exists():
|
||||
listed = set(re.findall(r"<file[^>]*>([^<]+)</file>", gresource.read_text()))
|
||||
for ui in files:
|
||||
if ui.name not in listed:
|
||||
print(f" FAIL {ui.name} is not listed in udpscope-ui.gresource.xml")
|
||||
failed += 1
|
||||
|
||||
print(f"check_ui: {len(files) - failed} ok, {failed} failed")
|
||||
if advice_count:
|
||||
print(f"check_ui: {advice_count} pieces of advice — not failures; --lint shows them")
|
||||
|
||||
Reference in new issue
Block a user