Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SG-30534: First step to supporting PySide6 #898

Merged
merged 2 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions python/tank/platform/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
from . import events
from . import qt
from . import qt5
from . import qt6
from .bundle import TankBundle
from .framework import setup_frameworks
from .engine_logging import ToolkitEngineHandler, ToolkitEngineLegacyHandler
Expand Down Expand Up @@ -92,6 +93,7 @@
self.__created_qt_dialogs = []
self.__qt_debug_info = {}
self.__has_qt5 = False
self.__has_qt6 = False

self.__commands_that_need_prefixing = []

Expand Down Expand Up @@ -179,6 +181,11 @@
for name, value in qt5_base.items():
setattr(qt5, name, value)

qt6_base = self.__define_qt6_base()
self.__has_qt6 = len(qt6_base) > 0
for name, value in qt6_base.items():
setattr(qt6, name, value)

Check warning on line 187 in python/tank/platform/engine.py

View check run for this annotation

Codecov / codecov/patch

python/tank/platform/engine.py#L187

Added line #L187 was not covered by tests

# Update the authentication module to use the engine's Qt.
# @todo: can this import be untangled? Code references internal part of the auth module
from ..authentication.ui import qt_abstraction
Expand Down Expand Up @@ -623,6 +630,16 @@
"""
return self.__has_qt5

@property
def has_qt6(self):
"""
Indicates that the host application has access to Qt 6 and that the ``sgtk.platform.qt6`` module
has been populated with the Qt 6 modules and information.

:returns bool: boolean value indicating if Qt 6 is available.
"""
return self.__has_qt6

Check warning on line 641 in python/tank/platform/engine.py

View check run for this annotation

Codecov / codecov/patch

python/tank/platform/engine.py#L641

Added line #L641 was not covered by tests

@property
def has_qt4(self):
"""
Expand Down Expand Up @@ -2167,6 +2184,17 @@
"""
return QtImporter(interface_version_requested=QtImporter.QT5).base

def __define_qt6_base(self):
"""
This will be called at initialization to discover every PySide6 module. It should provide
every Qt modules available as well as two extra attributes, ``__name__`` and
``__version__``, which refer to the name of the binding and it's version, e.g.
PySide6 and 6.2.7

:returns: A dictionary with all the modules, __version__ and __name__.
"""
return QtImporter(interface_version_requested=QtImporter.QT6).base

def _initialize_dark_look_and_feel(self):
"""
Initializes a standard toolkit look and feel using a combination of
Expand Down
12 changes: 12 additions & 0 deletions python/tank/platform/qt6/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (c) 2016 Shotgun Software Inc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2016 -> 2023
Shotgun Software Inc -> Autodesk

To apply on each new file of this PR

#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.

# This module will be populated during engine initialization with modules available for Qt 6 if
# PySide6 is accessible.
Loading