qudi.util.uic
This file contains a custom .ui file loader since the current (v5.14.1) Pyside2 implementation or qtpy implementation do not fully allow promotion to a custom widget if the custom widget is not a direct subclass of the base widget defined in the .ui file. For example you can subclass QDoubleSpinBox and promote this to your custom class MyDoubleSpinBox but you can not properly subclass QAbstractSpinBox and promote QDoubleSpinBox (even though QDoubleSpinBox inherits QAbstractSpinBox). Funny enough it works if you use Pyside2’s ui-to-py-converter and run the generated python code. This module provides a wrapper to do just that.
Functions
|
Compiles a given .ui-file at <file_path> into python code. |
- qudi.util.uic.loadUi(file_path, base_widget)[source]
Compiles a given .ui-file at <file_path> into python code. This code will be executed and the generated class will be used to initialize the widget given in <base_widget>. Creates a temporary file in the systems tmp directory using the tempfile module. The original .ui file will remain untouched.
- WARNING: base_widget must be of the same class as the top-level widget in the .ui file.
Compatible subclasses of the top-level widget in the .ui file will also work.
- Parameters:
- str
file_path: The full path to the .ui-file to load
- object
base_widget: Instance of the base widget represented by the .ui-file
- file_path
- base_widget
- Returns: