Refreshing any of assets / submission / env tab refreshes all the others

This commit is contained in:
David Kydd 2018-11-05 13:09:56 +13:00
Родитель 925b70ed6c
Коммит 1b5afe72a2
6 изменённых файлов: 21 добавлений и 11 удалений

Просмотреть файл

@ -63,9 +63,6 @@ class AzureBatchAssets(object):
self.ui = AssetsUI(self, frame)
self.frame = frame
#callback.after_new(self._callback_refresh)
#callback.after_read(self._callback_refresh)
def _callback_refresh(self, *args):
"""Called by Maya when a new scene file is loaded, so we reset
the asset and submission pages of the UI, as the file references
@ -261,11 +258,13 @@ class AzureBatchAssets(object):
data += asset.size
return data/BYTES/BYTES
def configure(self, session):
def configure(self, session, submission, environment):
"""Populate the Batch client for the current sessions of the asset tab.
Called on successful authentication.
"""
self._session = session
self._submission = submission
self._environment = environment
self._upload_threads = session.threads
self.batch = self._session.batch
self._set_searchpaths()

Просмотреть файл

@ -71,12 +71,13 @@ class AzureBatchEnvironment(object):
else:
self.licenses[license['label']] = False
def configure(self, session, submission):
def configure(self, session, submission, assets):
"""Populate the current session of the environment tab.
Called on successful authentication.
"""
self._session = session
self._submission = submission
self._assets = assets
self.batch = self._session.batch
self.ui.select_image(self._session.batch_image)
self.ui.select_sku(self._session.vm_sku)

Просмотреть файл

@ -93,9 +93,9 @@ class AzureBatchSettings(object):
self._log.debug("Starting AzureBatchShared...")
if self.config.auth:
self.frame.is_logged_in()
self.env.configure(self.config, self.submission)
self.env.configure(self.config, self.submission, self.assets)
self.jobhistory.configure(self.config)
self.assets.configure(self.config)
self.assets.configure(self.config, self.submission, self.env)
self.pools.configure(self.config, self.env)
self.submission.start(self.config, self.assets, self.pools, self.env)
else:

Просмотреть файл

@ -42,7 +42,7 @@ class AssetsUI(object):
with utils.Row(1, 1, 355, "center", (1,"bottom",0)) as r_btn:
self.refresh_button = utils.ProcButton(
"Refresh", "Refreshing...", self.refresh)
"Refresh", "Refreshing...", self.refresh_btn_clicked)
maya.form_layout(
self.page, edit=True,
@ -65,21 +65,27 @@ class AssetsUI(object):
frame.add_tab(self)
self.is_logged_out()
def refresh(self, *args):
def refresh_btn_clicked(self, *args):
self.refresh_button.start()
self.base._submission.ui.refresh()
self.base._environment.ui.refresh()
self.refresh()
self.refresh_button.finish()
def refresh(self):
"""Refresh Assets tab. Command for refresh_button.
Remove all existing UI elements and gathered
assets and re-build from scratch. This is also called to populate
the tab for the first time.
"""
self.refresh_button.start()
self.clear_ui()
maya.refresh()
project_name = self.base.get_project()
maya.text_field(self._asset_group, edit=True, text=project_name)
self.base.set_assets()
for f in self.base.get_assets():
f.display(self, self.asset_display, self.scroll_layout)
self.refresh_button.finish()
def upload(self, *args):
"""Upload gathered assets. Command for upload_button.
@ -163,7 +169,9 @@ class AssetsUI(object):
if not self.ready:
maya.refresh()
try:
self.refresh_button.start()
self.refresh()
self.refresh_button.finish()
self.is_logged_in()
self.ready = True
except Exception as exp:

Просмотреть файл

@ -261,6 +261,7 @@ class EnvironmentUI(object):
"""
self.refresh_button.start()
self.base._submission.ui.refresh()
self.base._assets.ui.refresh()
self.refresh()
self.refresh_button.finish()

Просмотреть файл

@ -142,6 +142,7 @@ class SubmissionUI(object):
"""
self.refresh_button.start()
self.base.env_manager.ui.refresh()
self.base.asset_manager.ui.refresh()
self.refresh()
self.refresh_button.finish()