himena.widgets
BackendMainWindow
Source code in src\himena\widgets\_backend.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
|
add_dock_widget(widget, title, area=DockArea.RIGHT, allowed_areas=None)
Add a dock widget containing the widget to the main window.
Return the backend dock widget.
Source code in src\himena\widgets\_backend.py
222 223 224 225 226 227 228 229 230 231 232 |
|
add_tab(title)
Add a empty tab with the title.
Source code in src\himena\widgets\_backend.py
219 220 |
|
add_widget(widget, i_tab, title)
Add a sub window containing the widget to the tab at the index.
Return the backend widget.
Source code in src\himena\widgets\_backend.py
210 211 212 213 214 |
|
set_widget_as_preview(widget)
Set the widget state as the preview mode.
Source code in src\himena\widgets\_backend.py
216 217 |
|
show(run=False)
Show the main window and run the app immediately if run
is True
Source code in src\himena\widgets\_backend.py
251 252 |
|
DockWidget
Dock widget wrapper.
Source code in src\himena\widgets\_wrapper.py
955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 |
|
title
property
writable
Title of the dock widget.
visible
property
writable
Visibility of the dock widget.
hide()
Hide the dock widget.
Source code in src\himena\widgets\_wrapper.py
989 990 991 |
|
show()
Show the dock widget.
Source code in src\himena\widgets\_wrapper.py
985 986 987 |
|
update_configs(cfg)
Update the configuration of the dock widget.
Source code in src\himena\widgets\_wrapper.py
1012 1013 1014 1015 1016 1017 1018 |
|
MainWindow
The main window handler object.
Source code in src\himena\widgets\_main_window.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 |
|
app_profile
property
Get the current application profile object.
area_size
property
(width, height) of the main window tab area.
clipboard
property
writable
Get the clipboard data as a ClipboardDataModel instance.
current_model
property
Get the current model of the active sub-window.
current_window
property
writable
Get the current sub-window.
dock_widgets
property
Dock widget list object.
events
property
Main window events.
model_app
property
The app-model application instance.
object_type_map
property
Mapping object to string that describes the type.
rect
property
writable
Window rect (left, top, width, height) of the main window.
size
property
writable
Size (width, height) of the main window.
socket_info
property
Socket information.
tabs
property
Tab list object.
theme
property
writable
Get the current color theme of the main window.
add_data_model(model_data)
Add a widget data model as a widget.
Source code in src\himena\widgets\_main_window.py
416 417 418 419 |
|
add_dock_widget(widget, *, title=None, area=DockArea.RIGHT, allowed_areas=None, _identifier=None)
Add a custom widget as a dock widget of the main window.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
widget
|
Widget type
|
Widget instance that is allowed for the backend. |
required |
title
|
str
|
Title of the dock widget. |
None
|
area
|
dock area
|
String or DockArea enum that describes where the dock widget initially appears. |
DockArea.RIGHT
|
allowed_areas
|
list of dock area
|
List of allowed dock areas for the widget. |
None
|
Returns:
Type | Description |
---|---|
DockWidget
|
The dock widget handler. |
Source code in src\himena\widgets\_main_window.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
|
add_function(func, *, preview=False, title=None, show_parameter_labels=True, auto_close=True, run_async=False, result_as='window')
Add a function as a parametric sub-window.
The input function must return a WidgetDataModel
instance, which can be
interpreted by the application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func
|
function (...) -> WidgetDataModel
|
Function that generates a model from the input parameters. |
required |
title
|
str
|
Title of the sub-window. |
None
|
Returns:
Type | Description |
---|---|
SubWindow
|
The sub-window instance that represents the output model. |
Source code in src\himena\widgets\_main_window.py
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 |
|
add_object(value, *, type=None, title=None, force_open_with=None, metadata=None)
Add any data as a widget data model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
Any
|
Any object. Whether it can be represented as a widget is dependent on the plugins that are installed. |
required |
type
|
str
|
Any str that describes the type of the object. This type must be registered with a proper widget class. |
None
|
title
|
str
|
Title of the sub-window. |
None
|
Returns:
Type | Description |
---|---|
SubWindow
|
The sub-window handler. |
Source code in src\himena\widgets\_main_window.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 |
|
add_tab(title=None)
Add a new tab of given name.
Source code in src\himena\widgets\_main_window.py
268 269 270 |
|
add_widget(widget, *, title=None)
Add a widget to the sub window.
Any widget that can be interpreted by the backend can be added. For example, for Qt application, you can add any QWidget instance:
ui.add_widget(QtW.QLabel("Hello world!"), title="my widget!")
Parameters:
Name | Type | Description | Default |
---|---|---|---|
widget
|
Any
|
Widget to add. |
required |
title
|
str
|
Title of the sub-window. If not given, its name will be automatically generated. |
None
|
Returns:
Type | Description |
---|---|
SubWindow
|
The sub-window handler. |
Source code in src\himena\widgets\_main_window.py
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
|
clear()
Clear all widgets in the main window.
Source code in src\himena\widgets\_main_window.py
532 533 534 535 536 |
|
close()
Close the main window.
Source code in src\himena\widgets\_main_window.py
833 834 835 836 837 |
|
exec_action(id, *, model_context=None, window_context=None, with_params=None, process_model_output=True)
Execute an action by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
Action ID. |
required |
model_context
|
WidgetDataModel
|
If given, this model will override the application context for the type
|
None
|
window_context
|
SubWindow
|
If given, this window will override the application context for the type
|
None
|
with_params
|
dict
|
Parameters to pass to the parametric action. These parameters will directly be passed to the parametric window created after the action is executed. |
None
|
process_model_output
|
bool
|
If True, the output result will be processed by the application context. If
the command return a |
True
|
Source code in src\himena\widgets\_main_window.py
641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 |
|
exec_choose_one_dialog(title, message, choices, how='buttons')
exec_choose_one_dialog(title: str, message: str, choices: list[tuple[str, _T]], how: Literal['buttons', 'radiobuttons'] = 'buttons') -> _T | None
exec_choose_one_dialog(title: str, message: str, choices: list[str], how: Literal['buttons', 'radiobuttons'] = 'buttons') -> str | None
Execute a dialog to choose one from the given choices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title
|
str
|
Window title of the dialog. |
required |
message
|
str
|
HTML Message to show in the dialog. |
required |
choices
|
list
|
List of choices. Each choice can be a string or a tuple of (text, value). This method will return the selected value. |
required |
how
|
str
|
How to show the choices. "buttons" for horizontal buttons, "radiobuttons" for vertically arranged radio buttons. |
"buttons"
|
Source code in src\himena\widgets\_main_window.py
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 |
|
exec_file_dialog(mode='r', *, extension_default=None, allowed_extensions=None, caption=None, start_path=None, group=None)
exec_file_dialog(mode: Literal['r', 'd', 'w'] = 'r', *, extension_default: str | None = None, allowed_extensions: list[str] | None = None, caption: str | None = None, start_path: str | Path | None = None, group: str | None = None) -> Path | None
exec_file_dialog(mode: Literal['rm'], *, extension_default: str | None = None, allowed_extensions: list[str] | None = None, caption: str | None = None, start_path: str | Path | None = None, group: str | None = None) -> list[Path] | None
Execute a file dialog to get file path(s).
Source code in src\himena\widgets\_main_window.py
779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 |
|
iter_windows()
Iterate over all the sub-windows in this main window.
Source code in src\himena\widgets\_main_window.py
875 876 877 878 |
|
load_session(path)
Read a session file and update the main window based on the content.
Source code in src\himena\widgets\_main_window.py
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
|
move_window(sub, target_index)
Move the sub-window to the target tab index.
Source code in src\himena\widgets\_main_window.py
898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 |
|
read_file(file_path, plugin=None)
Read local file(s) and open as a new sub-window.
Source code in src\himena\widgets\_main_window.py
474 475 476 477 478 479 480 481 |
|
read_files(file_paths)
Read multiple files one by one and open as new sub-windows in a same tab.
Source code in src\himena\widgets\_main_window.py
483 484 485 486 |
|
read_files_async(file_paths, plugin=None)
Read multiple files asynchronously and open as new sub-windows.
Source code in src\himena\widgets\_main_window.py
488 489 490 491 |
|
register_function(func=None, *, menus='plugins', title=None, types=None, enablement=None, keybindings=None, command_id=None)
register_function(func: None = None, *, menus: str | Sequence[str] = 'plugins', title: str | None = None, types: str | Sequence[str] | None = None, enablement: BoolOp | None = None, keybindings: Sequence[KeyBindingRule] | None = None, command_id: str | None = None) -> None
register_function(func: _F, *, menus: str | Sequence[str] = 'plugins', title: str | None = None, types: str | Sequence[str] | None = None, enablement: BoolOp | None = None, keybindings: Sequence[KeyBindingRule] | None = None, command_id: str | None = None) -> _F
Register a function as a callback in runtime.
Example
@ui.register_function(menus="plugins", title="Test functions)
def test_function():
print("test")
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func
|
callable
|
Function to register as an action. |
None
|
menus
|
str or sequence of str
|
Menu(s) to add the action. Submenus are separated by |
"plugins"
|
title
|
str
|
Title of the action. Name of the function will be used if not given. |
None
|
types
|
The |
None
|
|
enablement
|
Expression that describes when the action will be enabled. As this argument
is a generalized version of |
None
|
|
command_id
|
str
|
Command ID. If not given, the function qualname will be used. |
None
|
Source code in src\himena\widgets\_main_window.py
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 |
|
save_session(path, *, save_copies=False, allow_calculate=())
Save the current session to a zip file as a stand-along file.
Source code in src\himena\widgets\_main_window.py
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 |
|
set_clipboard(*, text=None, html=None, image=None, files=None, internal_data=None)
Set clipboard data.
Source code in src\himena\widgets\_main_window.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
|
set_status_tip(text, duration=10.0)
Set the status tip of the main window.
This method can be safely called from any thread.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Text to show in the status bar. |
required |
duration
|
float
|
Duration (seconds) to show the status tip. |
10.0
|
Source code in src\himena\widgets\_main_window.py
538 539 540 541 542 543 544 545 546 547 548 549 550 551 |
|
show(run=False)
Show the main window.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run
|
bool
|
If True, run the application event loop. |
False
|
Source code in src\himena\widgets\_main_window.py
821 822 823 824 825 826 827 828 829 830 831 |
|
submit_async_task(func, *args, progress_description=None, **kwargs)
Submit a task to the thread pool.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func
|
callable
|
Function to run in the background. |
required |
progress_description
|
str
|
Description of the task in the progress bar. |
None
|
Source code in src\himena\widgets\_main_window.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
|
window_for_id(identifier)
Retrieve a sub-window by its identifier.
Source code in src\himena\widgets\_main_window.py
272 273 274 275 276 277 278 279 |
|
windows_for_type(types)
Get all sub-windows for the given types.
Source code in src\himena\widgets\_main_window.py
181 182 183 184 185 186 187 188 189 190 191 |
|
ParametricWindow
Subwindow with a parametric widget inside.
Source code in src\himena\widgets\_wrapper.py
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 |
|
get_params()
Get the parameters of the widget.
Source code in src\himena\widgets\_wrapper.py
663 664 665 666 667 668 669 670 671 672 673 674 |
|
is_preview_enabled()
Whether the widget supports preview.
Source code in src\himena\widgets\_wrapper.py
898 899 900 901 |
|
SubWindow
Source code in src\himena\widgets\_wrapper.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 |
|
is_alive
property
Whether the sub-window is present in a main window.
rect
property
writable
Position and size of the sub-window.
state
property
writable
State (e.g. maximized, minimized) of the sub-window.
tab_area
property
Tab area of the sub-window.
title
property
writable
Title of the sub-window.
add_child(widget, *, title=None)
Add a child sub-window, which is automatically closed when the parent is closed.
Source code in src\himena\widgets\_wrapper.py
510 511 512 513 514 515 516 517 518 519 520 521 |
|
to_model()
Export the widget data.
Source code in src\himena\widgets\_wrapper.py
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
|
update(*, rect=None, state=None, title=None, anchor=None)
A helper method to update window properties.
Source code in src\himena\widgets\_wrapper.py
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 |
|
update_metadata(metadata)
Update the metadata of the widget data model.
Source code in src\himena\widgets\_wrapper.py
379 380 381 |
|
update_value(value)
Update the value of the widget.
Source code in src\himena\widgets\_wrapper.py
371 372 373 374 375 376 377 |
|
write_model(path, plugin=None)
Write the widget data to a file.
Source code in src\himena\widgets\_wrapper.py
383 384 385 |
|
TabArea
An area containing multiple sub-windows.
Source code in src\himena\widgets\_widget_list.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 |
|
current_index
property
writable
Get the index of the current sub-window.
layouts
property
List of layouts in the tab area.
name
property
Name of the tab area.
title
property
Title of the tab area.
add_data_model(model)
Add a widget data model as a widget.
Source code in src\himena\widgets\_widget_list.py
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
|
add_function(func, *, preview=False, title=None, show_parameter_labels=True, auto_close=True, run_async=False, result_as='window')
Add a function as a parametric sub-window.
The input function must return a WidgetDataModel
instance, which can be
interpreted by the application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func
|
function (...) -> WidgetDataModel
|
Function that generates a model from the input parameters. |
required |
preview
|
bool
|
If true, the parametric widget will be implemented with a preview toggle button, and the preview window will be created when it is enabled. |
False
|
title
|
str
|
Title of the parametric window. |
None
|
show_parameter_labels
|
bool
|
If true, the parameter labels will be shown in the parametric window. |
True
|
auto_close
|
bool
|
If true, close the parametric window after the function call. |
True
|
Returns:
Type | Description |
---|---|
SubWindow
|
The sub-window instance that represents the output model. |
Source code in src\himena\widgets\_widget_list.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
|
add_hbox_layout(*, margins=(0, 0, 0, 0), spacing=0)
Add a horizontal box layout to the tab area.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
margins
|
(int, int, int, int) or Margins
|
Left, top, right and bottom margins of the layout. |
(0, 0, 0, 0)
|
spacing
|
int
|
Spacing between the widgets. |
0
|
Source code in src\himena\widgets\_widget_list.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 |
|
add_parametric_widget(widget, callback=None, *, title=None, preview=False, auto_close=True, auto_size=True, run_async=False, result_as='window')
Add a custom parametric widget and its callback as a subwindow.
This method creates a parametric window inside the workspace, so that the calculation can be done with the user-defined parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
widget
|
_W
|
The parametric widget implemented with |
required |
callback
|
callable
|
The callback function that will be called with the parameters set by the widget. |
None
|
title
|
str
|
Title of the window to manage parameters. |
None
|
preview
|
bool
|
If true, the parametric widget will be check for whether preview is enabled everytime the parameter changed, and if preview is enabled, a preview window is created to show the preview result. |
False
|
auto_close
|
bool
|
If true, close the parametric window after the function call. |
True
|
auto_size
|
bool
|
If true, the output window will be auto-sized to the size of the parametric window. |
True
|
Returns:
Type | Description |
---|---|
ParametricWindow[_W]
|
A wrapper containing the backend widget. |
Source code in src\himena\widgets\_widget_list.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
|
add_vbox_layout(*, margins=(0, 0, 0, 0), spacing=0)
Add a vertical box layout to the tab area.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
margins
|
(int, int, int, int) or Margins
|
Left, top, right and bottom margins of the layout. |
(0, 0, 0, 0)
|
spacing
|
int
|
Spacing between the widgets. |
0
|
Source code in src\himena\widgets\_widget_list.py
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
|
add_widget(widget, *, title=None, auto_size=True)
Add a widget to the sub window.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
widget
|
QWidget
|
Widget to add. |
required |
title
|
str
|
Title of the sub-window. If not given, its name will be automatically generated. |
None
|
Returns:
Type | Description |
---|---|
SubWindow
|
A sub-window widget. The added widget is available by calling
|
Source code in src\himena\widgets\_widget_list.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
append(sub_window, title)
Append a sub-window to the tab area.
Source code in src\himena\widgets\_widget_list.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
current(default=None)
Get the current sub-window or a default value.
Source code in src\himena\widgets\_widget_list.py
185 186 187 188 189 190 191 192 193 |
|
read_file(file_path, plugin=None)
Read local file(s) and open as a new sub-window in this tab.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path
|
str or Path or list of them
|
Path(s) to the file to read. If a list is given, they will be read as a group, not as separate windows. |
required |
plugin
|
str
|
If given, reader provider will be searched with the plugin name. This value
is usually the full import path to the reader provider function, such as
|
None
|
Returns:
Type | Description |
---|---|
SubWindow
|
The sub-window instance that is constructed based on the return value of the reader. |
Source code in src\himena\widgets\_widget_list.py
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
|
read_files(file_paths, plugin=None)
Read multiple files and open as new sub-windows in this tab.
Source code in src\himena\widgets\_widget_list.py
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
|
read_files_async(file_paths, plugin=None)
Read multiple files asynchronously and return a future.
Source code in src\himena\widgets\_widget_list.py
534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 |
|
save_session(file_path, save_copies=False, allow_calculate=())
Save the current session to a file.
Source code in src\himena\widgets\_widget_list.py
550 551 552 553 554 555 556 557 558 559 560 561 562 |
|
append_result(item)
Append a new result to the result stack.
Source code in src\himena\widgets\_functions.py
58 59 60 61 62 |
|
current_instance(name=None)
Get current instance of the main window (raise if not exists).
Source code in src\himena\widgets\_initialize.py
32 33 34 35 36 |
|
get_clipboard()
Get the current clipboard data.
Source code in src\himena\widgets\_functions.py
19 20 21 |
|
notify(text, duration=5.0)
Show a notification popup in the bottom right corner.
Source code in src\himena\widgets\_functions.py
51 52 53 54 55 |
|
remove_instance(name, instance)
Remove the instance from the list.
Source code in src\himena\widgets\_initialize.py
57 58 59 60 61 62 63 64 65 66 |
|
set_clipboard(model=None, **kwargs)
set_clipboard(*, text: str | None = None, html: str | None = None, image: Any | None = None, files: list[str | Path] | None = None, interanal_data: Any | None = None) -> None
set_clipboard(model: ClipboardDataModel) -> None
Set data to clipboard.
Source code in src\himena\widgets\_functions.py
39 40 41 42 43 44 45 46 47 48 |
|
set_current_instance(name, instance)
Set the instance as the current one.
Source code in src\himena\widgets\_initialize.py
39 40 41 42 43 44 45 46 |
|
set_status_tip(text, duration=10.0)
Set a status tip to the current main window for duration (second).
Source code in src\himena\widgets\_functions.py
10 11 12 13 14 15 16 |
|