Commit b0af5c74 authored by Samuel GAIST's avatar Samuel GAIST Committed by Amir MOHAMMADI
Browse files

[widgets][assetwidget] Add tooltip when asset is invalid

It follows the same idea as the experiment editor hinting.

Fixes #264
parent 3c0c058b
Pipeline #40550 passed with stage
in 10 minutes and 25 seconds
......@@ -236,14 +236,19 @@ class AssetWidget(QWidget):
self.asset_name_label.setText(self.current_asset.name)
self.save_button.setEnabled(False)
def __update_editors_icon(self, is_valid):
def __update_editors_icon(self, is_valid, errors=None):
tab_index = self.tab_widget.indexOf(self.editors)
tab_icon = (
self.style().standardIcon(QStyle.SP_MessageBoxCritical)
if not is_valid
else QIcon()
)
tab_tooltip = ""
if errors is not None:
tab_tooltip = "\n".join(errors)
self.tab_widget.setTabIcon(tab_index, tab_icon)
self.tab_widget.setTabToolTip(tab_index, tab_tooltip)
def __clear_watcher(self):
"""Clears the content of the file system watcher"""
......@@ -454,7 +459,7 @@ class AssetWidget(QWidget):
do_load = True
if do_load:
self.__update_editors_icon(is_valid)
self.__update_editors_icon(is_valid, errors)
declaration = asset.declaration
......@@ -512,8 +517,8 @@ class AssetWidget(QWidget):
with FileBlocker(self.watcher, declaration_path):
self.current_asset.declaration = json_data
is_valid, _ = self.current_asset.is_valid()
self.__update_editors_icon(is_valid)
is_valid, errors = self.current_asset.is_valid()
self.__update_editors_icon(is_valid, errors)
if self.current_asset.type == AssetType.ALGORITHM:
update_code(self.current_asset)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment