當前位置: 首頁>>代碼示例>>Python>>正文


Python QtCore.Signal方法代碼示例

本文整理匯總了Python中qtpy.QtCore.Signal方法的典型用法代碼示例。如果您正苦於以下問題:Python QtCore.Signal方法的具體用法?Python QtCore.Signal怎麽用?Python QtCore.Signal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在qtpy.QtCore的用法示例。


在下文中一共展示了QtCore.Signal方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __getattr__

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import Signal [as 別名]
def __getattr__(self, name):
        """Pass through attr requests to signals to simplify connection API.

        The goal is to enable ``worker.signal.connect`` instead of
        ``worker.signals.yielded.connect``. Because multiple inheritance of Qt
        classes is not well supported in PyQt, we have to use composition here
        (signals are provided by QObjects, and QRunnable is not a QObject). So
        this passthrough allows us to connect to signals on the ``_signals``
        object.
        """
        # the Signal object is actually a class attribute
        attr = getattr(self._signals.__class__, name, None)
        if isinstance(attr, Signal):
            # but what we need to connect to is the instantiated signal
            # (which is of type `SignalInstance` in PySide and
            # `pyqtBoundSignal` in PyQt)
            return getattr(self._signals, name) 
開發者ID:napari,項目名稱:napari,代碼行數:19,代碼來源:threading.py

示例2: __init__

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import Signal [as 別名]
def __init__(self, axis: str, signal_target_changed: QtCore.Signal):
        """ A widget to change the tick properties

        Args:
            axis: whether to use the "x" or "y" axis
            signal_target_changed: a signal to emit when the target changed
        """
        QtWidgets.QWidget.__init__(self)
        self.setWindowTitle("Figure - " + axis + "-Axis - Ticks - Pylustrator")
        self.setWindowIcon(QtGui.QIcon(os.path.join(os.path.dirname(__file__), "icons", "ticks.ico")))
        self.layout = QtWidgets.QVBoxLayout(self)
        self.axis = axis

        self.label = QtWidgets.QLabel(
            "Ticks can be specified, one tick pre line.\nOptionally a label can be provided, e.g. 1 \"First\",")
        self.layout.addWidget(self.label)

        self.layout2 = QtWidgets.QHBoxLayout()
        self.layout.addLayout(self.layout2)

        self.input_ticks = TextWidget(self.layout2, axis + "-Ticks:", multiline=True, horizontal=False)
        self.input_ticks.editingFinished.connect(self.ticksChanged)

        self.input_ticks2 = TextWidget(self.layout2, axis + "-Ticks (minor):", multiline=True, horizontal=False)
        self.input_ticks2.editingFinished.connect(self.ticksChanged2)

        self.input_scale = ComboWidget(self.layout, axis + "-Scale", ["linear", "log", "symlog", "logit"])
        self.input_scale.link(axis + "scale", signal_target_changed)

        self.input_font = TextPropertiesWidget(self.layout)

        self.input_labelpad = NumberWidget(self.layout, axis + "-Labelpad", min=-999)
        self.input_labelpad.link(axis + "axis.labelpad", signal_target_changed, direct=True)

        self.button_ok = QtWidgets.QPushButton("Ok")
        self.layout.addWidget(self.button_ok)
        self.button_ok.clicked.connect(self.hide) 
開發者ID:rgerum,項目名稱:pylustrator,代碼行數:39,代碼來源:QComplexWidgets.py

示例3: __init__

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import Signal [as 別名]
def __init__(self, sig_write):
        """Initialize object.

        Args:
            sig_write (Signal): signal to emit
        """
        super(CaptureStdOutput, self).__init__()
        self.sig_write = sig_write 
開發者ID:spyder-ide,項目名稱:spyder-reports,代碼行數:10,代碼來源:reportsplugin.py

示例4: _show_interpreter_prompt_for_reply

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import Signal [as 別名]
def _show_interpreter_prompt_for_reply(self, msg):
        """ Shows a prompt for the interpreter given an 'execute_reply' message.
        """
        self._show_interpreter_prompt()

    #------ Signal handlers ---------------------------------------------------- 
開發者ID:jupyter,項目名稱:qtconsole,代碼行數:8,代碼來源:frontend_widget.py

示例5: test_QtCore_SignalInstance

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import Signal [as 別名]
def test_QtCore_SignalInstance():
    class ClassWithSignal(QtCore.QObject):
        signal = QtCore.Signal()

    instance = ClassWithSignal()

    assert isinstance(instance.signal, QtCore.SignalInstance) 
開發者ID:spyder-ide,項目名稱:qtpy,代碼行數:9,代碼來源:test_qtcore.py

示例6: link

# 需要導入模塊: from qtpy import QtCore [as 別名]
# 或者: from qtpy.QtCore import Signal [as 別名]
def link(self, property_name: str, signal: QtCore.Signal = None, condition: callable = None, direct: bool = False):
        self.element = None
        self.direct = direct
        if direct:
            parts = property_name.split(".")
            s = self

            def get():
                target = s.element
                for part in parts:
                    target = getattr(target, part)
                return target

            def set(v):
                get()
                target = s.element
                for part in parts[:-1]:
                    target = getattr(target, part)
                setattr(target, parts[-1], v)
                return [s.element]

            self.setLinkedProperty = set
            self.getLinkedProperty = get
            self.serializeLinkedProperty = lambda x: "." + property_name + " = %s" % x
        else:
            def set(v):
                elements = []
                getattr(self.element, "set_" + property_name)(v)
                elements.append(self.element)
                for elm in self.element.figure.selection.targets:
                    elm = elm.target
                    if elm != self.element:
                        try:
                            getattr(elm, "set_" + property_name, None)(v)
                        except TypeError as err:
                            pass
                        else:
                            elements.append(elm)
                return elements

            self.setLinkedProperty = set  # lambda text: getattr(self.element, "set_"+property_name)(text)
            self.getLinkedProperty = lambda: getattr(self.element, "get_" + property_name)()
            self.serializeLinkedProperty = lambda x: ".set_" + property_name + "(%s)" % x

        if condition is None:
            self.condition = lambda x: True
        else:
            self.condition = condition

        self.editingFinished.connect(self.updateLink)
        signal.connect(self.setTarget) 
開發者ID:rgerum,項目名稱:pylustrator,代碼行數:53,代碼來源:QLinkableWidgets.py


注:本文中的qtpy.QtCore.Signal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。