diff --git a/win_venv/files/input/input1 — kopia.mp4 b/win_venv/files/input/input1 — kopia.mp4 deleted file mode 100644 index e69de29..0000000 diff --git a/win_venv/files/input/input1.mp4 b/win_venv/files/input/input1.mp4 deleted file mode 100644 index e69de29..0000000 diff --git a/win_venv/files/input/test.txt b/win_venv/files/input/test.txt deleted file mode 100644 index 0a1baa4..0000000 --- a/win_venv/files/input/test.txt +++ /dev/null @@ -1 +0,0 @@ -test txt file \ No newline at end of file diff --git a/win_venv/files/output/test.pdf b/win_venv/files/output/test.pdf deleted file mode 100644 index d8d354c..0000000 Binary files a/win_venv/files/output/test.pdf and /dev/null differ diff --git a/win_venv/main.py b/win_venv/main.py index 6b5c83a..703f8e5 100644 --- a/win_venv/main.py +++ b/win_venv/main.py @@ -49,7 +49,7 @@ class deletePopup(QMessageBox): class LibraryTableButtons(QWidget): - def __init__(self, file, table, type, parent=None): + def __init__(self, file, table, type, mainWindow, parent=None): super(LibraryTableButtons,self).__init__(parent) def viewFile(): @@ -60,7 +60,7 @@ class LibraryTableButtons(QWidget): ret = self.exPopup.exec() if ret == self.exPopup.Yes: os.remove(file) - table.fillTable(type) + table.fillTable(type, mainWindow) def analyzeFile(): cmd = "py detect.py --source {} --view-img".format(str(file)) @@ -68,7 +68,7 @@ class LibraryTableButtons(QWidget): popen = subprocess.Popen(cmd, cwd="../yolov5/", stdout=subprocess.PIPE) popen.wait() # todo: display gif/spinning wheel - pass + mainWindow.showVisualisation(file) layout = QHBoxLayout() layout.setContentsMargins(0,0,0,0) @@ -92,11 +92,11 @@ class LibraryTableButtons(QWidget): class LibraryTable(QTableWidget): - def __init__(self, type, singleFilePath = None, parent = None): + def __init__(self, type, mainWindow, singleFilePath = None, parent = None): QTableWidget.__init__(self) - self.fillTable(type, singleFilePath) + self.fillTable(type, mainWindow, singleFilePath) - def fillTable(self, type, singleFilePath = None): + def fillTable(self, type, mainWindow, singleFilePath = None): self.setColumnCount(3) if singleFilePath != None: @@ -111,7 +111,7 @@ class LibraryTable(QTableWidget): self.setItem(0,0,QTableWidgetItem(str(datetime.fromtimestamp(os.path.getmtime(singleFilePath))))) self.setItem(0,1,QTableWidgetItem(str(os.path.basename(singleFilePath)))) - self.setCellWidget(0,2,LibraryTableButtons(singleFilePath, self, type)) + self.setCellWidget(0,2,LibraryTableButtons(singleFilePath, self, type, mainWindow)) else: @@ -138,14 +138,14 @@ 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(names[index].text(), self, type)) + self.setCellWidget(index,2,LibraryTableButtons(names[index].text(), self, type, mainWindow)) class formatHelp(QLabel): def __init__(self, parent=None): QLabel.__init__(self) - with open('static/help.txt', 'r', encoding='utf-8') as file: + with open(scriptPath + os.path.sep + 'static/help.txt', 'r', encoding='utf-8') as file: help_text = file.read().replace('\n', '') self.setText(help_text) self.setStyleSheet("padding-left: 20px; padding-right: 20px; padding-top: 10px; padding-bottom: 10px; font-size:32px;") @@ -167,12 +167,12 @@ class MainWindow(QMainWindow): # Show raw uploaded files def showInputLibrary(self): - libTable = LibraryTable(LIB_RAW) + libTable = LibraryTable(LIB_RAW, self) self.setCentralWidget(libTable) # Show visualisations def showVisualisationsLibrary(self): - libTable = LibraryTable(LIB_VIS) + libTable = LibraryTable(LIB_VIS, self) self.setCentralWidget(libTable) def showUploadFile(self): @@ -182,8 +182,12 @@ class MainWindow(QMainWindow): if dialog.exec_(): file_path = dialog.selectedFiles()[0] # ['C:/Users/agatha/Desktop/SYI/VisionScore/win_venv/requirements.txt'] newPath = save_input(file_path) - singleFileTable = LibraryTable(LIB_RAW, newPath) + singleFileTable = LibraryTable(LIB_RAW, self, newPath) self.setCentralWidget(singleFileTable) + + def showVisualisation(self, path): + singleFileTable = LibraryTable(LIB_VIS, self, path) + self.setCentralWidget(singleFileTable) def initUI(self): self.setGeometry(0, 0, 600, 400)