Skip to content

Commit 0390122

Browse files
"imports Qt/PySide" reverted (#1052)
1 parent cf32d30 commit 0390122

File tree

11 files changed

+30
-57
lines changed

11 files changed

+30
-57
lines changed

python/tank/authentication/interactive_authentication.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,23 @@
2626

2727
from .errors import AuthenticationCancelled
2828
from .console_authentication import ConsoleLoginHandler, ConsoleRenewSessionHandler
29+
from .ui_authentication import UiAuthenticationHandler
2930

3031
from .. import LogManager
3132

3233
import threading
3334
import os
3435
from tank.util import is_windows
3536

37+
# When importing qt_abstraction, a lot of code is executed to detects which
38+
# version of Qt is being used. Running business logic at import time is not
39+
# something usually done by the Toolkit. The worry is that the import may fail
40+
# in the context of a DCC, but occur too early for the Toolkit logging to be
41+
# fully in place to record it.
42+
try:
43+
from .ui.qt_abstraction import QtGui
44+
except Exception:
45+
QtGui = None
3646

3747
logger = LogManager.get_logger(__name__)
3848

@@ -60,23 +70,16 @@ def _get_current_os_user():
6070
return None
6171

6272

63-
def _get_ui_state() -> bool:
73+
def _get_ui_state():
6474
"""
6575
Returns the state of UI: do we have a ui or not.
6676
:returns: True or False
6777
"""
78+
if QtGui and QtGui.QApplication.instance() is not None:
79+
return True
80+
else:
81+
return False
6882

69-
# When importing qt_abstraction, a lot of code is executed to detects which
70-
# version of Qt is being used. Running business logic at import time is not
71-
# something usually done by the Toolkit. The worry is that the import may fail
72-
# in the context of a DCC, but occur too early for the Toolkit logging to be
73-
# fully in place to record it.
74-
try:
75-
from .ui.qt_abstraction import QtGui
76-
except Exception:
77-
QtGui = None
78-
79-
return bool(QtGui and QtGui.QApplication.instance())
8083

8184
class SessionRenewal(object):
8285
"""
@@ -219,7 +222,6 @@ def renew_session(user):
219222
has_ui = _get_ui_state()
220223
# If we have a gui, we need gui based authentication
221224
if has_ui:
222-
from .ui_authentication import UiAuthenticationHandler
223225
authenticator = UiAuthenticationHandler(
224226
is_session_renewal=True, session_metadata=user.get_session_metadata()
225227
)
@@ -255,8 +257,6 @@ def authenticate(default_host, default_login, http_proxy, fixed_host):
255257
# object instead of 5 element tuple.
256258
# If we have a gui, we need gui based authentication
257259
if has_ui:
258-
from .ui_authentication import UiAuthenticationHandler
259-
260260
# If we are renewing for a background thread, use the invoker
261261
authenticator = UiAuthenticationHandler(
262262
is_session_renewal=False, fixed_host=fixed_host

python/tank/authentication/login_dialog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
from . import site_info
4444
from .sso_saml2 import (
4545
SsoSaml2IncompletePySide2,
46+
SsoSaml2Toolkit,
4647
SsoSaml2MissingQtModuleError,
4748
)
48-
from .sso_saml2.sso_saml2_toolkit import SsoSaml2Toolkit
4949

5050
from .. import LogManager
5151

python/tank/authentication/sso_saml2/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
SsoSaml2MultiSessionNotSupportedError,
2323
)
2424

25+
# Classes
26+
from .sso_saml2 import SsoSaml2 # noqa
27+
28+
from .sso_saml2_toolkit import SsoSaml2Toolkit # noqa
29+
2530
# Functions
2631
from .utils import ( # noqa
2732
get_saml_claims_expiration,

python/tank/authentication/sso_saml2/core/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
"""
1111
This module contains files which are shared between RV and Toolkit.
1212
"""
13+
14+
# Classes
15+
from .sso_saml2_core import SsoSaml2Core # noqa

python/tank/authentication/sso_saml2/sso_saml2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# pylint: disable=too-many-arguments
1717
# pylint: disable=unused-import
1818

19-
from .core.sso_saml2_core import SsoSaml2Core # noqa
19+
from .core import SsoSaml2Core # noqa
2020

2121
from .core.utils import ( # noqa
2222
set_logger_parent,

tests/authentication_tests/test_web_login.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
skip_if_pyside_missing,
1818
)
1919

20-
from tank.authentication.sso_saml2.sso_saml2_toolkit import SsoSaml2Toolkit
20+
from tank.authentication.sso_saml2 import SsoSaml2Toolkit
2121

2222

2323
@only_run_on_nix # This test issues a seg-fault on Windows

tests/integration_tests/bootstrap_hook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,4 @@ def test_bootstrap_with_descriptor_hooks(self):
202202

203203

204204
if __name__ == "__main__":
205-
unittest.main(failfast=True, verbosity=2)
205+
ret_val = unittest.main(failfast=True, verbosity=2)

tests/integration_tests/import_sgtk.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

tests/integration_tests/multi_bootstrap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@ def test_bootstrap_more_than_once(self):
8989

9090

9191
if __name__ == "__main__":
92-
unittest.main(failfast=True, verbosity=2)
92+
ret_val = unittest.main(failfast=True, verbosity=2)

tests/integration_tests/offline_workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,4 @@ def test_04_bootstrap(self):
133133

134134

135135
if __name__ == "__main__":
136-
unittest.main(failfast=True, verbosity=2)
136+
ret_val = unittest.main(failfast=True, verbosity=2)

0 commit comments

Comments
 (0)