Move ayon-ui-qt to ayon-core#1873
Conversation
- Modified all imports
BigRoy
left a comment
There was a problem hiding this comment.
We are lacking the tests, we are also lacking some of the readme and documentation from ayon-ui-qt that should port over to document the design, etc.
We should really not be losing much on the move.
| try: | ||
| from qtmaterialsymbols import get_icon # type: ignore | ||
| except ImportError: | ||
| from ..vendor.qtmaterialsymbols import get_icon |
There was a problem hiding this comment.
| try: | |
| from qtmaterialsymbols import get_icon # type: ignore | |
| except ImportError: | |
| from ..vendor.qtmaterialsymbols import get_icon | |
| try: | |
| from qtmaterialsymbols import get_icon # type: ignore | |
| except ImportError: | |
| from ayon_core.vendor.qtmaterialsymbols import get_icon |
There was a problem hiding this comment.
@iLLiCiTiT , created _get_test_data_dir() for test resources as we moved resources from client to outside in 7a6ffc5, is that bad idea?
There was a problem hiding this comment.
BTW how is the comment related to the suggestion.
| try: | ||
| from qtmaterialsymbols import get_icon # type: ignore | ||
| except ImportError: | ||
| from ..vendor.qtmaterialsymbols import get_icon |
There was a problem hiding this comment.
| from ..vendor.qtmaterialsymbols import get_icon | |
| from ayon_core.vendor.qtmaterialsymbols import get_icon |
There was a problem hiding this comment.
@iLLiCiTiT , created _get_test_data_dir() for test resources as we moved resources from client to outside in 7a6ffc5, is that bad idea?
| try: | ||
| from qtmaterialsymbols import get_icon # type: ignore | ||
| except ImportError: | ||
| from ..vendor.qtmaterialsymbols import get_icon |
There was a problem hiding this comment.
| from ..vendor.qtmaterialsymbols import get_icon | |
| from ayon_core.vendor.qtmaterialsymbols import get_icon |
There was a problem hiding this comment.
@iLLiCiTiT , created _get_test_data_dir() for test resources as we moved resources from client to outside in 7a6ffc5, is that bad idea?
…5921d5ad5f0e583dde82c76e08d58432 - removed qtpy from client/pyproject.toml - removed duplicated client/ayon_core/ui/vendor directory - moved resources which used for UI testing to tests/client/ayon_core/ui/test_data - all tests and docs ported from ayon-ui-qt to here - created _get_test_data_dir() for test resources as we moved resources from client to outside
| # Add the vendor directory to sys.path so that we can import vendored where needed. | ||
| _vendor_path = os.path.join( | ||
| os.path.dirname(__file__), "..", "vendor", "python" | ||
| ) | ||
| if _vendor_path not in sys.path: | ||
| sys.path.insert(0, _vendor_path) | ||
|
|
||
|
|
There was a problem hiding this comment.
| # Add the vendor directory to sys.path so that we can import vendored where needed. | |
| _vendor_path = os.path.join( | |
| os.path.dirname(__file__), "..", "vendor", "python" | |
| ) | |
| if _vendor_path not in sys.path: | |
| sys.path.insert(0, _vendor_path) |
| sys.path.insert(0, _vendor_path) | ||
|
|
||
|
|
||
| def _get_test_data_dir(): |
There was a problem hiding this comment.
Bad location. Create _test_utils.py and move it there as get_test_data_dir, so it is imported as from ._test_utils import get_test_data_dir.
There was a problem hiding this comment.
At the end the best solution would be to move the tests to the tests too, but I would NOT do it now.
|
I am porting over ynput/ayon-ui-qt#54 |
Restructure module to avoid circular imports and large source files. Extract StyleDict, StyleData and singleton accessors in ayon_ui_qt.style_types. Extract all drawer classes in ayon_ui_qt.style and relocate them in ayon_ui_qt.drawers. Some relocated symbols are still exported from ayon_ui_qt.style for backward compatibility. Signed-off-by: philippe-ynput <philippe@ynput.io>
Signed-off-by: philippe-ynput <philippe@ynput.io>
Signed-off-by: philippe-ynput <philippe@ynput.io>
|
CI linting is passing now. |
Refactor the UI module to move style-related functions and types from `style.py` to `style_types.py`. This change updates all component imports, documentation, and tests to reflect the new module structure and removes the deprecated `style_widget_and_siblings` function. Signed-off-by: philippe-ynput <philippe@ynput.io>
Update paths for visual test resources and remove debug print to align with the new project structure. Signed-off-by: philippe-ynput <philippe@ynput.io>
Signed-off-by: philippe-ynput <philippe@ynput.io>
* feat(ui): implement custom menu drawer and styling Add `MenuDrawer` to provide custom painting for `QMenu` widgets using native `QPainter` calls instead of QSS. This includes support for custom menu item layouts, background colors, and icon visibility adjustments for macOS. - Implement `MenuDrawer` for `PE_PanelMenu`, `PE_FrameMenu`, and `CE_MenuItem`. - Add `QMenu` configuration to `ayon_style.json` with default and danger variants. - Update `AYONStyle` to handle `QMenu` translucency and icon visibility in actions. - Register `MenuDrawer` in the `AYONStyle` drawer registry. * feat(ui): add optional action menu items and visual tests Introduce `OptionalAction` to support menu items with secondary action buttons (option boxes), following the Maya-style pattern. This includes new component logic, style variants, and visual regression tests. - Add `OptionalAction`, `OptionBox`, and `OptionalActionWidget` components. - Implement `optional-action` variant for `QPushButton`, `QLabel`, and `QMenu`. - Update `AYLabel` to support explicit padding and transparent icon placeholders. - Add visual regression tests for `OptionalAction` states including hovering on the body and the option box. - Update `MenuDrawer` to correctly calculate icon gutters for complex action layouts. * test(ui): refactor optional action hover simulation Update `OptionalMenuTest` to use `qbot` for mouse movement simulation instead of manually setting highlight properties. This ensures hover states are triggered via actual input events rather than state manipulation. - Remove `_clear_hover` and replace with mouse movement to root. - Replace manual `set_highlight` calls with `self._qbot.mouseMove`. - Remove unused `get_icon` import. - Add assertions for `_qbot` availability in test steps. * fix(option_action): fix incorrect disabled state * feat(ui): add contextual menu style and update optional action widget Add Contextual_Menu variant to QFrameVariants and corresponding style definition in ayon_style.json. Update OptionalActionWidget to use AYFrame with the new contextual-menu variant and dynamically retrieve icon size from style configuration instead of hardcoding. * fix(ui): Make sure the hover state propagates to all children (frame, label, button). Add hover propagation to OptionalActionWidget to keep child widgets in sync with parent hover state. Update ButtonDrawer hover detection to use widget.underMouse() for more accurate state determination. * feat(option_action): close parent menus when option is clicked Add _close_menu_chain method to traverse widget hierarchy and close any QMenu parents when the option button is clicked. * fix(ui): apply disabled opacity to button icons Retrieve the disabled opacity value from style configuration and apply it to icon colors when rendering disabled states, ensuring consistent visual feedback for non-interactive buttons. * fix(menu): Clarify intention for _base_style method and add note on action variant resolution * fix(menu): Correct hover and disabled state logic in MenuDrawer * fix(option_action): Update documentation and method references for clarity in OptionalAction * fix(style): Remove unused import of QKeySequence in AYONStyle main block * fix(style): fix incorrect single quote in print() * fix(style): remove incorrect doubled single quote * fix(style): remove incorrect doubled single quote * fix(test_option_action): correct docstring. * feat(ui): rename option action components with AY prefix and add AYMenu Rename OptionBox, OptionalActionWidget, and OptionalAction to AYOptionBox, AYOptionalActionWidget, and AYOptionalAction respectively to follow the AYON UI naming convention. Add new AYMenu class that paints menus using AYON style for consistent appearance across the application. Update all references, imports, and visual test snapshots. BREAKING CHANGE: OptionBox, OptionalAction, and OptionalActionWidget have been renamed to AYOptionBox, AYOptionalAction, and AYOptionalActionWidget respectively. Update imports accordingly. * test(ui): add visual coverage for AYMenu drawer states Add visual regression snapshots for AYMenu initial, open, nested submenu, and optional action hover states. Align minimum menu item height across the menu style, optional action widgets, and drawer row calculations to keep rendered rows visually consistent. * chore(AYMenu): forgot to update tests. jeez ! * ci(tests): add Qt runtime setup for PR unit tests Install Qt runtime dependencies in the PR unit test workflow and run tests with `QT_QPA_PLATFORM=offscreen` so Qt-based tests can execute reliably in headless CI. * ci(ui): Add a comment to force a CI run. --------- Signed-off-by: philippe-ynput <philippe@ynput.io>
Signed-off-by: philippe-ynput <philippe@ynput.io>
|
I have tested this branch with develop review one. |
refactor conditions and use .get(...) intead if handling KeyError
Changelog Description
Merge UI Qt components into core.
Additional info
Testing notes:
can be tested desktop review that using the ayon_core.ui