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

guess: disable buttons when no items are selected

Changeset 4616270030ce

Parent b3f9dfd60586

by Steve Borho

Changes to one file · Browse files at 4616270030ce Showing diff from parent b3f9dfd60586 Diff from another changeset...

 
17
18
19
20
21
22
23
24
25
 
83
84
85
 
86
87
88
89
90
 
 
 
91
92
93
 
101
102
103
104
105
106
107
108
109
 
 
 
 
 
 
110
111
112
 
168
169
170
171
172
173
174
 
187
188
189
190
191
 
192
193
194
 
17
18
19
 
 
 
20
21
22
 
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
 
102
103
104
 
105
106
107
108
 
109
110
111
112
113
114
115
116
117
 
173
174
175
 
176
177
178
 
191
192
193
 
 
194
195
196
197
@@ -17,9 +17,6 @@
 from PyQt4.QtCore import *  from PyQt4.QtGui import *   -# Technical Debt -# Disable buttons when lists are empty -  class DetectRenameDialog(QDialog):   'Detect renames after they occur'   @@ -83,11 +80,15 @@
  copycheck.setChecked(True)   findrenames = QPushButton(_('Find Rename'))   findrenames.setToolTip(_('Find copy and/or rename sources')) + findrenames.setEnabled(False)   findrenames.clicked.connect(self.findRenames)   buthbox.addWidget(copycheck)   buthbox.addStretch(1)   buthbox.addWidget(findrenames)   self.findbtn, self.copycheck = findrenames, copycheck + def itemselect(): + self.findbtn.setEnabled(len(self.unrevlist.selectedItems())) + self.unrevlist.itemSelectionChanged.connect(itemselect)     matchlbl = QLabel(_('<b>Candidate Matches</b>'))   matchvbox.addWidget(matchlbl) @@ -101,12 +102,16 @@
  matchbtn = QPushButton(_('Accept Selected Matches'))   matchbtn.clicked.connect(self.acceptMatch)   matchbtn.setEnabled(False) - self.matchbtn = matchbtn   buthbox.addStretch(1)   buthbox.addWidget(matchbtn)   matchvbox.addWidget(matchtv)   matchvbox.addLayout(buthbox) - self.matchtv = matchtv + self.matchtv, self.matchbtn = matchtv, matchbtn + def matchselect(s, d): + count = len(matchtv.selectedIndexes()) + self.matchbtn.setEnabled(count > 0) + selmodel = matchtv.selectionModel() + selmodel.selectionChanged.connect(matchselect)     diffframe = QFrame(hsplit)   diffvbox = QVBoxLayout() @@ -168,7 +173,6 @@
  pct = self.simslider.value() / 100.0   copies = not self.copycheck.isChecked()   self.findbtn.setEnabled(False) - self.matchbtn.setEnabled(False)   self.errorstr = None     self.matchtv.model().clear() @@ -187,8 +191,7 @@
  self.pmon.hide()   for col in xrange(3):   self.matchtv.resizeColumnToContents(col) - self.findbtn.setEnabled(True) - self.matchbtn.setDisabled(self.matchtv.model().isEmpty()) + self.findbtn.setEnabled(len(self.unrevlist.selectedItems()))     def rowReceived(self, args):   self.matchtv.model().appendRow(*args)