Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

status: restore selection across refresh; select first file on open

Changeset 8e7047de06f4

Parent 1384c027496c

by Steve Borho

Changes to 2 files · Browse files at 8e7047de06f4 Showing diff from parent 1384c027496c Diff from another changeset...

 
21
22
23
24
25
26
27
28
 
21
22
23
 
 
24
25
26
@@ -21,8 +21,6 @@
   # Technical Debt for CommitWidget  # qrefresh support -# auto-select a file at startup? -# re-select the previous file after refresh  # threaded / wrapped commit (need a CmdRunner equivalent)  # qctlib decode failure dialog (ask for retry locale, suggest HGENCODING)  # Need a unicode-to-UTF8 function
 
235
236
237
 
 
 
 
 
 
 
 
 
 
 
 
 
238
239
240
 
275
276
277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
279
280
 
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
 
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
@@ -235,6 +235,19 @@
  self.curRow = None   self.override.setChecked(False)   self.override.setEnabled(False) + + # store selected paths or current path + model = self.tv.model() + if model: + sp = [model.getRow(i)[COL_PATH] for i in self.tv.selectedRows()] + if not sp: + index = self.tv.selectionModel().currentIndex() + if index.isValid(): + sp = [model.getRow(index)[COL_PATH]] + else: + sp = None + self.sp = sp +   self.emit(SIGNAL('loadBegin()'))   self.refreshing = StatusThread(self.repo, self.pats, self.opts)   self.connect(self.refreshing, SIGNAL('finished'), self.reloadComplete) @@ -275,6 +288,22 @@
  self.connect(tm, SIGNAL('checkToggled()'), self.updateCheckCount)   self.updateCheckCount()   + # reset selection, or select first row + selmodel = self.tv.selectionModel() + flags = QItemSelectionModel.Select | QItemSelectionModel.Rows + if self.sp: + first = None + for i, row in enumerate(tm.getAllRows()): + if row[COL_PATH] in self.sp: + index = tm.index(i, 0) + selmodel.select(index, flags) + if not first: first = index + else: + first = tm.index(0, 0) + selmodel.select(first, flags) + if first and first.isValid(): + self.rowSelected(first) +   def updateCheckCount(self):   text = _('Checkmarked file count: %d') % len(self.getChecked())   self.countlbl.setText(text)