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)
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)
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 __init__(self, parent=None): super(Status, self).__init__(parent) self.setupUi(self) self.base = parent self.wait_anim = QMovie(":/stuff/wait.gif") self.anim_lbl.setMovie(self.wait_anim) self.anim_lbl.hide() self.show_menu = QMenu(self) for i in [ self.act_page, self.act_date, self.act_text, self.act_comment ]: self.show_menu.addAction(i) # noinspection PyUnresolvedReferences i.triggered.connect(self.on_show_items) i.setChecked(True) sort_menu = QMenu(self) ico_sort = QIcon(":/stuff/sort.png") group = QActionGroup(self) action = QAction(_("Date"), sort_menu) action.setCheckable(True) action.setChecked(not self.base.high_by_page) action.triggered.connect(self.base.set_highlight_sort) action.setData(False) group.addAction(action) sort_menu.addAction(action) action = QAction(_("Page"), sort_menu) action.setCheckable(True) action.setChecked(self.base.high_by_page) action.triggered.connect(self.base.set_highlight_sort) action.setData(True) group.addAction(action) sort_menu.addAction(action) sort_menu.setIcon(ico_sort) sort_menu.setTitle(_("Sort by")) self.show_menu.addMenu(sort_menu) self.show_items_btn.setMenu(self.show_menu)
def __init__(self, loadIcon="loading_bar", primaryMessage="Please, Wait", message='', parent=None): super(LoadingWidget, self).__init__(parent) self.finished.connect(self._updateUI) self.setStyleSheet(""" QWidget { background-color: #ffffff } """) self._icon_load = loadIcon self._primary_message = primaryMessage self._label_message = QLabel(message) self._label_message.setWordWrap(True) self._label_message.setAlignment(Qt.AlignCenter) self._label_primary_message = QLabel(self._primary_message) self._label_primary_message.setStyleSheet(""" QLabel { font-size: 20px; font-weight:bold; color: rgb(65,65,65); } """) self._label_primary_message.setAlignment(Qt.AlignCenter) self._label_movie = QLabel() self._label_movie.setAlignment(Qt.AlignCenter) self._movie = QMovie(self._icon_load) self._label_movie.setMovie(self._movie) self._movie.start() layout = QVBoxLayout() layout.addWidget(self._label_primary_message) layout.addSpacing(5) layout.addWidget(self._label_message) layout.addSpacing(5) layout.addWidget(self._label_movie) layout.addStretch() #self._setupAnimation() # this should be done after showing everything to get correct geometries self.setLayout(layout)
def __init__(self, parent=None): super(PowerNotificationDialog, self).__init__(parent) self.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint) layout = QGridLayout() spinBox = QLabel() spinner = QMovie(":icons/spinner") spinner.start() spinBox.setMovie(spinner) layout.addWidget(spinBox, 0, 0) self.textBox = QLabel() layout.addWidget(self.textBox, 0, 1, 1, 3) btnOK = ExpandingButton() btnOK.setText("OK") btnOK.clicked.connect(self.accept) layout.addWidget(btnOK, 1, 1, 1, 2) self.setLayout(layout)
def __init__(self, parent=None): QLabel.__init__(self, parent) self.setText(self.tr("<u>can't obtain picture</u>")) self.lblLoadProcess = QLabel("...", self) self.lblLoadProcess.setMovie(QMovie(":/loading.gif")) self.lblLoadProcess.setAlignment(Qt.AlignCenter) self.lblLoadProcess.hide() self.btnDownload = QPushButton("", self) self.btnDownload.setIcon(QIcon(":/folder.png")) self.btnDownload.setIconSize(QSize(self._icon_size, self._icon_size)) self.btnDownload.setFlat(True) self.btnDownload.clicked.connect(self.save_image) self.btnDownload.clicked.connect(self.button_download_clicked) self.download_ended.connect(self.check_image) self.download_ended.connect(self.lblLoadProcess.hide) self.download_ended.connect(self.btnDownload.show) self.download_ended.connect(self.end_load_anim) self.download_started.connect(self.start_load_anim) self.download_started.connect(self.btnDownload.hide) self.download_started.connect(self.lblLoadProcess.show)
def __init__(self, parent=None): QLabel.__init__(self, parent) self.setAlignment(Qt.AlignCenter) self.movie = QMovie("assets/load2.gif") self.setMovie(self.movie)