Commit 51079085 authored by Yuya Nishihara's avatar Yuya Nishihara
Browse files

fileview, status: replace escapePressed and refreshPressed by event.ignore()

We can bubble up key press event through Qt's object tree if it's explicitly
ignored.
parent 68af8f398aff
......@@ -99,8 +99,6 @@ class CommitWidget(QWidget):
self.stwidget.showMessage.connect(self.showMessage)
self.stwidget.progress.connect(self.progress)
self.stwidget.linkActivated.connect(self.linkActivated)
self.stwidget.escapePressed.connect(self.escapePressed)
self.stwidget.refreshPressed.connect(self.refreshPressed)
self.stwidget.fileDisplayed.connect(self.fileDisplayed)
self.msghistory = []
self.qref = False
......
......@@ -84,19 +84,16 @@ class Annotator(qsci):
self.markerAdd(i, self.markers[idx % len(self.markers)])
class FileDisplay(qscilib.Scintilla):
escapePressed = pyqtSignal()
refreshPressed = pyqtSignal()
def __init__(self, parent=None):
super(FileDisplay, self).__init__(parent)
self.setWrapMode(qsci.WrapCharacter)
def keyPressEvent(self, event):
if event.key() == Qt.Key_Escape:
self.escapePressed.emit()
event.ignore()
return
if event.matches(QKeySequence.Refresh):
self.refreshPressed.emit()
event.ignore()
return
super(FileDisplay, self).keyPressEvent(event)
......@@ -108,8 +105,6 @@ class HgFileView(QFrame):
fileDisplayed = pyqtSignal(QString, QString)
showMessage = pyqtSignal(unicode)
revForDiffChanged = pyqtSignal(int)
escapePressed = pyqtSignal()
refreshPressed = pyqtSignal()
filled = pyqtSignal()
def __init__(self, parent=None):
......@@ -141,8 +136,6 @@ class HgFileView(QFrame):
framelayout.addLayout(l, 1)
self.sci = FileDisplay(self)
self.sci.escapePressed.connect(self.escapePressed)
self.sci.refreshPressed.connect(self.refreshPressed)
self.sci.setFrameStyle(0)
l.addWidget(self.sci, 1)
#self.sci.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
......
......@@ -50,8 +50,6 @@ class StatusWidget(QWidget):
titleTextChanged = pyqtSignal(QString)
linkActivated = pyqtSignal(QString)
showMessage = pyqtSignal(unicode)
escapePressed = pyqtSignal()
refreshPressed = pyqtSignal()
fileDisplayed = pyqtSignal(QString, QString)
def __init__(self, pats, opts, root=None, parent=None):
......@@ -172,8 +170,6 @@ class StatusWidget(QWidget):
self.fileview = fileview.HgFileView(self)
self.fileview.showMessage.connect(self.showMessage)
self.fileview.linkActivated.connect(self.linkActivated)
self.fileview.escapePressed.connect(self.escapePressed)
self.fileview.refreshPressed.connect(self.refreshPressed)
self.fileview.fileDisplayed.connect(self.fileDisplayed)
self.fileview.setMode('diff')
vbox.addWidget(self.fileview, 1)
......@@ -641,7 +637,6 @@ class StatusDialog(QDialog):
self.stwidget.showMessage.connect(self.statusbar.showMessage)
self.stwidget.progress.connect(self.statusbar.progress)
self.stwidget.titleTextChanged.connect(self.setWindowTitle)
self.stwidget.escapePressed.connect(self.reject)
self.setWindowTitle(self.stwidget.getTitle())
QTimer.singleShot(0, self.stwidget.refreshWctx)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment