1. TortoiseHg
  2. TortoiseHg
  3. hgtk

Commits

Steve Borho  committed 1853af8

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

Remove showDescSignal, which was no longer applicable

  • Participants
  • Parent commits 554e81e
  • Branches default

Comments (0)

Files changed (3)

File tortoisehg/hgqt/fileview.py

View file
 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()
 
         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)
     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:
         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:
             olddata = fd.olddata.splitlines()
             newdata = fd.contents.splitlines()
             self._diff = difflib.SequenceMatcher(None, olddata, newdata)
-            self._diffs = []
             self.blk.syncPageStep()
             self.timer.start()
 
     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()

File tortoisehg/hgqt/repowidget.py

View file
 
         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"))
 

File tortoisehg/hgqt/revdetails.py

View file
 
     showMessage = pyqtSignal(str)
     linkActivated = pyqtSignal(unicode)
+    grepRequested = pyqtSignal(unicode, dict)
+    revForDiffChanged = pyqtSignal(int)
 
     def __init__(self, repo):
         QWidget.__init__(self)
 
         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):