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