Commits

Steve Borho  committed 0329364

status: make getChecked() aware of partials dictionary, prevent circular updates

When the checkall button state is changed in reaction to file check state
changes, we do not want this state change to in turn trigger all of the files
to be toggled.

  • Participants
  • Parent commits f59116f

Comments (0)

Files changed (1)

File tortoisehg/hgqt/status.py

         self.savechecks = True
         self.refthread = None
         self.partials = {}
+        self.manualCheckAllUpdate = False
 
         # determine the user configured status colors
         # (in the future, we could support full rich-text tags)
         self.diffvbox = vbox
 
     def checkAllNone(self):
+        if self.manualCheckAllUpdate:
+            return
         state = self.checkAllNoneBtn.checkState()
         if state == Qt.Checked:
             self.checkAll()
                 state = Qt.Checked
             else:
                 state = Qt.PartiallyChecked
+            self.manualCheckAllUpdate = True
             self.checkAllNoneBtn.setCheckState(state)
+            self.manualCheckAllUpdate = False
 
     @pyqtSlot(QString, bool)
     def checkToggled(self, wfile, checked):
         if model:
             checked = model.getChecked()
             if types is None:
-                return [f for f, v in checked.iteritems() if v]
+                files = []
+                for f, v in checked.iteritems():
+                    if f in self.partials:
+                        changes = self.partials[f]
+                        if changes.excludecount < len(changes.hunks):
+                            files.append(f)
+                    elif v:
+                        files.append(f)
+                return files
             else:
                 files = []
                 for row in model.getAllRows():
                     path, status, mst, upath, ext, sz = row
-                    if status in types and checked[path]:
-                        files.append(path)
+                    if status in types:
+                        if path in self.partials:
+                            changes = self.partials[path]
+                            if changes.excludecount < len(changes.hunks):
+                                files.append(path)
+                        elif checked[path]:
+                            files.append(path)
                 return files
         else:
             return []