本文整理匯總了Python中PyQt4.QtCore.SIGNAL屬性的典型用法代碼示例。如果您正苦於以下問題:Python QtCore.SIGNAL屬性的具體用法?Python QtCore.SIGNAL怎麽用?Python QtCore.SIGNAL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類PyQt4.QtCore
的用法示例。
在下文中一共展示了QtCore.SIGNAL屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: doSettings
# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import SIGNAL [as 別名]
def doSettings(millisecWait, depth, fontSize):
global ui
Dialog = QtGui.QDialog()
settings = uic.loadUi(os.path.join(os.path.dirname(__file__), "./ui/settings.ui"), baseinstance=Dialog)
ui = settings
Dialog.setModal(True)
QtCore.QObject.connect(settings.lineEditNfSamples, QtCore.SIGNAL('textChanged (const QString&)'), onChange)
QtCore.QObject.connect(settings.lineEditTimesSecond, QtCore.SIGNAL('textChanged (const QString&)'), onChange)
ui.lineEditTimesSecond.setText(str(float(1000.0 / (millisecWait * 1.0))))
ui.lineEditNfSamples.setText(str(depth))
ui.lineEditFontSize.setText(str(fontSize))
Dialog.exec_()
millisecWait = int(1000.0 / float(str(ui.lineEditTimesSecond.displayText())))
depth = int(str(ui.lineEditNfSamples.displayText()))
fontSize = int(str(ui.lineEditFontSize.displayText()))
return(millisecWait, depth, fontSize)
示例2: getTiles
# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import SIGNAL [as 別名]
def getTiles(self, t, i=0):
t = int(t / 600)*600
self.getTime = t
self.getIndex = i
if i == 0:
self.tileurls = []
self.tileQimages = []
for tt in self.tiletails:
tileurl = "https://tilecache.rainviewer.com/v2/radar/%d/%s" \
% (t, tt)
self.tileurls.append(tileurl)
print self.myname + " " + str(self.getIndex) + " " + self.tileurls[i]
self.tilereq = QNetworkRequest(QUrl(self.tileurls[i]))
self.tilereply = manager.get(self.tilereq)
QtCore.QObject.connect(self.tilereply, QtCore.SIGNAL(
"finished()"), self.getTilesReply)
示例3: doHeavyLifting
# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import SIGNAL [as 別名]
def doHeavyLifting(self):
"""
UI callback, starts the thread with the proper arguments.
"""
if self.thread: # Sanity check.
return
self.singleProgress.setValue(1)
self.progressDialog.show();
self.mytimer.start(1000);
QtGui.QApplication.setOverrideCursor(
QtGui.QCursor(QtCore.Qt.WaitCursor))
self.thread = WorkThread(target=self.display_result)
QtCore.QObject.connect(self.thread, QtCore.SIGNAL("mainThread"),
self.mainThread)
QtCore.QObject.connect(self.thread, QtCore.SIGNAL("finished()"), self.threadDone)
self.thread.start()
示例4: run
# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import SIGNAL [as 別名]
def run(self):
self.lastTime = time.time()
while self.running:
# Timer
self.delta = time.time() - self.lastTime
if self.delta < self.limitDelta:
time.sleep(self.limitDelta - self.delta)
# print(1.0/(time.time() - self.lastTime))
self.lastTime = time.time()
# Process recieved queues
if not self.cmdQueue.empty():
# receive value must be tuple type
cmd, value = self.cmdQueue.get()
cmdName = get_command_name(cmd)
# recieved queues
if cmd == COMMAND.CLOSE_UI:
self.running = False
# call binded signal event
self.emit(QtCore.SIGNAL(cmdName), value)
示例5: sort
# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import SIGNAL [as 別名]
def sort(self, col, order=None):
if col in PlayerModel.sortableColumns:
reverse = False
if order == QtCore.Qt.DescendingOrder:
reverse = True
self.lastSort = col
self.lastSortOrder = order
getter = operator.itemgetter(col)
if col in [PlayerModel.PLAYER, PlayerModel.OPPONENT]:
keyfunc = lambda x: getter(x).lower()
else:
keyfunc = getter
self.emit(QtCore.SIGNAL("layoutAboutToBeChanged()"))
self.players = sorted(self.players, key=keyfunc, reverse=reverse)
self.players = sorted(self.players, key=operator.itemgetter(PlayerModel.STATE))
self.emit(QtCore.SIGNAL("layoutChanged()"))
示例6: setupUi
# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import SIGNAL [as 別名]
def setupUi(self, EmoticonDialog):
EmoticonDialog.setObjectName(_fromUtf8("EmoticonDialog"))
EmoticonDialog.resize(300, 500)
self.verticalLayout = QtGui.QVBoxLayout(EmoticonDialog)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.label = QtGui.QLabel(EmoticonDialog)
self.label.setObjectName(_fromUtf8("label"))
self.verticalLayout.addWidget(self.label)
self.uiEmoticonTextEdit = QtGui.QTextEdit(EmoticonDialog)
self.uiEmoticonTextEdit.setObjectName(_fromUtf8("uiEmoticonTextEdit"))
self.verticalLayout.addWidget(self.uiEmoticonTextEdit)
self.buttonBox = QtGui.QDialogButtonBox(EmoticonDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.verticalLayout.addWidget(self.buttonBox)
self.retranslateUi(EmoticonDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), EmoticonDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), EmoticonDialog.reject)
QtCore.QMetaObject.connectSlotsByName(EmoticonDialog)
示例7: waiting_dialog
# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import SIGNAL [as 別名]
def waiting_dialog(self, f):
s = Timer()
s.start()
w = QDialog()
w.resize(200, 70)
w.setWindowTitle('Encompass')
l = QLabel(_('Sending transaction, please wait.'))
vbox = QVBoxLayout()
vbox.addWidget(l)
w.setLayout(vbox)
w.show()
def ff():
s = f()
if s: l.setText(s)
else: w.close()
w.connect(s, QtCore.SIGNAL('timersignal'), ff)
w.exec_()
w.destroy()
示例8: dispatch
# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import SIGNAL [as 別名]
def dispatch(self, signal, *args):
"""
\remarks dispatches a string based signal through the system from an application
\param signal <str>
\param *args <tuple> additional arguments
"""
if cross3d.application.shouldBlockSignal(signal, self.signalsBlocked()):
return
# emit a defined pyqtSignal
if (hasattr(self, signal) and type(getattr(self, signal)).__name__ == 'pyqtBoundSignal'):
getattr(self, signal).emit(*args)
# otherwise emit a custom signal
else:
from PyQt4.QtCore import SIGNAL
self.emit(SIGNAL(signal), *args)
# emit linked signals
if (signal in self._linkedSignals):
for trigger in self._linkedSignals[signal]:
self.dispatch(trigger)
示例9: dispatchObject
# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import SIGNAL [as 別名]
def dispatchObject(self, signal, *args):
"""
\remarks dispatches a string based signal through the system from an application
\param signal <str>
\param *args <tuple> additional arguments
"""
if cross3d.application.shouldBlockSignal(signal, self.signalsBlocked()):
return
# emit a defined pyqtSignal
if (hasattr(self, signal) and type(getattr(self, signal)).__name__ == 'pyqtBoundSignal') and args[0]:
getattr(self, signal).emit(cross3d.SceneObject(cross3d.Scene.instance(), args[0]))
# otherwise emit a custom signal
else:
from PyQt4.QtCore import SIGNAL
self.emit(SIGNAL(signal), *args)
# emit linked signals
if (signal in self._linkedSignals):
for trigger in self._linkedSignals[signal]:
self.dispatch(trigger)
示例10: dispatchEvent
# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import SIGNAL [as 別名]
def dispatchEvent(self, signal, *args):
print 'Dispatching event', signal
if ( self.signalsBlocked() ):
return
# emit a defined pyqtSignal
if ( hasattr(Dispatch,signal) and type(getattr(Dispatch,signal)).__name__ == 'pyqtBoundSignal' ):
# this should identify the object type before emiting it if it needs to emit something
getattr(Dispatch,signal).emit(SceneObject(Scene.instance(), args[0]))
# elif process application specific signals like xsi's value changed
# otherwise emit a custom signal
else:
from PyQt4.QtCore import SIGNAL
self.emit( SIGNAL( signal ), *args )
# emit linked signals
if ( signal in self._linkedSignals ):
for trigger in self._linkedSignals[signal]:
self.dispatch( trigger )
示例11: updatesection
# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import SIGNAL [as 別名]
def updatesection(self):
self.y1 = int(self.y1ValueEdit.text())
self.y2 = int(self.y2ValueEdit.text())
self.nrows = int(self.nrValueEdit.text())
self.rstep = int(self.nsValueEdit.text())
if abs(self.y1 - self.y2) != self.nrows:
if self.log:
self.log.warning(
"Warning: Update y2 to increase the row sampling")
## self.y1line.set_ydata([self.y1, self.y1])
## self.y2line.set_ydata([self.y2, self.y2])
self.y1line.y1 = self.y1
self.y1line.y2 = self.y1
self.y2line.y1 = self.y2
self.y2line.y2 = self.y2
self.imdisplay.redraw(whence=3)
self.emit(QtCore.SIGNAL("regionChange(int,int)"), self.y1, self.y2)
示例12: err_redraw_canvas
# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import SIGNAL [as 別名]
def err_redraw_canvas(self, keepzoom=False):
if keepzoom:
# Store current zoom level
xmin, xmax = self.erraxes.get_xlim()
ymin, ymax = self.erraxes.get_ylim()
else:
self.xmin, self.xmax = self.axes.get_xlim()
# Clear plot
self.erraxes.clear()
# Draw image
self.plotErr()
# Restore zoom level
if keepzoom:
self.erraxes.set_xlim((xmin, xmax))
self.erraxes.set_ylim((ymin, ymax))
else:
self.erraxes.set_xlim((self.xmin, self.xmax))
self.errfigure.draw()
self.emit(QtCore.SIGNAL("fitUpdate()"))
示例13: __init__
# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import SIGNAL [as 別名]
def __init__(self):
super(WorkerStack, self).__init__()
self.workers = []
self.threads = []
self.load = {} # {'worker_name': tasks_count}
# Create workers crew
for i in range(0, 2):
worker = Worker(self, 'Slogger-' + str(i))
thread = QtCore.QThread()
worker.moveToThread(thread)
worker.connect(thread, QtCore.SIGNAL("started()"), worker.run)
worker.task_completed.connect(self.on_task_completed)
thread.start()
self.workers.append(worker)
self.threads.append(thread)
self.load[worker.name] = 0
示例14: Establish_Connections
# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import SIGNAL [as 別名]
def Establish_Connections(self):
# loop button and menu action to link to functions
for ui_name in self.uiList.keys():
if ui_name.endswith('_btn'):
QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("clicked()"), getattr(self, ui_name[:-4]+"_action", partial(self.default_action,ui_name)))
elif ui_name.endswith('_atn'):
QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("triggered()"), getattr(self, ui_name[:-4]+"_action", partial(self.default_action,ui_name)))
elif ui_name.endswith('_btnMsg'):
QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("clicked()"), getattr(self, ui_name[:-7]+"_message", partial(self.default_message,ui_name)))
elif ui_name.endswith('_atnMsg'):
QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("triggered()"), getattr(self, ui_name[:-7]+"_message", partial(self.default_message,ui_name)))
# custom connection
#=======================================
# UI Response functions (custom + prebuilt functions)
#=======================================
#-- ui actions
示例15: run
# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import SIGNAL [as 別名]
def run(self ):
# make sure current user have access right to execute shellScriptFile
try :
isFileExecuteable = os.access( self.shellScriptFile, os.X_OK )
if not isFileExecuteable :
response = "Error: Please make sure your shell script file has execute permission!"
self.emit(QtCore.SIGNAL("updateResponseShellScript(QString)"), response)
except OSError as e:
response = "Error: Cannot read shell script file!"
self.emit(QtCore.SIGNAL("updateResponseShellScript(QString)"), response)
if self.shellScriptType == "installer" :
self.doInstall()
else:
self.visitService()