lecore 0.2.1__tar.gz → 0.2.2__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 (80) hide show
  1. {lecore-0.2.1/src/lecore.egg-info → lecore-0.2.2}/PKG-INFO +5 -3
  2. {lecore-0.2.1 → lecore-0.2.2}/README.md +55 -53
  3. {lecore-0.2.1 → lecore-0.2.2}/pyproject.toml +1 -1
  4. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/LeBinDev.py +2 -2
  5. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/ModbusDev.py +10 -0
  6. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/QUICKSTART.md +1 -0
  7. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Scaffold.py +583 -520
  8. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/VisualModbus/AppLogging.py +35 -11
  9. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/VisualModbus/ReadWrite.py +1 -1
  10. {lecore-0.2.1 → lecore-0.2.2/src/lecore.egg-info}/PKG-INFO +5 -3
  11. {lecore-0.2.1 → lecore-0.2.2}/LICENSE +0 -0
  12. {lecore-0.2.1 → lecore-0.2.2}/MANIFEST.in +0 -0
  13. {lecore-0.2.1 → lecore-0.2.2}/setup.cfg +0 -0
  14. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/DeviceBase.py +0 -0
  15. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/PhaseDet/ComSettings.json +0 -0
  16. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/PhaseDet/PhaseDet.py +0 -0
  17. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/PhaseDet/PhaseDetRegs.py +0 -0
  18. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/PhaseDet/PhaseDet_Modbus.json +0 -0
  19. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/PhaseDet/UpgradeSettings.json +0 -0
  20. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/PhaseDet/VisualSettings.json +0 -0
  21. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/PhaseDet/__init__.py +0 -0
  22. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/Rftb/ComSettings.json +0 -0
  23. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/Rftb/Rftb.py +0 -0
  24. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/Rftb/RftbLeBin.py +0 -0
  25. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/Rftb/UpgradeSettings.json +0 -0
  26. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/Rftb/VisualSettings.json +0 -0
  27. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/Rftb/__init__.py +0 -0
  28. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/Rftb/rftbRegs.py +0 -0
  29. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/Rftb/rftb_Modbus.json +0 -0
  30. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/Rftb/rftb_registers.json +0 -0
  31. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/RtdEmul/ComSettings.json +0 -0
  32. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/RtdEmul/RtdEmul.py +0 -0
  33. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/RtdEmul/RtdEmulRegs.py +0 -0
  34. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/RtdEmul/RtdEmul_Modbus.json +0 -0
  35. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/RtdEmul/UpgradeSettings.json +0 -0
  36. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/RtdEmul/VisualSettings.json +0 -0
  37. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/RtdEmul/__init__.py +0 -0
  38. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/Validation.py +0 -0
  39. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/VmsRtd/ComSettings.json +0 -0
  40. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/VmsRtd/UpgradeSettings.json +0 -0
  41. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/VmsRtd/VMS_RTDRegs.py +0 -0
  42. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/VmsRtd/VMS_RTD_Modbus.json +0 -0
  43. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/VmsRtd/VisualSettings.json +0 -0
  44. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/VmsRtd/VmsRtd.py +0 -0
  45. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/VmsRtd/__init__.py +0 -0
  46. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Devices/__init__.py +0 -0
  47. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Doc/ModbusTable.py +0 -0
  48. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Doc/__init__.py +0 -0
  49. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Fg320/Fg320.py +0 -0
  50. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Fg320/__init__.py +0 -0
  51. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/LeBin/RegisterMap.py +0 -0
  52. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/LeBin/SerialCom.py +0 -0
  53. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/LeBin/UpgradeFirmware.py +0 -0
  54. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/LeBin/VisualLeBin.py +0 -0
  55. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/LeBin/__init__.py +0 -0
  56. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/Looger.py +0 -0
  57. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/TestFrame/CoreTest.py +0 -0
  58. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/TestFrame/ModbusUnitTest.py +0 -0
  59. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/TestFrame/RtuClient.py +0 -0
  60. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/TestFrame/Runner.py +0 -0
  61. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/TestFrame/TestUtils.py +0 -0
  62. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/TestFrame/__init__.py +0 -0
  63. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/VisualModbus/Crc32.py +0 -0
  64. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/VisualModbus/HelpAbout.py +0 -0
  65. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/VisualModbus/MbClient.py +0 -0
  66. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/VisualModbus/MbUpgrade.py +0 -0
  67. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/VisualModbus/RegMap.py +0 -0
  68. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/VisualModbus/TextMbApp.py +0 -0
  69. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/VisualModbus/TextMbAppCss.tcss +0 -0
  70. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/VisualModbus/VisualMbApp.py +0 -0
  71. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/VisualModbus/VmSettings.py +0 -0
  72. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/VisualModbus/__init__.py +0 -0
  73. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/__init__.py +0 -0
  74. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/__main__.py +0 -0
  75. {lecore-0.2.1 → lecore-0.2.2}/src/lecore/py.typed +0 -0
  76. {lecore-0.2.1 → lecore-0.2.2}/src/lecore.egg-info/SOURCES.txt +0 -0
  77. {lecore-0.2.1 → lecore-0.2.2}/src/lecore.egg-info/dependency_links.txt +0 -0
  78. {lecore-0.2.1 → lecore-0.2.2}/src/lecore.egg-info/entry_points.txt +0 -0
  79. {lecore-0.2.1 → lecore-0.2.2}/src/lecore.egg-info/requires.txt +0 -0
  80. {lecore-0.2.1 → lecore-0.2.2}/src/lecore.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lecore
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Logic Elements core utilities
5
5
  Author-email: Jan Bartovský <jan.bartovsky@logicelements.cz>
