Commits

Yuya Nishihara committed 0c35458

mqdock: tidy up method to update patch actions

  • Participants
  • Parent commits 4b11f79

Comments (0)

Files changed (1)

tortoisehg/hgqt/mq.py

 
     @pyqtSlot()
     def _updatePatchActions(self):
+        model = self.queueListWidget.model()
         index = self.queueListWidget.currentIndex()
-        if index.isValid():
-            model = self.queueListWidget.model()
-            self.qdeleteAct.setEnabled(not model.isApplied(index))
-            self.setGuardsAct.setEnabled(True)
-            self.qrenameAct.setEnabled(True)
-        else:
-            self.qdeleteAct.setEnabled(False)
-            self.setGuardsAct.setEnabled(False)
-            self.qrenameAct.setEnabled(False)
+        self.qdeleteAct.setEnabled(index.isValid()
+                                   and not model.isApplied(index))
+        self.setGuardsAct.setEnabled(index.isValid())
+        self.qrenameAct.setEnabled(index.isValid())
 
     @pyqtSlot(QString)
     def onQQueueActivated(self, text):