Skip to content

Add QMessagebox popup to confirm deleting axis#193

Merged
zdomke merged 2 commits into
slaclab:mainfrom
michaellans:delete_axis_popup
Sep 3, 2025
Merged

Add QMessagebox popup to confirm deleting axis#193
zdomke merged 2 commits into
slaclab:mainfrom
michaellans:delete_axis_popup

Conversation

@michaellans

Copy link
Copy Markdown
Collaborator

Description

Added a QMessagebox popup to confirm deleting an axis

Motivation

This makes his harder to accidentally delete an axis
[FEATURE] - Pop up for deleting axis #165

@YektaY YektaY requested a review from a team August 29, 2025 21:57
@YektaY YektaY linked an issue Aug 29, 2025 that may be closed by this pull request

@zdomke zdomke left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!
My only suggestion is to remove an unnecessary import.

Comment thread trace/widgets/control_panel.py Outdated
import qtawesome as qta
from qtpy import QtGui, QtCore, QtWidgets
from qtpy.QtCore import QTimer
from PyQt5.QtWidgets import QMessageBox

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from PyQt5.QtWidgets import QMessageBox

We import QtWidgets a couple lines above this. So you don't need to import the QMessageBox widget here.

Comment thread trace/widgets/control_panel.py Outdated
Comment on lines +648 to +657
dialog = QMessageBox(
text=str("Are you sure you want to delete the axis?"),
parent=self,
)
dialog.setIcon(QMessageBox.Information)
dialog.setWindowTitle("Delete Axis")
dialog.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
result = dialog.exec_()

if result == QMessageBox.Cancel:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dialog = QMessageBox(
text=str("Are you sure you want to delete the axis?"),
parent=self,
)
dialog.setIcon(QMessageBox.Information)
dialog.setWindowTitle("Delete Axis")
dialog.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
result = dialog.exec_()
if result == QMessageBox.Cancel:
dialog = QtWidgets.QMessageBox(
text=str("Are you sure you want to delete the axis?"),
parent=self,
)
dialog.setIcon(QtWidgets.QMessageBox.Information)
dialog.setWindowTitle("Delete Axis")
dialog.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
result = dialog.exec_()
if result == QtWidgets.QMessageBox.Cancel:

If we remove the import of QMessageBox above, then we need to reference it as QtWidgets.QMessageBox

@zdomke zdomke merged commit 5443c4c into slaclab:main Sep 3, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] - Pop up for deleting axis

2 participants