6
6
  License-Expression: MIT
@@ -34,6 +34,7 @@ Dynamic: license-file
34
34
 
35
35
  # LE core package
36
36
 
37
+ [![CI](https://github.com/LogicElements/lecore/actions/workflows/ci.yml/badge.svg)](https://github.com/LogicElements/lecore/actions/workflows/ci.yml)
37
38
  [![PyPI](https://img.shields.io/pypi/v/lecore)](https://pypi.org/project/lecore/)
38
39
  [![Python](https://img.shields.io/pypi/pyversions/lecore)](https://pypi.org/project/lecore/)
39
40
  [![License](https://img.shields.io/pypi/l/lecore)](LICENSE)
@@ -76,11 +77,12 @@ New device class (in the directory with the register map): `python -m lecore new
76
77
 
77
78
  ## Documentation
78
79
 
79
- - [Devices](doc/devices.md) - RTD Emulator, VMS-1502 RTD Meter, Phase Detector, FG-320
80
80
  - [Creating a new device](doc/new-device.md)
81
- - [Looger](doc/looger.md)
81
+ - [Device API](doc/api.md) - Modbus and LeBin device: read, write, firmware upgrade
82
82
  - [User interfaces](doc/user-interfaces.md) - graphical and terminal register browser
83
+ - [Devices](doc/devices.md) - RTD Emulator, VMS-1502 RTD Meter, Phase Detector, FG-320
83
84
  - [Build and release](doc/build.md)
85
+ - [Looger](doc/looger.md)
84
86
 
85
87
  ## License
86
88
 
@@ -1,53 +1,55 @@
1
- # LE core package
2
-
3
- [![PyPI](https://img.shields.io/pypi/v/lecore)](https://pypi.org/project/lecore/)
4
- [![Python](https://img.shields.io/pypi/pyversions/lecore)](https://pypi.org/project/lecore/)
5
- [![License](https://img.shields.io/pypi/l/lecore)](LICENSE)
6
-
7
- Core Python utilities for Logic Elements:
8
- - Looger client
9
- - Proprietary LeBin protocol
10
- - Proprietary Modbus RTU register map handling - VisualModbus
11
- - Test frame
12
- - Logic Elements devices
13
-
14
- ## Install
15
-
16
- Requires Python 3.9 or newer.
17
-
18
- ```
19
- pip install lecore
20
- pip install --upgrade lecore
21
- ```
22
-
23
- Optional extras: `lecore[extra]` (graphical UI, Word documentation) and `lecore[tui]` (terminal UI).
24
-
25
- ## Usage
26
-
27
- ```python
28
- import lecore.Devices.RtdEmul as RE
29
-
30
- # Create RTD emulator object and open communication at COM2 (default is COM1)
31
- rtd = RE.RtdEmul()
32
- rtd.open(comport='COM2')
33
-
34
- # Read serial number
35
- sn = rtd.read(RE.Reg.FACT_SERIAL_NUMBER)
36
-
37
- # Write emulated temperature at output 1
38
- rtd.write(RE.Reg.EMUL_TEMPERATURE_1, 30.5)
39
- ```
40
-
41
- New device class (in the directory with the register map): `python -m lecore new-device MyDevice`, quick guide: `python -m lecore guide`.
42
-
43
- ## Documentation
44
-
45
- - [Devices](doc/devices.md) - RTD Emulator, VMS-1502 RTD Meter, Phase Detector, FG-320
46
- - [Creating a new device](doc/new-device.md)
47
- - [Looger](doc/looger.md)
48
- - [User interfaces](doc/user-interfaces.md) - graphical and terminal register browser
49
- - [Build and release](doc/build.md)
50
-
51
- ## License
52
-
53
- MIT, see [LICENSE](LICENSE).
1
+ # LE core package
2
+
3
+ [![CI](https://github.com/LogicElements/lecore/actions/workflows/ci.yml/badge.svg)](https://github.com/LogicElements/lecore/actions/workflows/ci.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/lecore)](https://pypi.org/project/lecore/)
5
+ [![Python](https://img.shields.io/pypi/pyversions/lecore)](https://pypi.org/project/lecore/)
6
+ [![License](https://img.shields.io/pypi/l/lecore)](LICENSE)
7
+
8
+ Core Python utilities for Logic Elements:
9
+ - Looger client
10
+ - Proprietary LeBin protocol
11
+ - Proprietary Modbus RTU register map handling - VisualModbus
12
+ - Test frame
13
+ - Logic Elements devices
14
+
15
+ ## Install
16
+
17
+ Requires Python 3.9 or newer.
18
+
19
+ ```
20
+ pip install lecore
21
+ pip install --upgrade lecore
22
+ ```
23
+
24
+ Optional extras: `lecore[extra]` (graphical UI, Word documentation) and `lecore[tui]` (terminal UI).
25
+
26
+ ## Usage
27
+
28
+ ```python
29
+ import lecore.Devices.RtdEmul as RE
30
+
31
+ # Create RTD emulator object and open communication at COM2 (default is COM1)
32
+ rtd = RE.RtdEmul()
33
+ rtd.open(comport='COM2')
34
+
35
+ # Read serial number
36
+ sn = rtd.read(RE.Reg.FACT_SERIAL_NUMBER)
37
+
38
+ # Write emulated temperature at output 1
39
+ rtd.write(RE.Reg.EMUL_TEMPERATURE_1, 30.5)
40
+ ```
41
+
42
+ New device class (in the directory with the register map): `python -m lecore new-device MyDevice`, quick guide: `python -m lecore guide`.
43
+
44
+ ## Documentation
45
+
46
+ - [Creating a new device](doc/new-device.md)
47
+ - [Device API](doc/api.md) - Modbus and LeBin device: read, write, firmware upgrade
48
+ - [User interfaces](doc/user-interfaces.md) - graphical and terminal register browser
49
+ - [Devices](doc/devices.md) - RTD Emulator, VMS-1502 RTD Meter, Phase Detector, FG-320
50
+ - [Build and release](doc/build.md)
51
+ - [Looger](doc/looger.md)
52
+
53
+ ## License
54
+
55
+ MIT, see [LICENSE](LICENSE).
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "lecore"
7
7
  description = "Logic Elements core utilities"
8
- version = "0.2.1"
8
+ version = "0.2.2"
9
9
  authors = [
10
10
  { name="Jan Bartovský", email="jan.bartovsky@logicelements.cz" },
11
11
  ]
@@ -228,8 +228,8 @@ class LeBinDev(DeviceBase):
228
228
  check_file(file, "File to send")
229
229
  # Run upgrade procedure
230
230
  self._upg.load_file(file)
231
- ret = self._upg.run()
232
- return ret == 0
231
+ # LeBin upgrade returns True on success (unlike Modbus return code 0)
232
+ return bool(self._upg.run())
233
233
 
234
234
  def _visual(self) -> None:
235
235
  """
@@ -190,6 +190,16 @@ class ModbusDev(DeviceBase):
190
190
  self.close()
191
191
  return self._vis.handle(timeout)
192
192
 
193
+ def enable_log(self, enable: bool = True, directory: Optional[PathLike] = None) -> None:
194
+ """
195
+ Enable or disable logging of communication into file (disabled by default)
196
+ :param enable: True to enable, False to disable logging into file
197
+ :param directory: Directory of log files, default 'log/' in current working directory
198
+ """
199
+ if self._vis is None:
200
+ raise RuntimeError(f"{type(self).__name__}: device is not initialized")
201
+ self._vis.log.enable_file(enable, directory)
202
+
193
203
  def textual(self) -> None:
194
204
  """
195
205
  Run textual user interface application
@@ -29,6 +29,7 @@ Python API: `lecore.new_device("MyDevice", directory=".", ...)` returns `{path:
29
29
  | `VisualSettings.json` | created if missing (Modbus only) - GUI settings incl. default `slave_address` |
30
30
  | `__init__.py` | created if missing - exports device class, register class and alias `Reg`; existing one is not changed |
31
31
  | `__main__.py` | created if missing - command line: `python -m <package> [--comport COM5] [--slave 3] [--read NAME ...] [--list] [--gui \| --tui]` |
32
+ | `CLAUDE.md` | created if missing - short API and command line notes (Modbus/LeBin) for AI assistants; existing one is not changed |
32
33
 
33
34
  Run it from the package directory as `python . [options]`, or from its parent as `python -m mydevice [options]`;
34
35
  without options all registers are read and printed. `python MyDevice.py` does not work (relative imports).