当前位置: 首页>>代码示例>>Python>>正文


Python QVBoxLayout.addLayout方法代码示例

本文整理汇总了Python中qtpy.QtWidgets.QVBoxLayout.addLayout方法的典型用法代码示例。如果您正苦于以下问题:Python QVBoxLayout.addLayout方法的具体用法?Python QVBoxLayout.addLayout怎么用?Python QVBoxLayout.addLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qtpy.QtWidgets.QVBoxLayout的用法示例。


在下文中一共展示了QVBoxLayout.addLayout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import addLayout [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)
开发者ID:ShenggaoZhu,项目名称:spyder,代码行数:28,代码来源:editortools.py

示例2: create_controls

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import addLayout [as 别名]
    def create_controls(self):
        self.btn_start = QPushButton(tr("Start"))
        self.btn_stop = QPushButton(tr("Stop"))
        self.btn_stop.setEnabled(False)

        self.btn_start.clicked.connect(self.start_recording)
        self.btn_stop.clicked.connect(self.stop_recording)

        self.chk_actions = QCheckBox(tr("Actions"))
        self.chk_code = QCheckBox(tr("Code"))
        for c in [self.chk_actions, self.chk_code]:
            c.setChecked(True)
            c.toggled.connect(self.update_filter)

        hbox = QHBoxLayout()
        for w in [self.btn_start, self.btn_stop]:
            hbox.addWidget(w)
        hbox2 = QHBoxLayout()
        for w in [self.chk_actions, self.chk_code]:
            hbox2.addWidget(w)

        vbox = QVBoxLayout()
        vbox.addLayout(hbox)
        vbox.addLayout(hbox2)

        wrap = QWidget()
        wrap.setLayout(vbox)
        height = vbox.sizeHint().height()
        wrap.setFixedHeight(height)
        self.setWidget(wrap)
开发者ID:hyperspy,项目名称:hyperspyUI,代码行数:32,代码来源:recorderwidget.py

示例3: __init__

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import addLayout [as 别名]
    def __init__(self, parent, model):
        super(AlgorithmMonitorDialog, self).__init__(parent)
        self.tree = QTreeWidget(self)
        self.tree.setColumnCount(3)
        self.tree.setSelectionMode(QTreeWidget.NoSelection)
        self.tree.setColumnWidth(0, 220)
        self.tree.setHeaderLabels(['Algorithm', 'Progress', ''])
        header = self.tree.header()
        header.setSectionResizeMode(1, QHeaderView.Stretch)
        header.setSectionResizeMode(2, QHeaderView.Fixed)
        header.setStretchLastSection(False)

        button_layout = QHBoxLayout()
        self.close_button = QPushButton('Close')
        button_layout.addStretch()
        button_layout.addWidget(self.close_button)

        layout = QVBoxLayout()
        layout.addWidget(self.tree)
        layout.addLayout(button_layout)
        self.setLayout(layout)

        self.setWindowTitle('Mantid - Algorithm progress')
        self.setWindowIcon(QIcon(":/MantidPlot_Icon_32offset.png"))
        self.resize(500, 300)

        self.presenter = AlgorithmProgressDialogPresenter(self, model)
        self.presenter.update_gui()
开发者ID:samueljackson92,项目名称:mantid,代码行数:30,代码来源:dialog_widget.py

示例4: __init__

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import addLayout [as 别名]
    def __init__(self):
        QWidget.__init__(self)
        vlayout = QVBoxLayout()
        self.setLayout(vlayout)

        self.explorer = ProjectExplorerWidget(None, show_all=True)
        self.explorer.setup_project(osp.dirname(osp.abspath(__file__)))
        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)

        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)))
开发者ID:0xBADCA7,项目名称:spyder,代码行数:29,代码来源:explorer.py

示例5: __init__

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import addLayout [as 别名]
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.uid_label = QLabel()
        self.open_individually_button = QPushButton('Open individually')
        self.open_individually_button.hide()
        self.open_individually_button.clicked.connect(self._open_individually)
        self.open_overplotted_button = QPushButton('Open over-plotted')
        self.open_overplotted_button.hide()
        self.open_overplotted_button.clicked.connect(self._open_overplotted)
        self.open_overplotted_on_button = QPushButton('Add to tab...')
        self.open_overplotted_on_button.hide()
        self.open_overplotted_on_button.setEnabled(False)
        self.open_overplotted_on_button.clicked.connect(self._open_overplotted_on)
        self.copy_uid_button = QPushButton('Copy UID to Clipboard')
        self.copy_uid_button.hide()
        self.copy_uid_button.clicked.connect(self._copy_uid)
        self.streams = QLabel()
        self.entries = []

        uid_layout = QHBoxLayout()
        uid_layout.addWidget(self.uid_label)
        uid_layout.addWidget(self.copy_uid_button)
        layout = QVBoxLayout()
        layout.addWidget(self.open_individually_button)
        layout.addWidget(self.open_overplotted_button)
        layout.addWidget(self.open_overplotted_on_button)
        layout.addLayout(uid_layout)
        layout.addWidget(self.streams)
        self.setLayout(layout)

        self._tab_titles = ()
开发者ID:CJ-Wright,项目名称:bluesky-browser,代码行数:33,代码来源:summary.py

示例6: __init__

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import addLayout [as 别名]
 def __init__(self, parent=None, logname=None, level=logging.NOTSET):
     QWidget.__init__(self, parent=parent)
     # Create Widgets
     self.label = QLabel('Minimum displayed log level: ', parent=self)
     self.combo = QComboBox(parent=self)
     self.text = QPlainTextEdit(parent=self)
     self.text.setReadOnly(True)
     self.clear_btn = QPushButton("Clear", parent=self)
     # Create layout
     layout = QVBoxLayout()
     level_control = QHBoxLayout()
     level_control.addWidget(self.label)
     level_control.addWidget(self.combo)
     layout.addLayout(level_control)
     layout.addWidget(self.text)
     layout.addWidget(self.clear_btn)
     self.setLayout(layout)
     # Allow QCombobox to control log level
     for log_level, value in LogLevels.as_dict().items():
         self.combo.addItem(log_level, value)
     self.combo.currentIndexChanged[str].connect(self.setLevel)
     # Allow QPushButton to clear log text
     self.clear_btn.clicked.connect(self.clear)
     # Create a handler with the default format
     self.handler = GuiHandler(level=level, parent=self)
     self.logFormat = self.default_format
     self.handler.message.connect(self.write)
     # Create logger. Either as a root or given logname
     self.log = None
     self.level = None
     self.logName = logname or ''
     self.logLevel = level
     self.destroyed.connect(functools.partial(logger_destroyed, self.log))
开发者ID:slaclab,项目名称:pydm,代码行数:35,代码来源:logdisplay.py

示例7: create_controls

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import addLayout [as 别名]
    def create_controls(self):
        self.setWindowTitle(tr(self.plugin.name))

        vbox = QVBoxLayout()
        form = QFormLayout()
        for Name, (enabled, url) in self.packages.items():
            name = Name.lower()
            cbo = QComboBox()
            if enabled:
                branches = get_branches(name, url)
                for n, b in branches.items():
                    cbo.addItem(n, b)
                if not check_git_repo(name):
                    cbo.insertItem(0, "<Select to change>", None)
                cbo.setCurrentIndex(0)
                self._prev_indices[cbo] = 0
                cbo.currentIndexChanged.connect(
                    partial(self._cbo_changed, cbo))
            else:
                cbo.setEditText("<git repository>")
                cbo.setToolTip(tr(
                    "This is installed in a git repository but we're set to "
                    "not use git."))
            cbo.setEnabled(enabled)
            form.addRow(Name + ':', cbo)

        vbox.addLayout(form)
        vbox.addWidget(QLabel(tr(
            "You should restart the application if you make any changes!")))

        btns = QDialogButtonBox(QDialogButtonBox.Ok, Qt.Horizontal, self)
        btns.accepted.connect(self.accept)
        vbox.addWidget(btns)
        self.setLayout(vbox)
开发者ID:hyperspy,项目名称:hyperspyUI,代码行数:36,代码来源:gitgetter.py

示例8: __init__

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import addLayout [as 别名]
    def __init__(self, *args, **kwargs):
        super(ClosePackageManagerDialog, self).__init__(*args, **kwargs)
        self.label_icon = QLabel()
        self.label_about = QLabel('Conda is still busy.\n\n'
                                  'Do you want to cancel the process?')
        self.button_ok = QPushButton('Yes')
        self.button_cancel = QPushButton('No')
        self.buttonbox = QDialogButtonBox(Qt.Horizontal)

        # Widget setup
        self.buttonbox.addButton(self.button_ok, QDialogButtonBox.ActionRole)
        self.buttonbox.addButton(self.button_cancel,
                                 QDialogButtonBox.ActionRole)
#        self.label_icon.setPixmap(QPixmap(images.ANACONDA_ICON_64_PATH))
        self.setWindowTitle("Cancel Process")

        # Layouts
        h_layout = QHBoxLayout()
        h_layout.addWidget(self.label_icon, 0, Qt.AlignTop)
        h_layout.addSpacing(10)
        h_layout.addWidget(self.label_about)

        main_layout = QVBoxLayout()
        main_layout.addLayout(h_layout)
        main_layout.addSpacing(20)
        main_layout.addWidget(self.buttonbox)
        self.setLayout(main_layout)

        # Signals
        self.button_ok.clicked.connect(self.accept)
        self.button_cancel.clicked.connect(self.reject)
开发者ID:Discalced51,项目名称:conda-manager,代码行数:33,代码来源:close.py

示例9: __init__

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import addLayout [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()
开发者ID:rlaverde,项目名称:spyder,代码行数:62,代码来源:client.py

示例10: __init__

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import addLayout [as 别名]
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.search_bar = QLineEdit()
        search_bar_layout = QHBoxLayout()
        search_bar_layout.addWidget(QLabel('Custom Query:'))
        search_bar_layout.addWidget(self.search_bar)
        mongo_query_help_button = QPushButton()
        mongo_query_help_button.setText('?')
        search_bar_layout.addWidget(mongo_query_help_button)
        mongo_query_help_button.clicked.connect(self.show_mongo_query_help)

        self.since_widget = QDateTimeEdit()
        self.since_widget.setCalendarPopup(True)
        self.since_widget.setDisplayFormat('yyyy-MM-dd HH:mm')
        since_layout = QHBoxLayout()
        since_layout.addWidget(QLabel('Since:'))
        since_layout.addWidget(self.since_widget)

        self.until_widget = QDateTimeEdit()
        self.until_widget.setCalendarPopup(True)
        self.until_widget.setDisplayFormat('yyyy-MM-dd HH:mm')
        until_layout = QHBoxLayout()
        until_layout.addWidget(QLabel('Until:'))
        until_layout.addWidget(self.until_widget)

        layout = QVBoxLayout()
        layout.addLayout(since_layout)
        layout.addLayout(until_layout)
        layout.addLayout(search_bar_layout)
        self.setLayout(layout)
开发者ID:CJ-Wright,项目名称:bluesky-browser,代码行数:32,代码来源:search.py

示例11: __init__

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import addLayout [as 别名]
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.setWindowTitle("Spyder %s: %s" % (__version__,
                                               _("Dependencies")))
        self.setWindowIcon(ima.icon('tooloptions'))
        self.setModal(True)

        self.treewidget = DependenciesTreeWidget(self)

        self.label = QLabel(_("Optional modules are not required to run "
                              "Spyder but enhance its functions."))
        self.label2 = QLabel(_("<b>Note:</b> New dependencies or changed ones "
                               "will be correctly detected only after Spyder "
                               "is restarted."))

        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.treewidget)
        vlayout.addWidget(self.label)
        vlayout.addWidget(self.label2)
        vlayout.addLayout(hlayout)

        self.setLayout(vlayout)
        self.resize(840, 560)
开发者ID:0xBADCA7,项目名称:spyder,代码行数:34,代码来源:dependencies.py

示例12: __init__

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import addLayout [as 别名]
    def __init__(self, parent, plugin, tabs, data, icon):
        QDialog.__init__(self, parent)

        # Variables
        self.plugins_tabs = []
        self.plugins_data = []
        self.plugins_instances = []
        self.add_plugin(plugin, tabs, data, icon)
        self.plugin = None                # Last plugin with focus
        self.mode = self.FILE_MODE        # By default start in this mode
        self.initial_cursors = None       # {fullpath: QCursor}
        self.initial_path = None          # Fullpath of initial active editor
        self.initial_widget = None        # Initial active editor
        self.line_number = None           # Selected line number in filer
        self.is_visible = False           # Is the switcher visible?

        help_text = _("Press <b>Enter</b> to switch files or <b>Esc</b> to "
                      "cancel.<br><br>Type to filter filenames.<br><br>"
                      "Use <b>:number</b> to go to a line, e.g. "
                      "<b><code>main:42</code></b><br>"
                      "Use <b>@symbol_text</b> to go to a symbol, e.g. "
                      "<b><code>@init</code></b>"
                      "<br><br> Press <b>Ctrl+W</b> to close current tab.<br>")

        # Either allow searching for a line number or a symbol but not both
        regex = QRegExp("([A-Za-z0-9_]{0,100}@[A-Za-z0-9_]{0,100})|" +
                        "([A-Za-z0-9_]{0,100}:{0,1}[0-9]{0,100})")

        # Widgets
        self.edit = FilesFilterLine(self)
        self.help = HelperToolButton()
        self.list = QListWidget(self)
        self.filter = KeyPressFilter()
        regex_validator = QRegExpValidator(regex, self.edit)

        # Widgets setup
        self.setWindowFlags(Qt.Popup | Qt.FramelessWindowHint)
        self.setWindowOpacity(0.95)
        self.edit.installEventFilter(self.filter)
        self.edit.setValidator(regex_validator)
        self.help.setToolTip(help_text)
        self.list.setItemDelegate(HTMLDelegate(self))

        # Layout
        edit_layout = QHBoxLayout()
        edit_layout.addWidget(self.edit)
        edit_layout.addWidget(self.help)
        layout = QVBoxLayout()
        layout.addLayout(edit_layout)
        layout.addWidget(self.list)
        self.setLayout(layout)

        # Signals
        self.rejected.connect(self.restore_initial_state)
        self.filter.sig_up_key_pressed.connect(self.previous_row)
        self.filter.sig_down_key_pressed.connect(self.next_row)
        self.edit.returnPressed.connect(self.accept)
        self.edit.textChanged.connect(self.setup)
        self.list.itemSelectionChanged.connect(self.item_selection_changed)
        self.list.clicked.connect(self.edit.setFocus)
开发者ID:rlaverde,项目名称:spyder,代码行数:62,代码来源:fileswitcher.py

示例13: __init__

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import addLayout [as 别名]
    def __init__(self, parent):
        QWidget.__init__(self, parent)

        self._parent = parent
        self.cp = CondaProcess(self)

        # Widgets
        self.button_get_conda_version = QPushButton('get_conda_version')
        self.button_info = QPushButton('info')
        self.button_get_envs = QPushButton('get envs')
        self.button_install = QPushButton('install')
        self.button_package_info = QPushButton('package info')
        self.button_linked = QPushButton('linked')
        self.button_pip = QPushButton('pip')
        self.button_pip_remove = QPushButton('pip-remove')

        self.widgets = [self.button_get_conda_version, self.button_info,
                        self.button_get_envs, self.button_install,
                        self.button_package_info, self.button_linked,
                        self.button_pip]

        # Layout setup
        layout_top = QHBoxLayout()
        layout_top.addWidget(self.button_get_conda_version)
        layout_top.addWidget(self.button_get_envs)
        layout_top.addWidget(self.button_info)
        layout_top.addWidget(self.button_install)
        layout_top.addWidget(self.button_package_info)

        layout_middle = QHBoxLayout()
        layout_middle.addWidget(self.button_linked)

        layout_bottom = QHBoxLayout()
        layout_bottom.addWidget(self.button_pip)
        layout_bottom.addWidget(self.button_pip_remove)

        layout = QVBoxLayout()
        layout.addLayout(layout_top)
        layout.addLayout(layout_middle)
        layout.addLayout(layout_bottom)

        self.setLayout(layout)

        # Signals
        self.cp.sig_started.connect(self.disable_widgets)
        self.cp.sig_finished.connect(self.on_finished)
        self.cp.sig_finished.connect(self.enable_widgets)

        self.button_get_conda_version.clicked.connect(
            self.cp.get_conda_version)
        self.button_get_envs.clicked.connect(self.cp.get_envs)
        self.button_info.clicked.connect(self.cp.info)
        self.button_install.clicked.connect(self.cp.install)
        self.button_package_info.clicked.connect(
            lambda: self.cp.package_info('spyder'))
        self.button_linked.clicked.connect(
            lambda: self.cp.linked(self.cp.ROOT_PREFIX))
        self.button_pip.clicked.connect(lambda: self.cp.pip(name='root'))
        self.button_pip_remove.clicked.connect(
            lambda: self.cp.pip_remove(name='root', pkgs=['grequests']))
开发者ID:ccordoba12,项目名称:conda-manager,代码行数:62,代码来源:conda_api_q.py

示例14: setup_page

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import addLayout [as 别名]
    def setup_page(self):
        # Widgets
        self.table = ShortcutsTable(self)
        self.finder = ShortcutFinder(self.table, self.table.set_regex)
        self.table.finder = self.finder
        self.label_finder = QLabel(_('Search: '))
        self.reset_btn = QPushButton(_("Reset to default values"))

        # Layout
        hlayout = QHBoxLayout()
        vlayout = QVBoxLayout()
        hlayout.addWidget(self.label_finder)
        hlayout.addWidget(self.finder)
        vlayout.addWidget(self.table)
        vlayout.addLayout(hlayout)
        vlayout.addWidget(self.reset_btn)
        self.setLayout(vlayout)

        self.setTabOrder(self.table, self.finder)
        self.setTabOrder(self.finder, self.reset_btn)

        # Signals and slots
        if PYQT5:
            # Qt5 'dataChanged' has 3 parameters
            self.table.proxy_model.dataChanged.connect(
                lambda i1, i2, roles, opt='': self.has_been_modified(opt))
        else:
            self.table.proxy_model.dataChanged.connect(
                lambda i1, i2, opt='': self.has_been_modified(opt))
        self.reset_btn.clicked.connect(self.reset_to_default)
开发者ID:ChunHungLiu,项目名称:spyder,代码行数:32,代码来源:shortcuts.py

示例15: __init__

# 需要导入模块: from qtpy.QtWidgets import QVBoxLayout [as 别名]
# 或者: from qtpy.QtWidgets.QVBoxLayout import addLayout [as 别名]
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)

        self.main = parent

        # Widgets
        self.pages_widget = QStackedWidget()
        self.pages_widget.setMinimumWidth(600)
        self.contents_widget = QListWidget()
        self.button_reset = QPushButton(_('Reset to defaults'))

        bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Apply |
                                QDialogButtonBox.Cancel)
        self.apply_btn = bbox.button(QDialogButtonBox.Apply)

        # Widgets setup
        # Destroying the C++ object right after closing the dialog box,
        # otherwise it may be garbage-collected in another QThread
        # (e.g. the editor's analysis thread in Spyder), thus leading to
        # a segmentation fault on UNIX or an application crash on Windows
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setWindowTitle(_('Preferences'))
        self.setWindowIcon(ima.icon('configure'))
        self.contents_widget.setMovement(QListView.Static)
        self.contents_widget.setSpacing(1)
        self.contents_widget.setCurrentRow(0)
        self.contents_widget.setMinimumWidth(220)
        self.contents_widget.setMinimumHeight(400)

        # Layout
        hsplitter = QSplitter()
        hsplitter.addWidget(self.contents_widget)
        hsplitter.addWidget(self.pages_widget)
        hsplitter.setStretchFactor(0, 1)
        hsplitter.setStretchFactor(1, 2)

        btnlayout = QHBoxLayout()
        btnlayout.addWidget(self.button_reset)
        btnlayout.addStretch(1)
        btnlayout.addWidget(bbox)

        vlayout = QVBoxLayout()
        vlayout.addWidget(hsplitter)
        vlayout.addLayout(btnlayout)

        self.setLayout(vlayout)

        # Signals and slots
        if self.main:
            self.button_reset.clicked.connect(self.main.reset_spyder)
        self.pages_widget.currentChanged.connect(self.current_page_changed)
        self.contents_widget.currentRowChanged.connect(
                                             self.pages_widget.setCurrentIndex)
        bbox.accepted.connect(self.accept)
        bbox.rejected.connect(self.reject)
        bbox.clicked.connect(self.button_clicked)

        # Ensures that the config is present on spyder first run
        CONF.set('main', 'interface_language', load_lang_conf())
开发者ID:impact27,项目名称:spyder,代码行数:61,代码来源:configdialog.py


注:本文中的qtpy.QtWidgets.QVBoxLayout.addLayout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。