1. TortoiseHg
  2. TortoiseHg
  3. thg

Commits

Yuya Nishihara  committed fb32343

cmdui: extract helper method to remove progress widget by key

  • Participants
  • Parent commits 80239cd
  • Branches default

Comments (0)

Files changed (1)

File tortoisehg/hgqt/cmdui.py

View file
  • Ignore whitespace
     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)