From 36d5a30be04d5e5e451ef675825e4d5a9c8a8f94 Mon Sep 17 00:00:00 2001 From: VanillaHellen Date: Mon, 4 Jan 2021 12:23:17 +0100 Subject: [PATCH] added popup confirmation --- win_venv/main.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/win_venv/main.py b/win_venv/main.py index 869f44f..e3db0e1 100644 --- a/win_venv/main.py +++ b/win_venv/main.py @@ -15,6 +15,11 @@ def files(path): if os.path.isfile(os.path.join(path, file)): yield file +class deletePopup(QMessageBox): + def __init__(self, parent=None): + super(deletePopup,self).__init__(parent) + self.question(self,'', "Are you sure you want to delete the file?", self.Yes | self.No) + class LibraryTableButtons(QWidget): def __init__(self, filename, parent=None): super(LibraryTableButtons,self).__init__(parent) @@ -23,7 +28,11 @@ class LibraryTableButtons(QWidget): os.startfile(filePath + '\\' + filename) def deleteFile(): - os.remove(filePath + '\\' + filename) + self.exPopup = deletePopup() + self.exPopup.setGeometry(100, 200, 100, 100) + # self.exPopup.show() + if self.exPopup.Yes: + os.remove(filePath + '\\' + filename) layout = QHBoxLayout() layout.setContentsMargins(0,0,0,0)