-
Notifications
You must be signed in to change notification settings - Fork 0
custom_file_dialog
version: v1.0.8
File dialogs customized by a JSON file.
object CFDType [src]
Singleton object of the type _CFDType, containing the types of custom file dialogs (CFD) defined in the source JSON file.
function get_cfd_types() [src]
def get_cfd_types(fetch_data: bool = False) -> list[str | CFDData]Returns the available custom file dialog (CFD) types.
Parameters:
- fetch_data: A flag requesting the CFDData objects themselves. The default is False.
function merge_json() [src]
def merge_json(path: str) -> NoneTakes an external JSON dialog data file and merges its contents to the package's own file. This way if you create dialogs you can reuse them in another project.
Parameters:
- path: Path to the external JSON dialog data file.
dataclass CFDData [src]
Data describing a configuration for a given custom file dialog (CFD).
Parameters:
- path_id: Unique text identifier of the path.
- window_title: Title to set for the dialog.
- dialog_type: Numeric identifier for open/save file or open directory.
- file_type_filter: String filter for file handler dialogs (e.g. "JSON (*.json)").
- path: Absolute path to start browsing from.
[src]
def __eq__(self, other) -> boolCustom comparison rule, comparing each field.
[src]
def soft_eq(self, other) -> boolCustom soft comparison rule, comparing only the ID.
[src]
@property
def as_dict(self) -> dictReturns a dictionary containing the set values.
[src]
@classmethod
def from_dict(cls, src: dict) -> PathDataReturns an instance built from a dictionary.
Parameters:
- src: A dictionary containing data to build an instance, extracted from the handled JSON file.
function _import_json() [src]
def _import_json(full_id_key: bool = False) -> dict[str, CFDData] | NoneImports data from the handled JSON file.
Parameters:
- full_id_key: A flag marking whether to keep the full ID as key or to format it (default) beforehand.
Returns: A dictionary with keys of path IDs and values of CFDData objects, imported from the handled JSON file (or None if there is no such file).
class _FileDialogDataEditor(QDialog) [src]
An editor for developer use.
[src]
def __init__(self) -> NoneInitializer for the class.
[src]
def _setup_ui(self) -> NoneSets up the user interface: GUI objects and layouts.
[src]
def _setup_connections(self) -> NoneSets up the connections of the GUI objects.
[src]
def _export_json(self) -> NoneExports data to the handled JSON file.
[src]
def _reset_inputs(self) -> NoneResets the input fields to their default values.
[src]
def _slot_new_type_toggled(self) -> NoneSets the visibility of the type selector based on the control combobox.
[src]
def _slot_type_selection_changed(self) -> NoneUpdates the GUI according to the control combobox.
[src]
def _update_type_list_combobox(self) -> NoneUpdates the combobox from the type list.
[src]
def _slot_delete_data(self) -> NoneAttempts to delete the set data, updating the GUI.
[src]
def _slot_export_data(self) -> NoneAdds the set data to the stored dictionary and exports it, updating the GUI.
class _CFDType(metaclass=Singleton) [src]
A class for Enum-like access to custom file dialog (CFD) types.
[src]
def __init__(self) -> NoneInitializer for the class.
[src]
def __getattr__(self, name: str) -> PathData | NoneReturns a CFDData object identified by the passed string if there are CFD types loaded.
Parameters:
- name: The unique identifier of a path.
function custom_dialog() [src]
def custom_dialog(parent: QWidget, cfd_data: CFDData, custom_title: str = None) -> tuple[bool, str | None]Opens a file dialog of the requested type.
Parameters:
- parent: The widget from which the dialog is requested.
- cfd_data: An object defining the appearance and path of the dialog.
- custom_title: A custom title for the dialog. The default is None, which means that the one defined in the 'path_data' is used.
Returns: A tuple containing the success flag and the selected path or None if the selection is unsuccessful.
function write_stub() [src]
def write_stub() -> NoneWrites the stub file to the project directory if it doesn't exist already or if an external stub file directory is set it creates a new stub file there (and deletes the package's own) or overrides the existing one.