Commit ce45cbdb authored by Flavio TARSETTI's avatar Flavio TARSETTI
Browse files

[widgets] Improve dialog boxes for deleted/updated asset widgets

Fixes #241
parent 5a4d7eb2
Pipeline #37663 passed with stage
in 6 minutes and 24 seconds
...@@ -333,8 +333,8 @@ class AssetWidget(QWidget): ...@@ -333,8 +333,8 @@ class AssetWidget(QWidget):
if self.current_editor.isDirty(): if self.current_editor.isDirty():
answer = QMessageBox.question( answer = QMessageBox.question(
self, self,
self.tr(f"Save {self.current_asset.name} ?"), self.tr("Save changed content"),
self.tr("Content changed.\n" "Do you want to save ?"), self.tr(f"Content changed.\nSave {self.current_asset.name} ?"),
) )
if answer == QMessageBox.Yes: if answer == QMessageBox.Yes:
...@@ -371,7 +371,7 @@ class AssetWidget(QWidget): ...@@ -371,7 +371,7 @@ class AssetWidget(QWidget):
self, self,
self.tr("Deletion requested"), self.tr("Deletion requested"),
self.tr( self.tr(
"You are about to delete the asset you are currently editing\n\nAre you sure you want to do that ?" f"You are about to delete the asset {self.current_asset.name} you are currently editing\n\nAre you sure you want to do that ?"
), ),
) )
if answer == QMessageBox.No: if answer == QMessageBox.No:
...@@ -384,16 +384,17 @@ class AssetWidget(QWidget): ...@@ -384,16 +384,17 @@ class AssetWidget(QWidget):
self.current_asset = None self.current_asset = None
else: else:
# Check before deletion # Check before deletion
asset = Asset.from_path(self.prefix_root_path, file_path)
asset_type = str(asset.type).split("AssetType.")[1].lower()
answer = QMessageBox.question( answer = QMessageBox.question(
self, self,
self.tr("Deletion requested"), self.tr("Deletion requested"),
self.tr( self.tr(
"You are about to delete an asset\n\nAre you sure you want to do that ?" f"You are about to delete an asset of type {asset_type} named {asset.name}.\n\nAre you sure you want to do that ?"
), ),
) )
if answer == QMessageBox.No: if answer == QMessageBox.No:
return return
asset = Asset.from_path(self.prefix_root_path, file_path)
asset.delete() asset.delete()
def confirm_loading(self, errors): def confirm_loading(self, errors):
......
Supports Markdown
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