def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.tape = []
self.tape_pos = -1
self.style_sheet = None
self.search_bar = QLineEdit(self)
self.search_bar.textChanged.connect(self.onSearchTextChanged)
self.style_text_edit = QTextEdit(self)
self.style_text_edit.textChanged.connect(self.onStyleTextChanged)
# To prevent messing with contents when pasted from an IDE, for
# instance.
self.style_text_edit.setAcceptRichText(False)
self.apply_button = QPushButton('Apply', self)
self.apply_button.clicked.connect(self.onApplyButton)
layout = QVBoxLayout(self)
layout.addWidget(self.search_bar)
layout.addWidget(self.style_text_edit)
layout.addWidget(self.apply_button)
self.setLayout(layout)
next_hit_shortcut = QShortcut(QKeySequence(Qt.Key_F3), self)
next_hit_shortcut.activated.connect(self.onNextSearchHit)
search_shortcut = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_F), self)
search_shortcut.activated.connect(self.onFocusSearchBar)
apply_shortcut = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_S), self)
apply_shortcut.activated.connect(self.applyStyleSheet)
undo_shortcut = QShortcut(
QKeySequence(Qt.CTRL + Qt.ALT + Qt.Key_Z), self)
undo_shortcut.activated.connect(self.onUndo)
redo_shortcut = QShortcut(
QKeySequence(Qt.CTRL + Qt.ALT + Qt.Key_Y), self)
redo_shortcut.activated.connect(self.onRedo)
help_shortcut = QShortcut(
QKeySequence(Qt.Key_F1), self)
help_shortcut.activated.connect(self.onHelp)
self.loadStyleSheet()
评论列表
文章目录