當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。