Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

reporegistry: do not reload repo tree model twice when loading settings

The repo tree model of the repo registry was being load twice, once when setting
the "View/Show Subrepos on Registry" checkbox, and once again when setting the
"View/Show Subrepos for remote repositories" checkbox.

Changeset 26c8e6c497a0

Parent b456652089a2

by Angel Ezquerra

Changes to 2 files · Browse files at 26c8e6c497a0 Showing diff from parent b456652089a2 Diff from another changeset...

 
214
215
216
217
 
218
219
220
 
 
221
222
 
223
224
225
 
 
226
227
228
 
214
215
216
 
217
218
219
 
220
221
222
 
223
224
225
 
226
227
228
229
230
@@ -214,15 +214,17 @@
  self.createActions()   QTimer.singleShot(0, self.expand)   - def setShowSubrepos(self, show): + def setShowSubrepos(self, show, reloadModel=True):   if self.showSubrepos != show:   self.showSubrepos = show - self.reloadModel() + if reloadModel: + self.reloadModel()   - def setShowNetworkSubrepos(self, show): + def setShowNetworkSubrepos(self, show, reloadModel=True):   if self.showNetworkSubrepos != show:   self.showNetworkSubrepos = show - self.reloadModel() + if reloadModel: + self.reloadModel()     def reloadModel(self):   self.tview.setModel(
 
775
776
777
778
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
779
780
781
782
783
784
785
786
787
788
 
775
776
777
 
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
 
 
 
 
 
806
807
808
@@ -775,14 +775,34 @@
  self.actionSaveRepos.setChecked(save)   for path in hglib.fromunicode(s.value(wb + 'openrepos').toString()).split(','):   self._openRepo(path, False) - # Allow repo registry to assemble itself before toggling path state + + # Load the repo registry settings. Note that we must allow the + # repo registry to assemble itself before toggling its settings + # Also the view path setttings should be enabled last, once we have + # loaded the repo subrepositories (if needed) + + # Normally, checking the "show subrepos" and the "show network subrepos" + # settings will trigger a reload of the repo registry. + # To avoid reloading it twice (every time we set one of its view + # settings), we tell the setters to avoid reloading the repo tree + # model, and then we manually reload the model + ssr = s.value(wb + 'showSubrepos', + defaultValue=QVariant(True)).toBool() + snsr = s.value(wb + 'showNetworkSubrepos', + defaultValue=QVariant(True)).toBool() + self.reporegistry.setShowSubrepos(ssr, False) + self.reporegistry.setShowNetworkSubrepos(snsr, False) + + # Note that calling setChecked will NOT reload the model if the new + # setting is the same as the one in the repo registry + QTimer.singleShot(0, lambda: self.actionShowSubrepos.setChecked(ssr)) + QTimer.singleShot(0, lambda: self.actionShowNetworkSubrepos.setChecked(ssr)) + + # Manually reload the model now, to apply the settings + self.reporegistry.reloadModel() +   sp = s.value(wb + 'showPaths').toBool()   QTimer.singleShot(0, lambda: self.actionShowPaths.setChecked(sp)) - ssr = s.value(wb + 'showSubrepos', defaultValue=QVariant(True)).toBool() - QTimer.singleShot(0, lambda: self.actionShowSubrepos.setChecked(ssr)) - snsr = s.value(wb + 'showNetworkSubrepos', - defaultValue=QVariant(True)).toBool() - QTimer.singleShot(0, lambda: self.actionShowNetworkSubrepos.setChecked(ssr))     def goto(self, root, rev):   for rw in self._findrepowidget(root):