Merge pull request 'VIS-40-VIS-41' (#9) from VIS-40-VIS-41 into master

Reviewed-on: #9
This commit is contained in:
Helena Gałązka 2021-01-18 16:14:37 +01:00
commit 8f98740280

View File

@ -71,13 +71,29 @@ class LibraryTableButtons(QWidget):
class LibraryTable(QTableWidget):
def __init__(self, type, parent=None):
def __init__(self, type, singleFilePath = None, parent = None):
QTableWidget.__init__(self)
self.fillTable(type)
self.fillTable(type, singleFilePath)
def fillTable(self, type):
def fillTable(self, type, singleFilePath = None):
self.setColumnCount(3)
if singleFilePath != None:
self.setRowCount(1)
self.setHorizontalHeaderLabels(['Upload date', 'Filename', 'Options'])
filePath = inputFilePath
self.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch)
self.horizontalHeader().setSectionResizeMode(1, QHeaderView.Stretch)
self.horizontalHeader().setSectionResizeMode(2, QHeaderView.ResizeToContents)
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))
else:
if type == LIB_RAW:
self.setHorizontalHeaderLabels(['Upload date', 'Filename', 'Options'])
filePath = inputFilePath
@ -170,7 +186,9 @@ class MainWindow(QMainWindow):
dialog.setFilter(QDir.Files)
if dialog.exec_():
file_path = dialog.selectedFiles()[0] # ['C:/Users/agatha/Desktop/SYI/VisionScore/win_venv/requirements.txt']
save_input(file_path)
newPath = save_input(file_path)
singleFileTable = LibraryTable(LIB_RAW, newPath)
self.setCentralWidget(singleFileTable)
def initUI(self):
self.setGeometry(0, 0, 600, 400)