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


Python QDialog.setLayout方法代码示例

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


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

示例1: ShowInfo

# 需要导入模块: from AnyQt.QtWidgets import QDialog [as 别名]
# 或者: from AnyQt.QtWidgets.QDialog import setLayout [as 别名]
    def ShowInfo(self):
        dialog = QDialog(self)
        dialog.setModal(False)
        dialog.setLayout(QVBoxLayout())
        label = QLabel(dialog)
        label.setText("Ontology:\n" + self.ontology.header
                      if self.ontology else "Ontology not loaded!")
        dialog.layout().addWidget(label)

        label = QLabel(dialog)
        label.setText("Annotations:\n" + self.annotations.header.replace("!", "")
                      if self.annotations else "Annotations not loaded!")
        dialog.layout().addWidget(label)
        dialog.show()
开发者ID:markotoplak,项目名称:orange-bio,代码行数:16,代码来源:OWGOEnrichmentAnalysis.py

示例2: __run_add_package_dialog

# 需要导入模块: from AnyQt.QtWidgets import QDialog [as 别名]
# 或者: from AnyQt.QtWidgets.QDialog import setLayout [as 别名]
    def __run_add_package_dialog(self):
        dlg = QDialog(self, windowTitle="Add add-on by name")
        dlg.setAttribute(Qt.WA_DeleteOnClose)

        vlayout = QVBoxLayout()
        form = QFormLayout()
        form.setContentsMargins(0, 0, 0, 0)
        nameentry = QLineEdit(
            placeholderText="Package name",
            toolTip="Enter a package name as displayed on "
                    "PyPI (capitalization is not important)")
        nameentry.setMinimumWidth(250)
        form.addRow("Name:", nameentry)
        vlayout.addLayout(form)
        buttons = QDialogButtonBox(
            standardButtons=QDialogButtonBox.Ok | QDialogButtonBox.Cancel
        )
        okb = buttons.button(QDialogButtonBox.Ok)
        okb.setEnabled(False)
        okb.setText("Add")

        def changed(name):
            okb.setEnabled(bool(name))
        nameentry.textChanged.connect(changed)
        vlayout.addWidget(buttons)
        vlayout.setSizeConstraint(QVBoxLayout.SetFixedSize)
        dlg.setLayout(vlayout)
        f = None

        def query():
            nonlocal f
            name = nameentry.text()
            f = self._executor.submit(pypi_json_query_project_meta, [name])
            okb.setDisabled(True)

            def ondone(f):
                error_text = ""
                error_details = ""
                try:
                    pkgs = f.result()
                except Exception:
                    log.error("Query error:", exc_info=True)
                    error_text = "Failed to query package index"
                    error_details = traceback.format_exc()
                    pkg = None
                else:
                    pkg = pkgs[0]
                    if pkg is None:
                        error_text = "'{}' not was not found".format(name)
                if pkg:
                    method_queued(self.add_package, (object,))(pkg)
                    method_queued(dlg.accept, ())()
                else:
                    method_queued(self.__show_error_for_query, (str, str)) \
                        (error_text, error_details)
                    method_queued(dlg.reject, ())()

            f.add_done_callback(ondone)

        buttons.accepted.connect(query)
        buttons.rejected.connect(dlg.reject)
        dlg.exec_()
开发者ID:PrimozGodec,项目名称:orange3,代码行数:64,代码来源:addons.py

示例3: formatValues

# 需要导入模块: from AnyQt.QtWidgets import QDialog [as 别名]
# 或者: from AnyQt.QtWidgets.QDialog import setLayout [as 别名]
                    painter.drawText(x2 - widthMax - 1, rect.y() + rect.height() - 2, strMax)
                else:
                    painter.drawText(rect.x() + 1, x1 + height, strMin)
                    painter.drawText(rect.x() + rect.width() - widthMax - 1, x2 - 2, strMax)

    def formatValues(self, valueMin, valueMax):
        """Format the int values into strings that are shown if showText is True."""
        return str(valueMin), str(valueMax)


if __name__ == "__main__":
    from AnyQt.QtWidgets import QApplication, QDialog, QGridLayout, QLabel
    app = QApplication([])
    win = QDialog()
    grid = QGridLayout(win)
    win.setLayout(grid)
    kwargs = dict(
        minimum=0,
        maximum=100,
        tickInterval=5,
        minimumValue=20,
        maximumValue=80,
        slidersMoved=print
    )
    grid.addWidget(QLabel('RangeSlider:', win), 0, 0)
    grid.addWidget(RangeSlider(win, orientation=Qt.Horizontal, **kwargs), 0, 1)

    grid.addWidget(QLabel('RangeSlider:', win), 1, 0)
    grid.addWidget(RangeSlider(win, orientation=Qt.Vertical, **kwargs), 1, 1)

    grid.addWidget(QLabel('ViolinSlider:', win), 2, 0)
开发者ID:biolab,项目名称:orange3-timeseries,代码行数:33,代码来源:_rangeslider.py


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