Merge pull request 'VIS-50' (#15) from VIS-50 into master

Reviewed-on: #15
This commit is contained in:
Helena Gałązka 2021-02-01 17:36:39 +01:00
commit 179ee054a4

View File

@ -6,7 +6,7 @@ from datetime import datetime
import time import time
from PyQt5 import QtCore from PyQt5 import QtCore
from PyQt5.QtWidgets import * from PyQt5.QtWidgets import *
from PyQt5.QtGui import QIcon, QPixmap, QMovie from PyQt5.QtGui import *
from PyQt5.QtCore import * from PyQt5.QtCore import *
scriptPath = os.path.dirname(os.path.realpath(__file__)) scriptPath = os.path.dirname(os.path.realpath(__file__))
@ -17,6 +17,13 @@ LIB_RAW = 0
LIB_VIS = 1 LIB_VIS = 1
stylesheet = """
MainWindow {
background: qlineargradient(x1:0 y1:0, x2:1 y2:0, stop:0 rgba(255,218,113,1), stop:0.5 rgba(215,137,255,1), stop:1 rgba(105,126,255,1));
}
"""
def files(path): def files(path):
for subdir, dirs, files_list in os.walk(path): for subdir, dirs, files_list in os.walk(path):
for file in files_list: for file in files_list:
@ -175,7 +182,7 @@ class formatHelp(QLabel):
with open(scriptPath + os.path.sep + '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', '') help_text = file.read().replace('\n', '')
self.setText(help_text) self.setText(help_text)
self.setStyleSheet("padding-left: 20px; padding-right: 20px; padding-top: 10px; padding-bottom: 10px; font-size:32px;") self.setStyleSheet("padding-left: 20px; padding-right: 20px; padding-top: 10px; padding-bottom: 10px; font-size:32px; background-color: white;")
self.adjustSize() self.adjustSize()
@ -191,6 +198,25 @@ class MainWindow(QMainWindow):
def showHelp(self): def showHelp(self):
label = formatHelp() label = formatHelp()
self.setCentralWidget(label) self.setCentralWidget(label)
def showHomepage(self):
# Upload file button + instructions on homepage
label = QLabel('Welcome to VisionScore! Use the button below to upload a file and start analyzing it. If you need further help, please click the "help" item in the menu above.', self)
label.setFont(QFont('Arial', 14))
label.setStyleSheet('color: white;')
label.adjustSize()
label.move(200,200)
shadow = QGraphicsDropShadowEffect()
shadow.setBlurRadius(10)
shadow.setOffset(2)
label.setGraphicsEffect(shadow)
button = QPushButton('Upload file', self)
button.setToolTip('This is an example button')
button.move(850,270)
button.setFixedSize(220, 50)
button.clicked.connect(self.showUploadFile)
# Show raw uploaded files # Show raw uploaded files
def showInputLibrary(self): def showInputLibrary(self):
@ -221,7 +247,8 @@ class MainWindow(QMainWindow):
self.setWindowTitle('VisionScore') self.setWindowTitle('VisionScore')
scriptDir = os.path.dirname(os.path.realpath(__file__)) scriptDir = os.path.dirname(os.path.realpath(__file__))
self.setWindowIcon(QIcon(scriptDir + os.path.sep + 'static/v_logo.jpg')) self.setWindowIcon(QIcon(scriptDir + os.path.sep + 'static/v_logo.jpg'))
self.showHomepage()
# File menu # File menu
menuBar = self.menuBar() menuBar = self.menuBar()
fileMenu = QMenu("&File", self) fileMenu = QMenu("&File", self)
@ -263,6 +290,7 @@ class MainWindow(QMainWindow):
def main(): def main():
app = QApplication(sys.argv) app = QApplication(sys.argv)
app.setStyleSheet(stylesheet)
w = MainWindow() w = MainWindow()
sys.exit(app.exec_()) sys.exit(app.exec_())