本文整理汇总了Python中qtpy.QtWidgets.QGridLayout.setColumnStretch方法的典型用法代码示例。如果您正苦于以下问题:Python QGridLayout.setColumnStretch方法的具体用法?Python QGridLayout.setColumnStretch怎么用?Python QGridLayout.setColumnStretch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtWidgets.QGridLayout
的用法示例。
在下文中一共展示了QGridLayout.setColumnStretch方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_gui
# 需要导入模块: from qtpy.QtWidgets import QGridLayout [as 别名]
# 或者: from qtpy.QtWidgets.QGridLayout import setColumnStretch [as 别名]
def setup_gui(self):
"""Setup the main layout of the widget."""
layout = QGridLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.canvas, 0, 1)
layout.addLayout(self.setup_toolbar(), 0, 3, 2, 1)
layout.setColumnStretch(0, 100)
layout.setColumnStretch(2, 100)
layout.setRowStretch(1, 100)
示例2: ThumbnailScrollBar
# 需要导入模块: from qtpy.QtWidgets import QGridLayout [as 别名]
# 或者: from qtpy.QtWidgets.QGridLayout import setColumnStretch [as 别名]
class ThumbnailScrollBar(QFrame):
"""
A widget that manages the display of the FigureThumbnails that are
created when a figure is sent to the IPython console by the kernel and
that controls what is displayed in the FigureViewer.
"""
redirect_stdio = Signal(bool)
def __init__(self, figure_viewer, parent=None, background_color=None):
super(ThumbnailScrollBar, self).__init__(parent)
self._thumbnails = []
self.background_color = background_color
self.current_thumbnail = None
self.set_figureviewer(figure_viewer)
self.setup_gui()
def setup_gui(self):
"""Setup the main layout of the widget."""
scrollarea = self.setup_scrollarea()
up_btn, down_btn = self.setup_arrow_buttons()
self.setFixedWidth(150)
layout = QVBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
layout.addWidget(up_btn)
layout.addWidget(scrollarea)
layout.addWidget(down_btn)
def setup_scrollarea(self):
"""Setup the scrollarea that will contain the FigureThumbnails."""
self.view = QWidget()
self.scene = QGridLayout(self.view)
self.scene.setColumnStretch(0, 100)
self.scene.setColumnStretch(2, 100)
self.scrollarea = QScrollArea()
self.scrollarea.setWidget(self.view)
self.scrollarea.setWidgetResizable(True)
self.scrollarea.setFrameStyle(0)
self.scrollarea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.scrollarea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.scrollarea.setSizePolicy(QSizePolicy(QSizePolicy.Ignored,
QSizePolicy.Preferred))
# Set the vertical scrollbar explicitely :
# This is required to avoid a "RuntimeError: no access to protected
# functions or signals for objects not created from Python" in Linux.
self.scrollarea.setVerticalScrollBar(QScrollBar())
return self.scrollarea
def setup_arrow_buttons(self):
"""
Setup the up and down arrow buttons that are placed at the top and
bottom of the scrollarea.
"""
# Get the height of the up/down arrow of the default vertical
# scrollbar :
vsb = self.scrollarea.verticalScrollBar()
style = vsb.style()
opt = QStyleOptionSlider()
vsb.initStyleOption(opt)
vsb_up_arrow = style.subControlRect(
QStyle.CC_ScrollBar, opt, QStyle.SC_ScrollBarAddLine, self)
# Setup the up and down arrow button :
up_btn = up_btn = QPushButton(icon=ima.icon('last_edit_location'))
up_btn.setFlat(True)
up_btn.setFixedHeight(vsb_up_arrow.size().height())
up_btn.clicked.connect(self.go_up)
down_btn = QPushButton(icon=ima.icon('folding.arrow_down_on'))
down_btn.setFlat(True)
down_btn.setFixedHeight(vsb_up_arrow.size().height())
down_btn.clicked.connect(self.go_down)
return up_btn, down_btn
def set_figureviewer(self, figure_viewer):
"""Set the bamespace for the FigureViewer."""
self.figure_viewer = figure_viewer
# ---- Save Figure
def save_all_figures_as(self):
"""Save all the figures to a file."""
self.redirect_stdio.emit(False)
dirname = getexistingdirectory(self, caption='Save all figures',
basedir=getcwd_or_home())
self.redirect_stdio.emit(True)
if dirname:
return self.save_all_figures_todir(dirname)
def save_all_figures_todir(self, dirname):
"""Save all figure in dirname."""
fignames = []
for thumbnail in self._thumbnails:
fig = thumbnail.canvas.fig
fmt = thumbnail.canvas.fmt
#.........这里部分代码省略.........
示例3: setup_page
# 需要导入模块: from qtpy.QtWidgets import QGridLayout [as 别名]
# 或者: from qtpy.QtWidgets.QGridLayout import setColumnStretch [as 别名]
def setup_page(self):
self.ICON = ima.icon('genprefs')
newcb = self.create_checkbox
# --- Interface
general_group = QGroupBox(_("General"))
languages = LANGUAGE_CODES.items()
language_choices = sorted([(val, key) for key, val in languages])
language_combo = self.create_combobox(_('Language:'),
language_choices,
'interface_language',
restart=True)
opengl_options = ['Automatic', 'Desktop', 'Software', 'GLES']
opengl_choices = list(zip(opengl_options,
[c.lower() for c in opengl_options]))
opengl_combo = self.create_combobox(_('Rendering engine:'),
opengl_choices,
'opengl',
restart=True)
single_instance_box = newcb(_("Use a single instance"),
'single_instance',
tip=_("Set this to open external<br> "
"Python files in an already running "
"instance (Requires a restart)"))
prompt_box = newcb(_("Prompt when exiting"), 'prompt_on_exit')
popup_console_box = newcb(_("Show internal Spyder errors to report "
"them to Github"), 'show_internal_errors')
check_updates = newcb(_("Check for updates on startup"),
'check_updates_on_startup')
# Decide if it's possible to activate or not single instance mode
if running_in_mac_app():
self.set_option("single_instance", True)
single_instance_box.setEnabled(False)
comboboxes_advanced_layout = QHBoxLayout()
cbs_adv_grid = QGridLayout()
cbs_adv_grid.addWidget(language_combo.label, 0, 0)
cbs_adv_grid.addWidget(language_combo.combobox, 0, 1)
cbs_adv_grid.addWidget(opengl_combo.label, 1, 0)
cbs_adv_grid.addWidget(opengl_combo.combobox, 1, 1)
comboboxes_advanced_layout.addLayout(cbs_adv_grid)
comboboxes_advanced_layout.addStretch(1)
general_layout = QVBoxLayout()
general_layout.addLayout(comboboxes_advanced_layout)
general_layout.addWidget(single_instance_box)
general_layout.addWidget(prompt_box)
general_layout.addWidget(popup_console_box)
general_layout.addWidget(check_updates)
general_group.setLayout(general_layout)
# --- Theme
interface_group = QGroupBox(_("Interface"))
vertdock_box = newcb(_("Vertical title bars in panes"),
'vertical_dockwidget_titlebars')
verttabs_box = newcb(_("Vertical tabs in panes"),
'vertical_tabs')
animated_box = newcb(_("Animated toolbars and panes"),
'animated_docks')
tear_off_box = newcb(_("Tear off menus"), 'tear_off_menus',
tip=_("Set this to detach any<br> "
"menu from the main window"))
margin_box = newcb(_("Custom margin for panes:"),
'use_custom_margin')
margin_spin = self.create_spinbox("", _("pixels"), 'custom_margin',
0, 0, 30)
margin_box.toggled.connect(margin_spin.spinbox.setEnabled)
margin_box.toggled.connect(margin_spin.slabel.setEnabled)
margin_spin.spinbox.setEnabled(self.get_option('use_custom_margin'))
margin_spin.slabel.setEnabled(self.get_option('use_custom_margin'))
cursor_box = newcb(_("Cursor blinking:"),
'use_custom_cursor_blinking')
cursor_spin = self.create_spinbox(
"", _("ms"),
'custom_cursor_blinking',
default=QApplication.cursorFlashTime(),
min_=0, max_=5000, step=100)
cursor_box.toggled.connect(cursor_spin.spinbox.setEnabled)
cursor_box.toggled.connect(cursor_spin.slabel.setEnabled)
cursor_spin.spinbox.setEnabled(
self.get_option('use_custom_cursor_blinking'))
cursor_spin.slabel.setEnabled(
self.get_option('use_custom_cursor_blinking'))
margins_cursor_layout = QGridLayout()
margins_cursor_layout.addWidget(margin_box, 0, 0)
margins_cursor_layout.addWidget(margin_spin.spinbox, 0, 1)
margins_cursor_layout.addWidget(margin_spin.slabel, 0, 2)
margins_cursor_layout.addWidget(cursor_box, 1, 0)
margins_cursor_layout.addWidget(cursor_spin.spinbox, 1, 1)
margins_cursor_layout.addWidget(cursor_spin.slabel, 1, 2)
margins_cursor_layout.setColumnStretch(2, 100)
#.........这里部分代码省略.........
示例4: setup
# 需要导入模块: from qtpy.QtWidgets import QGridLayout [as 别名]
# 或者: from qtpy.QtWidgets.QGridLayout import setColumnStretch [as 别名]
def setup(self):
"""Setup the ShortcutEditor with the provided arguments."""
# Widgets
icon_info = HelperToolButton()
icon_info.setIcon(get_std_icon('MessageBoxInformation'))
layout_icon_info = QVBoxLayout()
layout_icon_info.setContentsMargins(0, 0, 0, 0)
layout_icon_info.setSpacing(0)
layout_icon_info.addWidget(icon_info)
layout_icon_info.addStretch(100)
self.label_info = QLabel()
self.label_info.setText(
_("Press the new shortcut and select 'Ok' to confirm, "
"click 'Cancel' to revert to the previous state, "
"or use 'Clear' to unbind the command from a shortcut."))
self.label_info.setAlignment(Qt.AlignTop | Qt.AlignLeft)
self.label_info.setWordWrap(True)
layout_info = QHBoxLayout()
layout_info.setContentsMargins(0, 0, 0, 0)
layout_info.addLayout(layout_icon_info)
layout_info.addWidget(self.label_info)
layout_info.setStretch(1, 100)
self.label_current_sequence = QLabel(_("Current shortcut:"))
self.text_current_sequence = QLabel(self.current_sequence)
self.label_new_sequence = QLabel(_("New shortcut:"))
self.text_new_sequence = ShortcutLineEdit(self)
self.text_new_sequence.setPlaceholderText(_("Press shortcut."))
self.helper_button = HelperToolButton()
self.helper_button.setIcon(QIcon())
self.label_warning = QLabel()
self.label_warning.setWordWrap(True)
self.label_warning.setAlignment(Qt.AlignTop | Qt.AlignLeft)
self.button_default = QPushButton(_('Default'))
self.button_ok = QPushButton(_('Ok'))
self.button_ok.setEnabled(False)
self.button_clear = QPushButton(_('Clear'))
self.button_cancel = QPushButton(_('Cancel'))
button_box = QHBoxLayout()
button_box.addWidget(self.button_default)
button_box.addStretch(100)
button_box.addWidget(self.button_ok)
button_box.addWidget(self.button_clear)
button_box.addWidget(self.button_cancel)
# New Sequence button box
self.btn_clear_sequence = create_toolbutton(
self, icon=ima.icon('editclear'),
tip=_("Clear all entered key sequences"),
triggered=self.clear_new_sequence)
self.button_back_sequence = create_toolbutton(
self, icon=ima.icon('ArrowBack'),
tip=_("Remove last key sequence entered"),
triggered=self.back_new_sequence)
newseq_btnbar = QHBoxLayout()
newseq_btnbar.setSpacing(0)
newseq_btnbar.setContentsMargins(0, 0, 0, 0)
newseq_btnbar.addWidget(self.button_back_sequence)
newseq_btnbar.addWidget(self.btn_clear_sequence)
# Setup widgets
self.setWindowTitle(_('Shortcut: {0}').format(self.name))
self.helper_button.setToolTip('')
style = """
QToolButton {
margin:1px;
border: 0px solid grey;
padding:0px;
border-radius: 0px;
}"""
self.helper_button.setStyleSheet(style)
icon_info.setToolTip('')
icon_info.setStyleSheet(style)
# Layout
layout_sequence = QGridLayout()
layout_sequence.setContentsMargins(0, 0, 0, 0)
layout_sequence.addLayout(layout_info, 0, 0, 1, 4)
layout_sequence.addItem(QSpacerItem(15, 15), 1, 0, 1, 4)
layout_sequence.addWidget(self.label_current_sequence, 2, 0)
layout_sequence.addWidget(self.text_current_sequence, 2, 2)
layout_sequence.addWidget(self.label_new_sequence, 3, 0)
layout_sequence.addWidget(self.helper_button, 3, 1)
layout_sequence.addWidget(self.text_new_sequence, 3, 2)
layout_sequence.addLayout(newseq_btnbar, 3, 3)
layout_sequence.addWidget(self.label_warning, 4, 2, 1, 2)
layout_sequence.setColumnStretch(2, 100)
layout_sequence.setRowStretch(4, 100)
layout = QVBoxLayout()
layout.addLayout(layout_sequence)
layout.addSpacing(5)
layout.addLayout(button_box)
self.setLayout(layout)
#.........这里部分代码省略.........
示例5: SkiviImageWindow
# 需要导入模块: from qtpy.QtWidgets import QGridLayout [as 别名]
# 或者: from qtpy.QtWidgets.QGridLayout import setColumnStretch [as 别名]
class SkiviImageWindow(QMainWindow):
def __init__(self, arr, mgr):
QMainWindow.__init__(self)
self.arr = arr
self.mgr = mgr
self.main_widget = QWidget()
self.layout = QGridLayout(self.main_widget)
self.setCentralWidget(self.main_widget)
self.label = ImageLabel(self, arr)
self.label_container = QFrame()
self.label_container.setFrameShape(QFrame.StyledPanel | QFrame.Sunken)
self.label_container.setLineWidth(1)
self.label_container.layout = QGridLayout(self.label_container)
self.label_container.layout.setContentsMargins(0, 0, 0, 0)
self.label_container.layout.addWidget(self.label, 0, 0)
self.layout.addWidget(self.label_container, 0, 0)
self.mgr.add_window(self)
self.main_widget.show()
self.setWindowTitle('Skivi - The skimage viewer.')
self.mixer_panel = MixerPanel(self.arr)
self.layout.addWidget(self.mixer_panel, 0, 2)
self.mixer_panel.show()
self.mixer_panel.set_callback(self.refresh_image)
self.rgbv_hist = QuadHistogram(self.arr)
self.layout.addWidget(self.rgbv_hist, 0, 1)
self.rgbv_hist.show()
self.rgb_hsv_disp = RGBHSVDisplay()
self.layout.addWidget(self.rgb_hsv_disp, 1, 0)
self.rgb_hsv_disp.show()
self.layout.setColumnStretch(0, 1)
self.layout.setRowStretch(0, 1)
self.save_file = QtWidgets.QPushButton('Save to File')
self.save_file.clicked.connect(self.save_to_file)
self.save_stack = QtWidgets.QPushButton('Save to Stack')
self.save_stack.clicked.connect(self.save_to_stack)
self.save_file.show()
self.save_stack.show()
self.layout.addWidget(self.save_stack, 1, 1)
self.layout.addWidget(self.save_file, 1, 2)
def closeEvent(self, event):
# Allow window to be destroyed by removing any
# references to it
self.mgr.remove_window(self)
def update_histograms(self):
self.rgbv_hist.update_hists(self.arr)
def refresh_image(self):
self.label.update_image()
self.update_histograms()
def scale_mouse_pos(self, x, y):
width = self.label.pm.width()
height = self.label.pm.height()
x_frac = 1. * x / width
y_frac = 1. * y / height
width = self.arr.shape[1]
height = self.arr.shape[0]
new_x = int(width * x_frac)
new_y = int(height * y_frac)
return(new_x, new_y)
def label_mouseMoveEvent(self, evt):
x = evt.x()
y = evt.y()
x, y = self.scale_mouse_pos(x, y)
# handle tracking out of array bounds
maxw = self.arr.shape[1]
maxh = self.arr.shape[0]
if x >= maxw or y >= maxh or x < 0 or y < 0:
r = g = b = h = s = v = ''
else:
r = self.arr[y, x, 0]
g = self.arr[y, x, 1]
b = self.arr[y, x, 2]
h, s, v = self.mixer_panel.mixer.rgb_2_hsv_pixel(r, g, b)
self.rgb_hsv_disp.update_vals((x, y, r, g, b, h, s, v))
def save_to_stack(self):
from ... import io
img = self.arr.copy()
io.push(img)
msg = dedent('''
The image has been pushed to the io stack.
Use io.pop() to retrieve the most recently
#.........这里部分代码省略.........
示例6: setup_page
# 需要导入模块: from qtpy.QtWidgets import QGridLayout [as 别名]
# 或者: from qtpy.QtWidgets.QGridLayout import setColumnStretch [as 别名]
#.........这里部分代码省略.........
_("Please don't modify these values unless "
"you know what you're doing!"))
advanced_label.setWordWrap(True)
advanced_label.setAlignment(Qt.AlignJustify)
# Advanced options
advanced_command_launch = self.create_lineedit(
_("Command to launch the Python language server: "),
'advanced/command_launch', alignment=Qt.Horizontal,
word_wrap=False)
advanced_host = self.create_lineedit(
_("IP Address and port to bind the server to: "),
'advanced/host', alignment=Qt.Horizontal,
word_wrap=False)
advanced_port = self.create_spinbox(
":", "", 'advanced/port', min_=1, max_=65535, step=1)
# Advanced layout
advanced_g_layout = QGridLayout()
advanced_g_layout.addWidget(advanced_command_launch.label, 1, 0)
advanced_g_layout.addWidget(advanced_command_launch.textbox, 1, 1)
advanced_g_layout.addWidget(advanced_host.label, 2, 0)
advanced_host_port_g_layout = QGridLayout()
advanced_host_port_g_layout.addWidget(advanced_host.textbox, 1, 0)
advanced_host_port_g_layout.addWidget(advanced_port.plabel, 1, 1)
advanced_host_port_g_layout.addWidget(advanced_port.spinbox, 1, 2)
advanced_g_layout.addLayout(advanced_host_port_g_layout, 2, 1)
advanced_widget = QWidget()
advanced_layout = QVBoxLayout()
advanced_layout.addWidget(advanced_label)
advanced_layout.addLayout(advanced_g_layout)
advanced_widget.setLayout(advanced_layout)
# --- Other servers tab ---
# Section label
servers_label = QLabel(
_("Spyder uses the <a href=\"{lsp_url}\">Language Server "
"Protocol</a> to provide code completion and linting "
"for its Editor. Here, you can setup and configure LSP servers "
"for languages other than Python, so Spyder can provide such "
"features for those languages as well."
).format(lsp_url=LSP_URL))
servers_label.setOpenExternalLinks(True)
servers_label.setWordWrap(True)
servers_label.setAlignment(Qt.AlignJustify)
# Servers table
table_group = QGroupBox(_('Available servers:'))
self.table = LSPServerTable(self, text_color=ima.MAIN_FG_COLOR)
table_layout = QVBoxLayout()
table_layout.addWidget(self.table)
table_group.setLayout(table_layout)
# Buttons
self.reset_btn = QPushButton(_("Reset to default values"))
self.new_btn = QPushButton(_("Set up a new server"))
self.delete_btn = QPushButton(_("Delete currently selected server"))
self.delete_btn.setEnabled(False)
# Slots connected to buttons
self.new_btn.clicked.connect(self.create_new_server)
self.reset_btn.clicked.connect(self.reset_to_default)
self.delete_btn.clicked.connect(self.delete_server)
# Buttons layout
btns = [self.new_btn, self.delete_btn, self.reset_btn]
buttons_layout = QGridLayout()
for i, btn in enumerate(btns):
buttons_layout.addWidget(btn, i, 1)
buttons_layout.setColumnStretch(0, 1)
buttons_layout.setColumnStretch(1, 2)
buttons_layout.setColumnStretch(2, 1)
# Combined layout
servers_widget = QWidget()
servers_layout = QVBoxLayout()
servers_layout.addSpacing(-10)
servers_layout.addWidget(servers_label)
servers_layout.addWidget(table_group)
servers_layout.addSpacing(10)
servers_layout.addLayout(buttons_layout)
servers_widget.setLayout(servers_layout)
# --- Tabs organization ---
tabs = QTabWidget()
tabs.addTab(self.create_tab(basic_features_group, advanced_group),
_('Introspection'))
tabs.addTab(self.create_tab(linting_widget), _('Linting'))
tabs.addTab(self.create_tab(code_style_widget), _('Code style'))
tabs.addTab(self.create_tab(docstring_style_widget),
_('Docstring style'))
tabs.addTab(self.create_tab(advanced_widget),
_('Advanced'))
tabs.addTab(self.create_tab(servers_widget), _('Other languages'))
vlayout = QVBoxLayout()
vlayout.addWidget(tabs)
self.setLayout(vlayout)
示例7: setup_page
# 需要导入模块: from qtpy.QtWidgets import QGridLayout [as 别名]
# 或者: from qtpy.QtWidgets.QGridLayout import setColumnStretch [as 别名]
def setup_page(self):
self.ICON = ima.icon('eyedropper')
names = self.get_option("names")
try:
names.pop(names.index(u'Custom'))
except ValueError:
pass
custom_names = self.get_option("custom_names", [])
# Interface options
theme_group = QGroupBox(_("Main interface"))
# Interface Widgets
ui_themes = ['Automatic', 'Light', 'Dark']
ui_theme_choices = list(zip(ui_themes, [ui_theme.lower()
for ui_theme in ui_themes]))
ui_theme_combo = self.create_combobox(_('Interface theme'),
ui_theme_choices,
'ui_theme',
restart=True)
styles = [str(txt) for txt in list(QStyleFactory.keys())]
# Don't offer users the possibility to change to a different
# style in Gtk-based desktops
# Fixes Issue 2036
if is_gtk_desktop() and ('GTK+' in styles):
styles = ['GTK+']
choices = list(zip(styles, [style.lower() for style in styles]))
style_combo = self.create_combobox(_('Qt windows style'), choices,
'windows_style',
default=self.main.default_style)
self.style_combobox = style_combo.combobox
themes = ['Spyder 2', 'Spyder 3']
icon_choices = list(zip(themes, [theme.lower() for theme in themes]))
icons_combo = self.create_combobox(_('Icon theme'), icon_choices,
'icon_theme', restart=True)
theme_comboboxes_layout = QGridLayout()
theme_comboboxes_layout.addWidget(ui_theme_combo.label, 0, 0)
theme_comboboxes_layout.addWidget(ui_theme_combo.combobox, 0, 1)
theme_comboboxes_layout.addWidget(style_combo.label, 1, 0)
theme_comboboxes_layout.addWidget(self.style_combobox, 1, 1)
theme_comboboxes_layout.addWidget(icons_combo.label, 2, 0)
theme_comboboxes_layout.addWidget(icons_combo.combobox, 2, 1)
theme_layout = QVBoxLayout()
theme_layout.addLayout(theme_comboboxes_layout)
theme_group.setLayout(theme_layout)
# Syntax coloring options
syntax_group = QGroupBox(_("Syntax highlighting theme"))
# Syntax Widgets
edit_button = QPushButton(_("Edit selected scheme"))
create_button = QPushButton(_("Create new scheme"))
self.delete_button = QPushButton(_("Delete scheme"))
self.reset_button = QPushButton(_("Reset to defaults"))
self.preview_editor = CodeEditor(self)
self.stacked_widget = QStackedWidget(self)
self.scheme_editor_dialog = SchemeEditor(parent=self,
stack=self.stacked_widget)
self.scheme_choices_dict = {}
schemes_combobox_widget = self.create_combobox('', [('', '')],
'selected')
self.schemes_combobox = schemes_combobox_widget.combobox
# Syntax layout
syntax_layout = QGridLayout(syntax_group)
btns = [self.schemes_combobox, edit_button, self.reset_button,
create_button, self.delete_button]
for i, btn in enumerate(btns):
syntax_layout.addWidget(btn, i, 1)
syntax_layout.setColumnStretch(0, 1)
syntax_layout.setColumnStretch(1, 2)
syntax_layout.setColumnStretch(2, 1)
syntax_layout.setContentsMargins(0, 12, 0, 12)
# Fonts options
fonts_group = QGroupBox(_("Fonts"))
# Fonts widgets
plain_text_font = self.create_fontgroup(
option='font',
title=_("Plain text"),
fontfilters=QFontComboBox.MonospacedFonts,
without_group=True)
rich_text_font = self.create_fontgroup(
option='rich_font',
title=_("Rich text"),
without_group=True)
# Fonts layouts
fonts_layout = QGridLayout()
fonts_layout.addWidget(plain_text_font.fontlabel, 0, 0)
fonts_layout.addWidget(plain_text_font.fontbox, 0, 1)
#.........这里部分代码省略.........