Commit 303106cf authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Merge branch '264_add_tooltip_for_errors' into 'master'

Add tooltip when asset is invalid

Closes #264

See merge request !135
parents 3c0c058b b0af5c74
Pipeline #40551 passed with stages
in 11 minutes and 31 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