本文整理汇总了Python中PyQt4.QtGui.QMovie.stop方法的典型用法代码示例。如果您正苦于以下问题:Python QMovie.stop方法的具体用法?Python QMovie.stop怎么用?Python QMovie.stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QMovie
的用法示例。
在下文中一共展示了QMovie.stop方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Radar
# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import stop [as 别名]
class Radar(QtGui.QLabel):
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 mapurl(self, radar,rect,markersonly):
#'https://maps.googleapis.com/maps/api/staticmap?maptype=hybrid¢er='+rcenter.lat+','+rcenter.lng+'&zoom='+rzoom+'&size=300x275'+markersr;
urlp = [];
if len(ApiKeys.googleapi) > 0: urlp.append('key='+ApiKeys.googleapi)
urlp.append('center='+str(radar['center'].lat)+','+str(radar['center'].lng))
zoom = radar['zoom']
rsize = rect.size()
if rsize.width() > 640 or rsize.height() > 640:
rsize = QtCore.QSize(rsize.width()/2,rsize.height()/2)
zoom -= 1
urlp.append('zoom='+str(zoom))
urlp.append('size='+str(rsize.width())+'x'+str(rsize.height()))
if markersonly:
urlp.append('style=visibility:off')
else:
urlp.append('maptype=hybrid')
for marker in radar['markers']:
marks = []
for opts in marker:
if opts != 'location':
marks.append(opts + ':' + marker[opts])
marks.append(str(marker['location'].lat)+','+str(marker['location'].lng))
urlp.append('markers='+'|'.join(marks))
return 'http://maps.googleapis.com/maps/api/staticmap?'+'&'.join(urlp)
def radarurl(self,radar,rect):
#wuprefix = 'http://api.wunderground.com/api/';
#wuprefix+wuapi+'/animatedradar/image.gif?maxlat='+rNE.lat+'&maxlon='+rNE.lng+'&minlat='+rSW.lat+'&minlon='+rSW.lng+wuoptionsr;
#wuoptionsr = '&width=300&height=275&newmaps=0&reproj.automerc=1&num=5&delay=25&timelabel=1&timelabel.y=10&rainsnow=1&smooth=1';
rr = getCorners(radar['center'],radar['zoom'],rect.width(),rect.height())
return (Config.wuprefix+ApiKeys.wuapi+'/animatedradar/image.gif'+
'?maxlat='+str(rr['N'])+
'&maxlon='+str(rr['E'])+
'&minlat='+str(rr['S'])+
'&minlon='+str(rr['W'])+
'&width='+str(rect.width())+
'&height='+str(rect.height())+
'&newmaps=0&reproj.automerc=1&num=5&delay=25&timelabel=1&timelabel.y=10&rainsnow=1&smooth=1&radar_bitmap=1&xnoclutter=1&xnoclutter_mask=1&cors=1'
)
def basefinished(self):
if self.basereply.error() != QNetworkReply.NoError: return
self.basepixmap = QPixmap()
self.basepixmap.loadFromData(self.basereply.readAll())
if self.basepixmap.size() != self.rect.size():
self.basepixmap = self.basepixmap.scaled(self.rect.size(), Qt.KeepAspectRatio, Qt.SmoothTransformation)
self.setPixmap(self.basepixmap)
def mkfinished(self):
if self.mkreply.error() != QNetworkReply.NoError: return
self.mkpixmap = QPixmap()
self.mkpixmap.loadFromData(self.mkreply.readAll())
if self.mkpixmap.size() != self.rect.size():
self.mkpixmap = self.mkpixmap.scaled(self.rect.size(), Qt.KeepAspectRatio, Qt.SmoothTransformation)
self.wmk.setPixmap(self.mkpixmap)
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())
#.........这里部分代码省略.........
示例2: Radar
# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import stop [as 别名]
#.........这里部分代码省略.........
zoom = radar['zoom']
rsize = rect.size()
if rsize.width() > 640 or rsize.height() > 640:
rsize = QtCore.QSize(rsize.width()/2,rsize.height()/2)
zoom -= 1
urlp.append('zoom='+str(zoom))
urlp.append('size='+str(rsize.width())+'x'+str(rsize.height()))
if markersonly:
urlp.append('style=visibility:off')
else:
urlp.append('maptype=hybrid')
for marker in radar['markers']:
marks = []
for opts in marker:
if opts != 'location':
marks.append(opts + ':' + marker[opts])
marks.append(str(marker['location'].lat)+','+str(marker['location'].lng))
urlp.append('markers='+'|'.join(marks))
return 'http://maps.googleapis.com/maps/api/staticmap?'+'&'.join(urlp)
def radarurl(self,radar,rect):
#wuprefix = 'http://api.wunderground.com/api/';
#wuprefix+wuapi+'/animatedradar/image.gif?maxlat='+rNE.lat+'&maxlon='+rNE.lng+'&minlat='+rSW.lat+'&minlon='+rSW.lng+wuoptionsr;
#wuoptionsr = '&width=300&height=275&newmaps=0&reproj.automerc=1&num=5&delay=25&timelabel=1&timelabel.y=10&rainsnow=1&smooth=1';
rr = getCorners(radar['center'],radar['zoom'],rect.width(),rect.height())
return (Config.wuprefix+ApiKeys.wuapi+'/animatedradar/image.gif'+
'?maxlat='+str(rr['N'])+
'&maxlon='+str(rr['E'])+
'&minlat='+str(rr['S'])+
'&minlon='+str(rr['W'])+
'&width='+str(rect.width())+
'&height='+str(rect.height())+
'&newmaps=0&reproj.automerc=1&num=5&delay=25&timelabel=1&timelabel.y=10&rainsnow=1&smooth=1&radar_bitmap=1&xnoclutter=1&xnoclutter_mask=1&cors=1'
)
def basefinished(self):
if self.basereply.error() != QNetworkReply.NoError: return
self.basepixmap = QPixmap()
self.basepixmap.loadFromData(self.basereply.readAll())
if self.basepixmap.size() != self.rect.size():
self.basepixmap = self.basepixmap.scaled(self.rect.size(), Qt.KeepAspectRatio, Qt.SmoothTransformation)
self.setPixmap(self.basepixmap)
def mkfinished(self):
if self.mkreply.error() != QNetworkReply.NoError: return
self.mkpixmap = QPixmap()
self.mkpixmap.loadFromData(self.mkreply.readAll())
if self.mkpixmap.size() != self.rect.size():
self.mkpixmap = self.mkpixmap.scaled(self.rect.size(), Qt.KeepAspectRatio, Qt.SmoothTransformation)
self.wmk.setPixmap(self.mkpixmap)
def wxfinished(self):
if self.wxreply.error() != QNetworkReply.NoError: return
self.wxdata = QtCore.QByteArray(self.wxreply.readAll())
self.wxbuff = QtCore.QBuffer(self.wxdata)
self.wxbuff.open(QtCore.QIODevice.ReadOnly)
self.wxmovie = QMovie(self.wxbuff, 'GIF')
self.wwx.setMovie( self.wxmovie)
if self.parent().isVisible():
self.wxmovie.start()
def getwx(self):
global manager
self.wxreq = QNetworkRequest(QUrl(self.wxurl+'&rrrand='+str(time.time())))
self.wxreply = manager.get(self.wxreq)
QtCore.QObject.connect(self.wxreply, QtCore.SIGNAL("finished()"),self.wxfinished)
def getbase(self):
global manager
self.basereq = QNetworkRequest(QUrl(self.baseurl))
self.basereply = manager.get(self.basereq)
QtCore.QObject.connect(self.basereply,QtCore.SIGNAL("finished()"),self.basefinished)
def getmk(self):
global manager
self.mkreq = QNetworkRequest(QUrl(self.mkurl))
self.mkreply = manager.get(self.mkreq)
QtCore.QObject.connect(self.mkreply,QtCore.SIGNAL("finished()"),self.mkfinished)
def start(self, interval=10*60*1000):
self.getbase()
self.getmk()
self.getwx()
self.timer = QtCore.QTimer()
QtCore.QObject.connect(self.timer,QtCore.SIGNAL("timeout()"), self.getwx)
self.timer.start(interval)
def wxstart(self):
self.wxmovie.start()
def wxstop(self):
self.wxmovie.stop()
def stop(self):
try:
self.timer.stop()
self.timer = None
if self.wxmovie: self.wxmovie.stop()
except Exception:
pass
示例3: VisionneurImagePourEKD
# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import stop [as 别名]
class VisionneurImagePourEKD(QScrollArea):
''' Classe pour l'affichage des images (avec des barres de
défilement)'''
def __init__(self, img=None):
QScrollArea.__init__(self)
# Déclaration du drapeau: a-t-on chargé un *.gif
if img and os.path.splitext(img)[1]!=".gif":
self.gif = 1
else:
self.gif = 0
# Facteur de redimensionnement de l'image à afficher par rapport à la taille réelle de l'image
self.factor = 1
# Variables de paramètres
self.modeTransformation=Qt.SmoothTransformation
#self.modeTransformation=Qt.FastTransformation
# widget qui contiendra l'image
self.imageLabel = QLabel()
self.imageLabel.setAlignment(Qt.AlignCenter)
self.setBackgroundRole(QPalette.Dark)
self.setWidget(self.imageLabel)
# Indispensable pour ne pas avoir d'images tronquées, lors du chargement de nvll img
self.setWidgetResizable(True)
# Position du curseur dans le QScrollArea au moment du clic de la souris
self.positionPresseeSourisIni = QPoint()
# Position du point haut-gauche du QScrollArea par rapport au QPixMap entier au
# moment du clic de la souris (par la suite appelée "position de la barre de défilement")
self.positionBarrePresseeSourisIni = QPoint()
# Création du menu contextuel
self.menuZoom=QMenu("Zoom")
# Entrée zoom taille réelle
self.menuTailleReelle=self.menuZoom.addAction(_(u'&Taille Réelle'))
self.menuTailleReelle.setIcon(QIcon("Icones" + os.sep + "taillereelle.png"))
self.connect(self.menuTailleReelle, SIGNAL("triggered()"), self.setTailleReelle)
# Entrée zoom taille fenetre
self.menuTailleFenetre=self.menuZoom.addAction(_(u'&Adapter à la fenêtre'))
self.menuTailleFenetre.setIcon(QIcon("Icones" + os.sep + "fenetre.png"))
self.connect(self.menuTailleFenetre, SIGNAL("triggered()"), self.setTailleFenetre)
# Entrée zoom +
self.menuZoomPlus=self.menuZoom.addAction(_(u'&Zoom Avant'))
self.menuZoomPlus.setIcon(QIcon("Icones" + os.sep + "zoomplus.png"))
self.connect(self.menuZoomPlus, SIGNAL("triggered()"), self.zoomAvant)
# Entrée zoom -
self.menuZoomMoins=self.menuZoom.addAction(_(u'&Zoom Arrière'))
self.menuZoomMoins.setIcon(QIcon("Icones" + os.sep + "zoommoins.png"))
self.connect(self.menuZoomMoins, SIGNAL("triggered()"), self.zoomArriere)
# Entrée mettre en pause/démarrer l'animation du gif
self.menuStartPauseGif=self.menuZoom.addAction(_(u"Mettre en pause/démarrer l'animation"))
self.menuStartPauseGif.setIcon(QIcon("Icones" + os.sep + "player_end.png"))
self.connect(self.menuStartPauseGif, SIGNAL("triggered()"), self.startPauseGif)
# Entrée mettre en pause/démarrer l'animation du gif
self.menuStopGif=self.menuZoom.addAction(_(u"Arrêter l'animation"))
self.menuStopGif.setIcon(QIcon("Icones" + os.sep + "player_stop.png"))
self.connect(self.menuStopGif, SIGNAL("triggered()"), self.stopGif)
# On cache les 2 menus de *.gif si on ne traite pas ce format
if not self.gif:
self.menuStartPauseGif.setVisible(False)
self.menuStopGif.setVisible(False)
# Si une image est en paramètre de classe, on l'affiche directement
# sinon on pourra toujours l'afficher plus tard en appelant la
# méthode setImage(), le moment venu
if img:
self.setImage(img)
self.setToolTip(img)
else:
# image par défaut
self.setImage("Icones" + os.sep + "avant-image.png")
self.setToolTip(_(u"image d'accueil"))
self.setTailleReelle()
def mousePressEvent(self, event):
"Menu contextuel et enregistrement de données préparant le déplacement de l'image par pincement"
# Menu contextuel
if event.button() == Qt.RightButton:
self.menuZoom.popup(event.globalPos())
# On enregistre la position du curseur et de la barre de défilement au moment du clic
elif event.button() == Qt.LeftButton:
self.positionPresseeSourisIni = QPoint(event.pos())
self.positionBarrePresseeSourisIni.setX(self.horizontalScrollBar().value())
self.positionBarrePresseeSourisIni.setY(self.verticalScrollBar().value())
if PYQT_VERSION_STR >= "4.1.0":
# curseur main fermée
self.setCursor(Qt.ClosedHandCursor)
else: self.setCursor(Qt.SizeAllCursor)
#.........这里部分代码省略.........
示例4: LearningWizard
# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import stop [as 别名]
#.........这里部分代码省略.........
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 trainingFinished(self):
if self.errors < 3:
self.training_summary.setText("The training sucessfully finished. Your OCR accuracy should be very high.")
elif self.errors < 6:
self.training_summary.setText("The training sucessfully finished. Your OCR accuracy should satisfactory. You might still increase it by repeating this process with other screenshots.")
elif self.errors < 10:
self.training_summary.setText("The training sucessfully finished. Your OCR accuracy is sufficient but not perfect. You should repeat this process with other screenshots.")
else:
self.training_summary.setText("The training finished. Your OCR accuracy is not sufficient. You should repeat this process with other screenshots.")
def stepFinished(self, value, error):
self.steps += 1
self.details.append(value+"\n")
self.errors += error
if self.steps == 3:
self.trainingFinished()
self.movie.stop()
self.loader.clear()
def connectData(self):
connected = {}
characters = ["'", ',', '-', '&', '[', ']', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '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', '*', '+', '#']
if self.user is None:
self.user = {}
if self.base is None:
self.base = {}
for char in characters:
if char in self.base and char in self.user:
connected[char] = self.base[char]+self.user[char]
elif char in self.base:
connected[char] = self.base[char]
elif char in self.user:
connected[char] = self.user[char]
return connected
def getRandomData(self, data, characters):
self.testsamples = {}
samples = 30
for char in characters:
amount = len(data[char])/400
if amount > samples:
picks = random.sample(range(amount), samples)
else:
picks = random.sample(range(amount), amount)
示例5: ServerToolsWindow
# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import stop [as 别名]
class ServerToolsWindow(base_class, ui_class):
__metaclass__ = QSingleton
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 _SH_AccountButtonMenuTriggered(self, action):
view = self.tab_widget.currentWidget()
account = action.data().toPyObject()
self.account_label.setText(account.id)
self.tab_widget.setTabText(self.tab_widget.currentIndex(), account.id)
view.load_account_page(account, tab=view.tab, task=view.task)
def _SH_WebViewLoadStarted(self):
self.spinner_label.setMovie(self.spinner_movie)
self.spinner_label.show()
self.spinner_movie.start()
self.progress_bar.setValue(0)
# self.progress_bar.show()
def _SH_WebViewLoadFinished(self, load_ok):
self.spinner_movie.stop()
self.spinner_label.hide()
self.progress_bar.hide()
if not load_ok:
web_view = self.tab_widget.currentWidget()
icon_path = Resources.get("icons/invalid.png")
error_message = web_view.last_error or "Unknown error"
html = """
<html>
<head>
<style>
.icon { width: 64px; height: 64px; float: left; }
.message { margin-left: 74px; line-height: 64px; vertical-align: middle; }
</style>
</head>
<body>
<img class="icon" src="file:%s" />
<div class="message">Failed to load web page: <b>%s</b></div>
</body>
</html>
""" % (
icon_path,
error_message,
)
web_view.loadStarted.disconnect(self._SH_WebViewLoadStarted)
web_view.loadFinished.disconnect(self._SH_WebViewLoadFinished)
web_view.setHtml(html)
web_view.loadStarted.connect(self._SH_WebViewLoadStarted)
web_view.loadFinished.connect(self._SH_WebViewLoadFinished)
def _SH_WebViewLoadProgress(self, percent):
self.progress_bar.setValue(percent)
def _SH_ModelChanged(self, parent_index, start, end):
menu = self.account_button.menu()
menu.clear()
for row in xrange(self.model.rowCount()):
account_info = self.model.data(self.model.index(row, 0), Qt.UserRole).toPyObject()
action = QAction(account_info.name, self)
action.setData(QVariant(account_info.account))
menu.addAction(action)
def open_settings_page(self, account):
view = self.tab_widget.currentWidget()
account = account or view.account
if account is None or account.server.settings_url is None:
account = self.account_button.menu().actions()[0].data().toPyObject()
self.account_label.setText(account.id)
self.tab_widget.setTabText(self.tab_widget.currentIndex(), account.id)
view.load_account_page(account, tab="settings")
self.show()
def open_search_for_people_page(self, account):
view = self.tab_widget.currentWidget()
#.........这里部分代码省略.........
示例6: MainWindow
# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import stop [as 别名]
#.........这里部分代码省略.........
def show_feedback(self):
feed = Feedback(self.com)
feed.exec_()
def about_semard(self):
about = QMessageBox.about(self, "Sobre Semard",
u"""<b>Semard</b> v%s
<p><b>Copyright (C) 2013</b> Ronnie Andrew.</p>
<p>Todos os direitos reservados de acordo com a licença GNU GPL v3 ou posterior.</p>
<p><b>Website Oficial:</b> <a href='https://github.com/ROAND/Series-Manager'>GitHub</a></p>
<p><b>Plataforma: </b>%s</p>
""" % (__version__, platform.system()))
def show_semard(self, message):
self.show()
def closeEvent(self, event):
self.hide()
self.tray.showMessage(u'Semard', u'Semard ainda está em execução.')
event.ignore()
@Slot(str)
def set_image(self, img_str):
self.ui.image_label.setPixmap(QPixmap(img_str))
@Slot(str)
def message(self, message):
if str(message) in 'ended':
self.ui.loading_label.hide()
# self.repaint()
self.ui.anime_list_widget.setEnabled(True)
self.ui.show_button.setEnabled(True)
self.movie.stop()
if str(message) in 'started':
self.ui.loading_label.show()
# self.repaint()
self.ui.anime_list_widget.setEnabled(False)
self.ui.show_button.setEnabled(False)
self.movie.start()
def anime_entered(self, item):
pass
def load_url_items(self):
self.com.sig.emit('started')
self.main_download_page = AnimeList('http://www.anbient.net/lista')
self.number, self.anime_list = self.main_download_page.get_attrs()
self.ui.avaLabel.setText('%s disponiveis.' % self.number)
self.add_full_items_animelist()
self.com.sig.emit('ended')
def episode_change(self):
self.com.sig.emit('started')
self.ui.options_list_widget.clear()
if self.ui.res_list_widget.currentItem():
name = self.ui.res_list_widget.currentItem().text()
episode = self.episode_list[name]
self.ui.options_list_widget.addItems(episode.links)
self.com.sig.emit('ended')
def download(self):
#name = self.ui.options_list_widget.currentItem().text()
link = self.ui.options_list_widget.currentItem().text()
self.com.sig.emit('started')
示例7: MuWizard
# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import stop [as 别名]
class MuWizard(QWizard):
def __init__(self, R=None, parent=None):
QWizard.__init__(self, parent)
self.R = R
self.data = None
self.addPage(self.introPage())
self.addPage(self.loadPage())
self.addPage(self.modelsPage())
self.addPage(self.resultsPage())
self.setWindowTitle('Wizard of muScale')
self.setPixmap(QWizard.LogoPixmap, QPixmap(RES + ICONS + LOGO))
self.setStyleSheet('QWizard {' + GRADIENT +'}\
QPushButton {\
color: #333;\
border: 1px solid #555;\
border-radius: 11px;\
padding: 2px;\
background: qradialgradient(cx: 0.3, cy: -0.4,\
fx: 0.3, fy: -0.4,\
radius: 1.35, stop: 0 #fff, stop: 1 #888);\
min-width: 80px;}\
QPushButton:hover {\
color: #fff;\
background: qradialgradient(cx: 0.3, cy: -0.4,\
fx: 0.3, fy: -0.4,\
radius: 1.35, stop: 0 #fff, stop: 1 #bbb);}\
QPushButton:pressed {\
color: #800;\
background: qradialgradient(cx: 0.4, cy: -0.1,\
fx: 0.4, fy: -0.1,\
radius: 1.35, stop: 0 #fff, stop: 1 #ddd);}\
QPushButton:checked {\
background: qradialgradient(cx: 0.4, cy: -0.1,\
fx: 0.4, fy: -0.1,\
radius: 1.35, stop: 0 #fff, stop: 1 #ddd);}\
QComboBox {\
color: #333;\
border: 1px solid #555;\
border-radius: 11px;\
padding: 1px 18px 1px 3px;\
background: qradialgradient(cx: 0.3, cy: -0.4,\
fx: 0.3, fy: -0.4,\
radius: 1.35, stop: 0 #fff, stop: 1 #888);\
min-width: 20px;}\
QComboBox:hover {\
color: #fff;\
background: qradialgradient(cx: 0.3, cy: -0.4,\
fx: 0.3, fy: -0.4,\
radius: 1.35, stop: 0 #fff, stop: 1 #bbb);}\
QComboBox::down-arrow {\
image: url(' + RES + ICONS + ARROW_DOWN + ');}\
QComboBox::down-arrow:on {\
top: 1px;\
left: 1px;}\
QComboBox::drop-down {\
subcontrol-origin: padding;\
subcontrol-position: top right;\
width: 15px;\
border-left-width: 1px;\
border-left-color: darkgray;\
border-left-style: solid;\
border-top-right-radius: 3px;\
border-bottom-right-radius: 3px;}\
QToolButton {\
color: #333;\
border: 1px solid #555;\
border-radius: 11px;\
padding: 2px;\
background: qradialgradient(cx: 0.3, cy: -0.4,\
fx: 0.3, fy: -0.4,\
radius: 1.35, stop: 0 #fff, stop: 1 #888);\
min-width: 20px;}\
QToolButton:hover {\
color: #fff;\
background: qradialgradient(cx: 0.3, cy: -0.4,\
fx: 0.3, fy: -0.4,\
radius: 1.35, stop: 0 #fff, stop: 1 #bbb);}\
QToolButton:pressed {\
background: qradialgradient(cx: 0.4, cy: -0.1,\
fx: 0.4, fy: -0.1,\
radius: 1.35, stop: 0 #fff, stop: 1 #ddd);}\
QToolButton:checked {\
background: qradialgradient(cx: 0.4, cy: -0.1,\
fx: 0.4, fy: -0.1,\
radius: 1.35, stop: 0 #fff, stop: 1 #ddd);}')
def introPage(self):
intro = QWizardPage()
intro.setTitle('Hello and welcome')
label = QLabel('''This is a wizard.
Now you're ready to forecast some time series!
''')
label.setWordWrap(True)
layout = QVBoxLayout()
#.........这里部分代码省略.........
示例8: genOneTab
# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import stop [as 别名]
def genOneTab(self, tabtitle="", tabbtn="", tabnums="", strwhere = "where studentsn like '03%' "):
# tabtitle.setFixedHeight(40)
# tabtitle.setFixedWidth(160)
tabtitle.setFont(QFont('Courier New', 20))
tabtitle.setText("随堂提问演板")
tabtitle.setStyleSheet("border: 3px solid blue;\
border-radius: 6px; \
padding: 1px 18px 1px 20px;\
min-width: 8em;")
tabtitle.setMinimumHeight(50);
titleLayout = QHBoxLayout()
titleLayout.addWidget(tabtitle)
titleLayout.setAlignment(tabtitle, Qt.AlignCenter)
btnlayout = QGridLayout()
cur = conn.cursor()
strsql = "select studentsn, studentname from student " + strwhere
cur.execute(strsql)
tmpnum = 0
for item in cur.fetchall():
irow = tmpnum // 7
icol = tmpnum % 7
tmpnum += 1
btnlayout.setRowMinimumHeight(irow, 80)
tmpbtn = QPushButton(item[1])
# tmpbtn.setFixedHeight(20)
tmpbtn.setSizePolicy(QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding))
# tmpbtn.setStyleSheet("border: 1px solid rgb(255,255,255,0);background-color: rgba(255,255,255,20);font-size:16px;")
tmpbtn.setFlat(True)
popMenu = QMenu(self)
entry1 = popMenu.addAction("正确")
self.connect(entry1,SIGNAL('triggered()'), lambda item=item[0]: self.answerRight(item))
entry2 = popMenu.addAction("错误")
self.connect(entry2,SIGNAL('triggered()'), lambda item=item[0]: self.answerWrong(item))
entry3 = popMenu.addAction("替换")
self.connect(entry3,SIGNAL('triggered()'), lambda item=item[0]: self.resetStudent(item))
tmpbtn.setMenu(popMenu)
tmpbtn.setAutoDefault(False)
self.btngroup.addButton(tmpbtn, int(item[0]))
tmpmovie = QMovie('image/ex_stu.gif', QByteArray(), self)
tmplabel = QLabel()
tmplabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
tmplabel.setAlignment(Qt.AlignCenter)
tmplabel.setMovie(tmpmovie)
tmplabel.setScaledContents(True)
tmplabel.setLayout(QHBoxLayout())
tmplabel.layout().setContentsMargins(0,0,0,0)
# tmplabel.setStyleSheet("border: 1px solid rgb(255,255,255,0);background-color: rgba(255,255,255,20);font-size:16px;")
tmplabel.layout().addWidget(tmpbtn)
tmpmovie.start()
tmpmovie.stop()
btnlayout.addWidget(tmplabel, irow, icol)
tabbtn.setIcon(QIcon("image/start.png"))
tabbtn.setStyleSheet("border: 5px solid yellow;")
tabbtn.setFixedHeight(40)
tabbtn.setFixedWidth(100)
tabbtn.setFont(QFont('宋体', 20))
# tabnums.setFixedHeight(45)
# tabnums.setFixedWidth(60)
tabnums.setFont(QFont('Courier New', 20))
tabnums.setStyleSheet("border: 5px solid blue; color:red;font-weight:bold;font-size:26px;\
border-radius: 6px; \
padding: 1px 1px 1px 1px;\
min-width: 2em; ")
tabnums.setEditable(True)
tabnums.lineEdit().setReadOnly(True);
tabnums.lineEdit().setAlignment(Qt.AlignCenter);
model = tabnums.model()
for row in list(range(1, 7)):
item = QStandardItem(str(row))
item.setTextAlignment(Qt.AlignCenter)
item.setForeground(QColor('red'))
item.setBackground(QColor(0,200,50, 130))
model.appendRow(item)
tabnums.setCurrentIndex(2)
# tabnums.setStyleSheet ("QComboBox::drop-down {border-width: 100px;}")
# tabnums.setStyleSheet ("QComboBox::down-arrow {image: url(image/downarrow.png);top: 10px;left: 1px;}")
bottomlayout = QHBoxLayout()
bottomlayout.setSizeConstraint(QLayout.SetFixedSize)
bottomlayout.addStretch(10)
bottomlayout.addWidget(tabbtn)
bottomlayout.setSpacing(5)
bottomlayout.addWidget(tabnums)
cur.close()
return(titleLayout, btnlayout, bottomlayout)
示例9: __init__
# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import stop [as 别名]
#.........这里部分代码省略.........
def show_settings_widget(self):
if self.settings_widget != None:
if not self.settings_widget.isVisible():
self.settings_widget.show()
self.settings_widget.check_settings()
def show_transfer_widget(self):
if self.settings_widget.isVisible():
self.settings_widget.hide()
self.transfer_widget.show()
def show_about(self):
if not self.about_dialog.isVisible():
self.about_dialog.show()
def show_note(self, message):
QMaemo5InformationBox.information(None, QString(message), 0)
def show_banner(self, message, timeout = 5000):
QMaemo5InformationBox.information(None, QString(message), timeout)
def show_loading_ui(self, message = "", loading = True):
self.loading_ui.info_label.setText(message)
self.loading_ui.info_label_icon.hide()
self.thumb_was_visible = self.manager_ui.thumb_container.isVisible()
self.manager_ui.thumb_container.hide()
self.loading_widget.show()
self.loading_ui.load_animation_label.setVisible(loading)
if loading:
self.loading_animation.start()
else:
self.loading_animation.stop()
def show_information_ui(self, message, succesfull, timeout = 4000):
self.loading_ui.load_animation_label.hide()
self.thumb_was_visible = self.manager_ui.thumb_container.isVisible()
if self.thumb_was_visible:
self.manager_ui.thumb_container.hide()
self.loading_ui.info_label.setText(message)
if succesfull == None:
icon = self.information_icon_queue
elif succesfull:
icon = self.information_icon_ok
else:
icon = self.information_icon_error
self.loading_ui.info_label_icon.setPixmap(icon)
self.loading_ui.info_label_icon.show()
self.loading_widget.show()
self.information_message_timer.start(timeout)
def hide_loading_ui(self):
if not self.information_message_timer.isActive():
self.loading_widget.hide()
if self.loading_animation.state() == QMovie.Running:
self.loading_animation.stop()
def hide_information_message(self):
self.loading_ui.info_label_icon.hide()
self.hide_loading_ui()
self.manager_ui.thumb_container.setVisible(self.thumb_was_visible)
def try_trusted_login(self):
self.trusted_login_ui.label_error.setText("")
email = self.trusted_login_ui.line_edit_email.text()