Commits

Yuya Nishihara committed 29c46bc

reporegistry: postpone loading subrepos by QTimer

The other settings are cheap. They can be applied at the initial load
of RepoTreeModel.

Now the progress is displayed again.

Comments (0)

Files changed (1)

tortoisehg/hgqt/reporegistry.py

         tv.dropAccepted.connect(self.dropAccepted)
 
         self.createActions()
+        self._loadSettings()
 
         sfile = settingsfilename()
+        # start without subrepos because loading them is expensive
         tv.setModel(repotreemodel.RepoTreeModel(sfile, self,
-            showSubrepos=self._isSettingEnabled('showSubrepos'),
-            showNetworkSubrepos=self._isSettingEnabled('showNetworkSubrepos')))
+            showSubrepos=False,
+            showNetworkSubrepos=self._isSettingEnabled('showNetworkSubrepos'),
+            showShortPaths=self._isSettingEnabled('showShortPaths')))
 
         # Setup a file system watcher to update the reporegistry
         # anytime it is modified by another thg instance
         self._pendingReloadModel = False
         self._activeTabRepo = None
 
-        self._loadSettings()
         QTimer.singleShot(0, self._initView)
 
     @pyqtSlot()
     def _initView(self):
         self.expand()
         self._updateColumnVisibility()
+        if self._isSettingEnabled('showSubrepos'):
+            self.reloadModel()  # delayed loading of subrepos
 
     def _loadSettings(self):
         defaultmap = {'showPaths': False, 'showSubrepos': True,
             action.setChecked(s.value(key, defaultmap[key]).toBool())
         s.endGroup()
 
-        # Manually reload the model now, to apply the settings
-        self.reloadModel()
-
     def _saveSettings(self):
         s = QSettings()
         s.beginGroup('Workbench')  # for compatibility with old release