Release 1.4.2: load-only dialog when nothing is selected
tests / fedora:latest (push) Successful in 1m15s
tests / ubuntu-latest · py3.11 (push) Successful in 1m32s
tests / ubuntu-latest · py3.13 (push) Successful in 1m1s
tests / archlinux:latest (push) Successful in 53s
tests / debian:12 (push) Successful in 51s
tests / ubuntu:24.04 (push) Successful in 1m8s
tests / NixOS (FHS wrapper from docs/NIXOS.md) (push) Skipped
Build PCM package / build (push) Successful in 10s

With neither mode derivable (nothing selected, no marker rectangles,
no config) the dialog now opens anyway instead of failing with an
error figure: both radios disabled with their reasons, OK/Save
disabled, Load config… live - a saved config can bootstrap the run.

README: note that macOS/NixOS field tests last ran with plugin v1.3.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HjSRLWQ8ywBBYyakvr3YTx
This commit is contained in:
janik
2026-08-31 11:42:51 +07:00
co-authored by Claude Fable 5
parent 19327c23b1
commit 634df87fe0
9 changed files with 144 additions and 41 deletions
+49
View File
@@ -590,6 +590,55 @@ def test_load_button_cancelled_picker_does_nothing(app, tmp_path,
assert not dlg.error_label.isVisible()
# --- no runnable mode: the load-only dialog ----------------------------------
def _no_mode_dlg(app, load_dir=None, save_callback=None):
"""Neither mode derivable (nothing selected, no marker rects, no
config): main opens the dialog anyway so a config can be loaded."""
return _Dialog({}, ORDER, "", "", "", "auto", "auto",
buildup_layers=[], pdn=None, pdn_candidates={},
classic_reason="nothing selected",
pdn_reason="no rectangles found",
save_callback=save_callback, load_dir=load_dir)
def test_no_mode_opens_load_only(app, tmp_path):
dlg = _no_mode_dlg(app, load_dir=tmp_path,
save_callback=lambda *_a: "x")
assert not dlg.mode_classic.isEnabled()
assert not dlg.mode_pdn.isEnabled()
# no mode is even checked - there is nothing to run
assert not dlg.mode_classic.isChecked()
assert not dlg.mode_pdn.isChecked()
assert not dlg.ok_button.isEnabled()
assert not dlg.save_button.isEnabled()
assert dlg.load_button.isEnabled()
# both reasons and the load hint are shown together
text = dlg.reason_label.text()
assert "nothing selected" in text
assert "no rectangles found" in text
assert "Load config…" in text
def test_no_mode_load_config_still_works(app, tmp_path, monkeypatch):
path = tmp_path / "fill_res_config.saved.json"
path.write_text('{"version": 1}', encoding="utf-8")
monkeypatch.setattr(dialog_mod, "QFileDialog", _FakePicker)
_FakePicker.result = (str(path), "json")
dlg = _no_mode_dlg(app, load_dir=tmp_path)
dlg._load_config()
assert dlg._load_request == path
assert dlg.result() == QDialog.Accepted
def test_available_modes_keep_ok_and_save_enabled(app, tmp_path):
dlg = _dlg(app, pdn=_setup(), save_callback=lambda *_a: "x",
load_dir=tmp_path)
assert dlg.ok_button.isEnabled()
assert dlg.save_button.isEnabled()
assert dlg.load_button.isEnabled()
# --- save button -------------------------------------------------------------
def _patch_save(monkeypatch, name):