Commits

Yuya Nishihara committed 34bcda1

workbench: eliminate signal chain to close tab of destroyed repo

Because the Workbench opens repo, it isn't necessary to ask each RepoWidget
to emit close request on repositoryDestroyed.

  • Participants
  • Parent commits f721a4d

Comments (0)

Files changed (2)

File tortoisehg/hgqt/repowidget.py

     # The following signals should be exchanged directly between workbench and
     # thgrepo. But it isn't possible because workbench cannot filter out known
     # repo from the result of thgrepo.repository().
-    closeSelfSignal = pyqtSignal(QWidget)
     repoChanged = pyqtSignal(QString)
     repoConfigChanged = pyqtSignal(QString)
     shortNameChanged = pyqtSignal(QString, QString)
 
         self.repo = repo
         repo.repositoryChanged.connect(self.repositoryChanged)
-        repo.repositoryDestroyed.connect(self.repositoryDestroyed)
         repo.configChanged.connect(self.configChanged)
         self.revsetfilter = False
         self.bundle = None  # bundle file name [local encoding]
         self.filterbar.refresh()
 
     @pyqtSlot()
-    def repositoryDestroyed(self):
-        'Repository has detected itself to be deleted'
-        self.closeSelfSignal.emit(self)
-
-    @pyqtSlot()
     def repositoryChanged(self):
         'Repository has detected a changelog / dirstate change'
         if self.isVisible():

File tortoisehg/hgqt/workbench.py

 
         self.ui = ui
         self._repomanager = repomanager
+        self._repomanager.repositoryDestroyed.connect(self.closeRepo)
 
         self.setupUi()
         self.setWindowTitle(_('TortoiseHg Workbench'))
         self.actionBack.setEnabled(rw.canGoBack())
         self.actionForward.setEnabled(rw.canGoForward())
 
-    def repoTabCloseSelf(self, widget):
-        index = self.repoTabsWidget.indexOf(widget)
-        self.repoTabCloseRequested(index)
-
     @pyqtSlot(int)
     def repoTabCloseRequested(self, index):
         tw = self.repoTabsWidget
         repo = repoagent.rawRepo()  # TODO: pass repoagent to RepoWidget
         rw = RepoWidget(repo, self, bundle=bundle)
         rw.showMessageSignal.connect(self.showMessage)
-        rw.closeSelfSignal.connect(self.repoTabCloseSelf)
         rw.progress.connect(self._showRepoWidgetProgress)
         rw.output.connect(self.log.output)
         rw.makeLogVisible.connect(self.log.setShown)