PyPlumIO 0.7.7__tar.gz → 0.7.8.post1__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.
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/PKG-INFO +1 -1
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/docs/source/cli.rst +9 -8
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/cli/__init__.py +1 -1
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/cli/state.py +10 -10
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/cli/ui.py +68 -18
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyproject.toml +1 -1
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/cli/test_init.py +2 -1
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/cli/test_state.py +88 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/cli/test_ui.py +115 -17
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/.gitignore +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/LICENSE +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/README.md +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/docs/Makefile +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/docs/make.bat +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/docs/source/callbacks.rst +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/docs/source/conf.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/docs/source/connecting.rst +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/docs/source/frames.rst +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/docs/source/index.rst +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/docs/source/mixers_thermostats.rst +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/docs/source/protocol.rst +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/docs/source/reading.rst +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/docs/source/schedules.rst +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/docs/source/writing.rst +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/__init__.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/__main__.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/cli/app.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/cli/codegen.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/cli/model.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/cli/session.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/connection.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/const.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/data_types.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/devices/__init__.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/devices/ecomax.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/devices/ecoster.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/devices/mixer.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/devices/thermostat.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/exceptions.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/filters.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/frames/__init__.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/frames/messages.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/frames/requests.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/frames/responses.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/helpers/__init__.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/helpers/async_cache.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/helpers/event_manager.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/helpers/task_manager.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/parameters/__init__.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/parameters/custom/__init__.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/parameters/custom/ecomax_350p2_zf.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/parameters/custom/ecomax_860d3_hb.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/parameters/custom/ecomax_860p4_nm_touch.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/parameters/ecomax.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/parameters/mixer.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/parameters/thermostat.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/protocol.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/py.typed +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/stream.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/structures/__init__.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/structures/alerts.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/structures/ecomax_parameters.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/structures/ecomax_service_parameters.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/structures/frame_versions.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/structures/mixer_parameters.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/structures/network_info.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/structures/product_info.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/structures/program_version.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/structures/regulator_data.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/structures/regulator_data_schema.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/structures/schedules.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/structures/sensor_data.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/structures/thermostat_parameters.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/pyplumio/utils.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/__init__.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/cli/__init__.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/cli/conftest.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/cli/test_app.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/cli/test_codegen.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/cli/test_model.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/cli/test_session.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/conftest.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/devices/__init__.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/devices/test_ecomax.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/devices/test_ecoster.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/devices/test_init.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/devices/test_mixer.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/devices/test_thermostat.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/frames/test_init.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/frames/test_messages.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/frames/test_requests.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/frames/test_responses.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/helpers/__init__.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/helpers/test_async_cache.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/helpers/test_event_manager.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/helpers/test_task_manager.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/helpers/test_uid.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/parameters/__init__.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/parameters/custom/__init__.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/parameters/custom/test_ecomax_350p2_zf.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/parameters/custom/test_ecomax_860d3_hb.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/parameters/custom/test_ecomax_860p4_nm_touch.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/parameters/custom/test_init.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/parameters/test_ecomax.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/parameters/test_init.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/parameters/test_mixers.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/parameters/test_thermostats.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/ruff.toml +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/structures/__init__.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/structures/test_alerts.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/structures/test_ecomax_parameters.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/structures/test_ecomax_service_parameters.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/structures/test_frame_versions.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/structures/test_mixer_parameters.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/structures/test_product_info.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/structures/test_program_version.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/structures/test_schedules.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/test_connection.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/test_data_types.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/test_filters.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/test_init.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/test_main.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/test_protocol.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/test_stream.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/test_utils.py +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/messages/regulator_data.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/messages/sensor_data.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/parameters/ecomax_350p2_zf.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/parameters/ecomax_860d3_hb.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/parameters/ecomax_860p4_nm_touch.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/requests/alerts.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/requests/ecomax_control.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/requests/ecomax_parameters.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/requests/ecomax_service_parameters.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/requests/mixer_parameters.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/requests/set_ecomax_parameter.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/requests/set_ecomax_service_parameter.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/requests/set_mixer_parameter.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/requests/set_schedule.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/requests/set_thermostat_parameter.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/requests/thermostat_parameters.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/responses/alerts.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/responses/device_available.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/responses/ecomax_parameters.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/responses/ecomax_service_parameters.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/responses/mixer_parameters.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/responses/password.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/responses/program_version.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/responses/regulator_data_schema.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/responses/schedules.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/responses/thermostat_parameters.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/responses/uid.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/unknown/unknown_ecomax_parameter.json +0 -0
- {pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/unknown/unknown_mixer_parameter.json +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: PyPlumIO
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.8.post1
|
|
4
4
|
Summary: PyPlumIO is a native ecoNET library for Plum ecoMAX controllers.
|
|
5
5
|
Project-URL: Documentation, https://pyplumio.denpa.pro
|
|
6
6
|
Project-URL: Source Code, https://github.com/denpamusic/PyPlumIO
|
|
@@ -13,7 +13,7 @@ Windows Executable
|
|
|
13
13
|
On Windows, download the standalone ``pyplumio.exe`` executable from the
|
|
14
14
|
`GitHub Releases <https://github.com/denpamusic/PyPlumIO/releases>`_ page. No Python
|
|
15
15
|
installation is required—double-click ``pyplumio.exe`` or run it from Command Prompt
|
|
16
|
-
or PowerShell. Generated files (
|
|
16
|
+
or PowerShell. Generated files (and optional ``<model_slug>.zip``) are saved in the working
|
|
17
17
|
directory where ``pyplumio.exe`` is launched unless ``--output`` is specified.
|
|
18
18
|
|
|
19
19
|
Python Package
|
|
@@ -55,7 +55,7 @@ The CLI supports the following arguments:
|
|
|
55
55
|
--output DIR Output directory for generated files (default: current working directory).
|
|
56
56
|
--interval SECONDS Polling interval in seconds (default: 2.0).
|
|
57
57
|
--baudrate BAUDRATE Serial baudrate (default: 115200).
|
|
58
|
-
-z, --zip
|
|
58
|
+
-z, --zip Also save output as a ZIP archive.
|
|
59
59
|
|
|
60
60
|
Interactive Connection Setup
|
|
61
61
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
@@ -85,10 +85,11 @@ polling in the background.
|
|
|
85
85
|
|
|
86
86
|
The interface consists of:
|
|
87
87
|
|
|
88
|
-
- **Header**:
|
|
88
|
+
- **Header**: Inverted top bar showing connected controller model, product ID, connection URL, and last update timestamp.
|
|
89
89
|
- **Table**: Monospace scrollable list showing parameter indices, mapped names, current values, minimums, and maximums. Recently changed parameters are highlighted with inverted colors.
|
|
90
90
|
- **Live Preview**: Real-time 4-line framed box docked above the input bar displaying active parameter fields, raw values, and live calculations.
|
|
91
|
-
- **
|
|
91
|
+
- **Status Bar**: Inverted bar positioned below the input prompt and directly above the hotkey bar displaying validation messages, available units, and connection status.
|
|
92
|
+
- **Hotkey Bar**: Bottom bar displaying keyboard shortcuts (``^S`` Save, ``^Q`` Quit, ``Esc`` Cancel, ``↑/↓`` Scroll, ``PgUp/PgDn`` Page, ``Tab`` Complete).
|
|
92
93
|
|
|
93
94
|
Interactive Wizard
|
|
94
95
|
~~~~~~~~~~~~~~~~~~
|
|
@@ -130,12 +131,12 @@ Press ``Ctrl+S`` to save generated files. At least one parameter must be mapped;
|
|
|
130
131
|
|
|
131
132
|
Nothing to save: map at least one parameter first.
|
|
132
133
|
|
|
133
|
-
Unless ``-z`` / ``--zip`` was passed on the command line, you will be asked ``
|
|
134
|
+
Unless ``-z`` / ``--zip`` was passed on the command line, you will be asked ``Also save as a ZIP archive? [y/N]``:
|
|
134
135
|
|
|
135
|
-
- Answering ``n`` (or pressing Enter) writes the three generated files directly into the ``<output>`` directory tree. If ``<output>/pyplumio/parameters/custom/<model_slug>.py`` already exists, you will be prompted to confirm overwrite (``Overwrite existing <model_slug>.py? [y/N]``).
|
|
136
|
-
- Answering ``y`` (or starting the CLI with ``-z`` / ``--zip``)
|
|
136
|
+
- Answering ``n`` (or pressing Enter) writes only the three generated files directly into the ``<output>`` directory tree. If ``<output>/pyplumio/parameters/custom/<model_slug>.py`` already exists, you will be prompted to confirm overwrite (``Overwrite existing <model_slug>.py? [y/N]``).
|
|
137
|
+
- Answering ``y`` (or starting the CLI with ``-z`` / ``--zip``) writes the three generated files into ``<output>`` and also saves ``<output>/<model_slug>.zip`` containing the same repository-relative paths inside, which can be attached directly to a GitHub issue instead of opening a PR. If ``<model_slug>.py``, ``<model_slug>.zip``, or both already exist, you will be prompted to confirm overwrite (``Overwrite existing <target>? [y/N]``, or ``Overwrite existing <model_slug>.py and <model_slug>.zip? [y/N]`` when both exist).
|
|
137
138
|
|
|
138
|
-
The utility produces the following three files
|
|
139
|
+
The utility produces the following three files on disk (and inside ``<output>/<model_slug>.zip`` when ZIP output is requested):
|
|
139
140
|
|
|
140
141
|
1. **Custom Parameter Module**:
|
|
141
142
|
``<output>/pyplumio/parameters/custom/<model_slug>.py``
|
|
@@ -91,7 +91,7 @@ def _run_cli(argv: Sequence[str] | None) -> int:
|
|
|
91
91
|
"--baudrate", type=int, default=DEFAULT_BAUDRATE, help="baudrate"
|
|
92
92
|
)
|
|
93
93
|
parser.add_argument(
|
|
94
|
-
"-z", "--zip", action="store_true", help="save output as a ZIP archive"
|
|
94
|
+
"-z", "--zip", action="store_true", help="also save output as a ZIP archive"
|
|
95
95
|
)
|
|
96
96
|
try:
|
|
97
97
|
return asyncio.run(run_app(parser.parse_args(argv)))
|
|
@@ -81,7 +81,7 @@ PAGE_SIZE: Final = 25
|
|
|
81
81
|
INDEX_PROMPT: Final = "Enter parameter index to edit: "
|
|
82
82
|
NAME_PROMPT: Final = "Name: "
|
|
83
83
|
COMMENT_PROMPT: Final = "Comment (leave empty for none): "
|
|
84
|
-
ZIP_PROMPT: Final = "
|
|
84
|
+
ZIP_PROMPT: Final = "Also save as a ZIP archive? [y/N]: "
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
def _normalize_number(value: float) -> float | int:
|
|
@@ -144,14 +144,14 @@ def _save_files(state: AppState) -> None:
|
|
|
144
144
|
state.output_dir,
|
|
145
145
|
comments=state.table.comments,
|
|
146
146
|
)
|
|
147
|
+
write_files(files)
|
|
147
148
|
if state.data.save_as_zip:
|
|
148
149
|
zip_path = zip_archive_path(
|
|
149
150
|
state.output_dir, model_slug(product_info.model)
|
|
150
151
|
)
|
|
151
152
|
write_zip(zip_path, files, state.output_dir)
|
|
152
|
-
state.status = f"Files saved to {zip_path}."
|
|
153
|
+
state.status = f"Files saved to {state.output_dir} and {zip_path.name}."
|
|
153
154
|
else:
|
|
154
|
-
write_files(files)
|
|
155
155
|
state.status = f"Files saved to {state.output_dir}."
|
|
156
156
|
|
|
157
157
|
except (OSError, ValueError) as err:
|
|
@@ -264,13 +264,13 @@ class AppState:
|
|
|
264
264
|
|
|
265
265
|
self.data.save_as_zip = self.zip_output if save_as_zip is None else save_as_zip
|
|
266
266
|
slug = model_slug(product_info.model)
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
)
|
|
272
|
-
|
|
273
|
-
prompt = f"Overwrite existing {
|
|
267
|
+
targets = [custom_module_path(self.output_dir, slug)]
|
|
268
|
+
if self.data.save_as_zip:
|
|
269
|
+
targets.append(zip_archive_path(self.output_dir, slug))
|
|
270
|
+
|
|
271
|
+
if existing := [path.name for path in targets if path.is_file()]:
|
|
272
|
+
names = " and ".join(existing)
|
|
273
|
+
prompt = f"Overwrite existing {names}? [y/N]: "
|
|
274
274
|
return self._set_step(AppStep.OVERWRITE, prompt, buffer)
|
|
275
275
|
|
|
276
276
|
_save_files(self)
|
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
from contextlib import suppress
|
|
6
6
|
from dataclasses import replace
|
|
7
7
|
from pathlib import Path
|
|
8
|
+
import textwrap
|
|
8
9
|
from typing import Any, Final
|
|
9
10
|
|
|
10
11
|
from prompt_toolkit.application import Application
|
|
@@ -49,11 +50,26 @@ from pyplumio.parameters.ecomax import (
|
|
|
49
50
|
)
|
|
50
51
|
|
|
51
52
|
SCROLL_SIZE: Final = 20
|
|
52
|
-
PREVIEW_BOX_WIDTH: Final =
|
|
53
|
+
PREVIEW_BOX_WIDTH: Final = 80
|
|
54
|
+
ELLIPSIS: Final = "..."
|
|
53
55
|
TABLE_HEADER: Final = (
|
|
54
56
|
"Index Name Value Min Max\n"
|
|
55
57
|
)
|
|
56
58
|
TABLE_SEPARATOR: Final = f"{'-' * 5} {'-' * 36} {'-' * 10} {'-' * 10} {'-' * 10}\n"
|
|
59
|
+
HOTKEY_BAR: Final[StyleAndTextTuples] = [
|
|
60
|
+
("reverse", "^S"),
|
|
61
|
+
("", " Save "),
|
|
62
|
+
("reverse", "^Q"),
|
|
63
|
+
("", " Quit "),
|
|
64
|
+
("reverse", "Esc"),
|
|
65
|
+
("", " Cancel "),
|
|
66
|
+
("reverse", "↑/↓"),
|
|
67
|
+
("", " Scroll "),
|
|
68
|
+
("reverse", "PgUp/PgDn"),
|
|
69
|
+
("", " Page "),
|
|
70
|
+
("reverse", "Tab"),
|
|
71
|
+
("", " Complete"),
|
|
72
|
+
]
|
|
57
73
|
|
|
58
74
|
TYPE_COMPLETER: Final = WordCompleter(list(_ParameterType))
|
|
59
75
|
UNIT_COMPLETER: Final = WordCompleter(
|
|
@@ -70,21 +86,48 @@ UNIT_COMPLETER: Final = WordCompleter(
|
|
|
70
86
|
)
|
|
71
87
|
|
|
72
88
|
|
|
89
|
+
def _truncate_middle(text: str, max_length: int) -> str:
|
|
90
|
+
"""Truncate text in the middle with an ellipsis to fit max_length."""
|
|
91
|
+
if len(text) <= max_length:
|
|
92
|
+
return text
|
|
93
|
+
|
|
94
|
+
if max_length <= len(ELLIPSIS):
|
|
95
|
+
return ELLIPSIS[: max(0, max_length)]
|
|
96
|
+
|
|
97
|
+
head = (max_length - len(ELLIPSIS)) // 2
|
|
98
|
+
tail = max_length - len(ELLIPSIS) - head
|
|
99
|
+
return f"{text[:head]}{ELLIPSIS}{text[-tail:]}"
|
|
100
|
+
|
|
101
|
+
|
|
73
102
|
def _get_header_text(state: AppState) -> StyleAndTextTuples:
|
|
74
103
|
"""Return formatted header text."""
|
|
75
104
|
product_info = state.session.product_info
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
105
|
+
model = product_info.model if product_info else "Unknown"
|
|
106
|
+
product_id = product_info.id if product_info else 0
|
|
107
|
+
updated = (
|
|
108
|
+
state.session.last_update_time.strftime("%H:%M:%S")
|
|
109
|
+
if state.session.last_update_time
|
|
110
|
+
else "Never"
|
|
79
111
|
)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
112
|
+
left = f" {model} (ID: {product_id})"
|
|
113
|
+
right = f"↻ {updated} "
|
|
114
|
+
middle_width = PREVIEW_BOX_WIDTH - len(left) - len(right)
|
|
115
|
+
url = _truncate_middle(state.session.url, middle_width - 4)
|
|
116
|
+
return [("reverse", f"{left}{url.center(middle_width)}{right}")]
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def _get_status_text(state: AppState) -> StyleAndTextTuples:
|
|
120
|
+
"""Return formatted status bar text."""
|
|
121
|
+
if not state.status.strip():
|
|
122
|
+
return []
|
|
123
|
+
|
|
124
|
+
lines = textwrap.wrap(
|
|
125
|
+
state.status,
|
|
126
|
+
width=PREVIEW_BOX_WIDTH,
|
|
127
|
+
break_long_words=True,
|
|
128
|
+
break_on_hyphens=False,
|
|
129
|
+
)
|
|
130
|
+
return [("reverse", "\n".join(line.center(PREVIEW_BOX_WIDTH) for line in lines))]
|
|
88
131
|
|
|
89
132
|
|
|
90
133
|
def _get_table_text(state: AppState) -> StyleAndTextTuples:
|
|
@@ -365,18 +408,17 @@ def create_app(
|
|
|
365
408
|
key_bindings = _create_key_bindings(state, buffer)
|
|
366
409
|
body = HSplit(
|
|
367
410
|
[
|
|
368
|
-
Window(
|
|
411
|
+
Window(
|
|
412
|
+
FormattedTextControl(lambda: _get_header_text(state)),
|
|
413
|
+
height=1,
|
|
414
|
+
),
|
|
415
|
+
Window(height=1),
|
|
369
416
|
Window(FormattedTextControl(lambda: _get_table_text(state))),
|
|
370
417
|
Window(height=1),
|
|
371
418
|
Window(
|
|
372
419
|
FormattedTextControl(lambda: _get_preview_text(state, buffer)),
|
|
373
420
|
height=4,
|
|
374
421
|
),
|
|
375
|
-
Window(
|
|
376
|
-
FormattedTextControl(lambda: f" {state.status}"),
|
|
377
|
-
wrap_lines=True,
|
|
378
|
-
dont_extend_height=True,
|
|
379
|
-
),
|
|
380
422
|
VSplit(
|
|
381
423
|
[
|
|
382
424
|
Window(
|
|
@@ -386,6 +428,14 @@ def create_app(
|
|
|
386
428
|
Window(BufferControl(buffer=buffer)),
|
|
387
429
|
]
|
|
388
430
|
),
|
|
431
|
+
Window(height=1),
|
|
432
|
+
Window(
|
|
433
|
+
FormattedTextControl(lambda: _get_status_text(state)),
|
|
434
|
+
width=PREVIEW_BOX_WIDTH,
|
|
435
|
+
wrap_lines=True,
|
|
436
|
+
dont_extend_height=True,
|
|
437
|
+
),
|
|
438
|
+
Window(FormattedTextControl(HOTKEY_BAR), height=1),
|
|
389
439
|
]
|
|
390
440
|
)
|
|
391
441
|
root = FloatContainer(
|
|
@@ -116,10 +116,11 @@ def test_main_eof_error() -> None:
|
|
|
116
116
|
mock_pause.assert_called_once()
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
def test_main_help_and_invalid_argument() -> None:
|
|
119
|
+
def test_main_help_and_invalid_argument(capsys: pytest.CaptureFixture[str]) -> None:
|
|
120
120
|
"""Test main handles SystemExit for --help and invalid arguments."""
|
|
121
121
|
with patch("pyplumio.cli._pause_before_exit") as mock_pause:
|
|
122
122
|
assert main(["--help"]) == 0
|
|
123
|
+
assert "also save output as a ZIP archive" in capsys.readouterr().out
|
|
123
124
|
mock_pause.assert_not_called()
|
|
124
125
|
|
|
125
126
|
assert main(["--unknown-flag"]) == 2
|
|
@@ -7,6 +7,7 @@ from unittest.mock import patch
|
|
|
7
7
|
|
|
8
8
|
from prompt_toolkit.buffer import Buffer
|
|
9
9
|
|
|
10
|
+
from pyplumio.cli.codegen import custom_module_path, zip_archive_path
|
|
10
11
|
from pyplumio.cli.model import ParameterTable
|
|
11
12
|
from pyplumio.cli.session import Session
|
|
12
13
|
from pyplumio.cli.state import (
|
|
@@ -444,6 +445,93 @@ async def test_app_state_save_and_overwrite(tmp_path: Path) -> None:
|
|
|
444
445
|
assert "Error saving files: Invalid parameter" in state.status
|
|
445
446
|
|
|
446
447
|
|
|
448
|
+
async def test_app_state_save_zip_writes_regular_files(tmp_path: Path) -> None:
|
|
449
|
+
"""Test _save_files writes regular output files alongside ZIP when enabled."""
|
|
450
|
+
session = Session(url="socket://localhost:8899")
|
|
451
|
+
session.product_info = dummy_product_info()
|
|
452
|
+
session.last_frame_message = b"\x00" * 40
|
|
453
|
+
session.last_parameters = [
|
|
454
|
+
(0, ParameterValues(value=10, min_value=0, max_value=20))
|
|
455
|
+
]
|
|
456
|
+
table = ParameterTable()
|
|
457
|
+
table.set_description(0, EcomaxNumberDescription(name="boiler_temp"))
|
|
458
|
+
|
|
459
|
+
state = AppState(session, table, tmp_path)
|
|
460
|
+
state.data.save_as_zip = True
|
|
461
|
+
_save_files(state)
|
|
462
|
+
assert state.status == f"Files saved to {tmp_path} and {DUMMY_SLUG}.zip."
|
|
463
|
+
assert custom_module_path(tmp_path, DUMMY_SLUG).is_file()
|
|
464
|
+
assert (tmp_path / f"tests/parameters/custom/test_{DUMMY_SLUG}.py").is_file()
|
|
465
|
+
assert (tmp_path / f"tests/testdata/parameters/{DUMMY_SLUG}.json").is_file()
|
|
466
|
+
assert zip_archive_path(tmp_path, DUMMY_SLUG).is_file()
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
async def test_app_state_save_overwrite_combinations(tmp_path: Path) -> None:
|
|
470
|
+
"""Test overwrite prompts and cancellation across regular and ZIP targets."""
|
|
471
|
+
session = Session(url="socket://localhost:8899")
|
|
472
|
+
session.product_info = dummy_product_info()
|
|
473
|
+
session.last_frame_message = b"\x00" * 40
|
|
474
|
+
session.last_parameters = [
|
|
475
|
+
(0, ParameterValues(value=10, min_value=0, max_value=20))
|
|
476
|
+
]
|
|
477
|
+
table = ParameterTable()
|
|
478
|
+
table.set_description(0, EcomaxNumberDescription(name="boiler_temp"))
|
|
479
|
+
|
|
480
|
+
module_path = custom_module_path(tmp_path, DUMMY_SLUG)
|
|
481
|
+
test_path = tmp_path / f"tests/parameters/custom/test_{DUMMY_SLUG}.py"
|
|
482
|
+
data_path = tmp_path / f"tests/testdata/parameters/{DUMMY_SLUG}.json"
|
|
483
|
+
zip_path = zip_archive_path(tmp_path, DUMMY_SLUG)
|
|
484
|
+
|
|
485
|
+
# Only <slug>.py exists -> prompts for <slug>.py, declining cancels without touch
|
|
486
|
+
state = AppState(session, table, tmp_path)
|
|
487
|
+
buff = Buffer()
|
|
488
|
+
module_path.parent.mkdir(parents=True, exist_ok=True)
|
|
489
|
+
module_path.write_text("# existing module", encoding="utf-8")
|
|
490
|
+
state.start_save(buff, save_as_zip=True)
|
|
491
|
+
assert _step(state) == AppStep.OVERWRITE
|
|
492
|
+
assert state.prompt == f"Overwrite existing {DUMMY_SLUG}.py? [y/N]: "
|
|
493
|
+
state.step_overwrite("n", buff)
|
|
494
|
+
assert _step(state) == AppStep.INDEX
|
|
495
|
+
assert state.status == "Save cancelled."
|
|
496
|
+
assert module_path.read_text(encoding="utf-8") == "# existing module"
|
|
497
|
+
assert not zip_path.exists()
|
|
498
|
+
|
|
499
|
+
# Only <slug>.zip exists + save_as_zip=False -> writes regular files immediately
|
|
500
|
+
module_path.unlink()
|
|
501
|
+
zip_path.write_bytes(b"existing zip")
|
|
502
|
+
state.start_save(buff, save_as_zip=False)
|
|
503
|
+
assert _step(state) == AppStep.INDEX
|
|
504
|
+
assert state.status == f"Files saved to {tmp_path}."
|
|
505
|
+
assert module_path.is_file()
|
|
506
|
+
assert test_path.is_file()
|
|
507
|
+
assert data_path.is_file()
|
|
508
|
+
assert zip_path.read_bytes() == b"existing zip"
|
|
509
|
+
|
|
510
|
+
# Only <slug>.zip exists + save_as_zip=True -> prompts for <slug>.zip, decline
|
|
511
|
+
module_path.unlink()
|
|
512
|
+
state.start_save(buff, save_as_zip=True)
|
|
513
|
+
assert _step(state) == AppStep.OVERWRITE
|
|
514
|
+
assert state.prompt == f"Overwrite existing {DUMMY_SLUG}.zip? [y/N]: "
|
|
515
|
+
state.step_overwrite("n", buff)
|
|
516
|
+
assert _step(state) == AppStep.INDEX
|
|
517
|
+
assert state.status == "Save cancelled."
|
|
518
|
+
assert not module_path.exists()
|
|
519
|
+
assert zip_path.read_bytes() == b"existing zip"
|
|
520
|
+
|
|
521
|
+
# Both <slug>.py and <slug>.zip exist -> prompts for both, declining cancels
|
|
522
|
+
module_path.write_text("# existing module", encoding="utf-8")
|
|
523
|
+
state.start_save(buff, save_as_zip=True)
|
|
524
|
+
assert _step(state) == AppStep.OVERWRITE
|
|
525
|
+
assert state.prompt == (
|
|
526
|
+
f"Overwrite existing {DUMMY_SLUG}.py and {DUMMY_SLUG}.zip? [y/N]: "
|
|
527
|
+
)
|
|
528
|
+
state.step_overwrite("n", buff)
|
|
529
|
+
assert _step(state) == AppStep.INDEX
|
|
530
|
+
assert state.status == "Save cancelled."
|
|
531
|
+
assert module_path.read_text(encoding="utf-8") == "# existing module"
|
|
532
|
+
assert zip_path.read_bytes() == b"existing zip"
|
|
533
|
+
|
|
534
|
+
|
|
447
535
|
def test_format_value_with_unit() -> None:
|
|
448
536
|
"""Test formatting values with units of measurement."""
|
|
449
537
|
# Unknown or None description
|
|
@@ -13,19 +13,23 @@ from prompt_toolkit.completion import CompleteEvent
|
|
|
13
13
|
from prompt_toolkit.document import Document
|
|
14
14
|
from prompt_toolkit.formatted_text import OneStyleAndTextTuple
|
|
15
15
|
from prompt_toolkit.key_binding import KeyPressEvent
|
|
16
|
+
from prompt_toolkit.layout.containers import VSplit
|
|
16
17
|
from prompt_toolkit.output import DummyOutput
|
|
17
18
|
|
|
18
19
|
from pyplumio.cli.model import ParameterTable
|
|
19
20
|
from pyplumio.cli.session import Session
|
|
20
21
|
from pyplumio.cli.state import AppState, AppStep
|
|
21
22
|
from pyplumio.cli.ui import (
|
|
23
|
+
HOTKEY_BAR,
|
|
22
24
|
PREVIEW_BOX_WIDTH,
|
|
23
25
|
TABLE_HEADER,
|
|
24
26
|
TABLE_SEPARATOR,
|
|
25
27
|
_get_completer,
|
|
26
28
|
_get_header_text,
|
|
27
29
|
_get_preview_text,
|
|
30
|
+
_get_status_text,
|
|
28
31
|
_get_table_text,
|
|
32
|
+
_truncate_middle,
|
|
29
33
|
create_app,
|
|
30
34
|
)
|
|
31
35
|
from pyplumio.const import PERCENTAGE, UnitOfMeasurement
|
|
@@ -71,15 +75,24 @@ def test_ui_header_and_table_text(tmp_path: Path) -> None:
|
|
|
71
75
|
|
|
72
76
|
# Initial header without product info or update time
|
|
73
77
|
header = _get_header_text(state)
|
|
74
|
-
assert
|
|
75
|
-
assert
|
|
78
|
+
assert header[0][0] == "reverse"
|
|
79
|
+
assert len(header[0][1]) == PREVIEW_BOX_WIDTH
|
|
80
|
+
assert header[0][1].startswith(" Unknown (ID: 0) ")
|
|
81
|
+
assert "socket://localhost:8899" in header[0][1]
|
|
82
|
+
assert header[0][1].endswith(" ↻ Never ")
|
|
83
|
+
assert "Model:" not in header[0][1]
|
|
84
|
+
assert "URL:" not in header[0][1]
|
|
85
|
+
assert "Updated:" not in header[0][1]
|
|
76
86
|
|
|
77
87
|
# Header with product info and update time
|
|
78
88
|
session.product_info = dummy_product_info()
|
|
79
89
|
session.last_update_time = datetime(2025, 1, 1, 12, 0, 0, tzinfo=UTC)
|
|
80
90
|
header = _get_header_text(state)
|
|
81
|
-
assert
|
|
82
|
-
assert
|
|
91
|
+
assert header[0][0] == "reverse"
|
|
92
|
+
assert len(header[0][1]) == PREVIEW_BOX_WIDTH
|
|
93
|
+
assert header[0][1].startswith(f" {DUMMY_MODEL} (ID: {DUMMY_ID}) ")
|
|
94
|
+
assert "socket://localhost:8899" in header[0][1]
|
|
95
|
+
assert header[0][1].endswith(" ↻ 12:00:00 ")
|
|
83
96
|
|
|
84
97
|
# Table text without description
|
|
85
98
|
table.update([(0, ParameterValues(value=10, min_value=0, max_value=20))])
|
|
@@ -453,7 +466,7 @@ def test_app_keybindings_and_layout(tmp_path: Path) -> None:
|
|
|
453
466
|
table.set_description(0, EcomaxNumberDescription(name="boiler_temp"))
|
|
454
467
|
bindings["c-s"](mock_event)
|
|
455
468
|
assert _step(state) == AppStep.ZIP
|
|
456
|
-
assert state.prompt == "
|
|
469
|
+
assert state.prompt == "Also save as a ZIP archive? [y/N]: "
|
|
457
470
|
state.step_zip("n", app_buffer)
|
|
458
471
|
assert _step(state) == AppStep.INDEX
|
|
459
472
|
assert state.status == f"Files saved to {tmp_path}."
|
|
@@ -472,7 +485,7 @@ def test_app_keybindings_and_layout(tmp_path: Path) -> None:
|
|
|
472
485
|
assert state.status == "Cancelled."
|
|
473
486
|
|
|
474
487
|
# 4. live preview container check
|
|
475
|
-
preview_win = app.layout.container.content.children[
|
|
488
|
+
preview_win = app.layout.container.content.children[4] # type: ignore[attr-defined]
|
|
476
489
|
assert preview_win.height == 4
|
|
477
490
|
preview_output = preview_win.content.text()
|
|
478
491
|
assert "Live Preview" in preview_output[0][1]
|
|
@@ -724,7 +737,7 @@ async def test_zip_save_flow_tree_and_cancel(tmp_path: Path) -> None:
|
|
|
724
737
|
# Ctrl+S asks ZIP question; Esc cancels back to INDEX
|
|
725
738
|
bindings["c-s"](mock_event)
|
|
726
739
|
assert _step(state) == AppStep.ZIP
|
|
727
|
-
assert state.prompt == "
|
|
740
|
+
assert state.prompt == "Also save as a ZIP archive? [y/N]: "
|
|
728
741
|
bindings["escape"](mock_event)
|
|
729
742
|
assert _step(state) == AppStep.INDEX
|
|
730
743
|
assert state.status == "Cancelled."
|
|
@@ -773,12 +786,15 @@ async def test_zip_save_flow_archive(tmp_path: Path) -> None:
|
|
|
773
786
|
app_buffer = buffer_ctrl.content.buffer
|
|
774
787
|
zip_path = tmp_path / f"{DUMMY_SLUG}.zip"
|
|
775
788
|
|
|
776
|
-
# Answering "y" writes ZIP and resets save_as_zip
|
|
789
|
+
# Answering "y" writes regular files + ZIP and resets save_as_zip
|
|
777
790
|
bindings["c-s"](mock_event)
|
|
778
791
|
state.step_zip("y", app_buffer)
|
|
779
792
|
assert _step(state) == AppStep.INDEX
|
|
780
|
-
assert state.status == f"Files saved to {zip_path}."
|
|
793
|
+
assert state.status == f"Files saved to {tmp_path} and {zip_path.name}."
|
|
781
794
|
assert state.data.save_as_zip is False
|
|
795
|
+
assert (tmp_path / f"pyplumio/parameters/custom/{DUMMY_SLUG}.py").is_file()
|
|
796
|
+
assert (tmp_path / f"tests/parameters/custom/test_{DUMMY_SLUG}.py").is_file()
|
|
797
|
+
assert (tmp_path / f"tests/testdata/parameters/{DUMMY_SLUG}.json").is_file()
|
|
782
798
|
assert zip_path.is_file()
|
|
783
799
|
with zipfile.ZipFile(zip_path, "r") as archive:
|
|
784
800
|
assert set(archive.namelist()) == {
|
|
@@ -787,24 +803,26 @@ async def test_zip_save_flow_archive(tmp_path: Path) -> None:
|
|
|
787
803
|
f"tests/testdata/parameters/{DUMMY_SLUG}.json",
|
|
788
804
|
}
|
|
789
805
|
|
|
790
|
-
# Existing ZIP -> OVERWRITE prompt, decline -> "Save cancelled."
|
|
806
|
+
# Existing files + ZIP -> OVERWRITE prompt, decline -> "Save cancelled."
|
|
791
807
|
bindings["c-s"](mock_event)
|
|
792
808
|
state.step_zip("y", app_buffer)
|
|
793
809
|
assert _step(state) == AppStep.OVERWRITE
|
|
794
|
-
assert state.prompt ==
|
|
810
|
+
assert state.prompt == (
|
|
811
|
+
f"Overwrite existing {DUMMY_SLUG}.py and {DUMMY_SLUG}.zip? [y/N]: "
|
|
812
|
+
)
|
|
795
813
|
assert bool(state.data.save_as_zip) is True
|
|
796
814
|
state.step_overwrite("n", app_buffer)
|
|
797
815
|
assert _step(state) == AppStep.INDEX
|
|
798
816
|
assert state.status == "Save cancelled."
|
|
799
817
|
assert state.data.save_as_zip is False
|
|
800
818
|
|
|
801
|
-
# Existing ZIP -> OVERWRITE accept -> rewrites
|
|
819
|
+
# Existing files + ZIP -> OVERWRITE accept -> rewrites and resets save_as_zip
|
|
802
820
|
bindings["c-s"](mock_event)
|
|
803
821
|
state.step_zip("yes", app_buffer)
|
|
804
822
|
assert _step(state) == AppStep.OVERWRITE
|
|
805
823
|
state.step_overwrite("y", app_buffer)
|
|
806
824
|
assert _step(state) == AppStep.INDEX
|
|
807
|
-
assert state.status == f"Files saved to {zip_path}."
|
|
825
|
+
assert state.status == f"Files saved to {tmp_path} and {zip_path.name}."
|
|
808
826
|
assert state.data.save_as_zip is False
|
|
809
827
|
|
|
810
828
|
|
|
@@ -832,16 +850,96 @@ async def test_zip_save_flag(tmp_path: Path) -> None:
|
|
|
832
850
|
zip_path = tmp_path / f"{DUMMY_SLUG}.zip"
|
|
833
851
|
bindings["c-s"](mock_event)
|
|
834
852
|
assert _step(state) == AppStep.INDEX
|
|
835
|
-
assert state.status == f"Files saved to {zip_path}."
|
|
853
|
+
assert state.status == f"Files saved to {tmp_path} and {zip_path.name}."
|
|
836
854
|
assert state.data.save_as_zip is False
|
|
855
|
+
assert (tmp_path / f"pyplumio/parameters/custom/{DUMMY_SLUG}.py").is_file()
|
|
837
856
|
assert zip_path.is_file()
|
|
838
857
|
|
|
839
|
-
# Second Ctrl+S goes directly to OVERWRITE for
|
|
858
|
+
# Second Ctrl+S goes directly to OVERWRITE for both regular module and ZIP file
|
|
840
859
|
bindings["c-s"](mock_event)
|
|
841
860
|
assert _step(state) == AppStep.OVERWRITE
|
|
842
|
-
assert state.prompt ==
|
|
861
|
+
assert state.prompt == (
|
|
862
|
+
f"Overwrite existing {DUMMY_SLUG}.py and {DUMMY_SLUG}.zip? [y/N]: "
|
|
863
|
+
)
|
|
843
864
|
app_buffer.text = "y"
|
|
844
865
|
state.dispatch_enter(app_buffer)
|
|
845
866
|
assert _step(state) == AppStep.INDEX
|
|
846
|
-
assert state.status == f"Files saved to {zip_path}."
|
|
867
|
+
assert state.status == f"Files saved to {tmp_path} and {zip_path.name}."
|
|
847
868
|
assert state.data.save_as_zip is False
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
def test_ui_header_url_truncation(tmp_path: Path) -> None:
|
|
872
|
+
"""Test middle truncation of long URLs in the single-line header."""
|
|
873
|
+
session = Session(
|
|
874
|
+
url="/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A50285BI-if00-port0"
|
|
875
|
+
)
|
|
876
|
+
session.product_info = dummy_product_info()
|
|
877
|
+
session.last_update_time = datetime(2025, 1, 1, 12, 0, 0, tzinfo=UTC)
|
|
878
|
+
table = ParameterTable()
|
|
879
|
+
state = AppState(session, table, tmp_path)
|
|
880
|
+
|
|
881
|
+
header = _get_header_text(state)
|
|
882
|
+
assert header[0][0] == "reverse"
|
|
883
|
+
assert "\n" not in header[0][1]
|
|
884
|
+
assert len(header[0][1]) == PREVIEW_BOX_WIDTH
|
|
885
|
+
assert header[0][1].startswith(f" {DUMMY_MODEL} (ID: {DUMMY_ID}) ")
|
|
886
|
+
assert header[0][1].endswith(" ↻ 12:00:00 ")
|
|
887
|
+
assert "/dev/serial/" in header[0][1]
|
|
888
|
+
assert "..." in header[0][1]
|
|
889
|
+
assert "-port0" in header[0][1]
|
|
890
|
+
|
|
891
|
+
# Edge cases for _truncate_middle
|
|
892
|
+
assert _truncate_middle("abcdef", 6) == "abcdef"
|
|
893
|
+
assert _truncate_middle("abcdef", 5) == "a...f"
|
|
894
|
+
assert _truncate_middle("abcdef", 4) == "...f"
|
|
895
|
+
assert _truncate_middle("abcdef", 3) == "..."
|
|
896
|
+
assert _truncate_middle("abcdef", 2) == ".."
|
|
897
|
+
assert _truncate_middle("abcdef", 0) == ""
|
|
898
|
+
assert _truncate_middle("abcdef", -3) == ""
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
def test_app_layout_header_and_hotkey_bar(tmp_path: Path) -> None:
|
|
902
|
+
"""Test header, preview, prompt, status, spacer, and hotkey bar layout."""
|
|
903
|
+
session = Session(url="socket://localhost:8899")
|
|
904
|
+
table = ParameterTable()
|
|
905
|
+
app, state = create_app(session, table, tmp_path, output=DummyOutput())
|
|
906
|
+
children = app.layout.container.content.children # type: ignore[attr-defined]
|
|
907
|
+
|
|
908
|
+
header_win = children[0]
|
|
909
|
+
assert header_win.height == 1
|
|
910
|
+
assert children[1].height == 1
|
|
911
|
+
assert children[3].height == 1
|
|
912
|
+
assert children[4].height == 4
|
|
913
|
+
assert isinstance(children[5], VSplit)
|
|
914
|
+
assert children[6].height == 1
|
|
915
|
+
|
|
916
|
+
status_win = children[7]
|
|
917
|
+
assert status_win.width == PREVIEW_BOX_WIDTH
|
|
918
|
+
assert status_win.dont_extend_height() is True
|
|
919
|
+
assert status_win.wrap_lines() is True
|
|
920
|
+
assert state.status == ""
|
|
921
|
+
assert _get_status_text(state) == []
|
|
922
|
+
assert status_win.content.text() == []
|
|
923
|
+
assert status_win.preferred_height(PREVIEW_BOX_WIDTH, 24).preferred == 1
|
|
924
|
+
|
|
925
|
+
state.status = " "
|
|
926
|
+
assert _get_status_text(state) == []
|
|
927
|
+
assert status_win.content.text() == []
|
|
928
|
+
|
|
929
|
+
state.status = "Cancelled."
|
|
930
|
+
assert status_win.content.text() == [
|
|
931
|
+
("reverse", "Cancelled.".center(PREVIEW_BOX_WIDTH))
|
|
932
|
+
]
|
|
933
|
+
|
|
934
|
+
state.status = "a " * 50
|
|
935
|
+
wrapped_status = _get_status_text(state)
|
|
936
|
+
assert wrapped_status[0][0] == "reverse"
|
|
937
|
+
assert "\n" in wrapped_status[0][1]
|
|
938
|
+
wrapped_lines = wrapped_status[0][1].splitlines()
|
|
939
|
+
assert all(len(line) == PREVIEW_BOX_WIDTH for line in wrapped_lines)
|
|
940
|
+
assert wrapped_lines[1].startswith(" ") and wrapped_lines[1].endswith(" ")
|
|
941
|
+
|
|
942
|
+
hotkey_win = children[8]
|
|
943
|
+
assert hotkey_win.height == 1
|
|
944
|
+
assert hotkey_win.content.text == HOTKEY_BAR
|
|
945
|
+
assert len("".join(item[1] for item in HOTKEY_BAR)) == PREVIEW_BOX_WIDTH
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/parameters/custom/test_ecomax_860p4_nm_touch.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/parameters/ecomax_860p4_nm_touch.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/requests/ecomax_service_parameters.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/requests/set_ecomax_service_parameter.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/requests/set_thermostat_parameter.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/responses/ecomax_service_parameters.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyplumio-0.7.7 → pyplumio-0.7.8.post1}/tests/testdata/unknown/unknown_ecomax_parameter.json
RENAMED
|
File without changes
|
|
File without changes
|