SSST - SunSpec Service Tool¶
Resources¶
Introduction¶
This is an exploratory application using QTrio. In general, it will provide visually laid out widgets for data dashboards. The data will be read and set over Modbus TCP using the SunSpec high level protocol.
Installation¶
This application is not yet published to PyPI nor built into directly runnable packages. It is installable via either cloning and installing or directly via the Git repository. When installing the Python package itself, it is recommended to work in a virtual environment. For a quick introduction, see Python Virtual Environments in Five Minutes.
$ myvenv/bin/pip install git+https://github.com/altendky/ssst
$ myvenv/scripts/pip install git+https://github.com/altendky/ssst
Running¶
Two main means of launching the application are provided.
A directly runnable console script and a Python module runnable using python -m
.
$ myvenv/bin/ssst gui
$ myvenv/bin/python -m ssst gui
$ myvenv/scripts/ssst gui
$ myvenv/scripts/python -m ssst gui
Exceptions¶
-
class
ssst.
SsstError
¶ Bases:
Exception
The base for all SSST errors. Not to be raised directly, but could be used if you want to catch any except this program may explicitly raise.
-
class
ssst.
InternalError
¶ Bases:
ssst.SsstError
Raised when things that should not happen do, and they aren’t the user’s fault.
-
class
ssst.
QtWrapperError
¶ Bases:
ssst.SsstError
To be used for any error related to dealing with qts that doesn’t get a dedicated exception type.
-
class
ssst.
ReuseError
(cls)¶ Bases:
ssst.SsstError
Some widgets are not meant for reuse and will raise this error when reuse is attempted.
-
class
ssst.
UnexpectedEmissionError
(emission)¶ Bases:
ssst.InternalError
Like an
ssst.InternalError
, but specifically for emissions that we didn’t expect.
CLI¶
-
ssst.cli.
cli
(*args, **kwargs)¶ SunSpec Service Tool (SSST)
For Modbus TCP SunSpec access.
-
ssst.cli.
gui
(*args, **kwargs)¶ Launch the main GUI application.
-
ssst.cli.
uic
(*args, **kwargs)¶ Compile the Qt UI files. This is generally not a thing you need to do outside of development.
Release History¶
Utilities¶
Qt Wrapper¶
-
class
ssst._utilities.
QtApis
(value)[source]¶ Bases:
enum.Enum
Supported Qt APIs. Values correspond to qts names for each. Generally used as a parameter to
ssst._utilities.configure_qt_wrapper()
.-
PyQt5
= 'pyqt5'¶ PyQt5 by Riverbank Computing
-
PySide2
= 'pyside2'¶ PySide2 by Qt
-
-
ssst._utilities.
configure_qt_wrapper
(api)[source]¶ Set the configuration such that qts will use the specified Qt wrapper API.
-
ssst._utilities.
qt_api_variable_name
= 'QTS_WRAPPER'¶ The name of the environment variable qts checks for selecting the desired Qt wrapper API.
Console Scripts¶
-
ssst._utilities.
scripts_path
()[source]¶ Get the path where console and GUI scripts are created. For example, in Linux this may be
env/bin/
and on Windows perhapsenv/scripts/
. Usessysconfig.get_path()
.- Return type
- Returns
The scripts directory path.
- Raises
ssst.InternalError – if
sysconfig.get_path()
returnsNone
.
UI Compilation¶
-
ssst._utilities.
compile_ui
(directory_path=(PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/ssst/envs/latest/lib/python3.8/site-packages/ssst')), output=None)[source]¶ Compile the specified Qt UI files to Python source that can be imported and used. The files are found by searching the passed directory path for
*.ui
files which are compiled to*_ui.py
within the same directory.
-
ssst._utilities.
generic_compile_ui
(file_paths=(), directory_paths=(), extension='.ui', suffix='_ui', encoding='utf-8', output=None)[source]¶ Compile the specified Qt UI files to Python source. In addition to the passed file paths, the passed directory paths are searched to find additional files to compile. The search is done based on the passed extension. Taking the default
".ui"
extension and"_ui"
suffix for the sake of an example, an input file such asx.ui
will be output asx_ui.py
in the same directory. The passed encoding is used when writing the Python file.If not
None
, the passed output callable will be used likeprint()
to produce any output.- Parameters
file_paths (
Sequence
[Path
]) – Paths to individual UI files to be compiled.directory_paths (
Sequence
[Path
]) – Paths of directories to be searched for UI files to compile.extension (
str
) – The extension used to identify UI files when searching.suffix (
str
) – The suffix to add to the stem of the UI file when creating the Python file names.encoding (
str
) – The encoding to use when writing the Python files.output (
Optional
[Callable
[…,object
]]) – The function to call when there is output that would normally be printed.
- Return type
-
ssst._utilities.
compile_paths
(ui_paths, suffix='_ui', encoding='utf-8', output=None)[source]¶ Compile the passed UI paths to Python files. The passed suffix will be added to the stem of each file compiled and the extension changed to
.py
to create the output file name within the same directory. The passed encoding will be used when writing the Python file.- Parameters
ui_paths (
Sequence
[Path
]) – The UI files to compile to Python.suffix (
str
) – The suffix to add to the stem when creating the Python file name.encoding (
str
) – The encoding to use when writing the Python file.output (
Optional
[Callable
[…,object
]]) – Theprint()
-alike output function to call.None
results in no output.
- Raises
ssst.QtWrapperError – If the
qts
module is not already imported and the import has not been forced.- Return type