From 47a0a52475909e6967e1d05c46a7ca53a3a9d6ba Mon Sep 17 00:00:00 2001 From: VanillaHellen Date: Mon, 11 Jan 2021 16:22:46 +0100 Subject: [PATCH 1/2] refreshes the table after deleting the file --- win_venv/main.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/win_venv/main.py b/win_venv/main.py index 9053a95..1879404 100644 --- a/win_venv/main.py +++ b/win_venv/main.py @@ -41,7 +41,7 @@ class deletePopup(QMessageBox): class LibraryTableButtons(QWidget): - def __init__(self, file, parent=None): + def __init__(self, file, table, type, parent=None): super(LibraryTableButtons,self).__init__(parent) def viewFile(): @@ -49,10 +49,10 @@ class LibraryTableButtons(QWidget): def deleteFile(): self.exPopup = deletePopup() - # self.exPopup.setGeometry(100, 200, 100, 100) ret = self.exPopup.exec() if ret == self.exPopup.Yes: os.remove(file) + table.fillTable(type) layout = QHBoxLayout() layout.setContentsMargins(0,0,0,0) @@ -73,6 +73,9 @@ class LibraryTable(QTableWidget): def __init__(self, type, parent=None): QTableWidget.__init__(self) + self.fillTable(type) + + def fillTable(self, type): self.setColumnCount(3) if type == LIB_RAW: @@ -81,6 +84,7 @@ class LibraryTable(QTableWidget): else: self.setHorizontalHeaderLabels(['Creation date', 'Filename', 'Options']) filePath = outputFilePath + self.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch) self.horizontalHeader().setSectionResizeMode(1, QHeaderView.Stretch) self.horizontalHeader().setSectionResizeMode(2, QHeaderView.ResizeToContents) @@ -96,7 +100,7 @@ class LibraryTable(QTableWidget): for index, date in enumerate(dates): self.setItem(index,0,date) self.setItem(index,1,names[index]) - self.setCellWidget(index,2,LibraryTableButtons(filePath + '\\' + names[index].text())) + self.setCellWidget(index,2,LibraryTableButtons(filePath + '\\' + names[index].text(), self, type)) class formatHelp(QLabel): @@ -152,13 +156,13 @@ class MainWindow(QMainWindow): # Show raw uploaded files def showInputLibrary(self): - libTable = LibraryTable(LIB_RAW) - self.setCentralWidget(libTable) + self.libTable = LibraryTable(LIB_RAW) + self.setCentralWidget(self.libTable) # Show visualisations def showVisualisationsLibrary(self): - libTable = LibraryTable(LIB_VIS) - self.setCentralWidget(libTable) + self.libTable = LibraryTable(LIB_VIS) + self.setCentralWidget(self.libTable) def showUploadFile(self): dialog = QFileDialog(self) -- 2.20.1 From 98c1768d4f877a09f24eb9639592953819654a82 Mon Sep 17 00:00:00 2001 From: VanillaHellen Date: Mon, 11 Jan 2021 16:24:30 +0100 Subject: [PATCH 2/2] fix --- win_venv/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/win_venv/main.py b/win_venv/main.py index 1879404..c73fea9 100644 --- a/win_venv/main.py +++ b/win_venv/main.py @@ -156,13 +156,13 @@ class MainWindow(QMainWindow): # Show raw uploaded files def showInputLibrary(self): - self.libTable = LibraryTable(LIB_RAW) - self.setCentralWidget(self.libTable) + libTable = LibraryTable(LIB_RAW) + self.setCentralWidget(libTable) # Show visualisations def showVisualisationsLibrary(self): - self.libTable = LibraryTable(LIB_VIS) - self.setCentralWidget(self.libTable) + libTable = LibraryTable(LIB_VIS) + self.setCentralWidget(libTable) def showUploadFile(self): dialog = QFileDialog(self) -- 2.20.1