本文整理汇总了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()