本文整理汇总了Python中qtpy.QtWidgets.QVBoxLayout.setContentsMargins方法的典型用法代码示例。如果您正苦于以下问题:Python QVBoxLayout.setContentsMargins方法的具体用法?Python QVBoxLayout.setContentsMargins怎么用?Python QVBoxLayout.setContentsMargins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtWidgets.QVBoxLayout
的用法示例。
在下文中一共展示了QVBoxLayout.setContentsMargins方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, parent, name_filters=[],
show_all=True, show_hscrollbar=True, options_button=None):
QWidget.__init__(self, parent)
self.name_filters = name_filters
self.show_all = show_all
self.show_hscrollbar = show_hscrollbar
self.treewidget = ExplorerTreeWidget(self, self.show_hscrollbar)
self.treewidget.setup(name_filters=self.name_filters,
show_all=self.show_all)
self.treewidget.setup_view()
self.treewidget.hide()
self.emptywidget = ExplorerTreeWidget(self)
if options_button:
btn_layout = QHBoxLayout()
btn_layout.setAlignment(Qt.AlignLeft)
btn_layout.addStretch()
btn_layout.addWidget(options_button, Qt.AlignRight)
layout = create_plugin_layout(btn_layout)
else:
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.emptywidget)
layout.addWidget(self.treewidget)
self.setLayout(layout)
示例2: __init__
# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, font=None, default_content=None, parent=None):
"""
:param font: An optional font to override the default editor font
:param default_content: str, if provided this will populate any new editor that is created
:param parent: An optional parent widget
"""
super(MultiPythonFileInterpreter, self).__init__(parent)
# attributes
self.default_content = default_content
self.default_font = font
self.prev_session_tabs = None
self.whitespace_visible = False
self.setAttribute(Qt.WA_DeleteOnClose, True)
# widget setup
layout = QVBoxLayout(self)
self._tabs = CodeEditorTabWidget(self)
layout.addWidget(self._tabs)
self.setLayout(layout)
layout.setContentsMargins(0, 0, 0, 0)
# add a single editor by default
self.append_new_editor()
# setting defaults
self.confirm_on_save = True
示例3: __init__
# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, parent=None, show_fullpath=True, fullpath_sorting=True,
show_all_files=True, show_comments=True):
QWidget.__init__(self, parent)
self.treewidget = OutlineExplorerTreeWidget(self,
show_fullpath=show_fullpath,
fullpath_sorting=fullpath_sorting,
show_all_files=show_all_files,
show_comments=show_comments)
self.visibility_action = create_action(self,
_("Show/hide outline explorer"),
icon='outline_explorer_vis.png',
toggled=self.toggle_visibility)
self.visibility_action.setChecked(True)
btn_layout = QHBoxLayout()
btn_layout.setAlignment(Qt.AlignLeft)
for btn in self.setup_buttons():
btn_layout.addWidget(btn)
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addLayout(btn_layout)
layout.addWidget(self.treewidget)
self.setLayout(layout)
示例4: __init__
# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, plugin, id_,
history_filename, config_options,
additional_options, interpreter_versions,
connection_file=None, hostname=None,
menu_actions=None, slave=False,
external_kernel=False, given_name=None):
super(ClientWidget, self).__init__(plugin)
SaveHistoryMixin.__init__(self, history_filename)
# --- Init attrs
self.id_ = id_
self.connection_file = connection_file
self.hostname = hostname
self.menu_actions = menu_actions
self.slave = slave
self.given_name = given_name
# --- Other attrs
self.options_button = None
self.stop_button = None
self.stop_icon = ima.icon('stop')
self.history = []
self.allow_rename = True
self.stderr_dir = None
# --- Widgets
self.shellwidget = ShellWidget(config=config_options,
ipyclient=self,
additional_options=additional_options,
interpreter_versions=interpreter_versions,
external_kernel=external_kernel,
local_kernel=True)
self.infowidget = WebView(self)
self.set_infowidget_font()
self.loading_page = self._create_loading_page()
self._show_loading_page()
# --- Layout
vlayout = QVBoxLayout()
toolbar_buttons = self.get_toolbar_buttons()
hlayout = QHBoxLayout()
for button in toolbar_buttons:
hlayout.addWidget(button)
vlayout.addLayout(hlayout)
vlayout.setContentsMargins(0, 0, 0, 0)
vlayout.addWidget(self.shellwidget)
vlayout.addWidget(self.infowidget)
self.setLayout(vlayout)
# --- Exit function
self.exit_callback = lambda: plugin.close_client(client=self)
# --- Signals
# As soon as some content is printed in the console, stop
# our loading animation
document = self.get_control().document()
document.contentsChange.connect(self._hide_loading_page)
# --- Dialog manager
self.dialog_manager = DialogManager()
示例5: setup_layout
# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def setup_layout(self):
"""Setup project explorer widget layout"""
self.emptywidget = ExplorerTreeWidget(self)
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.emptywidget)
self.setLayout(layout)
示例6: __init__
# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, parent,
search_text = r"# ?TODO|# ?FIXME|# ?XXX",
search_text_regexp=True, search_path=None,
include=[".", ".py"], include_idx=None, include_regexp=True,
exclude=r"\.pyc$|\.orig$|\.hg|\.svn", exclude_idx=None,
exclude_regexp=True,
supported_encodings=("utf-8", "iso-8859-1", "cp1252"),
in_python_path=False, more_options=False):
QWidget.__init__(self, parent)
self.setWindowTitle(_('Find in files'))
self.search_thread = None
self.get_pythonpath_callback = None
self.find_options = FindOptions(self, search_text, search_text_regexp,
search_path,
include, include_idx, include_regexp,
exclude, exclude_idx, exclude_regexp,
supported_encodings, in_python_path,
more_options)
self.find_options.find.connect(self.find)
self.find_options.stop.connect(self.stop_and_reset_thread)
self.result_browser = ResultsBrowser(self)
collapse_btn = create_toolbutton(self)
collapse_btn.setDefaultAction(self.result_browser.collapse_all_action)
expand_btn = create_toolbutton(self)
expand_btn.setDefaultAction(self.result_browser.expand_all_action)
restore_btn = create_toolbutton(self)
restore_btn.setDefaultAction(self.result_browser.restore_action)
# collapse_sel_btn = create_toolbutton(self)
# collapse_sel_btn.setDefaultAction(
# self.result_browser.collapse_selection_action)
# expand_sel_btn = create_toolbutton(self)
# expand_sel_btn.setDefaultAction(
# self.result_browser.expand_selection_action)
btn_layout = QVBoxLayout()
btn_layout.setAlignment(Qt.AlignTop)
for widget in [collapse_btn, expand_btn, restore_btn]:
# collapse_sel_btn, expand_sel_btn]:
btn_layout.addWidget(widget)
hlayout = QHBoxLayout()
hlayout.addWidget(self.result_browser)
hlayout.addLayout(btn_layout)
layout = QVBoxLayout()
left, _x, right, bottom = layout.getContentsMargins()
layout.setContentsMargins(left, 0, right, bottom)
layout.addWidget(self.find_options)
layout.addLayout(hlayout)
self.setLayout(layout)
示例7: __init__
# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, presenter, name, parent=None):
super(InstrumentView, self).__init__(parent)
self._presenter = presenter
self.setWindowTitle(name)
self.setWindowFlags(Qt.Window)
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(InstrumentWidget(name))
self.setLayout(layout)
示例8: __init__
# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, plugin, name, history_filename, config_options,
additional_options, interpreter_versions,
connection_file=None, hostname=None,
menu_actions=None, slave=False):
super(ClientWidget, self).__init__(plugin)
SaveHistoryMixin.__init__(self)
# --- Init attrs
self.name = name
self.history_filename = get_conf_path(history_filename)
self.connection_file = connection_file
self.hostname = hostname
self.menu_actions = menu_actions
self.slave = slave
# --- Other attrs
self.options_button = None
self.stop_button = None
self.stop_icon = ima.icon('stop')
self.history = []
# --- Widgets
self.shellwidget = ShellWidget(config=config_options,
additional_options=additional_options,
interpreter_versions=interpreter_versions,
local_kernel=True)
self.shellwidget.hide()
self.infowidget = WebView(self)
self.set_infowidget_font()
self.loading_page = self._create_loading_page()
self.infowidget.setHtml(self.loading_page,
QUrl.fromLocalFile(CSS_PATH))
# --- Layout
vlayout = QVBoxLayout()
toolbar_buttons = self.get_toolbar_buttons()
hlayout = QHBoxLayout()
for button in toolbar_buttons:
hlayout.addWidget(button)
vlayout.addLayout(hlayout)
vlayout.setContentsMargins(0, 0, 0, 0)
vlayout.addWidget(self.shellwidget)
vlayout.addWidget(self.infowidget)
self.setLayout(vlayout)
# --- Exit function
self.exit_callback = lambda: plugin.close_client(client=self)
# --- Signals
# As soon as some content is printed in the console, stop
# our loading animation
document = self.get_control().document()
document.contentsChange.connect(self._stop_loading_animation)
示例9: setup_gui
# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
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)
示例10: __init__
# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, parent):
QWidget.__init__(self, parent)
self.webview = FrameWebView(self)
self.find_widget = FindReplace(self)
self.find_widget.set_editor(self.webview.web_widget)
self.find_widget.hide()
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.webview)
layout.addWidget(self.find_widget)
self.setLayout(layout)
示例11: __init__
# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, default_content=None, parent=None):
super(MultiPythonFileInterpreter, self).__init__(parent)
# attributes
self.default_content = default_content
# widget setup
self._tabs = self.create_tabwidget()
layout = QVBoxLayout()
layout.addWidget(self._tabs)
self.setLayout(layout)
layout.setContentsMargins(0, 0, 0, 0)
# add a single editor by default
self.append_new_editor()
示例12: __init__
# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, parent):
super(MultiFileEditor, self).__init__(parent)
# layout
self.editors = MultiPythonFileInterpreter(font=text_font(),
default_content=DEFAULT_CONTENT,
parent=self)
layout = QVBoxLayout()
layout.addWidget(self.editors)
layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(layout)
self.setAcceptDrops(True)
# attributes
self.tabs_open_on_closing = None
示例13: __init__
# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, parent,
search_text=r"# ?TODO|# ?FIXME|# ?XXX",
search_text_regexp=True, search_path=None,
exclude=r"\.pyc$|\.orig$|\.hg|\.svn", exclude_idx=None,
exclude_regexp=True,
supported_encodings=("utf-8", "iso-8859-1", "cp1252"),
in_python_path=False, more_options=False,
case_sensitive=True, external_path_history=[],
options_button=None):
QWidget.__init__(self, parent)
self.setWindowTitle(_('Find in files'))
self.search_thread = None
self.search_path = ''
self.get_pythonpath_callback = None
self.status_bar = FileProgressBar(self)
self.status_bar.hide()
self.find_options = FindOptions(self, search_text,
search_text_regexp,
search_path,
exclude, exclude_idx,
exclude_regexp,
supported_encodings,
in_python_path,
more_options,
case_sensitive,
external_path_history,
options_button=options_button)
self.find_options.find.connect(self.find)
self.find_options.stop.connect(self.stop_and_reset_thread)
self.result_browser = ResultsBrowser(self)
hlayout = QHBoxLayout()
hlayout.addWidget(self.result_browser)
layout = QVBoxLayout()
left, _x, right, bottom = layout.getContentsMargins()
layout.setContentsMargins(left, 0, right, bottom)
layout.addWidget(self.find_options)
layout.addLayout(hlayout)
layout.addWidget(self.status_bar)
self.setLayout(layout)
示例14: __init__
# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, plugin, name, history_filename, connection_file=None,
hostname=None, sshkey=None, password=None,
kernel_widget_id=None, menu_actions=None):
super(IPythonClient, self).__init__(plugin)
SaveHistoryMixin.__init__(self)
self.options_button = None
# stop button and icon
self.stop_button = None
self.stop_icon = ima.icon('stop')
self.connection_file = connection_file
self.kernel_widget_id = kernel_widget_id
self.hostname = hostname
self.sshkey = sshkey
self.password = password
self.name = name
self.get_option = plugin.get_option
self.shellwidget = IPythonShellWidget(config=self.shellwidget_config(),
local_kernel=False)
self.shellwidget.hide()
self.infowidget = WebView(self)
self.menu_actions = menu_actions
self.history_filename = get_conf_path(history_filename)
self.history = []
self.namespacebrowser = None
self.set_infowidget_font()
self.loading_page = self._create_loading_page()
self.infowidget.setHtml(self.loading_page,
QUrl.fromLocalFile(CSS_PATH))
vlayout = QVBoxLayout()
toolbar_buttons = self.get_toolbar_buttons()
hlayout = QHBoxLayout()
for button in toolbar_buttons:
hlayout.addWidget(button)
vlayout.addLayout(hlayout)
vlayout.setContentsMargins(0, 0, 0, 0)
vlayout.addWidget(self.shellwidget)
vlayout.addWidget(self.infowidget)
self.setLayout(vlayout)
self.exit_callback = lambda: plugin.close_client(client=self)
示例15: setup_widgets_for_orientation
# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def setup_widgets_for_orientation(self, new_orientation):
"""
Reconstruct the widget given the orientation.
Parameters
----------
new_orientation : int
Qt.Horizontal or Qt.Vertical
"""
if new_orientation not in (Qt.Horizontal, Qt.Vertical):
logger.error("Invalid orientation '{0}'. The existing layout will not change.".format(new_orientation))
return
layout = None
if new_orientation == Qt.Horizontal:
layout = QVBoxLayout()
layout.setContentsMargins(4, 0, 4, 4)
label_layout = QHBoxLayout()
label_layout.addWidget(self.low_lim_label)
label_layout.addStretch(0)
label_layout.addWidget(self.value_label)
label_layout.addStretch(0)
label_layout.addWidget(self.high_lim_label)
layout.addLayout(label_layout)
self._slider.setOrientation(new_orientation)
layout.addWidget(self._slider)
elif new_orientation == Qt.Vertical:
layout = QHBoxLayout()
layout.setContentsMargins(0, 4, 4, 4)
label_layout = QVBoxLayout()
label_layout.addWidget(self.high_lim_label)
label_layout.addStretch(0)
label_layout.addWidget(self.value_label)
label_layout.addStretch(0)
label_layout.addWidget(self.low_lim_label)
layout.addLayout(label_layout)
self._slider.setOrientation(new_orientation)
layout.addWidget(self._slider)
if self.layout() is not None:
# Trick to remove the existing layout by re-parenting it in an empty widget.
QWidget().setLayout(self.layout())
self.setLayout(layout)