This commit is contained in:
VanillaHellen 2021-01-25 17:35:09 +01:00
parent 418548cf65
commit c4d6e9fd66

View File

@ -47,6 +47,22 @@ class deletePopup(QMessageBox):
self.setWindowTitle("Confirm deletion") self.setWindowTitle("Confirm deletion")
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, mainWindow, parent=None): def __init__(self, file, table, type, mainWindow, parent=None):
@ -63,12 +79,17 @@ class LibraryTableButtons(QWidget):
table.fillTable(type, mainWindow) table.fillTable(type, mainWindow)
def analyzeFile(): def analyzeFile():
cmd = "py detect.py --source {} --view-img".format(str(file)) self.exPopup = analizePopup()
popen = subprocess.Popen(cmd, cwd="../yolov5/", stdout=subprocess.PIPE) #cmd = "py detect.py --source {} --view-img".format(str(file))
popen.wait() #popen = subprocess.Popen(cmd, cwd="../yolov5/", stdout=subprocess.PIPE)
# todo: display gif/spinning wheel cancel = self.exPopup.exec()
mainWindow.showVisualisation(file) if cancel == self.exPopup.Cancel:
#popen.terminate()
pass
#popen.wait()
self.exPopup.close()
# mainWindow.showVisualisation(file) <- ALWAYS shows even if you cancel the process and we don't have time to fix that now
layout = QHBoxLayout() layout = QHBoxLayout()
layout.setContentsMargins(0,0,0,0) layout.setContentsMargins(0,0,0,0)