本文整理汇总了Python中guidata.qt.QtGui.QLabel.setWordWrap方法的典型用法代码示例。如果您正苦于以下问题:Python QLabel.setWordWrap方法的具体用法?Python QLabel.setWordWrap怎么用?Python QLabel.setWordWrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类guidata.qt.QtGui.QLabel
的用法示例。
在下文中一共展示了QLabel.setWordWrap方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from guidata.qt.QtGui import QLabel [as 别名]
# 或者: from guidata.qt.QtGui.QLabel import setWordWrap [as 别名]
def __init__(self, label, klass, wordwrap=False, **kwargs):
QGroupBox.__init__(self, label)
self.klass = klass
self.dataset = klass(**kwargs)
self.layout = QVBoxLayout()
if self.dataset.get_comment():
label = QLabel(self.dataset.get_comment())
label.setWordWrap(wordwrap)
self.layout.addWidget(label)
self.grid_layout = QGridLayout()
self.layout.addLayout(self.grid_layout)
self.setLayout(self.layout)
self.edit = self.get_edit_layout()
示例2: TestPropertiesWidget
# 需要导入模块: from guidata.qt.QtGui import QLabel [as 别名]
# 或者: from guidata.qt.QtGui.QLabel import setWordWrap [as 别名]
class TestPropertiesWidget(QWidget):
def __init__(self, parent):
QWidget.__init__(self, parent)
font = QFont(get_family(MONOSPACE), 10, QFont.Normal)
info_icon = QLabel()
icon = get_std_icon('MessageBoxInformation').pixmap(24, 24)
info_icon.setPixmap(icon)
info_icon.setFixedWidth(32)
info_icon.setAlignment(Qt.AlignTop)
self.desc_label = QLabel()
self.desc_label.setWordWrap(True)
self.desc_label.setAlignment(Qt.AlignTop)
self.desc_label.setFont(font)
group_desc = QGroupBox(_("Description"), self)
layout = QHBoxLayout()
layout.addWidget(info_icon)
layout.addWidget(self.desc_label)
group_desc.setLayout(layout)
self.editor = CodeEditor(self)
self.editor.setup_editor(linenumbers=True, font=font)
self.editor.setReadOnly(True)
group_code = QGroupBox(_("Source code"), self)
layout = QVBoxLayout()
layout.addWidget(self.editor)
group_code.setLayout(layout)
self.run_button = QPushButton(get_icon("apply.png"),
_("Run this script"), self)
self.quit_button = QPushButton(get_icon("exit.png"), _("Quit"), self)
hlayout = QHBoxLayout()
hlayout.addWidget(self.run_button)
hlayout.addStretch()
hlayout.addWidget(self.quit_button)
vlayout = QVBoxLayout()
vlayout.addWidget(group_desc)
vlayout.addWidget(group_code)
vlayout.addLayout(hlayout)
self.setLayout(vlayout)
def set_item(self, test):
self.desc_label.setText(test.get_description())
self.editor.set_text_from_file(test.filename)
示例3: DataSetShowWidget
# 需要导入模块: from guidata.qt.QtGui import QLabel [as 别名]
# 或者: from guidata.qt.QtGui.QLabel import setWordWrap [as 别名]
class DataSetShowWidget(AbstractDataSetWidget):
"""Read-only base widget"""
READ_ONLY = True
def __init__(self, item, parent_layout):
AbstractDataSetWidget.__init__(self, item, parent_layout)
self.group = QLabel()
wordwrap = item.get_prop_value("display", "wordwrap", False)
self.group.setWordWrap(wordwrap)
self.group.setToolTip(item.get_help())
self.group.setStyleSheet( LABEL_CSS )
self.group.setTextInteractionFlags(Qt.TextSelectableByMouse)
#self.group.setEnabled(False)
def get(self):
"""Override AbstractDataSetWidget method"""
self.set_state()
text = self.item.get_string_value()
self.group.setText(text)
def set(self):
"""Read only..."""
pass
示例4: setup_instance
# 需要导入模块: from guidata.qt.QtGui import QLabel [as 别名]
# 或者: from guidata.qt.QtGui.QLabel import setWordWrap [as 别名]
def setup_instance(self, instance):
"""Override DataSetEditDialog method"""
from guidata.dataset.datatypes import DataSetGroup
assert isinstance(instance, DataSetGroup)
tabs = QTabWidget()
# tabs.setUsesScrollButtons(False)
self.layout.addWidget(tabs)
for dataset in instance.datasets:
layout = QVBoxLayout()
layout.setAlignment(Qt.AlignTop)
if dataset.get_comment():
label = QLabel(dataset.get_comment())
label.setWordWrap(self.wordwrap)
layout.addWidget(label)
grid = QGridLayout()
self.edit_layout.append( self.layout_factory(dataset, grid) )
layout.addLayout(grid)
page = QWidget()
page.setLayout(layout)
if dataset.get_icon():
tabs.addTab( page, get_icon(dataset.get_icon()),
dataset.get_title() )
else:
tabs.addTab( page, dataset.get_title() )
示例5: PropertiesWidget
# 需要导入模块: from guidata.qt.QtGui import QLabel [as 别名]
# 或者: from guidata.qt.QtGui.QLabel import setWordWrap [as 别名]
class PropertiesWidget(QWidget):
def __init__(self, parent):
QWidget.__init__(self, parent)
font = QFont(get_family(MONOSPACE), 10, QFont.Normal)
info_icon = QLabel()
icon = get_std_icon('MessageBoxInformation').pixmap(24, 24)
info_icon.setPixmap(icon)
info_icon.setFixedWidth(32)
info_icon.setAlignment(Qt.AlignTop)
self.service_status_label = QLabel()
self.service_status_label.setWordWrap(True)
self.service_status_label.setAlignment(Qt.AlignTop)
self.service_status_label.setFont(font)
self.desc_label = QLabel()
self.desc_label.setWordWrap(True)
self.desc_label.setAlignment(Qt.AlignTop)
self.desc_label.setFont(font)
group_desc = QGroupBox("Description", self)
layout = QHBoxLayout()
layout.addWidget(info_icon)
layout.addWidget(self.desc_label)
layout.addStretch()
layout.addWidget(self.service_status_label )
group_desc.setLayout(layout)
self.editor = CodeEditor(self)
self.editor.setup_editor(linenumbers=True, font=font)
self.editor.setReadOnly(False)
group_code = QGroupBox("Source code", self)
layout = QVBoxLayout()
layout.addWidget(self.editor)
group_code.setLayout(layout)
self.enable_button = QPushButton(get_icon("apply.png"),
"Enable", self)
self.save_button = QPushButton(get_icon("filesave.png"),
"Save", self)
self.edit_datadog_conf_button = QPushButton(get_icon("edit.png"),
"Edit agent settings", self)
self.disable_button = QPushButton(get_icon("delete.png"),
"Disable", self)
self.view_log_button = QPushButton(get_icon("txt.png"),
"View log", self)
self.menu_button = QPushButton(get_icon("settings.png"),
"Manager", self)
hlayout = QHBoxLayout()
hlayout.addWidget(self.save_button)
hlayout.addStretch()
hlayout.addWidget(self.enable_button)
hlayout.addStretch()
hlayout.addWidget(self.disable_button)
hlayout.addStretch()
hlayout.addWidget(self.edit_datadog_conf_button)
hlayout.addStretch()
hlayout.addWidget(self.view_log_button)
hlayout.addStretch()
hlayout.addWidget(self.menu_button)
vlayout = QVBoxLayout()
vlayout.addWidget(group_desc)
vlayout.addWidget(group_code)
vlayout.addLayout(hlayout)
self.setLayout(vlayout)
self.current_file = None
def set_item(self, check):
self.current_file = check
self.desc_label.setText(check.get_description())
self.editor.set_text_from_file(check.file_path)
check.content = self.editor.toPlainText().__str__()
if check.enabled:
self.disable_button.setEnabled(True)
self.enable_button.setEnabled(False)
else:
self.disable_button.setEnabled(False)
self.enable_button.setEnabled(True)
def set_datadog_conf(self, datadog_conf):
self.current_file = datadog_conf
self.desc_label.setText(datadog_conf.get_description())
self.editor.set_text_from_file(datadog_conf.file_path)
datadog_conf.content = self.editor.toPlainText().__str__()
self.disable_button.setEnabled(False)
self.enable_button.setEnabled(False)
#.........这里部分代码省略.........