added analize popup
This commit is contained in:
parent
c20509f16f
commit
0a204e6f74
@ -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
|
from PyQt5.QtGui import QIcon, QPixmap, QMovie
|
||||||
from PyQt5.QtCore import *
|
from PyQt5.QtCore import *
|
||||||
|
|
||||||
scriptPath = os.path.dirname(os.path.realpath(__file__))
|
scriptPath = os.path.dirname(os.path.realpath(__file__))
|
||||||
@ -40,6 +40,24 @@ class deletePopup(QMessageBox):
|
|||||||
self.setStandardButtons(self.Yes | self.No)
|
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):
|
class LibraryTableButtons(QWidget):
|
||||||
def __init__(self, file, table, type, parent=None):
|
def __init__(self, file, table, type, parent=None):
|
||||||
super(LibraryTableButtons,self).__init__(parent)
|
super(LibraryTableButtons,self).__init__(parent)
|
||||||
@ -55,12 +73,17 @@ class LibraryTableButtons(QWidget):
|
|||||||
table.fillTable(type)
|
table.fillTable(type)
|
||||||
|
|
||||||
def analyzeFile():
|
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 = QHBoxLayout()
|
||||||
layout.setContentsMargins(0,0,0,0)
|
layout.setContentsMargins(0,0,0,0)
|
||||||
@ -137,7 +160,7 @@ class formatHelp(QLabel):
|
|||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
QLabel.__init__(self)
|
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', '')
|
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;")
|
||||||
@ -180,8 +203,7 @@ class MainWindow(QMainWindow):
|
|||||||
def initUI(self):
|
def initUI(self):
|
||||||
self.setGeometry(0, 0, 600, 400)
|
self.setGeometry(0, 0, 600, 400)
|
||||||
self.setWindowTitle('VisionScore')
|
self.setWindowTitle('VisionScore')
|
||||||
scriptDir = os.path.dirname(os.path.realpath(__file__))
|
self.setWindowIcon(QIcon(scriptPath + os.path.sep + 'static/v_logo.jpg'))
|
||||||
self.setWindowIcon(QIcon(scriptDir + os.path.sep + 'static/v_logo.jpg'))
|
|
||||||
|
|
||||||
# File menu
|
# File menu
|
||||||
menuBar = self.menuBar()
|
menuBar = self.menuBar()
|
||||||
|
BIN
win_venv/static/loading.gif
Normal file
BIN
win_venv/static/loading.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
Loading…
Reference in New Issue
Block a user