Skip to content

Commit 85481f3

Browse files
committed
Dialogs: Re-enable volume (down)load cancelling
1 parent 2c1fd3c commit 85481f3

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/histalign/frontend/dialogs.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,10 @@ def __init__(self, parent: Optional[QtWidgets.QWidget] = None) -> None:
3434

3535
self.setMinimum(0)
3636
self.setMaximum(0)
37-
self.setCancelButton(None) # type: ignore[arg-type]
3837

39-
def closeEvent(self, event: QtGui.QCloseEvent) -> None:
40-
# Ugly but not all platforms support having a frame and no close button
41-
event.ignore()
42-
return
43-
44-
def keyPressEvent(self, event: QtGui.QKeyEvent) -> None:
45-
if event.key() == QtCore.Qt.Key.Key_Escape:
46-
# Disable closing dialog with Escape
47-
event.accept()
48-
return
49-
50-
super().keyPressEvent(event)
38+
# Pressing the "Cancel" button emits `canceled`, pressing Escape emits
39+
# `rejected`, so simplify to a single signal.
40+
self.rejected.connect(self.canceled.emit)
5141

5242

5343
class InvalidProjectFileDialog(QtWidgets.QMessageBox):

0 commit comments

Comments
 (0)