tUse wrapper to drop an unwanted framework argument - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 9f665c9994a19210b1aa8946f866f01867a6d5ab DIR parent 60afddd595b9c1565ff0fa35fe367acb45168152 HTML Author: Neil Booth <kyuupichan@gmail.com> Date: Mon, 13 Jul 2015 21:27:34 +0900 Use wrapper to drop an unwanted framework argument QPushButton.clicked passes a "checked" argument to the action callback. We don't use or care for it, use a wrapper to drop it and provide a uniform function signature for menu actions and button actions. Diffstat: M gui/qt/main_window.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py t@@ -68,13 +68,17 @@ class StatusBarButton(QPushButton): self.setToolTip(tooltip) self.setFlat(True) self.setMaximumWidth(25) - self.clicked.connect(func) + self.clicked.connect(self.onPress) self.func = func self.setIconSize(QSize(25,25)) + def onPress(self, checked=False): + '''Drops the unwanted PyQt4 "checked" argument''' + self.func() + def keyPressEvent(self, e): if e.key() == QtCore.Qt.Key_Return: - apply(self.func,()) + self.func() from electrum.paymentrequest import PR_UNPAID, PR_PAID, PR_UNKNOWN, PR_EXPIRED