Commits

Yuya Nishihara committed ca1fa4d

qtlib: move clicked handler of PMButton to instance (gc)

Now it can be deleted by reference counting.

Comments (0)

Files changed (1)

tortoisehg/hgqt/qtlib.py

         icon = expanded and self.minus or self.plus
         self.setIcon(icon)
 
-        def clicked():
-            icon = self.is_expanded() and self.plus or self.minus
-            self.setIcon(icon)
-        self.clicked.connect(clicked)
+        self.clicked.connect(self._toggle_icon)
+
+    @pyqtSlot()
+    def _toggle_icon(self):
+        icon = self.is_expanded() and self.plus or self.minus
+        self.setIcon(icon)
 
     def set_expanded(self, state=True):
         icon = state and self.minus or self.plus