mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
update details in certain situations
This commit is contained in:
parent
55e4aa3c76
commit
bd9a987f7b
2 changed files with 23 additions and 8 deletions
|
|
@ -50,13 +50,13 @@ class PublisherTabsWidget(QtWidgets.QFrame):
|
|||
|
||||
self._btns_layout = btns_layout
|
||||
|
||||
self._current_button = None
|
||||
self._current_identifier = None
|
||||
self._buttons_by_identifier = {}
|
||||
|
||||
def is_current_tab(self, identifier):
|
||||
if isinstance(identifier, PublisherTabBtn):
|
||||
identifier = identifier.identifier
|
||||
return self._current_button == identifier
|
||||
return self._current_identifier == identifier
|
||||
|
||||
def add_tab(self, label, identifier):
|
||||
button = PublisherTabBtn(identifier, label, self)
|
||||
|
|
@ -64,7 +64,7 @@ class PublisherTabsWidget(QtWidgets.QFrame):
|
|||
self._btns_layout.addWidget(button, 0)
|
||||
self._buttons_by_identifier[identifier] = button
|
||||
|
||||
if self._current_button is None:
|
||||
if self._current_identifier is None:
|
||||
self.set_current_tab(identifier)
|
||||
return button
|
||||
|
||||
|
|
@ -72,21 +72,24 @@ class PublisherTabsWidget(QtWidgets.QFrame):
|
|||
if isinstance(identifier, PublisherTabBtn):
|
||||
identifier = identifier.identifier
|
||||
|
||||
if identifier == self._current_button:
|
||||
if identifier == self._current_identifier:
|
||||
return
|
||||
|
||||
new_btn = self._buttons_by_identifier.get(identifier)
|
||||
if new_btn is None:
|
||||
return
|
||||
|
||||
old_identifier = self._current_button
|
||||
old_identifier = self._current_identifier
|
||||
old_btn = self._buttons_by_identifier.get(old_identifier)
|
||||
self._current_button = identifier
|
||||
self._current_identifier = identifier
|
||||
|
||||
if old_btn is not None:
|
||||
old_btn.deactivate()
|
||||
new_btn.activate()
|
||||
self.tab_changed.emit(old_identifier, identifier)
|
||||
|
||||
def current_tab(self):
|
||||
return self._current_identifier
|
||||
|
||||
def _on_tab_click(self, identifier):
|
||||
self.set_current_tab(identifier)
|
||||
|
|
|
|||
|
|
@ -226,7 +226,17 @@ class PublisherWindow(QtWidgets.QDialog):
|
|||
def set_context_label(self, label):
|
||||
self._context_label.setText(label)
|
||||
|
||||
def _update_publish_details_widget(self, force=False):
|
||||
if not force and self._tabs_widget.current_tab() != "details":
|
||||
return
|
||||
|
||||
report_data = self.controller.get_publish_report()
|
||||
self._publish_details_widget.set_report_data(report_data)
|
||||
|
||||
def _on_tab_change(self, old_tab, new_tab):
|
||||
if old_tab == "details":
|
||||
self._publish_details_widget.close_details_popup()
|
||||
|
||||
if new_tab in ("create", "publish"):
|
||||
animate = True
|
||||
if old_tab not in ("create", "publish"):
|
||||
|
|
@ -240,7 +250,7 @@ class PublisherWindow(QtWidgets.QDialog):
|
|||
self._content_stacked_layout.setCurrentWidget(
|
||||
self._publish_details_widget
|
||||
)
|
||||
|
||||
self._update_publish_details_widget()
|
||||
|
||||
# TODO handle rest of conditions
|
||||
|
||||
|
|
@ -298,8 +308,8 @@ class PublisherWindow(QtWidgets.QDialog):
|
|||
self._create_tab.setEnabled(True)
|
||||
self._comment_input.setVisible(True)
|
||||
self._set_publish_visibility(False)
|
||||
|
||||
self._set_footer_enabled(False)
|
||||
self._update_publish_details_widget()
|
||||
|
||||
def _on_publish_start(self):
|
||||
self._reset_btn.setEnabled(False)
|
||||
|
|
@ -334,6 +344,7 @@ class PublisherWindow(QtWidgets.QDialog):
|
|||
|
||||
self._validate_btn.setEnabled(validate_enabled)
|
||||
self._publish_btn.setEnabled(publish_enabled)
|
||||
self._update_publish_details_widget()
|
||||
|
||||
def _validate_create_instances(self):
|
||||
if not self._controller.host_is_valid:
|
||||
|
|
@ -359,3 +370,4 @@ class PublisherWindow(QtWidgets.QDialog):
|
|||
|
||||
context_title = self.controller.get_context_title()
|
||||
self.set_context_label(context_title)
|
||||
self._update_publish_details_widget()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue