views
AYON Views subpackage.
Saved configurations (columns, sort, filter, grouping…) that can be applied to a :class:PaginatedTableModel + :class:AYTableView / :class:AYCardView setup.
Phase 1 ships the data model and storage backend. Phase 2 adds the :class:ViewBindings adapter and the :class:AYViewSelector / :class:AYViewEditor widgets.
AYViewEditor
Bases: QDialog
Modal editor for the metadata fields of a :class:View.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view | View | The :class: | required |
current_user | str | User identifier of the editor. Used to gate the studio scope when applicable. | '' |
allow_studio_scope | bool | Whether | False |
usernames_and_groups | dict[str, list] | None | Users and access groups offered in the "People with access" selector. | None |
allow_sharing | bool | Whether the "People with access" section is shown. When False the view's access is left unchanged. | True |
parent | QWidget | None | Optional parent widget. | None |
Source code in client/ayon_core/ui/components/views/view_editor.py
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 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 | |
Mode
Bases: IntEnum
Dialog mode: create or edit.
Source code in client/ayon_core/ui/components/views/view_editor.py
69 70 71 72 73 | |
delete_requested()
Whether the user requested deletion of the view.
Source code in client/ayon_core/ui/components/views/view_editor.py
608 609 610 | |
get_view()
Return the edited :class:View.
The original :attr:View.settings, :attr:View.id, :attr:View.view_type, :attr:View.owner, :attr:View.access, :attr:View.position and :attr:View.extra are kept intact; only the metadata edited in this dialog is mutated.
Returns:
| Type | Description |
|---|---|
View | The (mutated) original :class: |
Source code in client/ayon_core/ui/components/views/view_editor.py
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 | |
mode()
Return the dialog mode: create or edit.
Source code in client/ayon_core/ui/components/views/view_editor.py
604 605 606 | |
AYViewSelector
Bases: AYButtonMenu
Icon button exposing the Views feature.
Public API:
- :meth:
set_view_type— switch the view-type identifier and reload. - :meth:
refresh— re-pull the view list from the manager. - :meth:
current_view— return the active :class:View(orNone).
Signals
view_applied(View): Emitted after a view has been applied to the bindings. view_saved(View): Emitted after a view has been persisted. view_deleted(str): Emitted with the view id after deletion. view_modified(str, bool): Emitted when the live UI no longer matches the loaded view settings, or when it returns to the saved state. Payload is (current_view_name, modified). binding_error(str, str): Emitted with (stage, message) when :class:ViewBindings reports a non-fatal failure while applying or capturing a view.
Source code in client/ayon_core/ui/components/views/view_selector.py
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 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 | |
apply_default_settings()
Reset every tracked setting to the built-in AYON defaults.
Used when neither a project nor a studio default view is configured, so "reset" has to fall back to what the consumer declared as its defaults. Applying an empty :class:ViewSettings makes :class:ViewBindings fill in every slice from default_settings - columns, sort, filter, grouping, row height and the consumer's extras alike - so nothing carries over from the view that was active before.
The reset lands on the working view: it is emitted through :attr:view_applied (so consumers can sync widgets the bindings do not own, such as the Group By menu) and then persisted, which is what makes it survive a restart.
Source code in client/ayon_core/ui/components/views/view_selector.py
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 | |
current_view()
Return the currently active view, or None.
Source code in client/ayon_core/ui/components/views/view_selector.py
632 633 634 | |
emit_default_view_message(message, success)
Emit default-view feedback for host UIs.
Hosts can map this to the same toast presentation used by loader action results.
Source code in client/ayon_core/ui/components/views/view_selector.py
925 926 927 928 929 930 931 | |
get_default_views()
Return the current default views from the default view control.
Source code in client/ayon_core/ui/components/views/view_selector.py
1132 1133 1134 1135 1136 1137 | |
hideEvent(event)
Flush a pending working-view save before going away.
The debounce would otherwise drop the last few hundred milliseconds of edits when the window closes.
Source code in client/ayon_core/ui/components/views/view_selector.py
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 | |
notify_view_modified(*_args)
Mark the view as modified after a UI settings change.
Consumer code may connect custom widgets here when they affect :meth:ViewBindings.capture but are not part of the built-in table/filter stack.
Source code in client/ayon_core/ui/components/views/view_selector.py
636 637 638 639 640 641 642 643 | |
refresh()
Re-resolve the working view and drop the cached view list.
Restoring the user's last state only needs the working view, which has its own endpoint. The dropdown is not on screen yet, so listing the rest - and each one's settings - waits until the menu is opened; see :meth:_ensure_views_listed.
Source code in client/ayon_core/ui/components/views/view_selector.py
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | |
refresh_dropdown_size()
Resize the dropdown popup to fit its current content.
Call after any change to the dropdown's contents (a full rebuild, or swapping a single row/pill's children in place): rebuilding a widget's children leaves stale cached size hints on its ancestors, so a plain adjustSize() alone can settle on a size that no longer fits — e.g. clipping the label text on a default-view pill after it switches between its "unset" and "active" (wider) look. Invalidating the layout chain first forces every ancestor to recompute before the popup resizes.
Source code in client/ayon_core/ui/components/views/view_selector.py
906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 | |
set_view_type(view_type)
Switch to a new view-type identifier.
Source code in client/ayon_core/ui/components/views/view_selector.py
593 594 595 596 597 598 599 | |
ColumnState dataclass
State of a single column inside a View.
Attributes:
| Name | Type | Description |
|---|---|---|
name | str | Column key, matches :attr: |
visible | bool | Whether the column is currently shown. |
pinned | bool | Whether the column is pinned to the left (Phase 3 polish; stored but not visually frozen in Phase 1). |
width | int | None | Pixel width override, or |
Source code in client/ayon_core/ui/components/views/data_models.py
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 | |
from_payload(payload) classmethod
Build a ColumnState from a single payload column dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload | dict[str, Any] | Dict like | required |
Returns:
| Type | Description |
|---|---|
'ColumnState' | A new ColumnState instance. |
Source code in client/ayon_core/ui/components/views/data_models.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
to_payload()
Serialise this column state to the payload format.
Returns:
| Type | Description |
|---|---|
dict[str, Any] | A new dict with payload-friendly keys. |
Source code in client/ayon_core/ui/components/views/data_models.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
FilterDef dataclass
Server-side filter configuration captured in a View.
The condition dicts are opaque to ayon-core: they are passed through to the filter proxy untouched. The proxy converts them to :class:FilterCriterion via :meth:FilterCriterion.from_def / :meth:to_def.
Attributes:
| Name | Type | Description |
|---|---|---|
conditions | list[dict[str, Any]] | List of condition dicts. Each dict has at least a |
operator | str | How conditions combine — |
Source code in client/ayon_core/ui/components/views/data_models.py
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 | |
from_payload(payload) classmethod
Build a FilterDef from the payload's filter dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload | dict[str, Any] | None | Filter sub-dict, or | required |
Returns:
| Type | Description |
|---|---|
'FilterDef' | A new FilterDef. |
Source code in client/ayon_core/ui/components/views/data_models.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
is_empty()
Return True when there are no filter conditions.
Returns:
| Type | Description |
|---|---|
bool | True when there are no conditions configured. |
Source code in client/ayon_core/ui/components/views/data_models.py
219 220 221 222 223 224 225 | |
to_payload()
Serialise this filter to a payload dict.
Returns:
| Type | Description |
|---|---|
dict[str, Any] | A dict with |
Source code in client/ayon_core/ui/components/views/data_models.py
208 209 210 211 212 213 214 215 216 217 | |
GroupingDef dataclass
Grouping configuration captured in a View.
Attributes:
| Name | Type | Description |
|---|---|---|
group_by | str | None | Column key to group rows by, or |
group_sort_desc | bool | Whether the group ordering is descending. |
show_empty_groups | bool | Whether groups with no visible rows are rendered or hidden. |
Source code in client/ayon_core/ui/components/views/data_models.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
is_empty()
Return True when no grouping is configured.
Returns:
| Type | Description |
|---|---|
bool | True when |
Source code in client/ayon_core/ui/components/views/data_models.py
244 245 246 247 248 249 250 | |
InMemoryViewManager
Bases: ViewManager
Lightweight in-process implementation used by tests / demos.
Stores views in a dict keyed by view.id. Useful when the consumer app has not yet wired the real server backend, or when running the standalone tester harness.
Source code in client/ayon_core/ui/components/views/view_manager.py
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 | |
__init__(views=None, parent=None)
Seed the manager with an optional initial set of views.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
views | list[View] | None | Initial views to register. Each view must have a non-empty :attr: | None |
parent | QObject | None | Optional parent QObject. | None |
Source code in client/ayon_core/ui/components/views/view_manager.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
all_views()
Return every stored view across all view types.
Returns:
| Type | Description |
|---|---|
list[View] | A snapshot list of all stored views. |
Source code in client/ayon_core/ui/components/views/view_manager.py
294 295 296 297 298 299 300 | |
clear()
Remove all stored views (intended for tests).
Source code in client/ayon_core/ui/components/views/view_manager.py
287 288 289 290 291 292 | |
delete_view(view_id)
Remove view_id from the store, if present.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_id | str | Identifier of the view to remove. Missing ids are silently ignored after a debug log entry. | required |
Source code in client/ayon_core/ui/components/views/view_manager.py
262 263 264 265 266 267 268 269 270 271 272 273 274 | |
list_views(view_type)
Return views matching view_type, sorted for display.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_type | str | The view-type identifier. | required |
Returns:
| Type | Description |
|---|---|
list[View] | Sorted list of views. |
Source code in client/ayon_core/ui/components/views/view_manager.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
save_view(view)
Insert or replace view in the in-memory store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view | View | The view to save. An id is assigned if missing. | required |
Returns:
| Type | Description |
|---|---|
View | The same view instance (with assigned id). |
Source code in client/ayon_core/ui/components/views/view_manager.py
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
Scope
Bases: str, Enum
The level at which a view is stored on the server.
Source code in client/ayon_core/ui/components/views/data_models.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
ServerViewManager
Bases: ViewManager
ViewManager backed by AYON server REST endpoints.
Endpoints (project-scoped, all take ?project_name=<p>):
GET /api/views/{view_type}GET /api/views/{view_type}/workingPOST /api/views/{view_type}PATCH /api/views/{view_type}/{view_id}POST /api/addons/powerpack/{version}/views/{view_type}/{id}/shareDELETE /api/views/{view_type}/{view_id}
Attributes:
| Name | Type | Description |
|---|---|---|
project_name | str | Name of the project all calls are scoped to. |
Source code in client/ayon_core/ui/components/views/server_view_manager.py
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 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 | |
project_name property
Current project the manager is scoped to.
__init__(project_name, parent=None)
Initialise the manager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_name | str | Initial project the manager is scoped to. May be empty when the loader has no project yet. | required |
parent | QObject | None | Optional parent QObject. | None |
Source code in client/ayon_core/ui/components/views/server_view_manager.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
delete_view(view_id)
Delete view_id on the server.
The view type is resolved via the id-map (populated by :meth:list_views and :meth:save_view), so this works even when the per-type list cache has been cleared by :meth:set_project. Unknown ids emit an :attr:error signal.
Does nothing (without emitting :attr:error) when no project is set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_id | str | Identifier of the view to delete. | required |
Source code in client/ayon_core/ui/components/views/server_view_manager.py
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 | |
get_default_project_view(view_type)
Return project default view.
Source code in client/ayon_core/ui/components/views/server_view_manager.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
get_default_studio_view(view_type)
Return studio default view.
Source code in client/ayon_core/ui/components/views/server_view_manager.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |
get_working_view(view_type)
Return the working view for view_type using the direct endpoint.
Uses GET /api/views/{view_type}/working for faster lookup than scanning list_views.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_type | str | View-type identifier. | required |
Returns:
| Type | Description |
|---|---|
View | None | Parsed working :class: |
Source code in client/ayon_core/ui/components/views/server_view_manager.py
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 | |
list_views(view_type)
Return views for view_type, fetching from server on miss.
Returns an empty list (without emitting :attr:error) when the project name is empty — callers should wait for project_changed before listing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_type | str | View-type identifier (e.g. | required |
Returns:
| Type | Description |
|---|---|
list[View] | Sorted list of :class: |
list[View] | network or parse error. |
Source code in client/ayon_core/ui/components/views/server_view_manager.py
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 | |
load_view(view)
Return view with its settings fetched from the server.
:meth:list_views builds its rows from the listing endpoint, which omits settings, so opening the Views menu costs one request instead of one per view. This fills in the rest, and is a no-op for a view that already carries its settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view | View | A view, possibly built from a listing summary. | required |
Returns:
| Type | Description |
|---|---|
View | A fully populated view. The passed view is returned unchanged |
View | when it is already loaded, has no id, or the fetch fails - |
View | callers must still tolerate empty settings. |
Source code in client/ayon_core/ui/components/views/server_view_manager.py
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 | |
patch_view_access(view_id, access_data, should_share_access)
Patch per-view access data via the share endpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_id | str | Existing view identifier. | required |
access_data | dict[str, Any] | Access mapping (e.g. | required |
should_share_access | bool | Whether to set the view visibility to public (True) or private (False). | required |
Source code in client/ayon_core/ui/components/views/server_view_manager.py
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 | |
save_view(view)
POST a new view or PATCH an existing one.
The new-vs-update decision is based solely on whether :attr:View.id is non-empty. A view with a non-empty id is PATCHed; an empty id results in a POST. This is correct because ids are server-assigned — clients never mint them — so a non-empty id means the view was previously persisted.
The per-type cache is updated in-place (rather than invalidated) so the subsequent :attr:views_changed emission does not trigger an extra round-trip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view | View | The view to save. | required |
Returns:
| Type | Description |
|---|---|
View | The saved view, rebuilt from the server response when |
View | the response includes data, otherwise the input view. |
Raises:
| Type | Description |
|---|---|
Exception | Re-raises any |
Source code in client/ayon_core/ui/components/views/server_view_manager.py
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 | |
set_project(project_name)
Rebind the manager to a different project.
Clears both caches and emits :attr:project_changed with the new project name so listeners can refresh.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_name | str | Target project name. No-op when the same as the current project. | required |
Source code in client/ayon_core/ui/components/views/server_view_manager.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
set_working_view(view)
Mark view as the sole working view for its type.
The base implementation scans :meth:list_views to clear the flag on every other view, which costs a full listing on each save. The server exposes the working view directly, so at most one other view can be holding the flag and one request finds it - and when view already is the working view, none is needed at all.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view | View | The view to mark as working. | required |
Source code in client/ayon_core/ui/components/views/server_view_manager.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
supports_sharing()
Whether view sharing is available on the server.
Sharing is a powerpack feature: it requires the powerpack addon in the current bundle.
Returns:
| Type | Description |
|---|---|
bool | True when powerpack is available and licensed. |
Source code in client/ayon_core/ui/components/views/server_view_manager.py
604 605 606 607 608 609 610 611 612 613 | |
View dataclass
A saved configuration that can be applied to a table/card view.
Attributes:
| Name | Type | Description |
|---|---|---|
id | str | Server-assigned identifier. Empty string for views that have not been persisted yet. |
label | str | Human-readable name shown in the view selector. |
view_type | str | Identifier of the page/context the view belongs to (e.g. |
settings | ViewSettings | The actual UI configuration. |
owner | str | User name / id of the creator. |
scope | Scope |
|
visibility | Visibility | :class: |
loaded | bool | False for a view built from a listing summary, whose |
working | bool | True for the per-user fallback view that captures ad-hoc tweaks. At most one working view per (user, view_type) should be flagged. |
position | int | Sort order hint within the selector. |
access_level | int | Required access level (0–30, step 10) for editing public views. Components store the value and gate UI via :meth: |
access | dict[str, int] | Per-user/per-group access dict mapping names to integer access levels. |
Source code in client/ayon_core/ui/components/views/data_models.py
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 | |
can_edit(current_user, user_access_level=50)
Return True when current_user may edit this view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
current_user | str | The viewer's user name / id. | required |
user_access_level | int | The viewer's effective access level on the relevant scope (0–50). Defaults to | 50 |
Returns:
| Type | Description |
|---|---|
bool | True when: |
bool |
|
bool |
|
Source code in client/ayon_core/ui/components/views/data_models.py
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | |
from_payload(payload) classmethod
Build a View from a raw server payload.
Unknown top-level keys are preserved in :attr:extra.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload | dict[str, Any] | Raw server payload dict. | required |
Returns:
| Type | Description |
|---|---|
'View' | A new View instance. |
Source code in client/ayon_core/ui/components/views/data_models.py
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 | |
to_payload()
Serialise this view to a payload dict.
Returns:
| Type | Description |
|---|---|
dict[str, Any] | A dict suitable for sending to the server. |
Source code in client/ayon_core/ui/components/views/data_models.py
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | |
ViewBindings dataclass
Adapter wiring a :class:View to a concrete widget stack.
Only :attr:model is required. Every other widget is optional and skipped when None.
Attributes:
| Name | Type | Description |
|---|---|---|
model | PaginatedTableModel | The shared :class: |
table_view | Any | None | Optional :class: |
card_view | Any | None | Optional :class: |
filter_bar | Any | None | Optional :class: |
on_extra_apply | Any | None | Optional callback |
on_extra_capture | Any | None | Optional callback |
default_filter | Callable[[], FilterDef] | None | Optional callback returning a |
default_settings | Callable[[], ViewSettings] | None | Optional callback returning complete defaults. When supplied, it is the preferred source for columns, sorting, filtering, grouping, row height, and consumer extras. |
default_sort_by | str | None | Optional column key used when the incoming view does not define a sort column. |
on_error | ErrorCallback | None | Optional callback |
Source code in client/ayon_core/ui/components/views/view_bindings.py
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 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 | |
apply(settings)
Apply settings to every wired widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings | ViewSettings | The :class: | required |
Raises:
| Type | Description |
|---|---|
TypeError | If settings is not a :class: |
Source code in client/ayon_core/ui/components/views/view_bindings.py
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 | |
capture()
Build a fresh :class:ViewSettings from the live widget state.
Returns:
| Type | Description |
|---|---|
ViewSettings | A new :class: |
Source code in client/ayon_core/ui/components/views/view_bindings.py
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 | |
capture_filter()
Capture filter criteria from the live filter bar.
The operator is preserved from the last :meth:apply call so a view that arrived with operator="or" roundtrips losslessly, even though :class:AYTableFilter only implements AND.
Returns:
| Type | Description |
|---|---|
FilterDef | A new :class: |
Source code in client/ayon_core/ui/components/views/view_bindings.py
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | |
ViewManager
Bases: QObject
Abstract storage backend for :class:View instances.
Signals
views_changed(str): Emitted with view_type whenever the list of views for that type may have changed. view_saved(str): Emitted with the view id after a successful save_view. view_deleted(str): Emitted with the view id after a successful delete_view. project_changed(str): Emitted with the new project name when the manager is rebound to a different project. error(str): Emitted with an error message when an operation fails (subclasses may emit this instead of raising).
Source code in client/ayon_core/ui/components/views/view_manager.py
30 31 32 33 34 35 36 37 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 | |
__init__(parent=None)
Initialise the manager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent | QObject | None | Optional parent QObject. | None |
Source code in client/ayon_core/ui/components/views/view_manager.py
52 53 54 55 56 57 58 | |
delete_view(view_id) abstractmethod
Delete the view with the given id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_id | str | Identifier of the view to delete. | required |
Source code in client/ayon_core/ui/components/views/view_manager.py
88 89 90 91 92 93 94 | |
get_default_project_view(view_type)
Return the project-scope default view for view_type, if any.
See :meth:get_default_studio_view for how default views are identified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_type | str | The view-type identifier. | required |
Returns:
| Type | Description |
|---|---|
View | None | The project default view for view_type, or |
Source code in client/ayon_core/ui/components/views/view_manager.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
get_default_studio_view(view_type)
Return the studio-scope default view for view_type, if any.
Default views are saved with :data:DEFAULT_VIEW_LABEL and the matching :class:Scope (see DefaultViewControl._set_default_for_scope). Subclasses backed by a dedicated endpoint (e.g. :class:ServerViewManager) should override this rather than rely on filtering :meth:list_views.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_type | str | The view-type identifier. | required |
Returns:
| Type | Description |
|---|---|
View | None | The studio default view for view_type, or |
Source code in client/ayon_core/ui/components/views/view_manager.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
get_working_view(view_type)
Return the working view for view_type, if any.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_type | str | The view-type identifier. | required |
Returns:
| Type | Description |
|---|---|
View | None | The view flagged with |
View | None |
|
Source code in client/ayon_core/ui/components/views/view_manager.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
list_views(view_type) abstractmethod
Return the list of views for the given view type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_type | str | The view-type identifier (e.g. | required |
Returns:
| Type | Description |
|---|---|
list[View] | List of :class: |
list[View] | attr: |
Source code in client/ayon_core/ui/components/views/view_manager.py
62 63 64 65 66 67 68 69 70 71 72 | |
load_view(view)
Return view with its :attr:View.settings populated.
Managers that list views cheaply - fetching only the metadata the dropdown needs - override this to fetch the full payload the first time a view is actually used. The default implementation assumes :meth:list_views already returned complete views.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view | View | The view to complete. | required |
Returns:
| Type | Description |
|---|---|
View | A view whose settings are safe to apply or persist. |
Source code in client/ayon_core/ui/components/views/view_manager.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
save_view(view) abstractmethod
Persist a new or updated view.
Implementations must assign a non-empty :attr:View.id when creating a new view and return the (possibly modified) view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view | View | The view to save. | required |
Returns:
| Type | Description |
|---|---|
View | The saved view, with its assigned id. |
Source code in client/ayon_core/ui/components/views/view_manager.py
74 75 76 77 78 79 80 81 82 83 84 85 86 | |
set_working_view(view)
Mark view as the (sole) working view for its view type.
The default implementation clears the working flag on every other view of the same type and saves them all. Subclasses can override this with a bulk-update endpoint for efficiency.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view | View | The view to mark as working. | required |
Source code in client/ayon_core/ui/components/views/view_manager.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
supports_sharing()
Whether views can be shared with other users.
Sharing controls in the UI (the "Shared views" section, the people-with-access editor) are shown only when this returns True. The default implementation has no restrictions.
Returns:
| Type | Description |
|---|---|
bool | True when views can be shared. |
Source code in client/ayon_core/ui/components/views/view_manager.py
98 99 100 101 102 103 104 105 106 107 108 | |
ViewSettings dataclass
The actual user-visible configuration of a View.
All "generic" knobs (columns, sort, row height, filter, grouping) are first-class fields. Anything else (showProducts, gridHeight, featuredVersionOrder, slicerType, …) is stashed verbatim in :attr:extra so the payload roundtrips losslessly across app versions.
Attributes:
| Name | Type | Description |
|---|---|---|
columns | list[ColumnState] | Ordered list of column states. |
sort_by | str | None | Column key to sort by, or |
sort_desc | bool | Whether the sort is descending. |
row_height | int | Table row height in pixels. Consumers without a table may use this for another height-based presentation setting. |
grouping | GroupingDef | Grouping configuration. |
filter | FilterDef | Filter configuration. |
extra | dict[str, Any] | All other settings keys, preserved untouched. |
Source code in client/ayon_core/ui/components/views/data_models.py
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 | |
from_payload(payload) classmethod
Build ViewSettings from the payload's settings sub-dict.
Unknown keys are preserved verbatim in :attr:extra.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload | dict[str, Any] | None | Settings sub-dict, or | required |
Returns:
| Type | Description |
|---|---|
'ViewSettings' | A new ViewSettings instance. |
Source code in client/ayon_core/ui/components/views/data_models.py
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 | |
to_payload()
Serialise these settings to a payload dict.
Unknown keys from :attr:extra are merged back in. Known keys in extra are ignored (first-class fields win) so accidental duplication can't corrupt a roundtrip.
Returns:
| Type | Description |
|---|---|
dict[str, Any] | A dict suitable for embedding under |
dict[str, Any] | View payload. |
Source code in client/ayon_core/ui/components/views/data_models.py
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 | |
Visibility
Bases: str, Enum
Whether a view is owner-only or public to others.
Subclasses str so it serialises naturally to JSON.
Source code in client/ayon_core/ui/components/views/data_models.py
72 73 74 75 76 77 78 79 | |