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


Python LayoutWidget.__init__方法代码示例

本文整理汇总了Python中artiq.gui.tools.LayoutWidget.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python LayoutWidget.__init__方法的具体用法?Python LayoutWidget.__init__怎么用?Python LayoutWidget.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在artiq.gui.tools.LayoutWidget的用法示例。


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

示例1: __init__

# 需要导入模块: from artiq.gui.tools import LayoutWidget [as 别名]
# 或者: from artiq.gui.tools.LayoutWidget import __init__ [as 别名]
    def __init__(self, procdesc, state):
        LayoutWidget.__init__(self)

        scale = procdesc["scale"]
        self.value = QtWidgets.QDoubleSpinBox()
        disable_scroll_wheel(self.value)
        self.value.setDecimals(procdesc["ndecimals"])
        if procdesc["global_min"] is not None:
            self.value.setMinimum(procdesc["global_min"]/scale)
        else:
            self.value.setMinimum(float("-inf"))
        if procdesc["global_max"] is not None:
            self.value.setMaximum(procdesc["global_max"]/scale)
        else:
            self.value.setMaximum(float("inf"))
        self.value.setSingleStep(procdesc["global_step"]/scale)
        if procdesc["unit"]:
            self.value.setSuffix(" " + procdesc["unit"])
        self.addWidget(QtWidgets.QLabel("Value:"), 0, 0)
        self.addWidget(self.value, 0, 1)

        self.value.setValue(state["value"]/scale)
        def update(value):
            state["value"] = value*scale
        self.value.valueChanged.connect(update)
开发者ID:amhankin,项目名称:artiq,代码行数:27,代码来源:entries.py

示例2: __init__

# 需要导入模块: from artiq.gui.tools import LayoutWidget [as 别名]
# 或者: from artiq.gui.tools.LayoutWidget import __init__ [as 别名]
    def __init__(self, state):
        LayoutWidget.__init__(self)

        self.value = QtWidgets.QLineEdit()
        self.addWidget(QtWidgets.QLabel("Sequence:"), 0, 0)
        self.addWidget(self.value, 0, 1)

        float_regexp = "[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"
        regexp = "(float)?( +float)* *".replace("float", float_regexp)
        self.value.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(regexp),
                                                       self.value))

        self.value.setText(" ".join([str(x) for x in state["sequence"]]))
        def update(text):
            state["sequence"] = [float(x) for x in text.split()]
        self.value.textEdited.connect(update)
开发者ID:cntnly,项目名称:artiq,代码行数:18,代码来源:entries.py

示例3: __init__

# 需要导入模块: from artiq.gui.tools import LayoutWidget [as 别名]
# 或者: from artiq.gui.tools.LayoutWidget import __init__ [as 别名]
    def __init__(self, procdesc, state):
        LayoutWidget.__init__(self)

        scale = procdesc["scale"]
        self.value = ScientificSpinBox()
        disable_scroll_wheel(self.value)
        self.value.setDecimals(procdesc["ndecimals"])
        self.value.setPrecision()
        if procdesc["global_min"] is not None:
            self.value.setMinimum(procdesc["global_min"] / scale)
        else:
            self.value.setMinimum(float("-inf"))
        if procdesc["global_max"] is not None:
            self.value.setMaximum(procdesc["global_max"] / scale)
        else:
            self.value.setMaximum(float("inf"))
        self.value.setSingleStep(procdesc["global_step"] / scale)
        self.value.setRelativeStep()
        if procdesc["unit"]:
            self.value.setSuffix(" " + procdesc["unit"])
        self.addWidget(QtWidgets.QLabel("Value:"), 0, 0)
        self.addWidget(self.value, 0, 1)

        self.value.setValue(state["value"] / scale)

        def update(value):
            state["value"] = value * scale

        self.value.valueChanged.connect(update)

        self.repetitions = QtWidgets.QSpinBox()
        self.repetitions.setMinimum(1)
        self.repetitions.setMaximum((1 << 31) - 1)
        disable_scroll_wheel(self.repetitions)
        self.addWidget(QtWidgets.QLabel("Repetitions:"), 1, 0)
        self.addWidget(self.repetitions, 1, 1)

        self.repetitions.setValue(state["repetitions"])

        def update_repetitions(value):
            state["repetitions"] = value

        self.repetitions.valueChanged.connect(update_repetitions)
开发者ID:cjbe,项目名称:artiq,代码行数:45,代码来源:entries.py

示例4: __init__

# 需要导入模块: from artiq.gui.tools import LayoutWidget [as 别名]
# 或者: from artiq.gui.tools.LayoutWidget import __init__ [as 别名]
    def __init__(self):
        LayoutWidget.__init__(self)

        self.waiting_spinner = QtWaitingSpinner()
        self.addWidget(self.waiting_spinner, 1, 1)
        self.addWidget(QtWidgets.QLabel("Repository scan in progress..."), 1, 2)
开发者ID:cjbe,项目名称:artiq,代码行数:8,代码来源:explorer.py

示例5: __init__

# 需要导入模块: from artiq.gui.tools import LayoutWidget [as 别名]
# 或者: from artiq.gui.tools.LayoutWidget import __init__ [as 别名]
    def __init__(self, procdesc, state):
        LayoutWidget.__init__(self)

        scale = procdesc["scale"]

        def apply_properties(widget):
            widget.setDecimals(procdesc["ndecimals"])
            if procdesc["global_min"] is not None:
                widget.setMinimum(procdesc["global_min"]/scale)
            else:
                widget.setMinimum(float("-inf"))
            if procdesc["global_max"] is not None:
                widget.setMaximum(procdesc["global_max"]/scale)
            else:
                widget.setMaximum(float("inf"))
            if procdesc["global_step"] is not None:
                widget.setSingleStep(procdesc["global_step"]/scale)
            if procdesc["unit"]:
                widget.setSuffix(" " + procdesc["unit"])

        center = ScientificSpinBox()
        disable_scroll_wheel(center)
        apply_properties(center)
        center.setPrecision()
        center.setRelativeStep()
        center.setValue(state["center"])
        self.addWidget(center, 0, 1)
        self.addWidget(QtWidgets.QLabel("Center:"), 0, 0)

        span = ScientificSpinBox()
        disable_scroll_wheel(span)
        apply_properties(span)
        span.setPrecision()
        span.setRelativeStep()
        span.setMinimum(0)
        span.setValue(state["span"])
        self.addWidget(span, 1, 1)
        self.addWidget(QtWidgets.QLabel("Span:"), 1, 0)

        step = ScientificSpinBox()
        disable_scroll_wheel(step)
        apply_properties(step)
        step.setPrecision()
        step.setRelativeStep()
        step.setMinimum(0)
        step.setValue(state["step"])
        self.addWidget(step, 2, 1)
        self.addWidget(QtWidgets.QLabel("Step:"), 2, 0)

        randomize = QtWidgets.QCheckBox("Randomize")
        self.addWidget(randomize, 3, 1)
        randomize.setChecked(state["randomize"])

        def update_center(value):
            state["center"] = value*scale

        def update_span(value):
            state["span"] = value*scale

        def update_step(value):
            state["step"] = value*scale

        def update_randomize(value):
            state["randomize"] = value

        center.valueChanged.connect(update_center)
        span.valueChanged.connect(update_span)
        step.valueChanged.connect(update_step)
        randomize.stateChanged.connect(update_randomize)
开发者ID:m-labs,项目名称:artiq,代码行数:71,代码来源:entries.py


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