当前位置: 首页>>代码示例>>Python>>正文


Python QtCore.QObject类代码示例

本文整理汇总了Python中AnyQt.QtCore.QObject的典型用法代码示例。如果您正苦于以下问题:Python QObject类的具体用法?Python QObject怎么用?Python QObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_expr

    def test_expr(self):
        obj1 = QObject()

        obj1.setProperty("value", 1)
        obj1.setProperty("other", 2)

        result = DynamicPropertyBinding(obj1, "result")
        result.bindTo(
            PropertyBindingExpr(
                "value + other",
                locals={"value": binding_for(obj1, "value"),
                        "other": binding_for(obj1, "other")}
                )
            )

        expr = PropertyBindingExpr(
           "True if value < 3 else False",
           dict(value=DynamicPropertyBinding(obj1, "result"))
        )

        result_values = []
        result.changed[object].connect(result_values.append)

        expr_values = []
        expr.changed[object].connect(expr_values.append)

        self.assertEqual(result.get(), 3)
        self.assertEqual(expr.get(), False)

        obj1.setProperty("value", 0)
        self.assertEqual(result_values[-1], 2)
        self.assertEqual(expr_values[-1], True)

        self.assertEqual(result.get(), 2)
        self.assertEqual(expr.get(), True)
开发者ID:RachitKansal,项目名称:orange3,代码行数:35,代码来源:test_propertybindings.py

示例2: __init__

    def __init__(self, source_node, source_channel,
                 sink_node, sink_channel, enabled=True, properties=None,
                 parent=None):
        QObject.__init__(self, parent)
        self.source_node = source_node

        if isinstance(source_channel, str):
            source_channel = source_node.output_channel(source_channel)
        elif source_channel not in source_node.output_channels():
            raise ValueError("%r not in in nodes output channels." \
                             % source_channel)

        self.source_channel = source_channel

        self.sink_node = sink_node

        if isinstance(sink_channel, str):
            sink_channel = sink_node.input_channel(sink_channel)
        elif sink_channel not in sink_node.input_channels():
            raise ValueError("%r not in in nodes input channels." \
                             % source_channel)

        self.sink_channel = sink_channel

        if not compatible_channels(source_channel, sink_channel):
            raise IncompatibleChannelTypeError(
                "Cannot connect %r to %r"
                % (source_channel.type, sink_channel.type)
            )

        self.__enabled = enabled
        self.__dynamic_enabled = False
        self.__state = SchemeLink.NoState
        self.__tool_tip = ""
        self.properties = properties or {}
开发者ID:PrimozGodec,项目名称:orange3,代码行数:35,代码来源:link.py

示例3: __init__

    def __init__(self, parent=None, minimum=0, maximum=0, text="", value=0):
        QObject.__init__(self, parent)

        self._minimum = minimum
        self._maximum = max(maximum, minimum)
        self._text = text
        self._value = value
开发者ID:JakaKokosar,项目名称:orange-bio,代码行数:7,代码来源:OWDatabasesUpdate.py

示例4: __init__

    def __init__(self, parent=None):
        QObject.__init__(self, parent)
        self.__scheme = None
        self.__signal_manager = None
        self.__widgets = []
        self.__initstate_for_node = {}
        self.__creation_policy = WidgetManager.Normal
        #: a queue of all nodes whose widgets are scheduled for
        #: creation/initialization
        self.__init_queue = deque()  # type: Deque[SchemeNode]
        #: Timer for scheduling widget initialization
        self.__init_timer = QTimer(self, interval=0, singleShot=True)
        self.__init_timer.timeout.connect(self.__create_delayed)

        #: A mapping of SchemeNode -> OWWidget (note: a mapping is only added
        #: after the widget is actually created)
        self.__widget_for_node = {}
        #: a mapping of OWWidget -> SchemeNode
        self.__node_for_widget = {}

        # Widgets that were 'removed' from the scheme but were at
        # the time in an input update loop and could not be deleted
        # immediately
        self.__delay_delete = set()

        #: Deleted/removed during creation/initialization.
        self.__delete_after_create = []

        #: processing state flags for all widgets (including the ones
        #: in __delay_delete).
        #: Note: widgets which have not yet been created do not have an entry
        self.__widget_processing_state = {}

        # Tracks the widget in the update loop by the SignalManager
        self.__updating_widget = None
