Commits

Yuya Nishihara committed 9730a98

refresh and comment

Comments (0)

Files changed (3)

 # Date 1381848405 -32400
 #      Tue Oct 15 23:46:45 2013 +0900
 # Node ID bfe55b60392fef9a3b6baf3e5cdb142ad85a4ee7
-# Parent  08d9b23d70574e72b198723f7dcc86312ea46988
+# Parent 4b11f790ea68a0aa69ed0b97ced8e0bec1691b95
 mqdock: tidy up method to update patch actions
 
 diff --git a/tortoisehg/hgqt/mq.py b/tortoisehg/hgqt/mq.py
 --- a/tortoisehg/hgqt/mq.py
 +++ b/tortoisehg/hgqt/mq.py
-@@ -685,16 +685,12 @@ class MQPatchesWidget(QDockWidget):
-             self.patchSelected.emit(model.patchName(index))
+@@ -697,16 +697,12 @@ class MQPatchesWidget(QDockWidget):
  
+     @pyqtSlot()
      def _updatePatchActions(self):
 +        model = self.queueListWidget.model()
          index = self.queueListWidget.currentIndex()

mq-laychanged.diff

 # HG changeset patch
-# Parent 3df21cc05b2f5ee80fd3619f8f336a2462f49ec7
-XXX is this a correct usage of layoutChanged ???
+# Date 1381928132 -32400
+# Parent 0d62a8316abfc00db32207e517644e82f74b7684
+mqdock: make sure patch actions catch up changes in model
+
+For example, qpush will update cache of PatchQueueModel and emit dataChanged.
+Then, patch actions should be enabled/disabled accordingly.
 
 diff --git a/tortoisehg/hgqt/mq.py b/tortoisehg/hgqt/mq.py
 --- a/tortoisehg/hgqt/mq.py
          if self._repoagent:
              newmodel = PatchQueueModel(self._repoagent, self)
              self.queueListWidget.setModel(newmodel)
-+            newmodel.layoutChanged.connect(self._updatePatchActions)
++            newmodel.dataChanged.connect(self._updatePatchActions)
              selmodel = self.queueListWidget.selectionModel()
              selmodel.currentRowChanged.connect(self.onPatchSelected)
 +            self._updatePatchActions()
  
 +    @pyqtSlot()
      def _updatePatchActions(self):
-         model = self.queueListWidget.model()
+         index = self.queueListWidget.currentIndex()
+         if index.isValid():
+@@ -740,7 +743,6 @@ class MQPatchesWidget(QDockWidget):
+         self.qqueueComboWidget.setEnabled(self.qqueueComboWidget.count() > 1)
+         self.qpushAllAct.setEnabled(bool(repo.thgmqunappliedpatches))
+         self.qpushAct.setEnabled(bool(repo.thgmqunappliedpatches))
+-        self._updatePatchActions()
+         self.qpopAct.setEnabled(bool(applied))
+         self.qpopAllAct.setEnabled(bool(applied))
  
-@@ -739,7 +742,6 @@ class MQPatchesWidget(QDockWidget):
-         self.refreshSelectedGuards()
- 
-         self.qqueueComboWidget.setEnabled(self.qqueueComboWidget.count() > 1)
--        self._updatePatchActions()
- 
-     def loadQQueues(self):
-         repo = self.repo
 15282.diff
 15283.diff
 15284.diff
+mq-laychanged.diff
 15285.diff
 15286.diff
 mq-upmove.diff
 mq-appliedcnt.diff
-mq-laychanged.diff
 ci-checked.diff
 cmdui-height.diff
 cmdui-mark-setlogvisible.diff
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.