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

status: replace selectedIndexes with selectedRows, remove getPath

Changeset 1d23891095ba

Parent 3ab3429a3599

by Steve Borho

Changes to one file · Browse files at 1d23891095ba Showing diff from parent 3ab3429a3599 Diff from another changeset...

 
302
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
 
337
338
339
340
341
342
343
344
345
 
346
347
348
 
350
351
352
 
 
 
353
354
355
 
457
458
459
460
461
462
463
464
465
466
 
482
483
484
485
486
487
488
489
490
491
 
302
303
304
 
305
306
307
 
308
 
 
 
 
309
310
311
312
313
314
315
 
316
 
 
 
 
 
 
 
 
317
318
319
320
321
322
323
324
325
 
330
331
332
 
333
 
 
 
 
334
335
336
337
 
339
340
341
342
343
344
345
346
347
 
449
450
451
 
 
 
 
452
453
454
 
470
471
472
 
 
 
 
473
474
475
@@ -302,31 +302,24 @@
    def keyPressEvent(self, event):   if event.key() == 32: - for index in self.selectedIndexes(): + for index in self.selectedRows():   self.model().toggleRow(index)   if event.key() == Qt.Key_D and event.modifiers() == Qt.ControlModifier: - rows = set()   selfiles = [] - for index in self.selectedIndexes(): - if index.row() in rows: - continue - rows.add(index.row()) + for index in self.selectedRows():   selfiles.append(self.model().getRow(index)[COL_PATH])   visdiff.visualdiff(self.repo.ui, self.repo, selfiles, {})   else:   return super(WctxFileTree, self).keyPressEvent(event)     def dragObject(self): - rows = set()   urls = [] - for index in self.selectedIndexes(): - if index.row() not in rows: - rows.add(index.row()) - path = self.model().getPath(index) - u = QUrl() - u.setPath('file://' + os.path.join(self.repo.root, path)) - urls.append(u) - if rows: + for index in self.selectedRows(): + path = self.model().getRow(index)[COL_PATH] + u = QUrl() + u.setPath('file://' + os.path.join(self.repo.root, path)) + urls.append(u) + if urls:   d = QDrag(self)   m = QMimeData()   m.setUrls(urls) @@ -337,12 +330,8 @@
  self.dragObject()     def customContextMenuRequested(self, point): - rows = set()   selrows = [] - for index in self.selectedIndexes(): - if index.row() in rows: - continue - rows.add(index.row()) + for index in self.selectedRows():   c, status, mst, u, path = self.model().getRow(index)   selrows.append((set(status+mst.lower()), path))   point = self.mapToGlobal(point) @@ -350,6 +339,9 @@
  if action:   self.emit(SIGNAL('menuAction()'))   + def selectedRows(self): + return self.selectionModel().selectedRows() +  COL_CHECK = 0  COL_STATUS = 1  COL_MERGE_STATE = 2 @@ -457,10 +449,6 @@
  return True   return False   - def getPath(self, index): - assert index.isValid() - return self.rows[index.row()][COL_PATH] -   def getRow(self, index):   assert index.isValid()   return self.rows[index.row()] @@ -482,10 +470,6 @@
  def __init__(self, parent=None):   QSortFilterProxyModel.__init__(self, parent)   - def getPath(self, index): - index = self.mapToSource(index) - return self.sourceModel().getPath(index) -   def getRow(self, index):   index = self.mapToSource(index)   return self.sourceModel().getRow(index)