本文整理汇总了Python中spyderlib.qt.QtGui.QLabel.setWordWrap方法的典型用法代码示例。如果您正苦于以下问题:Python QLabel.setWordWrap方法的具体用法?Python QLabel.setWordWrap怎么用?Python QLabel.setWordWrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyderlib.qt.QtGui.QLabel
的用法示例。
在下文中一共展示了QLabel.setWordWrap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_page
# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setWordWrap [as 别名]
def setup_page(self):
"""
Create the Spyder Config page for this plugin.
As of Dec 2014, there are no options available to set, so we only
display the data path.
"""
results_group = QGroupBox(_("Results"))
results_label1 = QLabel(_("Results are stored here:"))
results_label1.setWordWrap(True)
# Warning: do not try to regroup the following QLabel contents with
# widgets above -- this string was isolated here in a single QLabel
# on purpose: to fix Issue 863
results_label2 = QLabel(CoverageWidget.DATAPATH)
results_label2.setTextInteractionFlags(Qt.TextSelectableByMouse)
results_label2.setWordWrap(True)
results_layout = QVBoxLayout()
results_layout.addWidget(results_label1)
results_layout.addWidget(results_label2)
results_group.setLayout(results_layout)
vlayout = QVBoxLayout()
vlayout.addWidget(results_group)
vlayout.addStretch(1)
self.setLayout(vlayout)
示例2: setup_page
# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setWordWrap [as 别名]
def setup_page(self):
settings_group = QGroupBox(_("Settings"))
use_color_box = self.create_checkbox(
_("Use deterministic colors to differentiate functions"),
'use_colors', default=True)
results_group = QGroupBox(_("Results"))
results_label1 = QLabel(_("Memory profiler plugin results "
"(the output of memory_profiler)\n"
"is stored here:"))
results_label1.setWordWrap(True)
# Warning: do not try to regroup the following QLabel contents with
# widgets above -- this string was isolated here in a single QLabel
# on purpose: to fix Issue 863 of Profiler plugon
results_label2 = QLabel(MemoryProfilerWidget.DATAPATH)
results_label2.setTextInteractionFlags(Qt.TextSelectableByMouse)
results_label2.setWordWrap(True)
settings_layout = QVBoxLayout()
settings_layout.addWidget(use_color_box)
settings_group.setLayout(settings_layout)
results_layout = QVBoxLayout()
results_layout.addWidget(results_label1)
results_layout.addWidget(results_label2)
results_group.setLayout(results_layout)
vlayout = QVBoxLayout()
vlayout.addWidget(settings_group)
vlayout.addWidget(results_group)
vlayout.addStretch(1)
self.setLayout(vlayout)
示例3: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setWordWrap [as 别名]
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.runconf = RunConfiguration()
common_group = QGroupBox(_("General settings"))
common_layout = QGridLayout()
common_group.setLayout(common_layout)
self.clo_cb = QCheckBox(_("Command line options:"))
common_layout.addWidget(self.clo_cb, 0, 0)
self.clo_edit = QLineEdit()
self.connect(self.clo_cb, SIGNAL("toggled(bool)"), self.clo_edit.setEnabled)
self.clo_edit.setEnabled(False)
common_layout.addWidget(self.clo_edit, 0, 1)
self.wd_cb = QCheckBox(_("Working directory:"))
common_layout.addWidget(self.wd_cb, 1, 0)
wd_layout = QHBoxLayout()
self.wd_edit = QLineEdit()
self.connect(self.wd_cb, SIGNAL("toggled(bool)"), self.wd_edit.setEnabled)
self.wd_edit.setEnabled(False)
wd_layout.addWidget(self.wd_edit)
browse_btn = QPushButton(get_std_icon("DirOpenIcon"), "", self)
browse_btn.setToolTip(_("Select directory"))
self.connect(browse_btn, SIGNAL("clicked()"), self.select_directory)
wd_layout.addWidget(browse_btn)
common_layout.addLayout(wd_layout, 1, 1)
radio_group = QGroupBox(_("Interpreter"))
radio_layout = QVBoxLayout()
radio_group.setLayout(radio_layout)
self.current_radio = QRadioButton(_("Execute in current Python " "or IPython interpreter"))
radio_layout.addWidget(self.current_radio)
self.new_radio = QRadioButton(_("Execute in a new dedicated " "Python interpreter"))
radio_layout.addWidget(self.new_radio)
self.systerm_radio = QRadioButton(_("Execute in an external " "system terminal"))
radio_layout.addWidget(self.systerm_radio)
new_group = QGroupBox(_("Dedicated Python interpreter"))
self.connect(self.current_radio, SIGNAL("toggled(bool)"), new_group.setDisabled)
new_layout = QGridLayout()
new_group.setLayout(new_layout)
self.interact_cb = QCheckBox(_("Interact with the Python " "interpreter after execution"))
new_layout.addWidget(self.interact_cb, 1, 0, 1, -1)
self.pclo_cb = QCheckBox(_("Command line options:"))
new_layout.addWidget(self.pclo_cb, 2, 0)
self.pclo_edit = QLineEdit()
self.connect(self.pclo_cb, SIGNAL("toggled(bool)"), self.pclo_edit.setEnabled)
self.pclo_edit.setEnabled(False)
new_layout.addWidget(self.pclo_edit, 2, 1)
pclo_label = QLabel(_("The <b>-u</b> option is " "added to these commands"))
pclo_label.setWordWrap(True)
new_layout.addWidget(pclo_label, 3, 1)
# TODO: Add option for "Post-mortem debugging"
layout = QVBoxLayout()
layout.addWidget(common_group)
layout.addWidget(radio_group)
layout.addWidget(new_group)
self.setLayout(layout)
示例4: DependenciesDialog
# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setWordWrap [as 别名]
class DependenciesDialog(QDialog):
def __init__(self, parent):
QDialog.__init__(self, parent)
self.setWindowTitle("Spyder %s: %s" % (__version__, _("Optional Dependencies")))
self.setModal(True)
self.view = DependenciesTableView(self, [])
important_mods = ["rope", "pyflakes", "IPython", "matplotlib"]
self.label = QLabel(
_(
"Spyder depends on several Python modules to "
"provide additional functionality for its "
"plugins. The table below shows the required "
"and installed versions (if any) of all of "
"them.<br><br>"
"Although Spyder can work without any of these "
"modules, it's strongly recommended that at "
"least you try to install <b>%s</b> and "
"<b>%s</b> to have a much better experience."
)
% (", ".join(important_mods[:-1]), important_mods[-1])
)
self.label.setWordWrap(True)
self.label.setAlignment(Qt.AlignJustify)
self.label.setContentsMargins(5, 8, 12, 10)
btn = QPushButton(_("Copy to clipboard"))
self.connect(btn, SIGNAL("clicked()"), self.copy_to_clipboard)
bbox = QDialogButtonBox(QDialogButtonBox.Ok)
self.connect(bbox, SIGNAL("accepted()"), SLOT("accept()"))
hlayout = QHBoxLayout()
hlayout.addWidget(btn)
hlayout.addStretch()
hlayout.addWidget(bbox)
vlayout = QVBoxLayout()
vlayout.addWidget(self.label)
vlayout.addWidget(self.view)
vlayout.addLayout(hlayout)
self.setLayout(vlayout)
self.resize(560, 350)
def set_data(self, dependencies):
self.view.model.set_data(dependencies)
self.view.adjust_columns()
self.view.sortByColumn(0, Qt.DescendingOrder)
def copy_to_clipboard(self):
from spyderlib.dependencies import status
QApplication.clipboard().setText(status())
示例5: DependenciesDialog
# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setWordWrap [as 别名]
class DependenciesDialog(QDialog):
def __init__(self, parent):
QDialog.__init__(self, parent)
self.setWindowTitle("Spyder %s: %s" % (__version__,
_("Dependencies")))
self.setWindowIcon(ima.icon('tooloptions'))
self.setModal(True)
self.view = DependenciesTableView(self, [])
opt_mods = ['NumPy', 'Matplotlib', 'Pandas', 'SymPy']
self.label = QLabel(_("Spyder depends on several Python modules to "
"provide the right functionality for all its "
"panes. The table below shows the required "
"and installed versions (if any) of all of "
"them.<br><br>"
"<b>Note</b>: You can safely use Spyder "
"without the following modules installed: "
"<b>%s</b> and <b>%s</b>")
% (', '.join(opt_mods[:-1]), opt_mods[-1]))
self.label.setWordWrap(True)
self.label.setAlignment(Qt.AlignJustify)
self.label.setContentsMargins(5, 8, 12, 10)
btn = QPushButton(_("Copy to clipboard"), )
btn.clicked.connect(self.copy_to_clipboard)
bbox = QDialogButtonBox(QDialogButtonBox.Ok)
bbox.accepted.connect(self.accept)
hlayout = QHBoxLayout()
hlayout.addWidget(btn)
hlayout.addStretch()
hlayout.addWidget(bbox)
vlayout = QVBoxLayout()
vlayout.addWidget(self.label)
vlayout.addWidget(self.view)
vlayout.addLayout(hlayout)
self.setLayout(vlayout)
self.resize(630, 420)
def set_data(self, dependencies):
self.view.model.set_data(dependencies)
self.view.adjust_columns()
self.view.sortByColumn(0, Qt.DescendingOrder)
def copy_to_clipboard(self):
from spyderlib.dependencies import status
QApplication.clipboard().setText(status())
示例6: create_lineedit
# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setWordWrap [as 别名]
def create_lineedit(self, text, option, default=NoDefault,
tip=None, alignment=Qt.Vertical):
label = QLabel(text)
label.setWordWrap(True)
edit = QLineEdit()
layout = QVBoxLayout() if alignment == Qt.Vertical else QHBoxLayout()
layout.addWidget(label)
layout.addWidget(edit)
layout.setContentsMargins(0, 0, 0, 0)
if tip:
edit.setToolTip(tip)
self.lineedits[edit] = (option, default)
widget = QWidget(self)
widget.setLayout(layout)
return widget
示例7: setup_page
# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setWordWrap [as 别名]
def setup_page(self):
""" Setup of the configuration page. All widgets need to be added here"""
setup_group = QGroupBox(_("RateLaw Plugin Configuration"))
setup_label = QLabel(_("RateLaw plugin configuration needs to be "\
"implemented here.\n"))
setup_label.setWordWrap(True)
# Warning: do not try to regroup the following QLabel contents with
# widgets above -- this string was isolated here in a single QLabel
# on purpose: to fix Issue 863
setup_layout = QVBoxLayout()
setup_layout.addWidget(setup_label)
setup_group.setLayout(setup_layout)
vlayout = QVBoxLayout()
vlayout.addWidget(setup_group)
vlayout.addStretch(1)
self.setLayout(vlayout)
示例8: setup_page
# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setWordWrap [as 别名]
def setup_page(self):
results_group = QGroupBox(_("Results"))
results_label1 = QLabel(_("Profiler plugin results "\
"(the output of python's profile/cProfile)\n"
"are stored here:"))
results_label1.setWordWrap(True)
# Warning: do not try to regroup the following QLabel contents with
# widgets above -- this string was isolated here in a single QLabel
# on purpose: to fix Issue 863
results_label2 = QLabel(ProfilerWidget.DATAPATH)
results_label2.setTextInteractionFlags(Qt.TextSelectableByMouse)
results_label2.setWordWrap(True)
results_layout = QVBoxLayout()
results_layout.addWidget(results_label1)
results_layout.addWidget(results_label2)
results_group.setLayout(results_layout)
vlayout = QVBoxLayout()
vlayout.addWidget(results_group)
vlayout.addStretch(1)
self.setLayout(vlayout)
示例9: setup_page
# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setWordWrap [as 别名]
def setup_page(self):
settings_group = QGroupBox(_("Settings"))
save_box = self.create_checkbox(_("Save file before analyzing it"),
'save_before', default=True)
hist_group = QGroupBox(_("History"))
hist_label1 = QLabel(_("The following option will be applied at next "
"startup."))
hist_label1.setWordWrap(True)
hist_spin = self.create_spinbox(_("History: "),
_(" results"), 'max_entries', default=50,
min_=10, max_=1000000, step=10)
results_group = QGroupBox(_("Results"))
results_label1 = QLabel(_("Results are stored here:"))
results_label1.setWordWrap(True)
# Warning: do not try to regroup the following QLabel contents with
# widgets above -- this string was isolated here in a single QLabel
# on purpose: to fix Issue 863
results_label2 = QLabel(PylintWidget.DATAPATH)
results_label2.setTextInteractionFlags(Qt.TextSelectableByMouse)
results_label2.setWordWrap(True)
settings_layout = QVBoxLayout()
settings_layout.addWidget(save_box)
settings_group.setLayout(settings_layout)
hist_layout = QVBoxLayout()
hist_layout.addWidget(hist_label1)
hist_layout.addWidget(hist_spin)
hist_group.setLayout(hist_layout)
results_layout = QVBoxLayout()
results_layout.addWidget(results_label1)
results_layout.addWidget(results_label2)
results_group.setLayout(results_layout)
vlayout = QVBoxLayout()
vlayout.addWidget(settings_group)
vlayout.addWidget(hist_group)
vlayout.addWidget(results_group)
vlayout.addStretch(1)
self.setLayout(vlayout)
示例10: setup_page
# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setWordWrap [as 别名]
def setup_page(self):
about_label = QLabel(_("The <b>global working directory</b> is "
"the working directory for newly opened <i>consoles</i> "
"(Python/IPython consoles and terminals), for the "
"<i>file explorer</i>, for the <i>find in files</i> "
"plugin and for new files created in the <i>editor</i>."))
about_label.setWordWrap(True)
startup_group = QGroupBox(_("Startup"))
startup_bg = QButtonGroup(startup_group)
startup_label = QLabel(_("At startup, the global working "
"directory is:"))
startup_label.setWordWrap(True)
lastdir_radio = self.create_radiobutton(
_("the same as in last session"),
'startup/use_last_directory', True,
_("At startup, Spyder will restore the "
"global directory from last session"),
button_group=startup_bg)
thisdir_radio = self.create_radiobutton(
_("the following directory:"),
'startup/use_fixed_directory', False,
_("At startup, the global working "
"directory will be the specified path"),
button_group=startup_bg)
thisdir_bd = self.create_browsedir("", 'startup/fixed_directory',
getcwd())
self.connect(thisdir_radio, SIGNAL("toggled(bool)"),
thisdir_bd.setEnabled)
self.connect(lastdir_radio, SIGNAL("toggled(bool)"),
thisdir_bd.setDisabled)
thisdir_layout = QHBoxLayout()
thisdir_layout.addWidget(thisdir_radio)
thisdir_layout.addWidget(thisdir_bd)
editor_o_group = QGroupBox(_("Open file"))
editor_o_label = QLabel(_("Files are opened from:"))
editor_o_label.setWordWrap(True)
editor_o_bg = QButtonGroup(editor_o_group)
editor_o_radio1 = self.create_radiobutton(
_("the current file directory"),
'editor/open/browse_scriptdir',
button_group=editor_o_bg)
editor_o_radio2 = self.create_radiobutton(
_("the global working directory"),
'editor/open/browse_workdir',
button_group=editor_o_bg)
editor_n_group = QGroupBox(_("New file"))
editor_n_label = QLabel(_("Files are created in:"))
editor_n_label.setWordWrap(True)
editor_n_bg = QButtonGroup(editor_n_group)
editor_n_radio1 = self.create_radiobutton(
_("the current file directory"),
'editor/new/browse_scriptdir',
button_group=editor_n_bg)
editor_n_radio2 = self.create_radiobutton(
_("the global working directory"),
'editor/new/browse_workdir',
button_group=editor_n_bg)
# Note: default values for the options above are set in plugin's
# constructor (see below)
other_group = QGroupBox(_("Change to file base directory"))
newcb = self.create_checkbox
open_box = newcb(_("When opening a file"),
'editor/open/auto_set_to_basedir')
save_box = newcb(_("When saving a file"),
'editor/save/auto_set_to_basedir')
startup_layout = QVBoxLayout()
startup_layout.addWidget(startup_label)
startup_layout.addWidget(lastdir_radio)
startup_layout.addLayout(thisdir_layout)
startup_group.setLayout(startup_layout)
editor_o_layout = QVBoxLayout()
editor_o_layout.addWidget(editor_o_label)
editor_o_layout.addWidget(editor_o_radio1)
editor_o_layout.addWidget(editor_o_radio2)
editor_o_group.setLayout(editor_o_layout)
editor_n_layout = QVBoxLayout()
editor_n_layout.addWidget(editor_n_label)
editor_n_layout.addWidget(editor_n_radio1)
editor_n_layout.addWidget(editor_n_radio2)
editor_n_group.setLayout(editor_n_layout)
other_layout = QVBoxLayout()
other_layout.addWidget(open_box)
other_layout.addWidget(save_box)
other_group.setLayout(other_layout)
vlayout = QVBoxLayout()
vlayout.addWidget(about_label)
vlayout.addSpacing(10)
vlayout.addWidget(startup_group)
vlayout.addWidget(editor_o_group)
vlayout.addWidget(editor_n_group)
vlayout.addWidget(other_group)
#.........这里部分代码省略.........
示例11: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setWordWrap [as 别名]
def __init__(self, parent, max_entries=100):
"Initialize Various list objects before assignment"
displaylist = []
displaynamelist = []
infixmod = []
infixlist = []
desclist = []
parameternamelist = []
parameterdesclist = []
parameterstringlist = []
paramcountlist = []
buttonlist = []
xmldoc = minidom.parse('C:\\Users\\Jayit\\.spyder2\\ratelaw2_0_3.xml')
#xmldoc = minidom.parse('%\\Downloads\\ratelaw2_0_3.xml')
lawlistxml = xmldoc.getElementsByTagName('law')
o = 0
for s in lawlistxml:
o = o + 1
parameternamelistlist = [0 for x in range(o)]
parameterdesclistlist = [0 for x in range(o)]
"""i is the number of laws currently in the xml file"""
i = 0
"""
Parsing xml: Acquiring rate law name, description, and list of parameter information
"""
for s in lawlistxml:
#RATE_LAW_MESSAGE += s.getAttribute('displayName') + "\n"
"""Gets Latec Expression"""
displaylist.append(s.getAttribute('display'))
"""Gets Rate-Law Name"""
displaynamelist.append(s.getAttribute('displayName'))
""""Gets Raw Rate-Law expression"""
infixlist.append(s.getAttribute('infixExpression'))
"""Gets description statement"""
desclist.append(s.getAttribute('description'))
"""Gets listOfParameters Object"""
parameterlist = s.getElementsByTagName('listOfParameters')[0]
"""Gets a list of parameters within ListOfParameters object"""
parameters = parameterlist.getElementsByTagName('parameter')
for param in parameters:
parameternamelist.append(param.attributes['name'].value)
#print(param.attributes['name'].value)
parameterdesclist.append(param.attributes['description'].value)
parameternamelistlist[i] = parameternamelist
#print("break")
parameterdesclistlist[i] = parameterdesclist
parameternamelist = []
parameterdesclist = []
i = i + 1
SLElistlist = [ 0 for x in range(i)]
PLElistlist = [ 0 for x in range(i)]
ILElistlist = [ 0 for x in range(i)]
paramLElistlist = [ 0 for x in range(i)]
numlistlist = [ 0 for x in range(i)]
QWidget.__init__(self, parent)
self.setWindowTitle("Rate Law Library")
self.output = None
self.error_output = None
self._last_wdir = None
self._last_args = None
self._last_pythonpath = None
#self.textlabel = QLabel(RATE_LAW_MESSAGE)
self.lawlist = QListWidget()
self.lawpage = QStackedWidget()
index = 0
for j in range(i):
item = QListWidgetItem(displaynamelist[j])
self.lawlist.addItem(item)
self.lawdetailpage = QWidget()
setup_group = QGroupBox(displaynamelist[j])
infixmod.append(infixlist[j].replace("___"," "))
setup_label = QLabel(infixmod[j])
setup_label.setWordWrap(True)
desc_group = QGroupBox("Description")
desc_label = QLabel(desclist[j])
#.........这里部分代码省略.........
示例12: setup_page
# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setWordWrap [as 别名]
def setup_page(self):
# Fonts group
plain_text_font_group = self.create_fontgroup(
option=None, text=_("Plain text font style"), fontfilters=QFontComboBox.MonospacedFonts
)
rich_text_font_group = self.create_fontgroup(option="rich_text", text=_("Rich text font style"))
# Connections group
connections_group = QGroupBox(_("Automatic connections"))
connections_label = QLabel(
_(
"The Object Inspector can automatically "
"show an object's help information after "
"a left parenthesis is written next to it. "
"Below you can decide to which plugin "
"you want to connect it to turn on this "
"feature."
)
)
connections_label.setWordWrap(True)
editor_box = self.create_checkbox(_("Editor"), "connect/editor")
rope_installed = programs.is_module_installed("rope")
jedi_installed = programs.is_module_installed("jedi", ">=0.8.0")
editor_box.setEnabled(rope_installed or jedi_installed)
# TODO: Don't forget to add Jedi here
if not rope_installed:
rope_tip = _("This feature requires the Rope library.\n" "It seems you don't have it installed.")
editor_box.setToolTip(rope_tip)
python_box = self.create_checkbox(_("Python Console"), "connect/python_console")
ipython_box = self.create_checkbox(_("IPython Console"), "connect/ipython_console")
ipython_installed = programs.is_module_installed("IPython", ">=0.13")
ipython_box.setEnabled(ipython_installed)
connections_layout = QVBoxLayout()
connections_layout.addWidget(connections_label)
connections_layout.addWidget(editor_box)
connections_layout.addWidget(python_box)
connections_layout.addWidget(ipython_box)
connections_group.setLayout(connections_layout)
# Features group
features_group = QGroupBox(_("Additional features"))
math_box = self.create_checkbox(_("Render mathematical equations"), "math")
req_sphinx = sphinx_version is not None and programs.is_module_installed("sphinx", ">=1.1")
math_box.setEnabled(req_sphinx)
if not req_sphinx:
sphinx_tip = _("This feature requires Sphinx 1.1 or superior.")
if sphinx_version is not None:
sphinx_tip += "\n" + _("Sphinx %s is currently installed.") % sphinx_version
math_box.setToolTip(sphinx_tip)
features_layout = QVBoxLayout()
features_layout.addWidget(math_box)
features_group.setLayout(features_layout)
# Source code group
sourcecode_group = QGroupBox(_("Source code"))
wrap_mode_box = self.create_checkbox(_("Wrap lines"), "wrap")
names = CONF.get("color_schemes", "names")
choices = list(zip(names, names))
cs_combo = self.create_combobox(_("Syntax color scheme: "), choices, "color_scheme_name")
sourcecode_layout = QVBoxLayout()
sourcecode_layout.addWidget(wrap_mode_box)
sourcecode_layout.addWidget(cs_combo)
sourcecode_group.setLayout(sourcecode_layout)
# Final layout
vlayout = QVBoxLayout()
vlayout.addWidget(rich_text_font_group)
vlayout.addWidget(plain_text_font_group)
vlayout.addWidget(connections_group)
vlayout.addWidget(features_group)
vlayout.addWidget(sourcecode_group)
vlayout.addStretch(1)
self.setLayout(vlayout)
示例13: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setWordWrap [as 别名]
def __init__(self, parent, max_entries=100):
""" Creates a very basic window with some text """
"""
RATE_LAW_MESSAGE = \
"The Plugins for Spyder consists out of three main classes: \n\n" \
"1. HelloWorld\n\n" \
"\tThe HelloWorld class inherits all its methods from\n" \
"\tSpyderPluginMixin and the HelloWorldWidget and performs all\n" \
"\tthe processing required by the GU. \n\n" \
"2. HelloWorldConfigPage\n\n" \
"\tThe HelloWorldConfig class inherits all its methods from\n" \
"\tPluginConfigPage to create a configuration page that can be\n" \
"\tfound under Tools -> Preferences\n\n" \
"3. HelloWorldWidget\n\n" \
"\tThe HelloWorldWidget class inherits all its methods from\n" \
"\tQWidget to create the actual plugin GUI interface that \n" \
"\tdisplays this message on screen\n\n"
"""
#Testing access editor on plugin initialization
RATE_LAW_MESSAGE = ""
displaynamelist = []
#displaylist = []
infixlist = []
desclist = []
parameterstringlist = []
xmldoc = minidom.parse('\\.spyder2\\ratelaw2_0_3.xml')
#xmldoc = minidom.parse('%\\Downloads\\ratelaw2_0_3.xml')
lawlistxml = xmldoc.getElementsByTagName('law')
#i is the number of laws currently in the xml file
i = 0
for s in lawlistxml:
#RATE_LAW_MESSAGE += s.getAttribute('displayName') + "\n"
RATE_LAW_MESSAGE += s.getAttribute('display') + "\n"
#displaynamelist[i] = s.getAttribute('displayName')
#displaylist[i] = s.getAttribute('display')
displaynamelist.append(s.getAttribute('displayName'))
#displaylist.append(s.getAttribute('display'))
infixlist.append(s.getAttribute('infixExpression'))
desclist.append(s.getAttribute('description'))
parameterlist = s.getElementsByTagName('listOfParameters')[0]
#for p in parameterlist
parameters = parameterlist.getElementsByTagName('parameter')
parameterstring = ""
for param in parameters:
parametername = param.attributes['name'].value
parameterdesc = param.attributes['description'].value
parameterstring = parameterstring + '\t' + parametername + ":" + '\t' + " " + parameterdesc + "\n"
#print('\t' + parametername + ":" + '\t' + parameterdesc)
parameterstringlist.append(parameterstring)
i = i + 1
QWidget.__init__(self, parent)
self.setWindowTitle("Rate Law Library")
self.output = None
self.error_output = None
self._last_wdir = None
self._last_args = None
self._last_pythonpath = None
self.textlabel = QLabel(RATE_LAW_MESSAGE)
self.lawlist = QListWidget()
self.lawpage = QStackedWidget()
#Adding displayName items to lawlist
for j in range(i):
item = QListWidgetItem(displaynamelist[j])
self.lawlist.addItem(item)
self.lawdetailpage = QWidget()
# Page layout will become its own function
setup_group = QGroupBox(displaynamelist[j])
infixmod = infixlist[j].replace("___"," ")
setup_label = QLabel(infixmod)
setup_label.setWordWrap(True)
desc_group = QGroupBox("Description")
desc_label = QLabel(desclist[j])
desc_label.setWordWrap(True)
param_label = QLabel(parameterstringlist[j])
param_label.setWordWrap(True)
# Warning: do not try to regroup the following QLabel contents with
# widgets above -- this string was isolated here in a single QLabel
# on purpose: to fix Issue 863
setup_layout = QVBoxLayout()
setup_layout.addWidget(setup_label)
setup_group.setLayout(setup_layout)
desc_layout = QVBoxLayout()
desc_layout.addWidget(desc_label)
desc_layout.addWidget(param_label)
desc_group.setLayout(desc_layout)
vlayout = QVBoxLayout()
#.........这里部分代码省略.........
示例14: setup_page
# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setWordWrap [as 别名]
def setup_page(self):
if ERR_MSG:
label = QLabel(_("Could not load plugin:\n{0}".format(ERR_MSG)))
layout = QVBoxLayout()
layout.addWidget(label)
self.setLayout(layout)
return
# Layout parameter
indent = QCheckBox().sizeHint().width()
# General options
options_group = QGroupBox(_("Options"))
# Hack : the spinbox widget will be added to self.spinboxes
spinboxes_before = set(self.spinboxes)
passes_spin = self.create_spinbox(
_("Number of pep8 passes: "), "", 'passes',
default=0, min_=0, max_=1000000, step=1)
spinbox = set(self.spinboxes) - spinboxes_before
spinbox = spinbox.pop()
spinbox.setSpecialValueText(_("Infinite"))
aggressive1_checkbox = self.create_checkbox(
"Aggressivity level 1", "aggressive1", default=False)
aggressive1_label = QLabel(_(
"Allow possibly unsafe fixes (E711 and W6), shorten lines"
" and remove trailing whitespace more aggressively (in"
" docstrings and multiline strings)."))
aggressive1_label.setWordWrap(True)
aggressive1_label.setIndent(indent)
font_description = aggressive1_label.font()
font_description.setPointSizeF(font_description.pointSize() * 0.9)
aggressive1_label.setFont(font_description)
aggressive2_checkbox = self.create_checkbox(
"Aggressivity level 2", "aggressive2", default=False)
aggressive2_label = QLabel(_(
"Allow more possibly unsafe fixes (E712) and shorten lines."))
aggressive2_label.setWordWrap(True)
aggressive2_label.setIndent(indent)
aggressive2_label.setFont(font_description)
self.connect(aggressive1_checkbox, SIGNAL("toggled(bool)"),
aggressive2_checkbox.setEnabled)
self.connect(aggressive1_checkbox, SIGNAL("toggled(bool)"),
aggressive2_label.setEnabled)
aggressive2_checkbox.setEnabled(aggressive1_checkbox.isChecked())
aggressive2_label.setEnabled(aggressive1_checkbox.isChecked())
# Enable/disable error codes
fix_layout = QVBoxLayout()
last_group = ""
FIX_LIST.sort(key=lambda item: item[0][1])
for code, description in FIX_LIST:
# Create a new group if necessary
if code[1] != last_group:
last_group = code[1]
group = QGroupBox(_(self.GROUPS.get(code[1], "")))
fix_layout.addWidget(group)
group_layout = QVBoxLayout(group)
# Checkbox for the option
text = code
default = True
if code in DEFAULT_IGNORE:
text += _(" (UNSAFE)")
default = False
option = self.create_checkbox(text, code, default=default)
# Label for description
if code in self.CODES:
label = QLabel("{autopep8} ({pep8}).".format(
autopep8=_(description).rstrip("."),
pep8=self.CODES[code]))
else:
label = QLabel(_(description))
label.setWordWrap(True)
label.setIndent(indent)
label.setFont(font_description)
# Add widgets to layout
option_layout = QVBoxLayout()
option_layout.setSpacing(0)
option_layout.addWidget(option)
option_layout.addWidget(label)
group_layout.addLayout(option_layout)
# Special cases
if code in ("E711", "W6"):
self.connect(aggressive1_checkbox, SIGNAL("toggled(bool)"),
option.setEnabled)
self.connect(aggressive1_checkbox, SIGNAL("toggled(bool)"),
label.setEnabled)
option.setEnabled(aggressive1_checkbox.isChecked())
label.setEnabled(aggressive1_checkbox.isChecked())
if code == "E712":
def e712_enabled():
enabled = (aggressive1_checkbox.isChecked()
and aggressive2_checkbox.isChecked())
option.setEnabled(enabled)
label.setEnabled(enabled)
self.connect(aggressive1_checkbox, SIGNAL("toggled(bool)"),
#.........这里部分代码省略.........
示例15: setup_page
# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setWordWrap [as 别名]
def setup_page(self):
newcb = self.create_checkbox
mpl_present = programs.is_module_installed("matplotlib")
# --- Display ---
font_group = self.create_fontgroup(option=None, text=None,
fontfilters=QFontComboBox.MonospacedFonts)
# Interface Group
interface_group = QGroupBox(_("Interface"))
banner_box = newcb(_("Display initial banner"), 'show_banner',
tip=_("This option lets you hide the message shown at\n"
"the top of the console when it's opened."))
gui_comp_box = newcb(_("Use a completion widget"),
'use_gui_completion',
tip=_("Use a widget instead of plain text "
"output for tab completion"))
pager_box = newcb(_("Use a pager to display additional text inside "
"the console"), 'use_pager',
tip=_("Useful if you don't want to fill the "
"console with long help or completion texts.\n"
"Note: Use the Q key to get out of the "
"pager."))
calltips_box = newcb(_("Display balloon tips"), 'show_calltips')
ask_box = newcb(_("Ask for confirmation before closing"),
'ask_before_closing')
interface_layout = QVBoxLayout()
interface_layout.addWidget(banner_box)
interface_layout.addWidget(gui_comp_box)
interface_layout.addWidget(pager_box)
interface_layout.addWidget(calltips_box)
interface_layout.addWidget(ask_box)
interface_group.setLayout(interface_layout)
# Background Color Group
bg_group = QGroupBox(_("Background color"))
light_radio = self.create_radiobutton(_("Light background"),
'light_color')
dark_radio = self.create_radiobutton(_("Dark background"),
'dark_color')
bg_layout = QVBoxLayout()
bg_layout.addWidget(light_radio)
bg_layout.addWidget(dark_radio)
bg_group.setLayout(bg_layout)
# Source Code Group
source_code_group = QGroupBox(_("Source code"))
buffer_spin = self.create_spinbox(
_("Buffer: "), _(" lines"),
'buffer_size', min_=-1, max_=1000000, step=100,
tip=_("Set the maximum number of lines of text shown in the\n"
"console before truncation. Specifying -1 disables it\n"
"(not recommended!)"))
source_code_layout = QVBoxLayout()
source_code_layout.addWidget(buffer_spin)
source_code_group.setLayout(source_code_layout)
# --- Graphics ---
# Pylab Group
pylab_group = QGroupBox(_("Support for graphics (Matplotlib)"))
pylab_box = newcb(_("Activate support"), 'pylab')
autoload_pylab_box = newcb(_("Automatically load Pylab and NumPy "
"modules"),
'pylab/autoload',
tip=_("This lets you load graphics support "
"without importing \nthe commands to do "
"plots. Useful to work with other\n"
"plotting libraries different to "
"Matplotlib or to develop \nGUIs with "
"Spyder."))
autoload_pylab_box.setEnabled(self.get_option('pylab') and mpl_present)
self.connect(pylab_box, SIGNAL("toggled(bool)"),
autoload_pylab_box.setEnabled)
pylab_layout = QVBoxLayout()
pylab_layout.addWidget(pylab_box)
pylab_layout.addWidget(autoload_pylab_box)
pylab_group.setLayout(pylab_layout)
if not mpl_present:
self.set_option('pylab', False)
self.set_option('pylab/autoload', False)
pylab_group.setEnabled(False)
pylab_tip = _("This feature requires the Matplotlib library.\n"
"It seems you don't have it installed.")
pylab_box.setToolTip(pylab_tip)
# Pylab backend Group
inline = _("Inline")
automatic = _("Automatic")
backend_group = QGroupBox(_("Graphics backend"))
bend_label = QLabel(_("Decide how graphics are going to be displayed "
"in the console. If unsure, please select "
"<b>%s</b> to put graphics inside the "
"console or <b>%s</b> to interact with "
"them (through zooming and panning) in a "
"separate window.") % (inline, automatic))
bend_label.setWordWrap(True)
#.........这里部分代码省略.........