UI Dialogs
karcytics_sdk.plugin.dialogs
Dialog utilities for Karcytics SDK.
Provides convenient wrappers for common PySide6 file dialogs and message boxes that work with the current theme.
SaveWorkflowDialog
Bases: QDialog
Dialog to capture metadata before saving a workflow.
Source code in src/karcytics_sdk/plugin/dialogs.py
get_metadata()
Extracts and formats the user input.
Source code in src/karcytics_sdk/plugin/dialogs.py
ask_ok_cancel(parent=None, title='', message='')
Show OK/Cancel dialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Parent widget |
None
|
|
title
|
str
|
Dialog title |
''
|
message
|
str
|
Dialog message |
''
|
Returns:
| Type | Description |
|---|---|
bool
|
True if user clicks OK, False otherwise |
Source code in src/karcytics_sdk/plugin/dialogs.py
ask_yes_no(parent=None, title='', message='')
Show yes/no question dialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Parent widget |
None
|
|
title
|
str
|
Dialog title |
''
|
message
|
str
|
Dialog message |
''
|
Returns:
| Type | Description |
|---|---|
bool
|
True if user clicks Yes, False otherwise |
Source code in src/karcytics_sdk/plugin/dialogs.py
bring_into_project(parent, path)
path, registered with the open project after offering to copy it into its assets.
A file chosen from outside the project would be left behind when the project moves to another computer, so the user is asked whether to copy it into the project's 'assets' folder. It is registered with the project either way (copied, or referenced where it is).
Returns the path to use (the copy's when it was copied), path itself
when no project is open, or None when the project couldn't take it (a
warning says why), so the caller can stop.
Source code in src/karcytics_sdk/plugin/dialogs.py
confirm_destructive(parent, title, message, items=())
Ask before an action that also affects other things, listing them.
For "deleting X also deletes its 3 children" or "rename in 5 samples": the message, then the affected items as a bulleted list (the first six and a count of the rest), with No as the default answer.
Returns:
| Type | Description |
|---|---|
bool
|
True if the user clicks Yes. |
Source code in src/karcytics_sdk/plugin/dialogs.py
get_directory(parent=None, title='Select Directory', start_dir='')
Show directory selection dialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Parent widget |
None
|
|
title
|
str
|
Dialog title |
'Select Directory'
|
start_dir
|
str
|
Initial directory |
''
|
Returns:
| Type | Description |
|---|---|
str | None
|
Selected directory path or None if cancelled |
Source code in src/karcytics_sdk/plugin/dialogs.py
get_double(parent=None, title='', label='', value=0.0, min_val=-999.99, max_val=999.99, decimals=2)
Show float input dialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Parent widget |
None
|
|
title
|
str
|
Dialog title |
''
|
label
|
str
|
Label text |
''
|
value
|
float
|
Default value |
0.0
|
min_val
|
float
|
Minimum allowed value |
-999.99
|
max_val
|
float
|
Maximum allowed value |
999.99
|
decimals
|
int
|
Number of decimal places |
2
|
Returns:
| Type | Description |
|---|---|
float | None
|
User input or None if cancelled |
Source code in src/karcytics_sdk/plugin/dialogs.py
get_image_path(parent=None, title='Select Image', start_dir='')
Show file dialog to select an image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Parent widget |
None
|
|
title
|
str
|
Dialog title |
'Select Image'
|
start_dir
|
str
|
Initial directory (default: the open project's assets folder) |
''
|
Returns:
| Type | Description |
|---|---|
str | None
|
Selected file path or None if cancelled |
Source code in src/karcytics_sdk/plugin/dialogs.py
get_image_paths(parent=None, title='Select Images', start_dir='')
Show file dialog to select multiple images.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Parent widget |
None
|
|
title
|
str
|
Dialog title |
'Select Images'
|
start_dir
|
str
|
Initial directory (default: the open project's assets folder) |
''
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of selected file paths |
Source code in src/karcytics_sdk/plugin/dialogs.py
get_number(parent=None, title='', label='', value=0, min_val=-999999, max_val=999999)
Show integer input dialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Parent widget |
None
|
|
title
|
str
|
Dialog title |
''
|
label
|
str
|
Label text |
''
|
value
|
int
|
Default value |
0
|
min_val
|
int
|
Minimum allowed value |
-999999
|
max_val
|
int
|
Maximum allowed value |
999999
|
Returns:
| Type | Description |
|---|---|
int | None
|
User input or None if cancelled |
Source code in src/karcytics_sdk/plugin/dialogs.py
get_save_path(parent=None, title='Save As', start_dir='', file_filter='')
Show save file dialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Parent widget |
None
|
|
title
|
str
|
Dialog title |
'Save As'
|
start_dir
|
str
|
Initial directory |
''
|
file_filter
|
str
|
Qt file filter string (e.g. "CSV Files (.csv);;All Files ()") |
''
|
Returns:
| Type | Description |
|---|---|
str | None
|
Selected file path or None if cancelled |
Source code in src/karcytics_sdk/plugin/dialogs.py
get_text(parent=None, title='', label='', default='')
Show text input dialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Parent widget |
None
|
|
title
|
str
|
Dialog title |
''
|
label
|
str
|
Label text |
''
|
default
|
str
|
Default value in text field |
''
|
Returns:
| Type | Description |
|---|---|
str | None
|
User input or None if cancelled |
Source code in src/karcytics_sdk/plugin/dialogs.py
import_assets_workflow(parent, project_manager, file_paths)
Orchestrates the multi-file import workflow as requested by the user.
- If multiple files, asks if they should be grouped in a subdirectory.
- Asks once for 'Copy to Workspace' for the entire batch.
- Executes the batch import via ProjectManager.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of file hashes for the imported assets. |
Source code in src/karcytics_sdk/plugin/dialogs.py
project_assets_dir(widget=None)
The open project's assets folder, as widget's window knows it ("" with no project).
The Hub (and an isolated plugin's runtime) sets project_manager on the
plugin's window; its assets_dir is where a project's images live.
Source code in src/karcytics_sdk/plugin/dialogs.py
show_error(parent=None, title='Error', message='')
Show error dialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Parent widget |
None
|
|
title
|
str
|
Dialog title |
'Error'
|
message
|
str
|
Dialog message |
''
|
Source code in src/karcytics_sdk/plugin/dialogs.py
show_info(parent=None, title='Information', message='')
Show information dialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Parent widget |
None
|
|
title
|
str
|
Dialog title |
'Information'
|
message
|
str
|
Dialog message |
''
|
Source code in src/karcytics_sdk/plugin/dialogs.py
show_warning(parent=None, title='Warning', message='')
Show warning dialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
Parent widget |
None
|
|
title
|
str
|
Dialog title |
'Warning'
|
message
|
str
|
Dialog message |
''
|