def __init__(self, conf_path): QtGui.QWidget.__init__(self) Ui_Procedure.__init__(self) self.setupUi(self) self.db_api = db_api.DBApi( utils.get_conf_value(conf_path, 'db', 'db_path')) self.image_advertisement_path = utils.get_static_images_path( conf_path, 'image_advisediment_name') self.image_advertisement_path_other = utils.get_static_images_path( conf_path, 'image_advisediment_name2') self.image_guide_path = utils.get_static_images_path( conf_path, 'image_guide_name') self.image_recogniting_path = utils.get_static_images_path( conf_path, 'image_recogniting_name') self.image_unidentified_path = utils.get_static_images_path( conf_path, 'image_unidentified_name') self.guide_timeout = int( utils.get_conf_value(conf_path, 'guide', 'timeout')) self.unidentified_timeout = int( utils.get_conf_value(conf_path, 'unidentified', 'timeout')) self.rec_sys_path = utils.get_static_images_path( conf_path, 'rec_sys_name') self.pra_sys_path = utils.get_static_images_path( conf_path, 'pra_sys_name') self.save_image_base_path = utils.get_conf_value( conf_path, 'cache_fruits_images', 'save_image_base_path') self.pra_button.setStyleSheet("QPushButton{border-image: url(%s)}" % self.pra_sys_path) self.rec_button.setStyleSheet("QPushButton{border-image: url(%s)}" % self.rec_sys_path) self.advertisement_movie = QMovie(self.image_advertisement_path) self.guide_movie = QMovie(self.image_guide_path) self.recogniting_movie = QMovie(self.image_recogniting_path) self.unidentified_movie = QMovie(self.image_unidentified_path) self.advertisement_button.clicked.connect(self.show_guide_ui) self.setWindowFlags(Qt.Qt.FramelessWindowHint) self.running_dialog = '' self.timeout_timer = QTimer() self.timeout_timer.timeout.connect(self.timeout_handler) self.image_choice_system_path = utils.get_static_images_path( conf_path, 'image_logo_name') self.pra_button.clicked.connect(self.show_praitce_dialog) self.rec_button.clicked.connect(self.show_advertisment_ui) self.return_choice_button.clicked.connect(self.upload_cloud) self.choice_system() self.change_shop_button.clicked.connect(self.show_praitce_dialog) self.file_path = '' self.practice_mode = False self.qthread = UploadImage(self.save_image_base_path) self.qthread.signal_upload_resp.connect(self.set_if_success_label) self.setStyleSheet("QPushButton{outline: none}")
def wxfinished(self): if self.wxreply.error() != QNetworkReply.NoError: print "get radar error " + self.myname + ":" + str( self.wxreply.error()) self.lastwx = 0 return print "radar map received:" + self.myname + ":" + time.ctime() self.wxmovie.stop() self.wxdata = QtCore.QByteArray(self.wxreply.readAll()) self.wxbuff = QtCore.QBuffer(self.wxdata) self.wxbuff.open(QtCore.QIODevice.ReadOnly) mov = QMovie(self.wxbuff, 'GIF') print "radar map frame count:" + self.myname + ":" + str( mov.frameCount()) if mov.frameCount() > 2: self.lastwx = time.time() else: # radar image retreval failed self.lastwx = 0 # retry in 5 seconds QtCore.QTimer.singleShot(5 * 1000, self.getwx) return self.wxmovie = mov self.wwx.setMovie(self.wxmovie) if self.parent().isVisible(): self.wxmovie.start()
def __init__(self, model, parent=None): super(ServerToolsWindow, self).__init__(parent) with Resources.directory: self.setupUi(self) self.spinner_movie = QMovie( Resources.get('icons/servertools-spinner.mng')) self.spinner_label.setMovie(self.spinner_movie) self.spinner_label.hide() self.progress_bar.hide() while self.tab_widget.count(): self.tab_widget.removeTab(0) # remove the tab(s) added in designer self.tab_widget.tabBar().hide() self.account_button.setMenu(QMenu(self.account_button)) self.setWindowTitle('Blink Server Tools') self.setWindowIconText('Server Tools') self.model = model self.tab_widget.addTab(ServerToolsWebView(self), '') font = self.account_label.font() font.setPointSizeF(self.account_label.fontInfo().pointSizeF() + 2) font.setFamily("Sans Serif") self.account_label.setFont(font) self.model.rowsInserted.connect(self._SH_ModelChanged) self.model.rowsRemoved.connect(self._SH_ModelChanged) self.account_button.menu().triggered.connect( self._SH_AccountButtonMenuTriggered) web_view = self.tab_widget.currentWidget() web_view.loadStarted.connect(self._SH_WebViewLoadStarted) web_view.loadFinished.connect(self._SH_WebViewLoadFinished) web_view.loadProgress.connect(self._SH_WebViewLoadProgress)
def __init__(self): super(MainWindow, self).__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self) self.ui.searchEdit.textChanged.connect(self.search_text_changed) self.ui.show_button.clicked.connect(self.show_episodes) self.ui.searchEdit.returnPressed.connect(self.show_episodes) self.episodes = None self.episode_list = None self.number = 0 self.anime_list = None self.ui.download_button.clicked.connect(self.download) self.ui.res_list_widget.currentItemChanged.connect(self.episode_change) self.com = Comunicate() self.com.sig.connect(self.message) self.com.img.connect(self.set_image) self.ui.anime_list_widget.itemDoubleClicked.connect(self.show_episodes) self.setWindowIcon(QIcon(get_file('animes.png'))) self.ui.anime_list_widget.itemPressed.connect(self.anime_entered) Thread(target=self.load_url_items).start() #self.load_url_items() self.movie = QMovie(get_file('ajax-loader.gif')) self.ui.loading_label.setMovie(self.movie) self.link = None self.main_download_page = None self.tray = SystemTrayIcon(QIcon(get_file('animes.png')), self.com, self) self.com.op.connect(self.show_semard) self.ui.action_About_Semard.activated.connect(self.about_semard) self.ui.action_Contato.activated.connect(self.show_feedback) self.setWindowTitle('Semard - Animes') self.browser = None self.player = None
def __init__(self): QWidget.__init__(self) self.tray = Tray(self) self.setMinimumSize(QSize(320, 200)) self.setWindowFlags(Qt.Popup | Qt.FramelessWindowHint) self.verticalLayout = QVBoxLayout(self) self.verticalLayout.setMargin(1) self.text = QTextBrowser(self) self.text.setReadOnly(True) self.text.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.text.setOpenExternalLinks(True) self.verticalLayout.addWidget(self.text) self.text.textChanged.connect(self.on_text_changed) self.notify = Notify(self) self.movie = QMovie() dev = QBuffer() dev.setData(QByteArray.fromBase64(CHECK_IMAGE)) dev.open(QBuffer.ReadOnly) dev.setParent(self.movie) self.movie.setDevice(dev) self.movie.frameChanged.connect(self.on_frame_changed) self.realized = False self.show()
def __init__(self): super(self.__class__, self).__init__() movie = QMovie(HERE_PATH + "/spinner.gif") movie.setScaledSize(QSize(23, 23)) movie.setSpeed(200) self.setMovie(movie) movie.start()
def trainOCR(self): self.train_button.setEnabled(False) alldata = self.connectData() testnumbers = self.getRandomData(alldata, self.NUMBERS) testletters = self.getRandomData(alldata, self.LETTERS) teststation = self.getRandomData(alldata, self.STATION) self.movie = QMovie(":/ico/loader.gif") self.loader.setMovie(self.movie) self.movie.start() self.numberstrainerthread = Trainer(self, "numbers", self.base, self.user, testnumbers, testletters, teststation) self.letterstrainerthread = Trainer(self, "letters", self.base, self.user, testnumbers, testletters, teststation) self.stationtrainerthread = Trainer(self, "station", self.base, self.user, testnumbers, testletters, teststation) QObject.connect(self.numberstrainerthread, SIGNAL('finished(QString, int)'), self.stepFinished) QObject.connect(self.letterstrainerthread, SIGNAL('finished(QString, int)'), self.stepFinished) QObject.connect(self.stationtrainerthread, SIGNAL('finished(QString, int)'), self.stepFinished) #QObject.connect(self.trainerthread, SIGNAL('finishedall(int)'), self.trainingFinished) self.numberstrainerthread.execute() self.letterstrainerthread.execute() self.stationtrainerthread.execute() self.training_summary.setText("Training in progress")
def set_widgets(self): """Set all widgets on the tab.""" contacts = Contact.get_rows() for contact in contacts: contact_name = contact.name contact_email = ' - ' + contact.email if contact.email else '' contact_phone = ' - ' + contact.phone if contact.phone else '' contact_item = QListWidgetItem(contact_name + contact_email + contact_phone) contact_item.setData(Qt.UserRole, contact) self.project_contact_list.addItem(contact_item) self.project_contact_list.setSelectionMode( QAbstractItemView.ExtendedSelection) icon_path = resources_path('images', 'throbber.gif') movie = QMovie(icon_path) self.throbber_loader.setMovie(movie) movie.start() self.get_available_organisations() self.organisation_box.setFocus() self.project_description_text.setTabChangesFocus(True)
def __init__(self, parent, radar, rect, myname): global xscale, yscale self.myname = myname self.rect = rect self.baseurl = self.mapurl(radar, rect, False) #print "google map base url: "+self.baseurl self.mkurl = self.mapurl(radar, rect, True) self.wxurl = self.radarurl(radar, rect) QtGui.QLabel.__init__(self, parent) self.interval = Config.radar_refresh * 60 self.lastwx = 0 self.setObjectName("radar") self.setGeometry(rect) self.setStyleSheet("#radar { background-color: grey; }") self.setAlignment(Qt.AlignCenter) self.wwx = QtGui.QLabel(self) self.wwx.setObjectName("wx") self.wwx.setStyleSheet("#wx { background-color: transparent; }") self.wwx.setGeometry(0, 0, rect.width(), rect.height()) self.wmk = QtGui.QLabel(self) self.wmk.setObjectName("mk") self.wmk.setStyleSheet("#mk { background-color: transparent; }") self.wmk.setGeometry(0, 0, rect.width(), rect.height()) self.wxmovie = QMovie()
def on_radioButton_clicked(self, checked): """ Slot documentation goes here. """ # TODO: not implemented yet global audio, record_t movie = QMovie(":/icon/icon/siri.gif") self.label_4.setMovie(movie) if checked: self.label_4.setStyleSheet("") movie.start() if self.thread_flag == 0: print "abcd" self.start_flag = 1 record_t = MyThread(ui.record_wave, (ui, ), ui.record_wave.__name__) record_t.setDaemon(True) record_t.start() self.thread_flag = 1 else: movie.stop() self.label_4.setStyleSheet( "border-image: url(:/icon/icon/siri.gif);") if self.thread_flag == 1: self.start_flag = 0 self.thread_flag = 0
def __init__(self, fileName): QLabel.__init__(self) thread = Thread(self) m = QMovie(fileName) m.start() self.setMovie(m) app.aboutToQuit.connect(thread.stop) thread.start()
def show_unmute(self): self.movie = QMovie(":/unmute.gif", QByteArray(), self) self.movie.setScaledSize(CustomSize*0.7) self.movie.setCacheMode(QMovie.CacheAll) self.movie.setSpeed(100) self.movie_screen.setMovie(self.movie) self.muted = False self.movie.start()
def visualize(self): self.steps = 0 gdal.UseExceptions() si = subprocess.STARTUPINFO() si.dwFlags |= subprocess.STARTF_USESHOWWINDOW if self.point1.x() > self.point2.x(): minx = math.floor(self.point2.x()) maxx = math.ceil(self.point1.x()) else: minx = math.floor(self.point1.x()) maxx = math.ceil(self.point2.x()) if self.point1.y() > self.point2.y(): miny = math.floor(self.point2.y()) maxy = math.ceil(self.point1.y()) else: miny = math.floor(self.point1.y()) maxy = math.ceil(self.point2.y()) dataset_full = gdal.Open(self.dir_path[0] + '/' + self.roofground_file) full_array = dataset_full.ReadAsArray().astype(np.float) fullsizex = full_array.shape[1] fullsizey = full_array.shape[0] toplefty = self.yllcorner + fullsizey gdalclip_build = 'gdal_translate -a_nodata -9999 -projwin ' + str(minx) + ' ' + str(maxy)\ + ' ' + str(maxx) + ' ' + str(miny) + \ ' -of GTiff ' + self.dir_path[0] + '/' + self.roofground_file + ' ' \ + self.plugin_dir + '/data/temp.tif' subprocess.call(gdalclip_build, startupinfo=si) dataset = gdal.Open(self.plugin_dir + '/data/temp.tif') self.energy_array = dataset.ReadAsArray().astype(np.float) sizex = self.energy_array.shape[1] sizey = self.energy_array.shape[0] gdalclipasc_build = 'gdal_translate -a_nodata -9999 -projwin ' + str(minx) + ' ' + str(maxy) + ' ' + str(maxx) +\ ' ' + str(miny) + ' -of GTiff ' + self.dir_path[0] + '/' + self.height_file + ' ' + \ self.plugin_dir + '/data/temp_asc.tif' subprocess.call(gdalclipasc_build, startupinfo=si) dataset = gdal.Open(self.plugin_dir + '/data/temp_asc.tif') self.asc_array = dataset.ReadAsArray().astype(np.float) movie = QMovie(self.plugin_dir + '/loader.gif') self.visDlg.label.setMovie(movie) self.visDlg.label.show() movie.start() self.start_listworker(minx, maxy, sizex, sizey, toplefty)
def mute(self): """stop the animation""" self.movie = QMovie(":/mute.gif", QByteArray(), self) self.movie.setScaledSize(CustomSize*0.7) self.movie.setCacheMode(QMovie.CacheAll) self.movie.setSpeed(100) self.movie_screen.setMovie(self.movie) self.muted = True #print("Emitted 'sig_mute'") self.emit(SIGNAL("sig_mute")) self.movie.start()
def set_widgets(self): """Set all widgets on the tab.""" self.project_combo_box.currentIndexChanged.connect( self.project_combo_box_changed) icon_path = resources_path('images', 'throbber.gif') movie = QMovie(icon_path) self.throbber_loader.setMovie(movie) movie.start() self.get_available_projects() self.project_combo_box.setFocus()
def View5(self): #Pasamos vista 5 #---------------------- #Aqui se pone el gif :) self.movie = QMovie(self.GIF) self.ui.the_gif.setMovie(self.movie) self.movie.start() #---------------------- #Te gusta la foto? self.ui.setCurrentWidget(self.ui.View5)
def create_gif_icon(dir_=None): icon = QIcon() movie = QMovie(dir_) def update_icon(): i = QIcon(movie.currentPixmap()) icon.swap(i) movie.frameChanged.connect(update_icon) movie.start() return icon
def choice_system(self): self.show() self.shop_image.hide() self.change_shop_button.hide() self.return_choice_button.hide() self.advertisement_button.hide() self.gif = QMovie(self.image_choice_system_path) self.change_status_label.setMovie(self.gif) self.gif.start() self.if_success.setText('') # self.change_status_label.setStyleSheet( # "QPushButton{background-image: url(%s)}" % # self.image_choice_system_path) self.change_status_label.show()
def trainOCR(self): self.train_button.setEnabled(False) alldata = self.connectData() testnumbers = self.getRandomData( alldata, [',', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']) testletters = self.getRandomData(alldata, [ "'", ',', '-', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ]) teststation = self.getRandomData(alldata, [ "'", ',', '-', '&', '[', ']', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ]) testlevel = self.getRandomData(alldata, ['*', '+', '#']) self.movie = QMovie(":/ico/loader.gif") self.loader.setMovie(self.movie) self.movie.start() self.numberstrainerthread = Trainer(self, "numbers", self.base, self.user, testnumbers, testletters, teststation, testlevel) self.letterstrainerthread = Trainer(self, "letters", self.base, self.user, testnumbers, testletters, teststation, testlevel) self.stationtrainerthread = Trainer(self, "station", self.base, self.user, testnumbers, testletters, teststation, testlevel) self.leveltrainerthread = Trainer(self, "level", self.base, self.user, testnumbers, testletters, teststation, testlevel) QObject.connect(self.numberstrainerthread, SIGNAL('finished(QString, int)'), self.stepFinished) QObject.connect(self.letterstrainerthread, SIGNAL('finished(QString, int)'), self.stepFinished) QObject.connect(self.stationtrainerthread, SIGNAL('finished(QString, int)'), self.stepFinished) QObject.connect(self.leveltrainerthread, SIGNAL('finished(QString, int)'), self.stepFinished) #QObject.connect(self.trainerthread, SIGNAL('finishedall(int)'), self.trainingFinished) self.numberstrainerthread.execute() self.letterstrainerthread.execute() self.stationtrainerthread.execute() self.leveltrainerthread.execute() self.training_summary.setText("Training in progress")
def __init__(self, parent=None): QDialog.__init__(self, parent) self.ui = Ui_UpdateInstallProgressDialog() self.ui.setupUi(self) # Swap out the label with the gif to a movie that will actually display # it correctly. self.window = self.ui.updateIconLabel self.movie = QMovie(':/icons/icons/update-in-progress.gif', QByteArray(), self) # Run the GIF self.movie.setCacheMode(QMovie.CacheAll) self.movie.setSpeed(100) self.window.setMovie(self.movie) self.movie.start()
def notifyTimeout(self): self.timeoutCount += 1 if self.timeoutCount == self.notifyCount: msg = self.tr(u'No fix for %s since more than %d seconds!') % ( self.name, self.timeoutTime * self.timeoutCount / 1000) w = self.iface.messageBar().createMessage( self.tr(u'PosiView Attention'), msg) l = QLabel(w) m = QMovie(':/plugins/PosiView/hand.gif') m.setSpeed(75) l.setMovie(m) m.setParent(l) m.start() w.layout().addWidget(l) self.iface.messageBar().pushWidget(w, QgsMessageBar.CRITICAL, duration=self.notifyDuration)
def __init__(self, parent=None): """ Constructor """ QDialog.__init__(self, parent) label = QLabel(self) self.setFixedSize(100, 100) #self.setWindowOpacity(0.5) self.setAttribute(QtCore.Qt.WA_TranslucentBackground, True) self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.FramelessWindowHint) self.connect(self, SIGNAL("finished()"), self.close) self.setContentsMargins(0, 0, 0, 0) movie = QMovie(':/image/ajax-loader.gif') label.setMovie(movie) movie.start()
def __init__(self, parent): # initialize the super class super(LoaderWidget, self).__init__(parent) # create the movie if (LoaderWidget.MOVIE == None): LoaderWidget.MOVIE = QMovie( resources.find('img/main/ajax-loader.gif')) LoaderWidget.MOVIE.start() # create the movie label self._movieLabel = QLabel(self) self._movieLabel.setMovie(LoaderWidget.MOVIE) self._movieLabel.setAlignment(Qt.AlignCenter) self._messageLabel = QLabel(self) self._messageLabel.setAlignment(Qt.AlignCenter) palette = self._messageLabel.palette() palette.setColor(palette.WindowText, QColor('gray')) self._messageLabel.setPalette(palette) # create the interface layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.addStretch() layout.addWidget(self._movieLabel) layout.addWidget(self._messageLabel) layout.addStretch() self.setLayout(layout) self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) self.resize(0, 0) self.setMessage('') # set the default properties self.setAutoFillBackground(True) self.setBackgroundRole(QPalette.Window) # create custom properties clr = QColor('black') clr.setAlpha(150) self._backgroundColor = clr
def __init__(self, parent=None): QWidget.__init__(self, parent) # Create connecting image self.connectingGif = QMovie( qtUtils.getAbsoluteImagePath('waiting.gif')) self.connectingGif.start() self.connetingImageLabel = QLabel(self) self.connetingImageLabel.setMovie(self.connectingGif) self.connectingLabel = QLabel(self) hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(self.connetingImageLabel, alignment=Qt.AlignCenter) hbox.addSpacing(10) hbox.addWidget(self.connectingLabel, alignment=Qt.AlignCenter) hbox.addStretch(1) self.setLayout(hbox)
def __init__(self, parent, text=""): QDialog.__init__(self, parent) # Create waiting image waitingImage = QMovie(qtUtils.getAbsoluteImagePath('waiting.gif')) waitingImage.start() waitingImageLabel = QLabel(self) waitingImageLabel.setMovie(waitingImage) waitingLabel = QLabel(text, self) hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(waitingImageLabel) hbox.addSpacing(10) hbox.addWidget(waitingLabel) hbox.addStretch(1) self.setLayout(hbox)
def set_widgets(self): """Set all widgets on the tab.""" self.project_combo_box.currentIndexChanged.connect( self.project_combo_box_changed) checkbox_checked = get_setting('public_project') if checkbox_checked: self.public_projects_checkbox.setCheckState(Qt.Checked) self.public_projects_checkbox.stateChanged.connect( self.public_check_box_changed) icon_path = resources_path('images', 'throbber.gif') movie = QMovie(icon_path) self.throbber_loader.setMovie(movie) movie.start() self.get_available_projects() self.add_contact_label.mousePressEvent = self.add_contact_label_clicked self.set_enabled_add_contact_label(False) self.project_combo_box.setFocus() set_setting('public_project', self.public_projects_checkbox.checkState() == Qt.Checked)
def setStatus(self,status,message='',tooltip=None): '''Sets indicator icon and statusbar message''' self.parent.statusbar.showMessage(message) self.parent.statusbar.setToolTip(tooltip if tooltip else '') #progress loc = os.path.abspath(os.path.join(IMG_LOC,self.imgset[status])) #loc = os.path.abspath(os.path.join(os.path.dirname(__file__),self.parent.IMG_LOC,self.imgset[status])) self.progressbar.setVisible(status in (self.STATUS.BUSY, self.STATUS.CLEAN)) #icon anim = QMovie(loc, QByteArray(), self) anim.setScaledSize(QSize(self.IMG_WIDTH,self.IMG_HEIGHT)) anim.setCacheMode(QMovie.CacheAll) anim.setSpeed(self.IMG_SPEED) self.view.clear() self.view.setMovie(anim) anim.start() self.view.repaint() QApplication.processEvents(QEventLoop.AllEvents)
def wxfinished(self): if self.wxreply.error() != QNetworkReply.NoError: print "get radar error " + self.myname + ":" + \ str(self.wxreply.error()) self.lastwx = 0 return print "radar map received:" + self.myname + ":" + time.ctime() self.wxmovie.stop() self.wxdata = QtCore.QByteArray(self.wxreply.readAll()) self.wxbuff = QtCore.QBuffer(self.wxdata) self.wxbuff.open(QtCore.QIODevice.ReadOnly) mov = QMovie(self.wxbuff, 'GIF') print "radar map frame count:" + self.myname + ":" + \ str(mov.frameCount()) + ":r" + str(self.retries) if mov.frameCount() > 2: self.lastwx = time.time() self.retries = 0 else: # radar image retreval failed if self.retries > 3: # give up, last successful animation stays. # the next normal radar_refresh time (default 10min) will apply self.lastwx = time.time() return self.lastwx = 0 # count retries self.retries = self.retries + 1 # retry in 5 seconds QtCore.QTimer.singleShot(5 * 1000, self.getwx) return self.wxmovie = mov if self.satellite: self.setMovie(self.wxmovie) else: self.wwx.setMovie(self.wxmovie) if self.parent().isVisible(): self.wxmovie.start()
def __init__(self, visualization, parent_widget=None): QWidget.__init__(self, parent_widget) self.inGui = False self.visualization = visualization size = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.widgetLayout = QGridLayout(self) self.setSizePolicy(size) self.scroll = QScrollArea() file_path = self.visualization.get_file_path() self.label = QLabel() movie = QMovie(QString(file_path), QByteArray(), self) movie.setCacheMode(QMovie.CacheAll) self.label.setMovie(movie) movie.start() self.scroll.setWidget(self.label) self.widgetLayout.addWidget(self.scroll) self.tabIcon = QIcon(":/Images/Images/map.png") self.tabLabel = visualization.table_name
def __init__(self, filename, parent=None): QWidget.__init__(self, parent) # Load the file into a QMovie self.movie = QMovie(filename, QByteArray(), self) size = self.movie.scaledSize() self.setGeometry(200, 200, size.width(), size.height()) self.movie_screen = QLabel() # Make label fit the gif self.movie_screen.setAlignment(Qt.AlignCenter) # Create the layout main_layout = QVBoxLayout() main_layout.addWidget(self.movie_screen) self.setLayout(main_layout) # Add the QMovie object to the label self.movie.setCacheMode(QMovie.CacheAll) self.movie.setSpeed(100) self.movie_screen.setMovie(self.movie) self.movie.start()