added popup confirmation

This commit is contained in:
VanillaHellen 2021-01-04 12:23:17 +01:00
parent f75fb1f333
commit 36d5a30be0

View File

@ -15,6 +15,11 @@ def files(path):
if os.path.isfile(os.path.join(path, file)): if os.path.isfile(os.path.join(path, file)):
yield 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): class LibraryTableButtons(QWidget):
def __init__(self, filename, parent=None): def __init__(self, filename, parent=None):
super(LibraryTableButtons,self).__init__(parent) super(LibraryTableButtons,self).__init__(parent)
@ -23,6 +28,10 @@ class LibraryTableButtons(QWidget):
os.startfile(filePath + '\\' + filename) os.startfile(filePath + '\\' + filename)
def deleteFile(): def deleteFile():
self.exPopup = deletePopup()
self.exPopup.setGeometry(100, 200, 100, 100)
# self.exPopup.show()
if self.exPopup.Yes:
os.remove(filePath + '\\' + filename) os.remove(filePath + '\\' + filename)
layout = QHBoxLayout() layout = QHBoxLayout()