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


Python CodeEditor.verticalScrollBar方法代码示例

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


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

示例1: add_file

# 需要导入模块: from spyderlib.widgets.sourcecode.codeeditor import CodeEditor [as 别名]
# 或者: from spyderlib.widgets.sourcecode.codeeditor.CodeEditor import verticalScrollBar [as 别名]
    def add_file(self, file_name):
        font = QFont('Some font that does not exist')
        font.setStyleHint(font.TypeWriter, font.PreferDefault)
        editor = CodeEditor()
        editor.setup_editor(linenumbers=True, language='py',
            scrollflagarea=False, codecompletion_enter=True,
            tab_mode=False, edge_line=False, font=font,
            codecompletion_auto=True, go_to_definition=True,
            codecompletion_single=True)
        editor.setCursor(Qt.IBeamCursor)
        editor.horizontalScrollBar().setCursor(Qt.ArrowCursor)
        editor.verticalScrollBar().setCursor(Qt.ArrowCursor)
        editor.file_name = file_name

        if file_name.endswith('py'):
            editor.set_text_from_file(file_name)
            tab_name = os.path.split(file_name)[1]
        else:
            editor.set_text(self.template_code)
            tab_name = 'New Analysis'

        editor.file_was_changed = False
        editor.textChanged.connect(lambda: self.file_changed(editor))

        self.tabs.addTab(editor, tab_name)
        self.tabs.setCurrentWidget(editor)

        self.setVisible(True)
        self.raise_()
开发者ID:neurodebian,项目名称:spykeviewer,代码行数:31,代码来源:plugin_editor_dock.py

示例2: FilterDialog

# 需要导入模块: from spyderlib.widgets.sourcecode.codeeditor import CodeEditor [as 别名]
# 或者: from spyderlib.widgets.sourcecode.codeeditor.CodeEditor import verticalScrollBar [as 别名]
class FilterDialog(QDialog):
    """ A dialog for editing filters
    """
    solo_signatures = ['def filter(block):', 'def filter(segment):',
                       'def filter(rcg):', 'def filter(rc):',
                       'def filter(unit):']

    combi_signatures = ['def filter(blocks):', 'def filter(segments):',
                        'def filter(rcgs):', 'def filter(rcs):',
                        'def filter(units):']

    def __init__(self, groups, type=None, group=None, name=None, code=None, combined=False, on_exception=False, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi()
        self.groups = groups

        if type:
            index = self.filterTypeComboBox.findText(type)
            if index >= 0:
                self.filterTypeComboBox.setCurrentIndex(index)

        self.populate_groups()
        if group:
            index = self.filterGroupComboBox.findText(group)
            if index >= 0:
                self.filterGroupComboBox.setCurrentIndex(index)

        if name:
            self.nameLineEdit.setText(name)
        if code:
            self.editor.set_text('\n'.join(code))
        if name and code and type:
            self.filterTypeComboBox.setEnabled(False)
        self.combinedCheckBox.setChecked(combined)

        self.onExceptionCheckBox.setChecked(on_exception)

    def populate_groups(self):
        self.filterGroupComboBox.clear()
        self.filterGroupComboBox.addItem('')
        for g in sorted(self.groups[self.filterTypeComboBox.currentText()]):
            self.filterGroupComboBox.addItem(g)

    def setupUi(self):
        self.setWindowTitle('Edit filter')
        #self.resize(400, 300)

        self.signatureLabel = QLabel(self)
        self.signatureLabel.setText('def filter(block):')

        font = QFont('Some font that does not exist')
        font.setStyleHint(font.TypeWriter, font.PreferDefault)
        self.editor = CodeEditor(self)
        self.editor.setup_editor(
            linenumbers=False, language='py',
            scrollflagarea=False, codecompletion_enter=True, font=font,
            highlight_current_line=False, occurence_highlighting=False)
        self.editor.setCursor(Qt.IBeamCursor)
        self.editor.horizontalScrollBar().setCursor(Qt.ArrowCursor)
        self.editor.verticalScrollBar().setCursor(Qt.ArrowCursor)
        self.editor.set_text('return True')

        self.onExceptionCheckBox = QCheckBox(self)
        self.onExceptionCheckBox.setText('True on exception')
        self.onExceptionCheckBox.setToolTip('Determines if the filter will '
                                            'admit items if there is an '
                                            'exception during its execution')

        self.combinedCheckBox = QCheckBox(self)
        self.combinedCheckBox.setText('Combined filter')
        self.combinedCheckBox.setToolTip('Determines if the filter operates '
                                         'on single items (return True or '
                                         'False) or lists of items (return a '
                                         'list of items to be admitted)')

        self.filterTypeComboBox = QComboBox(self)
        self.filterTypeComboBox.addItem('Block')
        self.filterTypeComboBox.addItem('Segment')
        self.filterTypeComboBox.addItem('Recording Channel Group')
        self.filterTypeComboBox.addItem('Recording Channel')
        self.filterTypeComboBox.addItem('Unit')

        self.filterGroupComboBox = QComboBox(self)

        self.nameLineEdit = QLineEdit()

        self.dialogButtonBox = QDialogButtonBox(self)
        self.dialogButtonBox.setAutoFillBackground(False)
        self.dialogButtonBox.setOrientation(Qt.Horizontal)
        self.dialogButtonBox.setStandardButtons(
            QDialogButtonBox.Cancel | QDialogButtonBox.Ok)
        self.dialogButtonBox.setCenterButtons(True)

        gridLayout = QGridLayout(self)
        gridLayout.addWidget(self.signatureLabel, 0, 0, 1, 4)
        gridLayout.addWidget(self.editor, 1, 0, 1, 4)
        gridLayout.addWidget(self.onExceptionCheckBox, 2, 2, 1, 1)
        gridLayout.addWidget(self.combinedCheckBox, 2, 3, 1, 1)
        gridLayout.addWidget(QLabel('Type:', self), 2, 0)
        gridLayout.addWidget(self.filterTypeComboBox, 2, 1)
#.........这里部分代码省略.........
开发者ID:SmokinCaterpillar,项目名称:spykeviewer,代码行数:103,代码来源:filter_dialog.py


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