Commits

Yuya Nishihara committed eaaf7ff

import dummystart-splitresize

  • Participants
  • Parent commits 8d53b2a

Comments (0)

Files changed (4)

File reporeg-dummystart-splitresize.diff

+# HG changeset patch
+# Parent 08cb2ec18b864b13ca172e40d7edb384e82ffd0b
+diff --git a/tortoisehg/hgqt/reporegistry.py b/tortoisehg/hgqt/reporegistry.py
+--- a/tortoisehg/hgqt/reporegistry.py
++++ b/tortoisehg/hgqt/reporegistry.py
+@@ -280,6 +280,7 @@ class RepoRegistryView(QDockWidget):
+         self._activeTabRepo = None
+ 
+         self._loadSettings()
++        self._updateColumnVisibility()
+ 
+     def _loadSettings(self):
+         defaultmap = {'showPaths': False, 'showSubrepos': True,
+@@ -358,7 +359,7 @@ class RepoRegistryView(QDockWidget):
+         newmodel.updateProgress.connect(self.updateProgress)
+         oldmodel.deleteLater()
+         self.expand()
+-        self._updateColumnVisibility()  # resize columns to fit
++        self._resizeColumnsToFit()
+         self._reloadModelTimer.stop()
+ 
+     def _getItemAndAncestors(self, it):
+@@ -430,6 +431,9 @@ class RepoRegistryView(QDockWidget):
+         show = self._isSettingEnabled('showPaths')
+         self.tview.setColumnHidden(1, not show)
+         self.tview.setHeaderHidden(not show)
++
++    def _resizeColumnsToFit(self):
++        show = self._isSettingEnabled('showPaths')
+         if show:
+             self.tview.resizeColumnToContents(0)
+             self.tview.resizeColumnToContents(1)

File reporeg-dummystart.diff

  
          mainframe.layout().addWidget(tv)
  
-@@ -267,6 +267,7 @@ class RepoRegistryView(QDockWidget):
+@@ -267,10 +267,11 @@ class RepoRegistryView(QDockWidget):
          # anytime it is modified by another thg instance
          # Note that we must make sure that the settings file exists before
          # setting thefile watcher
          if not os.path.exists(sfile):
              if not os.path.exists(os.path.dirname(sfile)):
                  os.makedirs(os.path.dirname(sfile))
+-            tv.model().write(sfile)
++            repotreemodel.RepoTreeModel(filename=None).write(sfile)
+         self.watcher = QFileSystemWatcher(self)
+         self.watcher.addPath(sfile)
+         self._reloadModelTimer = QTimer(self, interval=2000, singleShot=True)
 @@ -279,12 +280,6 @@ class RepoRegistryView(QDockWidget):
          self._activeTabRepo = None
  

File reporeg-lazywatcher.diff

-# HG changeset patch
-# Parent 34104f6611be0f6ada150b64dc055650b7ee36b5
-reporegistry: postpone setup of file monitor until initial reloadModel()
-
-Without this, it tries to call dummymodel.write() on clean startup, which
-is no-op.
-
-diff --git a/tortoisehg/hgqt/reporegistry.py b/tortoisehg/hgqt/reporegistry.py
---- a/tortoisehg/hgqt/reporegistry.py
-+++ b/tortoisehg/hgqt/reporegistry.py
-@@ -262,7 +262,10 @@ class RepoRegistryView(QDockWidget):
-         tv.dropAccepted.connect(self.dropAccepted)
- 
-         self.createActions()
-+        self._activeTabRepo = None
-+        self._loadSettings()
- 
-+    def _setupWatcher(self):
-         # Setup a file system watcher to update the reporegistry
-         # anytime it is modified by another thg instance
-         # Note that we must make sure that the settings file exists before
-@@ -271,15 +274,12 @@ class RepoRegistryView(QDockWidget):
-         if not os.path.exists(sfile):
-             if not os.path.exists(os.path.dirname(sfile)):
-                 os.makedirs(os.path.dirname(sfile))
--            tv.model().write(sfile)
-+            self.tview.model().write(sfile)
-         self.watcher = QFileSystemWatcher(self)
-         self.watcher.addPath(sfile)
-         self._reloadModelTimer = QTimer(self, interval=2000, singleShot=True)
-         self._reloadModelTimer.timeout.connect(self.reloadModel)
-         self.watcher.fileChanged.connect(self._reloadModelTimer.start)
--        self._activeTabRepo = None
--
--        self._loadSettings()
- 
-     def _loadSettings(self):
-         defaultmap = {'showPaths': False, 'showSubrepos': True,
-@@ -356,6 +356,8 @@ class RepoRegistryView(QDockWidget):
-                 self._isSettingEnabled('showNetworkSubrepos'),
-                 self._isSettingEnabled('showShortPaths')))
-         oldmodel.deleteLater()
-+        if not self.watcher:
-+            self._setupWatcher()
-         self.expand()
-         self._updateColumnVisibility()  # resize columns to fit
-         self._reloadModelTimer.stop()
-@@ -436,7 +438,8 @@ class RepoRegistryView(QDockWidget):
-     def close(self):
-         # We must stop monitoring the settings file and then we can save it
-         sfile = settingsfilename()
--        self.watcher.removePath(sfile)
-+        if self.watcher:
-+            self.watcher.removePath(sfile)
-         self.tview.model().write(sfile)
-         self._saveSettings()
- 
 reporeg-modsettingtimer.diff
 reporeg-connect.diff
 reporeg-dummystart.diff
-reporeg-lazywatcher.diff
+reporeg-dummystart-splitresize.diff
 wb-createserver.diff
 wb-launch.diff
 wb-delayload.diff