added post-vis table, fixed help, removed test input/output files
This commit is contained in:
parent
681f434386
commit
0864afb2b7
@ -1 +0,0 @@
|
||||
test txt file
|
Binary file not shown.
@ -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,14 +60,15 @@ 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))
|
||||
# cmd = "py detect.py --source {} --view-img".format(str(file))
|
||||
|
||||
popen = subprocess.Popen(cmd, cwd="../yolov5/", stdout=subprocess.PIPE)
|
||||
popen.wait()
|
||||
# popen = subprocess.Popen(cmd, cwd="../yolov5/", stdout=subprocess.PIPE)
|
||||
# popen.wait()
|
||||
# todo: display gif/spinning wheel
|
||||
mainWindow.showVisualisation(file)
|
||||
pass
|
||||
|
||||
layout = QHBoxLayout()
|
||||
@ -92,11 +93,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 +112,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 +139,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 +168,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,7 +183,11 @@ 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):
|
||||
|
Loading…
Reference in New Issue
Block a user