本文整理汇总了Python中spyderlib.qt.QtGui.QWidget.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QWidget.__init__方法的具体用法?Python QWidget.__init__怎么用?Python QWidget.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyderlib.qt.QtGui.QWidget
的用法示例。
在下文中一共展示了QWidget.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QWidget [as 别名]
# 或者: from spyderlib.qt.QtGui.QWidget import __init__ [as 别名]
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)
示例2: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QWidget [as 别名]
# 或者: from spyderlib.qt.QtGui.QWidget import __init__ [as 别名]
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
示例3: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QWidget [as 别名]
# 或者: from spyderlib.qt.QtGui.QWidget import __init__ [as 别名]
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)
示例4: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QWidget [as 别名]
# 或者: from spyderlib.qt.QtGui.QWidget import __init__ [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.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)
示例5: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QWidget [as 别名]
# 或者: from spyderlib.qt.QtGui.QWidget import __init__ [as 别名]
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()")),
)
示例6: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QWidget [as 别名]
# 或者: from spyderlib.qt.QtGui.QWidget import __init__ [as 别名]
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(".."))
示例7: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QWidget [as 别名]
# 或者: from spyderlib.qt.QtGui.QWidget import __init__ [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)
示例8: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QWidget [as 别名]
# 或者: from spyderlib.qt.QtGui.QWidget import __init__ [as 别名]
def __init__(self, parent=None):
QWidget.__init__(self, parent=parent)
SpyderPluginMixin.__init__(self, parent)
layout = QVBoxLayout()
self.setLayout(layout)
# Initialize plugin
self.initialize_plugin()
示例9: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QWidget [as 别名]
# 或者: from spyderlib.qt.QtGui.QWidget import __init__ [as 别名]
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)
示例10: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QWidget [as 别名]
# 或者: from spyderlib.qt.QtGui.QWidget import __init__ [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.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)
示例11: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QWidget [as 别名]
# 或者: from spyderlib.qt.QtGui.QWidget import __init__ [as 别名]
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)
示例12: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QWidget [as 别名]
# 或者: from spyderlib.qt.QtGui.QWidget import __init__ [as 别名]
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)
示例13: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QWidget [as 别名]
# 或者: from spyderlib.qt.QtGui.QWidget import __init__ [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)
self.find_widget.hide()
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.webview)
layout.addWidget(self.find_widget)
self.setLayout(layout)
示例14: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QWidget [as 别名]
# 或者: from spyderlib.qt.QtGui.QWidget import __init__ [as 别名]
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.dictwidget.clear_all_breakpoints.connect(lambda: self.clear_all_breakpoints.emit())
self.dictwidget.clear_breakpoint.connect(lambda s1, lino: self.clear_breakpoint.emit(s1, lino))
self.dictwidget.edit_goto.connect(lambda s1, lino, s2: self.edit_goto.emit(s1, lino, s2))
self.dictwidget.set_or_edit_conditional_breakpoint.connect(
lambda: self.set_or_edit_conditional_breakpoint.emit()
)
示例15: __init__
# 需要导入模块: from spyderlib.qt.QtGui import QWidget [as 别名]
# 或者: from spyderlib.qt.QtGui.QWidget import __init__ [as 别名]
def __init__(self, parent):
QWidget.__init__(self, parent)
SpyderPluginMixin.__init__(self, parent)
# Widgets
self.stack = QStackedWidget(self)
self.shellwidgets = {}
# Layout
layout = QVBoxLayout()
layout.addWidget(self.stack)
self.setLayout(layout)
# Initialize plugin
self.initialize_plugin()