Merge branch 'VIS-31'

This commit is contained in:
Agata 2021-01-25 17:12:20 +01:00
commit bcf7808cba
2 changed files with 31 additions and 9 deletions

View File

@ -6,7 +6,7 @@ from datetime import datetime
import time
from PyQt5 import QtCore
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QIcon, QPixmap
from PyQt5.QtGui import QIcon, QPixmap, QMovie
from PyQt5.QtCore import *
scriptPath = os.path.dirname(os.path.realpath(__file__))
@ -40,6 +40,24 @@ class deletePopup(QMessageBox):
self.setStandardButtons(self.Yes | self.No)
class analizePopup(QMessageBox):
def __init__(self, parent=None):
super(analizePopup, self).__init__(parent)
self.setStyleSheet("QLabel{min-width: 100px; max-width: 100px; qproperty-alignment: AlignCenter;}");
self.setWindowIcon(QIcon(scriptPath + os.path.sep + 'static/v_logo.jpg'))
self.setText("Analizing file...")
self.setWindowTitle("File analysis")
# create Label
self.setIconPixmap(QPixmap(scriptPath + os.path.sep + 'static/loading.gif'))
icon_label = self.findChild(QLabel, "qt_msgboxex_icon_label")
movie = QMovie(scriptPath + os.path.sep + 'static/loading.gif')
# avoid garbage collector
setattr(self, 'icon_label', movie)
icon_label.setMovie(movie)
movie.start()
self.setStandardButtons(self.Cancel)
class LibraryTableButtons(QWidget):
def __init__(self, file, table, type, parent=None):
super(LibraryTableButtons,self).__init__(parent)
@ -55,12 +73,17 @@ class LibraryTableButtons(QWidget):
table.fillTable(type)
def analyzeFile():
cmd = "py detect.py --source {} --view-img".format(str(file))
self.exPopup = analizePopup()
#cmd = "py detect.py --source {} --view-img".format(str(file))
#popen = subprocess.Popen(cmd, cwd="../yolov5/", stdout=subprocess.PIPE)
cancel = self.exPopup.exec()
if cancel == self.exPopup.Cancel:
#popen.terminate()
pass
#popen.wait()
self.exPopup.close()
popen = subprocess.Popen(cmd, cwd="../yolov5/", stdout=subprocess.PIPE)
popen.wait()
# todo: display gif/spinning wheel
pass
layout = QHBoxLayout()
layout.setContentsMargins(0,0,0,0)
@ -137,7 +160,7 @@ 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;")
@ -180,8 +203,7 @@ class MainWindow(QMainWindow):
def initUI(self):
self.setGeometry(0, 0, 600, 400)
self.setWindowTitle('VisionScore')
scriptDir = os.path.dirname(os.path.realpath(__file__))
self.setWindowIcon(QIcon(scriptDir + os.path.sep + 'static/v_logo.jpg'))
self.setWindowIcon(QIcon(scriptPath + os.path.sep + 'static/v_logo.jpg'))
# File menu
menuBar = self.menuBar()

BIN
win_venv/static/loading.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB