本文整理汇总了Python中spyderlib.widgets.sourcecode.codeeditor.CodeEditor.horizontalScrollBar方法的典型用法代码示例。如果您正苦于以下问题:Python CodeEditor.horizontalScrollBar方法的具体用法?Python CodeEditor.horizontalScrollBar怎么用?Python CodeEditor.horizontalScrollBar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyderlib.widgets.sourcecode.codeeditor.CodeEditor
的用法示例。
在下文中一共展示了CodeEditor.horizontalScrollBar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_file
# 需要导入模块: from spyderlib.widgets.sourcecode.codeeditor import CodeEditor [as 别名]
# 或者: from spyderlib.widgets.sourcecode.codeeditor.CodeEditor import horizontalScrollBar [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_()
示例2: FilterDialog
# 需要导入模块: from spyderlib.widgets.sourcecode.codeeditor import CodeEditor [as 别名]
# 或者: from spyderlib.widgets.sourcecode.codeeditor.CodeEditor import horizontalScrollBar [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)
#.........这里部分代码省略.........