-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
139 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""Confirmation dialog.""" | ||
|
||
from PyQt6 import QtWidgets | ||
|
||
|
||
class ConfirmDialog(QtWidgets.QDialog): | ||
"""Dialog to confirm an action.""" | ||
|
||
def __init__(self, title, text, parent=None): | ||
super().__init__(parent) | ||
|
||
self.setWindowTitle(title) | ||
|
||
button_box = QtWidgets.QDialogButtonBox( | ||
QtWidgets.QDialogButtonBox.StandardButton.Ok | QtWidgets.QDialogButtonBox.StandardButton.Cancel | ||
) | ||
button_box.accepted.connect(self.accept) | ||
button_box.rejected.connect(self.reject) | ||
|
||
layout = QtWidgets.QVBoxLayout() | ||
message = QtWidgets.QLabel(text) | ||
layout.addWidget(message) | ||
layout.addWidget(button_box) | ||
self.setLayout(layout) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"""Test the confirm dialog.""" | ||
|
||
from rascal2.dialogs.confirm import ConfirmDialog | ||
|
||
|
||
def test_confirm_init(): | ||
"""Test that we can create a confirmation dialog.""" | ||
dlg = ConfirmDialog("Confirm Title", "Confirm?") | ||
assert dlg.windowTitle() == "Confirm Title" | ||
assert dlg.layout().itemAt(0).widget().text() == "Confirm?" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters