Commits

Yuya Nishihara committed fb32343

cmdui: extract helper method to remove progress widget by key

Comments (0)

Files changed (1)

tortoisehg/hgqt/cmdui.py

     def clear(self):
         keys = self.topics.keys()
         for key in keys:
-            pm = self.topics[key]
-            self.removeWidget(pm)
-            pm.setParent(None)
-            del self.topics[key]
+            self._removeProgress(key)
+
+    def _removeProgress(self, key):
+        pm = self.topics[key]
+        self.removeWidget(pm)
+        pm.setParent(None)
+        del self.topics[key]
 
     # TODO: migrate to setProgress() API
     @pyqtSlot(QString, object, QString, QString, object)
         key = (root, topic)
         if pos is None or (not pos and not total):
             if key in self.topics:
-                pm = self.topics[key]
-                self.removeWidget(pm)
-                pm.setParent(None)
-                del self.topics[key]
+                self._removeProgress(key)
             return
         if key not in self.topics:
             pm = ProgressMonitor(topic, self)