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