Merge branch 'TESTS'

This commit is contained in:
Agata 2020-12-21 22:43:51 +01:00
commit d02d0e53d1
2 changed files with 27 additions and 1 deletions

View File

@ -1,7 +1,9 @@
#import tkinter as tk
import sys
import os
import shutil
from datetime import datetime
import time
from PyQt5 import QtCore
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QIcon, QPixmap
@ -16,6 +18,16 @@ def files(path):
yield file
def save_input(oldpath):
# make timestampt the filename, so it wouln't overwrite
timestamp = str(int(time.time()))
filename = timestamp + '.' + oldpath.split('.')[-1]
newpath = filePath + '\\' + filename
print(oldpath)
print(newpath)
shutil.copy(oldpath, newpath)
class LibraryTableButtons(QWidget):
def __init__(self, filename, parent=None):
super(LibraryTableButtons,self).__init__(parent)
@ -60,6 +72,7 @@ class LibraryTable(QTableWidget):
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
@ -69,6 +82,14 @@ class MainWindow(QMainWindow):
libTable = LibraryTable()
self.setCentralWidget(libTable)
def showUploadFile(self):
dialog = QFileDialog(self)
dialog.setFileMode(QFileDialog.AnyFile)
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)
def initUI(self):
self.setGeometry(0, 0, 600, 400)
self.setWindowTitle('VisionScore')
@ -79,7 +100,11 @@ class MainWindow(QMainWindow):
menuBar = self.menuBar()
homeMenu = QMenu("&Home", self)
menuBar.addMenu(homeMenu)
homeMenu.addAction("Load new file")
# Upload file
uploadAct = QAction('&Upload new file', self)
uploadAct.triggered.connect(self.showUploadFile)
homeMenu.addAction(uploadAct)
libraryAct = QAction('&Library', self)
libraryAct.triggered.connect(self.showLibrary)

1
win_venv/tests.py Normal file
View File

@ -0,0 +1 @@
#tests