Skip to content

Commit e41f258

Browse files
committed
WIP add spinner and raise questions
1 parent a2ee46b commit e41f258

File tree

2 files changed

+55
-7
lines changed

2 files changed

+55
-7
lines changed

python/tank/authentication/login_dialog.py

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,19 @@ def __init__(
337337

338338
self.confirm_box.setStyleSheet(self.styleSheet())
339339

340+
# Init UI Spinner
341+
self.ui.spinner_movie = QtGui.QMovie(":/spinning_wheel.gif")
342+
if self.ui.spinner_movie.loopCount() != -1:
343+
self.ui.spinner_movie.finished.connect(self.ui.spinner_movie.start)
344+
# TODO get a better GIF that loop forever
345+
346+
self.ui.refresh_site_info_spinner.setMovie(self.ui.spinner_movie)
347+
348+
# TODO: Init which widget are display by default
349+
# IF not host at all in the recent box: nothing but the site widget
350+
# IF host exists: spinner mode
351+
352+
340353
def __del__(self):
341354
"""
342355
Destructor.
@@ -399,6 +412,16 @@ def _update_ui_according_to_site_support(self):
399412
TODO the name and description of this method are not accurate!!!!!
400413
"""
401414

415+
self.ui.login.setVisible(False)
416+
self.ui.password.setVisible(False)
417+
self.ui.message.setVisible(False)
418+
self.ui.forgot_password_link.setVisible(False)
419+
self.ui.button_options.setVisible(False)
420+
self.ui.sign_in.setVisible(False) # maybe setEnable instead?
421+
422+
self.ui.refresh_site_info_spinner.setVisible(True)
423+
self.ui.refresh_site_info_label.setVisible(True)
424+
402425
logger.debug("_update_ui_according_to_site_support")
403426
self._query_task.url_to_test = self._get_current_site()
404427
self._query_task.start()
@@ -558,6 +581,11 @@ def _toggle_web(self, method_selected=None):
558581

559582
self.method_selected = method_selected
560583

584+
self.ui.refresh_site_info_spinner.setVisible(False)
585+
self.ui.refresh_site_info_label.setVisible(False)
586+
self.ui.message.setVisible(True)
587+
self.ui.sign_in.setVisible(True)
588+
561589
# if we are switching from one mode (using the web) to another (not using
562590
# the web), or vice-versa, we need to update the GUI.
563591
# In web-based authentication, the web form is in charge of obtaining
@@ -701,13 +729,18 @@ def result(self):
701729

702730
return self._sso_saml2.get_session_data()
703731

704-
# We want to wait until we know what is supported by the site, to avoid
705-
# flickering GUI.
706-
if not self._query_task.wait(THREAD_WAIT_TIMEOUT_MS):
707-
logger.warning(
708-
"Timed out awaiting requesting information: %s"
709-
% self._get_current_site()
710-
)
732+
# # We want to wait until we know what is supported by the site, to avoid
733+
# # flickering GUI.
734+
# if not self._query_task.wait(THREAD_WAIT_TIMEOUT_MS):
735+
# logger.warning(
736+
# "Timed out awaiting requesting information: %s"
737+
# % self._get_current_site()
738+
# )
739+
740+
# Configure the GUI according to what we know: site and user preferences
741+
# TODO -> self._toggle_web....
742+
743+
self.ui.spinner_movie.start()
711744

712745
res = self.exec_()
713746
if res != QtGui.QDialog.Accepted:

python/tank/authentication/site_info.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ def _get_site_infos(url, http_proxy=None):
4040
:returns: A dictionary with the site infos.
4141
"""
4242

43+
time.sleep(3)
44+
return {
45+
"user_authentication_method": "oxygen",
46+
"unified_login_flow_enabled": True,
47+
"authentication_app_session_launcher_enabled": True,
48+
}
49+
4350
# logger.info("Sleep for 10s")
4451
# time.sleep(30)
4552
# logger.info("done sleeping")
@@ -115,6 +122,14 @@ def reload(self, url, http_proxy=None):
115122
logger.debug("Unable to connect with %s, got exception '%s'", url, exc)
116123
return
117124

125+
126+
# TODO emit a signal with the infos dict instead of waiting for the comsumer to retrieve it.
127+
# Because the thread might already run with different URL at that point....
128+
129+
130+
# ALSO, the following logs should only run if needed
131+
# ALSO, why don't we consume the cache here ?!
132+
118133
self._url = url
119134
self._infos = infos
120135

0 commit comments

Comments
 (0)