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

shelve: limit number of setContext() events during combo refreshes

Changeset 0d2c3b8d6527

Parent ef69b49dd90d

by Steve Borho

Changes to one file · Browse files at 0d2c3b8d6527 Showing diff from parent ef69b49dd90d Diff from another changeset...

 
284
285
286
287
288
289
290
291
 
297
298
299
 
300
301
302
 
304
305
306
307
 
308
309
 
310
311
 
312
313
314
315
316
 
 
317
318
319
 
320
321
 
322
323
324
325
326
 
 
 
 
 
 
327
328
329
330
331
332
 
 
333
334
335
 
340
341
342
 
 
343
344
345
 
284
285
286
 
 
287
288
289
 
295
296
297
298
299
300
301
 
303
304
305
 
306
307
 
308
309
 
310
311
 
 
 
 
312
313
314
315
 
316
317
 
318
319
 
 
 
 
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
 
341
342
343
344
345
346
347
348
@@ -284,8 +284,6 @@
  @pyqtSlot()   def refreshCombos(self):   shelvea, shelveb = self.currentPatchA(), self.currentPatchB() - oldidxa = self.comboa.currentIndex() - oldidxb = self.comboa.currentIndex()     shelves = self.repo.thgshelves()   disp = [_('Shelf: %s') % hglib.tounicode(s) for s in shelves] @@ -297,6 +295,7 @@
  self.shelves = [os.path.join(self.repo.shelfdir, s) for s in shelves]   self.patches = [self.repo.mq.join(p) for p in patches]   + self.comboRefreshInProgress = True   self.comboa.clear()   self.combob.clear()   self.comboa.addItems([self.wdir] + disp) @@ -304,32 +303,34 @@
    # attempt to restore selection   if shelvea == self.wdir: - idx = 0 + idxa = 0   elif shelvea in self.shelves: - idx = self.shelves.index(shelvea) + 1 + idxa = self.shelves.index(shelvea) + 1   elif shelvea in self.patches: - idx = len(self.shelves) + self.patches.index(shelvea) + 1 + idxa = len(self.shelves) + self.patches.index(shelvea) + 1   else: - idx = 0 - self.comboa.setCurrentIndex(idx) - if idx == oldidxa: - self.comboAChanged(idx) + idxa = 0 + self.comboa.setCurrentIndex(idxa)     if shelveb in self.shelves: - idx = self.shelves.index(shelveb) + idxb = self.shelves.index(shelveb)   elif shelveb in self.patches: - idx = len(self.shelves) + self.patches.index(shelveb) + idxb = len(self.shelves) + self.patches.index(shelveb)   else: - idx = 0 - self.combob.setCurrentIndex(idx) - if idx == oldidxb: - self.comboBChanged(idx) + idxb = 0 + self.combob.setCurrentIndex(idxb) + self.comboRefreshInProgress = False + + self.comboAChanged(idxa) + self.comboBChanged(idxb)   if not patches and not shelves:   self.delShelfButtonB.setEnabled(False)   self.browseb.setContext(patchctx('', self.repo, None))     @pyqtSlot(int)   def comboAChanged(self, index): + if self.comboRefreshInProgress: + return   if index == 0:   rev = None   self.delShelfButtonA.setEnabled(False) @@ -340,6 +341,8 @@
    @pyqtSlot(int)   def comboBChanged(self, index): + if self.comboRefreshInProgress: + return   rev = self.currentPatchB()   self.delShelfButtonB.setEnabled(index < len(self.shelves))   self.browseb.setContext(self.repo.changectx(rev))