我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用PySide.QtCore.Signal()。
def import_pyqt5(): """ Import PyQt5 ImportErrors rasied within this function are non-recoverable """ import sip from PyQt5 import QtCore, QtSvg, QtWidgets, QtGui # Alias PyQt-specific functions for PySide compatibility. QtCore.Signal = QtCore.pyqtSignal QtCore.Slot = QtCore.pyqtSlot # Join QtGui and QtWidgets for Qt4 compatibility. QtGuiCompat = types.ModuleType('QtGuiCompat') QtGuiCompat.__dict__.update(QtGui.__dict__) QtGuiCompat.__dict__.update(QtWidgets.__dict__) api = QT_API_PYQT5 return QtCore, QtGuiCompat, QtSvg, api
def import_pyqt4(version=2): """ Import PyQt4 Parameters ---------- version : 1, 2, or None Which QString/QVariant API to use. Set to None to use the system default ImportErrors rasied within this function are non-recoverable """ # The new-style string API (version=2) automatically # converts QStrings to Unicode Python strings. Also, automatically unpacks # QVariants to their underlying objects. import sip if version is not None: sip.setapi('QString', version) sip.setapi('QVariant', version) from PyQt4 import QtGui, QtCore, QtSvg if not check_version(QtCore.PYQT_VERSION_STR, '4.7'): raise ImportError("IPython requires PyQt4 >= 4.7, found %s" % QtCore.PYQT_VERSION_STR) # Alias PyQt-specific functions for PySide compatibility. QtCore.Signal = QtCore.pyqtSignal QtCore.Slot = QtCore.pyqtSlot # query for the API version (in case version == None) version = sip.getapi('QString') api = QT_API_PYQTv1 if version == 1 else QT_API_PYQT return QtCore, QtGui, QtSvg, api
def __init__(self, widget, Ui, Electrode, electrodeUI, communitiesAcrossTimeStep,\ Tab_1_CorrelationTable, Tab_2_CorrelationTable, Visualizer, quantData, quantTableObject, Graph_Layout): self.widget = widget self.Ui = Ui # self.CustomWebView = None self.Graph_Layout = Graph_Layout self.quantData = quantData self.quantTableObject = quantTableObject self.Electrode = Electrode self.electrodeUI = electrodeUI self.communitiesAcrossTimeStep = communitiesAcrossTimeStep self.Tab_1_CorrelationTable = Tab_1_CorrelationTable self.Tab_2_CorrelationTable = Tab_2_CorrelationTable #Signal Connections self.PreComputeSignals() self.connectAnimationSignals() self.communityModeSignals() self.NodeSelectionSignals() self.ReferenceSignals() self.ColorSignals() self.quantSignals() self.Graph_LayoutSignals() self.GlyphSignals() self.TimeStepInterval() self.TableSignals() # self.WebSignals() self.LinkingWithinTables() self.SyllableSignals() # self.CommentedSignals()
def update_gui(self): """activates on Signal, updates GUI table from db""" if time.time() - self._last_updated > 0.1: self._last_updated = time.time() self._raw_db_output = get_monitors() self.populate_table()
def clearSig (self, o) : def print_signals_and_slots(obj): for i in xrange(obj.metaObject().methodCount()): m = obj.metaObject().method(i) if m.methodType() == QtCore.QMetaMethod.MethodType.Signal: print "SIGNAL: sig=", m.signature(), "hooked to nslots=",obj.receivers(QtCore.SIGNAL(m.signature())) elif m.methodType() == QtCore.QMetaMethod.MethodType.Slot: print "SLOT: sig=", m.signature() print_signals_and_slots (o)
def AddWidgets(self): im = self.dataProcess.im draw = ImageDraw.Draw(im) self.setSizePolicy(QtGui.QSizePolicy.Policy.Expanding, QtGui.QSizePolicy.Policy.Expanding) # Saving the image file as an output file self.label = QtGui.QLabel() self.NodeSlider() im.save("BackgroundImage/output.png") # Loading the pixmap for better analysis loadedImage = QtGui.QImage() loadedImage.load("BackgroundImage/output.png") self.PixMap = QtGui.QPixmap.fromImage(loadedImage) self.ElectrodeView = ElectrodeView(self) x_interval = LayoutWidth/6 y_interval = LayoutHeight/6 for i in range(self.Chunks+1): self.SmallMultipleElectrode.append(ElectrodeView(self, i, x_interval,y_interval)) CommunitySelectPerTime = QtCore.Signal(list, int ,list, list) self.SmallMultipleElectrode[i].CommunitySelectPerTime.connect(self.SelectingCommunitiesInaTimestep) self.SmallMultipleElectrode[i].DataLink.connect(self.GettingDataFromSmallMultiples) self.SmallMultipleElectrode[i].CommunitySelectAcrossTime.connect(self.SelectingCommunitiesAcrossaTimestep) self.LayoutForSmallMultiples = LayoutForSmallMultiples(self,self.SmallMultipleElectrode,x_interval,y_interval) # # Use pycharm to have a better way to do it self.ImageView = QtGui.QHBoxLayout() self.ImageView2 = QtGui.QHBoxLayout() self.ImageView2.setContentsMargins(0, 0, 0, 0) self.ImageView2.addWidget(self.ElectrodeView) self.ImageView2.setContentsMargins(0, 0, 0, 0) # Image additions vbox = QtGui.QVBoxLayout() vbox.setContentsMargins(0, 0, 0, 0) vbox.addLayout(self.ImageView2) vbox.setContentsMargins(0, 0, 0, 0) self.scene = QtGui.QGraphicsScene(0, 0,500 ,600) self.setContentsMargins(0, 0, 0, 0) self.setLayout(vbox)