Read about our upcoming Code of Conduct on this issue

Commit 1f0dfd1b authored by Steve Borho's avatar Steve Borho
Browse files

fileview: connect some manifest signals, disable next/prev in ann mode

Remove showDescSignal, which was no longer applicable
parent 554e81e94c06
......@@ -37,10 +37,9 @@ qsci = Qsci.QsciScintilla
class HgFileView(QFrame):
"""file diff and content viewer"""
showDescSignal = pyqtSignal(QString)
linkActivated = pyqtSignal(QString)
fileDisplayed = pyqtSignal(QString, QString)
showMessage = pyqtSignal(unicode)
showMessage = pyqtSignal(QString)
revForDiffChanged = pyqtSignal(int)
filled = pyqtSignal()
......@@ -138,9 +137,9 @@ class HgFileView(QFrame):
for name in ('searchRequested', 'editSelected', 'grepRequested'):
getattr(self._annotate, name).connect(getattr(self, name))
self._annotate.revisionHint.connect(self.showMessage)
self._annotate.sourceChanged.connect(self.sourceChanged)
self._annotate.setAnnotationEnabled(True)
self._stacked.addWidget(self._annotate)
# self._annotate.sourceChanged.connect( ?? )
ll = QVBoxLayout()
ll.setContentsMargins(0, 0, 0, 0)
......@@ -230,9 +229,9 @@ class HgFileView(QFrame):
def setMode(self, action):
'One of the mode toolbar buttons has been toggled'
mode = {'Diff':'diff', 'File':'file', 'Ann':'ann'}[str(action.text())]
self.actionNextDiff.setEnabled(mode != 'diff')
self.actionNextDiff.setEnabled(mode == 'file')
self.actionPrevDiff.setEnabled(False)
self.blk.setVisible(mode != 'diff')
self.blk.setVisible(mode == 'file')
if mode == 'ann':
self._stacked.setCurrentWidget(self._annotate)
else:
......@@ -279,6 +278,7 @@ class HgFileView(QFrame):
self.extralabel.hide()
self.sci.setMarginLineNumbers(1, False)
self.sci.setMarginWidth(1, '')
self._diffs = []
def displayFile(self, filename=None, rev=None, status=None):
if filename is None:
......@@ -369,7 +369,6 @@ class HgFileView(QFrame):
olddata = fd.olddata.splitlines()
newdata = fd.contents.splitlines()
self._diff = difflib.SequenceMatcher(None, olddata, newdata)
self._diffs = []
self.blk.syncPageStep()
self.timer.start()
......@@ -426,6 +425,10 @@ class HgFileView(QFrame):
def nDiffs(self):
return len(self._diffs)
@pyqtSlot(unicode, object, int)
def sourceChanged(self, path, rev, line=None):
self.revForDiffChanged.emit(rev)
def searchString(self, text):
self._find_text = text
self.clearHighlights()
......
......@@ -154,7 +154,8 @@ class RepoWidget(QWidget):
self.revDetailsWidget = w = RevDetailsWidget(self.repo)
w.linkActivated.connect(self._openLink)
w.fileview.showDescSignal.connect(self.showMessage)
w.revForDiffChanged.connect(self.repoview.goto)
w.grepRequested.connect(self.grep)
self.logTabIndex = idx = tt.addTab(w, geticon('log'), '')
tt.setTabToolTip(idx, _("Revision details"))
......
......@@ -21,6 +21,8 @@ class RevDetailsWidget(QWidget):
showMessage = pyqtSignal(str)
linkActivated = pyqtSignal(unicode)
grepRequested = pyqtSignal(unicode, dict)
revForDiffChanged = pyqtSignal(int)
def __init__(self, repo):
QWidget.__init__(self)
......@@ -41,6 +43,8 @@ class RevDetailsWidget(QWidget):
self.fileview.setFont(getfont('fontdiff').font())
self.fileview.showMessage.connect(self.showMessage)
self.fileview.grepRequested.connect(self.grepRequested)
self.fileview.revForDiffChanged.connect(self.revForDiffChanged)
self.restoreSettings()
def setRepo(self, repo):
......
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