开发者ID:benzei,项目名称:orange3,代码行数:35,代码来源:widgetsscheme.py

示例5: __init__

    def __init__(self, obj, propertyName, parent=None):
        QObject.__init__(self, parent)

        self.obj = obj
        self.propertyName = propertyName
        self.obj.destroyed.connect(self._on_destroyed)
        self._source = None
开发者ID:RachitKansal,项目名称:orange3,代码行数:7,代码来源:propertybindings.py

示例6: __init__

 def __init__(self, parent=None, threadPool=None):
     QObject.__init__(self, parent)
     if threadPool is None:
         threadPool = QThreadPool.globalInstance()
     self._threadPool = threadPool
     self._depot_thread = None
     self._futures = []
     self._shutdown = False
     self._state_lock = threading.Lock()
开发者ID:RachitKansal,项目名称:orange3,代码行数:9,代码来源:concurrent.py

示例7: __init__

    def __init__(self, parent=None, defaults=(), path=None, store=None):
        QObject.__init__(self, parent)

        if store is None:
            store = QSettings()

        path = path = (path or "").rstrip("/")

        self.__path = path
        self.__defaults = dict([(slot.key, slot) for slot in defaults])
        self.__store = store
开发者ID:RachitKansal,项目名称:orange3,代码行数:11,代码来源:settings.py

示例8: __init__

 def __init__(self, parent=None):
     QObject.__init__(self, parent)
     self.__splitter = None
     self.__widget = None
     self.__updateOnShow = True  # Need __update on next show event
     self.__animationEnabled = True
     self.__size = -1
     self.__expanded = False
     self.__animation = QPropertyAnimation(self, b"size_", self, duration=200)
     self.__action = QAction("toogle-expanded", self, checkable=True)
     self.__action.triggered[bool].connect(self.setExpanded)
开发者ID:biolab,项目名称:orange3,代码行数:11,代码来源:canvastooldock.py

示例9: __init__

    def __init__(self, document, parent=None, deleteOnEnd=True):
        QObject.__init__(self, parent)
        self.document = document
        self.scene = document.scene()
        self.scheme = document.scheme()
        self.deleteOnEnd = deleteOnEnd

        self.cancelOnEsc = False

        self.__finished = False
        self.__canceled = False
        self.__cancelReason = self.NoReason
开发者ID:RachitKansal,项目名称:orange3,代码行数:12,代码来源:interactions.py

示例10: __init__

    def __init__(self, parent=None, title=None, description=None, env={}):
        QObject.__init__(self, parent)

        self.__title = title or ""
        "Workflow title (empty string by default)."

        self.__description = description or ""
        "Workflow description (empty string by default)."

        self.__annotations = []
        self.__nodes = []
        self.__links = []
        self.__env = dict(env)
开发者ID:astaric,项目名称:orange3,代码行数:13,代码来源:scheme.py

示例11: __init__

    def __init__(self, scatter_widget, parent=None, view_box=ViewBox):
        QObject.__init__(self)
        gui.OWComponent.__init__(self, scatter_widget)

        self.subset_is_shown = False

        self.view_box = view_box(self)
        self.plot_widget = pg.PlotWidget(viewBox=self.view_box, parent=parent,
                                         background="w")
        self.plot_widget.hideAxis("left")
        self.plot_widget.hideAxis("bottom")
        self.plot_widget.getPlotItem().buttonsHidden = True
        self.plot_widget.setAntialiasing(True)
        self.plot_widget.sizeHint = lambda: QSize(500, 500)

        self.density_img = None
        self.scatterplot_item = None
        self.scatterplot_item_sel = None
        self.labels = []

        self.master = scatter_widget
        self._create_drag_tooltip(self.plot_widget.scene())

        self.selection = None  # np.ndarray

        self.n_valid = 0
        self.n_shown = 0
        self.sample_size = None
        self.sample_indices = None

        self.palette = None

        self.shape_legend = self._create_legend(((1, 0), (1, 0)))
        self.color_legend = self._create_legend(((1, 1), (1, 1)))
        self.update_legend_visibility()

        self.scale = None  # DiscretizedScale
        self._too_many_labels = False

        # self.setMouseTracking(True)
        # self.grabGesture(QPinchGesture)
        # self.grabGesture(QPanGesture)

        self.update_grid_visibility()

        self._tooltip_delegate = EventDelegate(self.help_event)
        self.plot_widget.scene().installEventFilter(self._tooltip_delegate)
        self.view_box.sigTransformChanged.connect(self.update_density)
        self.view_box.sigRangeChangedManually.connect(self.update_labels)

        self.timer = None
开发者ID:mstrazar,项目名称:orange3,代码行数:51,代码来源:owscatterplotgraph.py

示例12: __init__

    def __init__(self, parent=None):
        QObject.__init__(self, parent)
        assert QThread.currentThread() is QApplication.instance().thread()

        netmanager = self._NETMANAGER_REF and self._NETMANAGER_REF()
        if netmanager is None:
            netmanager = QNetworkAccessManager()
            cache = QNetworkDiskCache()
            cache.setCacheDirectory(
                os.path.join(settings.widget_settings_dir(),
                             __name__ + ".ImageLoader.Cache")
            )
            netmanager.setCache(cache)
            ImageLoader._NETMANAGER_REF = weakref.ref(netmanager)
        self._netmanager = netmanager
开发者ID:RachitKansal,项目名称:orange3,代码行数:15,代码来源:owimageviewer.py

示例13: __init__

    def __init__(self, description, title=None, position=None,
                 properties=None, parent=None):
        QObject.__init__(self, parent)
        self.description = description

        if title is None:
            title = description.name

        self.__title = title
        self.__position = position or (0, 0)
        self.__progress = -1
        self.__processing_state = 0
        self.__status_message = ""
        self.__state_messages = {}
        self.properties = properties or {}
开发者ID:PrimozGodec,项目名称:orange3,代码行数:15,代码来源:node.py

示例14: setModel

    def setModel(self, model):
        """
        Reimplemented.

        Parameters
        ----------
        model : QAbstractItemModel
        """
        if model is self.__completerModel:
            return

        if self.__completerModel is not None:
            self.__completerModel.dataChanged.disconnect(
                self.__initDynamicModel)
            self.__completerModel.rowsInserted.disconnect(
                self.__initDynamicModel)
            self.__completerModel.rowsRemoved.disconnect(
                self.__initDynamicModel)

            if QObject.parent(self.__completerModel) is self:
                self.__completerModel.deleteLater()
            self.__completerModel = None

        self.__completerModel = model

        if self.__completerModel is not None:
            self.__completerModel.dataChanged.connect(
                self.__initDynamicModel)
            self.__completerModel.rowsInserted.connect(
                self.__initDynamicModel)
            self.__completerModel.rowsRemoved.connect(
                self.__initDynamicModel)

        self.__initDynamicModel()
开发者ID:JakaKokosar,项目名称:orange-bio,代码行数:34,代码来源:gui.py

示例15: __init__

    def __init__(self, scheme):
        assert scheme
        QObject.__init__(self, scheme)
        self._input_queue = []

        # mapping a node to it's current outputs
        # {node: {channel: {id: signal_value}}}
        self._node_outputs = {}

        self.__state = SignalManager.Running
        self.__runtime_state = SignalManager.Waiting

        # A flag indicating if UpdateRequest event should be rescheduled
        self.__reschedule = False
        self.__update_timer = QTimer(self, interval=100, singleShot=True)
        self.__update_timer.timeout.connect(self.__process_next)
开发者ID:ales-erjavec,项目名称:orange3,代码行数:16,代码来源:signalmanager.py


注:本文中的AnyQt.QtCore.QObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。