本文整理汇总了Python中spyderlib.qt.QtGui.QWidget类的典型用法代码示例。如果您正苦于以下问题:Python QWidget类的具体用法?Python QWidget怎么用?Python QWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QWidget类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: create_spinbox
def create_spinbox(self, prefix, suffix, option, default=NoDefault,
min_=None, max_=None, step=None, tip=None):
if prefix:
plabel = QLabel(prefix)
else:
plabel = None
if suffix:
slabel = QLabel(suffix)
else:
slabel = None
spinbox = QSpinBox()
if min_ is not None:
spinbox.setMinimum(min_)
if max_ is not None:
spinbox.setMaximum(max_)
if step is not None:
spinbox.setSingleStep(step)
if tip is not None:
spinbox.setToolTip(tip)
self.spinboxes[spinbox] = (option, default)
layout = QHBoxLayout()
for subwidget in (plabel, spinbox, slabel):
if subwidget is not None:
layout.addWidget(subwidget)
layout.addStretch(1)
layout.setContentsMargins(0, 0, 0, 0)
widget = QWidget(self)
widget.setLayout(layout)
return widget
开发者ID:jromang,项目名称:spyderlib,代码行数:29,代码来源:configdialog.py
示例2: __init__
def __init__(self, parent):
QWidget.__init__(self, parent)
vert_layout = QVBoxLayout()
# Type frame
type_layout = QHBoxLayout()
type_label = QLabel(_("Import as"))
type_layout.addWidget(type_label)
self.array_btn = array_btn = QRadioButton(_("array"))
array_btn.setEnabled(ndarray is not FakeObject)
array_btn.setChecked(ndarray is not FakeObject)
type_layout.addWidget(array_btn)
list_btn = QRadioButton(_("list"))
list_btn.setChecked(not array_btn.isChecked())
type_layout.addWidget(list_btn)
if pd:
self.df_btn = df_btn = QRadioButton(_("DataFrame"))
df_btn.setChecked(False)
type_layout.addWidget(df_btn)
h_spacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
type_layout.addItem(h_spacer)
type_frame = QFrame()
type_frame.setLayout(type_layout)
self._table_view = PreviewTable(self)
vert_layout.addWidget(type_frame)
vert_layout.addWidget(self._table_view)
self.setLayout(vert_layout)
开发者ID:gyenney,项目名称:Tools,代码行数:33,代码来源:importwizard.py
示例3: __init__
def __init__(self, parent):
QWidget.__init__(self, parent)
self.shellwidget = None
self.is_internal_shell = None
self.ipyclient = None
self.is_ipykernel = None
self.is_visible = True # Do not modify: light mode won't work!
self.setup_in_progress = None
# Remote dict editor settings
self.check_all = None
self.exclude_private = None
self.exclude_uppercase = None
self.exclude_capitalized = None
self.exclude_unsupported = None
self.excluded_names = None
self.truncate = None
self.minmax = None
self.remote_editing = None
self.autorefresh = None
self.editor = None
self.exclude_private_action = None
self.exclude_uppercase_action = None
self.exclude_capitalized_action = None
self.exclude_unsupported_action = None
self.filename = None
开发者ID:ImadBouirmane,项目名称:spyder,代码行数:31,代码来源:namespacebrowser.py
示例4: __init__
def __init__(self, parent=None, name_filters=['*.py', '*.pyw'],
valid_types=('.py', '.pyw'), show_all=False,
show_cd_only=None, show_toolbar=True, show_icontext=True):
QWidget.__init__(self, parent)
self.treewidget = ExplorerTreeWidget(self, show_cd_only=show_cd_only)
self.treewidget.setup(name_filters=name_filters,
valid_types=valid_types, show_all=show_all)
self.treewidget.chdir(os.getcwdu())
toolbar_action = create_action(self, _("Show toolbar"),
toggled=self.toggle_toolbar)
icontext_action = create_action(self, _("Show icons and text"),
toggled=self.toggle_icontext)
self.treewidget.common_actions += [None,
toolbar_action, icontext_action]
# Setup toolbar
self.toolbar = QToolBar(self)
self.toolbar.setIconSize(QSize(16, 16))
self.previous_action = create_action(self, text=_("Previous"),
icon=get_icon('previous.png'),
triggered=self.treewidget.go_to_previous_directory)
self.toolbar.addAction(self.previous_action)
self.previous_action.setEnabled(False)
self.connect(self.treewidget, SIGNAL("set_previous_enabled(bool)"),
self.previous_action.setEnabled)
self.next_action = create_action(self, text=_("Next"),
icon=get_icon('next.png'),
triggered=self.treewidget.go_to_next_directory)
self.toolbar.addAction(self.next_action)
self.next_action.setEnabled(False)
self.connect(self.treewidget, SIGNAL("set_next_enabled(bool)"),
self.next_action.setEnabled)
parent_action = create_action(self, text=_("Parent"),
icon=get_icon('up.png'),
triggered=self.treewidget.go_to_parent_directory)
self.toolbar.addAction(parent_action)
options_action = create_action(self, text=_("Options"),
icon=get_icon('tooloptions.png'))
self.toolbar.addAction(options_action)
widget = self.toolbar.widgetForAction(options_action)
widget.setPopupMode(QToolButton.InstantPopup)
menu = QMenu(self)
add_actions(menu, self.treewidget.common_actions)
options_action.setMenu(menu)
toolbar_action.setChecked(show_toolbar)
self.toggle_toolbar(show_toolbar)
icontext_action.setChecked(show_icontext)
self.toggle_icontext(show_icontext)
vlayout = QVBoxLayout()
vlayout.addWidget(self.toolbar)
vlayout.addWidget(self.treewidget)
self.setLayout(vlayout)
开发者ID:jromang,项目名称:retina-old,代码行数:60,代码来源:explorer.py
示例5: create_scedit
def create_scedit(self, text, option, default=NoDefault, tip=None,
without_layout=False):
label = QLabel(text)
clayout = ColorLayout(QColor(Qt.black), self)
clayout.lineedit.setMaximumWidth(80)
if tip is not None:
clayout.setToolTip(tip)
cb_bold = QCheckBox()
cb_bold.setIcon(ima.icon('bold'))
cb_bold.setToolTip(_("Bold"))
cb_italic = QCheckBox()
cb_italic.setIcon(ima.icon('italic'))
cb_italic.setToolTip(_("Italic"))
self.scedits[(clayout, cb_bold, cb_italic)] = (option, default)
if without_layout:
return label, clayout, cb_bold, cb_italic
layout = QHBoxLayout()
layout.addWidget(label)
layout.addLayout(clayout)
layout.addSpacing(10)
layout.addWidget(cb_bold)
layout.addWidget(cb_italic)
layout.addStretch(1)
layout.setContentsMargins(0, 0, 0, 0)
widget = QWidget(self)
widget.setLayout(layout)
return widget
开发者ID:gyenney,项目名称:Tools,代码行数:27,代码来源:configdialog.py
示例6: __init__
def __init__(self, parent):
QWidget.__init__(self, parent)
self.setWindowTitle("Breakpoints")
self.dictwidget = BreakpointTableView(self, self._load_all_breakpoints())
layout = QVBoxLayout()
layout.addWidget(self.dictwidget)
self.setLayout(layout)
self.connect(
self.dictwidget, SIGNAL("clear_all_breakpoints()"), lambda: self.emit(SIGNAL("clear_all_breakpoints()"))
)
self.connect(
self.dictwidget,
SIGNAL("clear_breakpoint(QString,int)"),
lambda s1, lino: self.emit(SIGNAL("clear_breakpoint(QString,int)"), s1, lino),
)
self.connect(
self.dictwidget,
SIGNAL("edit_goto(QString,int,QString)"),
lambda s1, lino, s2: self.emit(SIGNAL("edit_goto(QString,int,QString)"), s1, lino, s2),
)
self.connect(
self.dictwidget,
SIGNAL("set_or_edit_conditional_breakpoint()"),
lambda: self.emit(SIGNAL("set_or_edit_conditional_breakpoint()")),
)
开发者ID:arvindchari88,项目名称:newGitTest,代码行数:26,代码来源:breakpointsgui.py
示例7: __init__
def __init__(self):
QWidget.__init__(self)
vlayout = QVBoxLayout()
self.setLayout(vlayout)
self.explorer = ExplorerWidget(self, show_cd_only=None)
vlayout.addWidget(self.explorer)
hlayout1 = QHBoxLayout()
vlayout.addLayout(hlayout1)
label = QLabel("<b>Open file:</b>")
label.setAlignment(Qt.AlignRight)
hlayout1.addWidget(label)
self.label1 = QLabel()
hlayout1.addWidget(self.label1)
self.explorer.sig_open_file.connect(self.label1.setText)
hlayout2 = QHBoxLayout()
vlayout.addLayout(hlayout2)
label = QLabel("<b>Open dir:</b>")
label.setAlignment(Qt.AlignRight)
hlayout2.addWidget(label)
self.label2 = QLabel()
hlayout2.addWidget(self.label2)
self.explorer.open_dir.connect(self.label2.setText)
hlayout3 = QHBoxLayout()
vlayout.addLayout(hlayout3)
label = QLabel("<b>Option changed:</b>")
label.setAlignment(Qt.AlignRight)
hlayout3.addWidget(label)
self.label3 = QLabel()
hlayout3.addWidget(self.label3)
self.explorer.sig_option_changed.connect(lambda x, y: self.label3.setText("option_changed: %r, %r" % (x, y)))
self.explorer.open_dir.connect(lambda: self.explorer.treewidget.refresh(".."))
开发者ID:sonofeft,项目名称:spyder,代码行数:34,代码来源:explorer.py
示例8: __init__
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.AlignRight)
for btn in self.setup_buttons():
btn_layout.addWidget(btn)
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.treewidget)
layout.addLayout(btn_layout)
self.setLayout(layout)
开发者ID:jromang,项目名称:retina-old,代码行数:26,代码来源:editortools.py
示例9: __init__
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)
开发者ID:jromang,项目名称:retina-old,代码行数:59,代码来源:runconfig.py
示例10: __init__
def __init__(self, parent=None):
QWidget.__init__(self, parent=parent)
SpyderPluginMixin.__init__(self, parent)
layout = QVBoxLayout()
self.setLayout(layout)
# Initialize plugin
self.initialize_plugin()
开发者ID:kirichoi,项目名称:spyderplugins,代码行数:8,代码来源:p_import_combine_phrasedml.py
示例11: __init__
def __init__(self, parent=None):
QWidget.__init__(self, parent)
vlayout = QVBoxLayout()
self.setLayout(vlayout)
self.treewidget = FilteredDirView(self)
self.treewidget.setup_view()
self.treewidget.set_root_path(r'D:\Python')
self.treewidget.set_folder_names(['spyder', 'spyder-2.0'])
vlayout.addWidget(self.treewidget)
开发者ID:ImadBouirmane,项目名称:spyder,代码行数:9,代码来源:explorer.py
示例12: create_tab
def create_tab(self, *widgets):
"""Create simple tab widget page: widgets added in a vertical layout"""
widget = QWidget()
layout = QVBoxLayout()
for widg in widgets:
layout.addWidget(widg)
layout.addStretch(1)
widget.setLayout(layout)
return widget
开发者ID:gyenney,项目名称:Tools,代码行数:9,代码来源:configdialog.py
示例13: hide
def hide(self):
"""Overrides Qt Method"""
for widget in self.replace_widgets:
widget.hide()
QWidget.hide(self)
self.visibility_changed.emit(False)
if self.editor is not None:
self.editor.setFocus()
self.clear_matches()
开发者ID:AungWinnHtut,项目名称:spyder,代码行数:9,代码来源:findreplace.py
示例14: __init__
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.connect(self.find_options, SIGNAL('find()'), self.find)
self.connect(self.find_options, SIGNAL('stop()'),
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)
开发者ID:jromang,项目名称:retina-old,代码行数:56,代码来源:findinfiles.py
示例15: __init__
def __init__(self, parent):
QWidget.__init__(self, parent)
self.parent = parent
# Variables to adjust
self.duration_canvas = [666, 666]
self.duration_tips = [333, 333]
self.opacity_canvas = [0.0, 0.7]
self.opacity_tips = [0.0, 1.0]
self.color = Qt.black
self.easing_curve = [QEasingCurve.Linear]
self.current_step = 0
self.step_current = 0
self.steps = 0
self.canvas = None
self.tips = None
self.frames = None
self.spy_window = None
self.widgets = None
self.dockwidgets = None
self.decoration = None
self.run = None
self.is_tour_set = False
# Widgets
self.canvas = FadingCanvas(self.parent, self.opacity_canvas,
self.duration_canvas, self.easing_curve,
self.color)
self.tips = FadingTipBox(self.parent, self.opacity_tips,
self.duration_tips, self.easing_curve)
# Widgets setup
# Needed to fix issue #2204
self.setAttribute(Qt.WA_TransparentForMouseEvents)
# Signals and slots
self.tips.button_next.clicked.connect(self.next_step)
self.tips.button_previous.clicked.connect(self.previous_step)
self.tips.button_close.clicked.connect(self.close_tour)
self.tips.button_run.clicked.connect(self.run_code)
self.tips.button_home.clicked.connect(self.first_step)
self.tips.button_end.clicked.connect(self.last_step)
self.tips.button_run.clicked.connect(
lambda: self.tips.button_run.setDisabled(True))
self.tips.combo_title.currentIndexChanged.connect(self.go_to_step)
# Main window move or resize
self.parent.sig_resized.connect(self._resized)
self.parent.sig_moved.connect(self._moved)
# To capture the arrow keys that allow moving the tour
self.tips.sig_key_pressed.connect(self._key_pressed)
开发者ID:MarvinLiu0810,项目名称:spyder,代码行数:56,代码来源:tour.py
示例16: get_std_icon
def get_std_icon(name, size=None):
"""Get standard platform icon
Call 'show_std_icons()' for details"""
if not name.startswith('SP_'):
name = 'SP_' + name
icon = QWidget().style().standardIcon(getattr(QStyle, name))
if size is None:
return icon
else:
return QIcon(icon.pixmap(size, size))
开发者ID:saishangxue123,项目名称:spyder,代码行数:10,代码来源:icon_manager.py
示例17: keyPressEvent
def keyPressEvent(self, event):
"""Reimplemented to handle key events"""
ctrl = event.modifiers() & Qt.ControlModifier
shift = event.modifiers() & Qt.ShiftModifier
if event.key() in (Qt.Key_Enter, Qt.Key_Return):
self.find.emit()
elif event.key() == Qt.Key_F and ctrl and shift:
# Toggle find widgets
self.parent().toggle_visibility.emit(not self.isVisible())
else:
QWidget.keyPressEvent(self, event)
开发者ID:AminJamalzadeh,项目名称:spyder,代码行数:11,代码来源:findinfiles.py
示例18: __init__
def __init__(self, parent):
self.tabwidget = None
self.menu_actions = None
self.dockviewer = None
self.wrap_action = None
self.editors = []
self.filenames = []
self.icons = []
if PYQT5:
SpyderPluginWidget.__init__(self, parent, main = parent)
else:
SpyderPluginWidget.__init__(self, parent)
# Initialize plugin
self.initialize_plugin()
self.set_default_color_scheme()
layout = QVBoxLayout()
self.tabwidget = Tabs(self, self.menu_actions)
self.tabwidget.currentChanged.connect(self.refresh_plugin)
self.tabwidget.move_data.connect(self.move_tab)
if sys.platform == 'darwin':
tab_container = QWidget()
tab_container.setObjectName('tab-container')
tab_layout = QHBoxLayout(tab_container)
tab_layout.setContentsMargins(0, 0, 0, 0)
tab_layout.addWidget(self.tabwidget)
layout.addWidget(tab_container)
else:
layout.addWidget(self.tabwidget)
self.tabwidget.setStyleSheet("QTabWidget::pane {border: 0;}")
# Menu as corner widget
options_button = create_toolbutton(self, text=_('Options'),
icon=ima.icon('tooloptions'))
options_button.setPopupMode(QToolButton.InstantPopup)
menu = QMenu(self)
add_actions(menu, self.menu_actions)
options_button.setMenu(menu)
self.tabwidget.setCornerWidget(options_button)
# Find/replace widget
self.find_widget = FindReplace(self)
self.find_widget.hide()
self.register_widget_shortcuts("Editor", self.find_widget)
layout.addWidget(self.find_widget)
self.setLayout(layout)
开发者ID:Codemon88,项目名称:spyder,代码行数:53,代码来源:history.py
示例19: __init__
def __init__(self, parent, statusbar):
QWidget.__init__(self, parent)
self.label_font = font = get_font('editor')
font.setPointSize(self.font().pointSize())
font.setBold(True)
layout = QHBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(layout)
statusbar.addPermanentWidget(self)
开发者ID:ImadBouirmane,项目名称:spyder,代码行数:12,代码来源:status.py
示例20: __init__
def __init__(self, parent):
QWidget.__init__(self, parent)
self.webview = FrameWebView(self)
self.find_widget = FindReplace(self)
self.find_widget.set_editor(self.webview)
self.find_widget.hide()
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.webview)
layout.addWidget(self.find_widget)
self.setLayout(layout)
开发者ID:dzosz,项目名称:spyder,代码行数:13,代码来源:help.py
注:本文中的spyderlib.qt.QtGui.QWidget类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论