Exemplo n.º 1
0
    def __init__(self, parent=None, statusBarService=None):
        """
        Creates a QProgressBar and adds it to the given status bar (for
        threads that can provide accurate progress information).

        Note: The status bar can either be a QStatusBar or the StatusBarService. In the default
        BioPARKIN use, it is the StatusBarService instance.

        @todo: A throbber is created and also added to the status bar (for
        threads that can only provide start/stop information).
        """
        #        super(ProgressBarService, self).__init__(parent)   # done in __new__

        if statusBarService is not None:
            self.statusBarService = statusBarService
            self.progressBar = QProgressBar(None)  # used for showing progress
            self.progressBarMutex = QMutex()
            self.progressBar.hide()
            self.statusBarService.addPermanentWidget(self.progressBar)
            self.progressRunning = False

            self.throbber = QLabel()
            self.throbberRunning = False
            self.throbberMutex = QMutex()
            self.statusBarService.addPermanentWidget(self.throbber)
            self.throbber.show()
            self.throbber.hide()

            throbberImage = QMovie(":/images/Spinning_wheel_throbber.gif", parent=self.throbber)
            throbberImage.setScaledSize(QSize(24, 24))
            throbberImage.setCacheMode(QMovie.CacheAll)
            throbberImage.start()
            self.throbber.setMovie(throbberImage)
            self.throbber.setFixedSize(24, 24)
Exemplo n.º 2
0
    def __init__(self, parent=None, statusBarService=None):
        """
        Creates a QProgressBar and adds it to the given status bar (for
        threads that can provide accurate progress information).

        Note: The status bar can either be a QStatusBar or the StatusBarService. In the default
        BioPARKIN use, it is the StatusBarService instance.

        @todo: A throbber is created and also added to the status bar (for
        threads that can only provide start/stop information).
        """
        #        super(ProgressBarService, self).__init__(parent)   # done in __new__

        if statusBarService is not None:
            self.statusBarService = statusBarService
            self.progressBar = QProgressBar(None)  # used for showing progress
            self.progressBarMutex = QMutex()
            self.progressBar.hide()
            self.statusBarService.addPermanentWidget(self.progressBar)
            self.progressRunning = False

            self.throbber = QLabel()
            self.throbberRunning = False
            self.throbberMutex = QMutex()
            self.statusBarService.addPermanentWidget(self.throbber)
            self.throbber.show()
            self.throbber.hide()

            throbberImage = QMovie(":/images/Spinning_wheel_throbber.gif",
                                   parent=self.throbber)
            throbberImage.setScaledSize(QSize(24, 24))
            throbberImage.setCacheMode(QMovie.CacheAll)
            throbberImage.start()
            self.throbber.setMovie(throbberImage)
            self.throbber.setFixedSize(24, 24)
Exemplo n.º 3
0
 def update(self):
     self.my_rank = 0
     for class_id in self.img_wdg.keys():
         if class_id != '8':
             r = self.wdg_pos[class_id][0]
             c = self.wdg_pos[class_id][1]
             t_min = round(self.pose_time[class_id] / 60)
             t_sec = self.pose_time[class_id] - t_min * 60
             self.cellWidget(r, c * 3 + 2).setText('%02d:%02d' %
                                                   (t_min, t_sec))
             self.cellWidget(r, c * 3 + 2).update()
             if t_sec > 0 or t_min > 0:
                 if not os.path.isdir('tmp'):
                     os.mkdir('tmp')
                 gif_output = imageio.get_writer('tmp/%s.gif' % class_id,
                                                 mode='I',
                                                 fps=2)
                 for img in self.correctFrames[class_id]:
                     #pimg=cv2.rectangle(img,(0,0),(256,256),(0,255,0),3)
                     gif_output.append_data(img[:, :, (2, 1, 0)])
                 gif_output.close()
                 print 'load gif'
                 lblMov = QtGui.QLabel('', self)
                 gif_anim = QMovie('tmp/%s.gif' % class_id, parent=self)
                 gif_anim.setCacheMode(QMovie.CacheAll)
                 gif_anim.setSpeed(200)
                 lblMov.setMovie(gif_anim)
                 gif_anim.start()
                 self.setCellWidget(r, c * 3 + 1, lblMov)
                 self.cellWidget(
                     r, c * 3).setStyleSheet('background-color: green;')
                 self.my_rank += 1
                 #self.cellWidget(r,c*3+1).setImage(self.correctFrames[class_id][0])
                 #self.cellWidget(r,c*3+1).update()
             else:
                 lblMov = QtGui.QLabel('', self)
                 gif_anim = QMovie('examples/%s.gif' % class_id,
                                   parent=self)
                 gif_anim.setCacheMode(QMovie.CacheAll)
                 gif_anim.setSpeed(300)
                 gif_anim.setScaledSize(QtCore.QSize(150, 150))
                 lblMov.setMovie(gif_anim)
                 gif_anim.start()
                 self.setCellWidget(r, c * 3 + 1, lblMov)
             print '%02d:%02d' % (t_min, t_sec)
Exemplo n.º 4
0
        class SpinnerDialog(SpinnerDialogType, BaseType):
            def __init__(self, parent=None):
                SpinnerDialogType.__init__(self, parent)
                BaseType.__init__(self, parent)
                self.setupUi(self)
                self.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint
                                    | Qt.WindowTitleHint)

                spinner_filename = os.path.join(
                    SubmitWindowController._get_self_dir(),
                    SPINNER_GIF_FILE_NAME)
                self.spinner_movie = QMovie(spinner_filename)
                self.spinner_movie.setScaledSize(QSize(40, 40))
                self.spinner_label.setMovie(self.spinner_movie)

            def show(self):
                super(SpinnerDialog, self).show()
                self.spinner_movie.start()