Skip to content

Commit

Permalink
QPushButton clicked slot now passes checked
Browse files Browse the repository at this point in the history
It didn't used to do this; it must be a recent change in PyQt.

Fixes #7
  • Loading branch information
Neil Booth committed Jan 11, 2019
1 parent 6bdad85 commit 410ef3c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions electrumsv/gui/qt/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -2358,7 +2358,9 @@ def sign_verify_message(self, address=None):
hbox = QHBoxLayout()

b = QPushButton(_("Sign"))
b.clicked.connect(partial(self.do_sign, address_e, message_e, signature_e))
def do_sign(checked=False):
self.do_sign(address_e, message_e, signature_e)
b.clicked.connect(do_sign)
hbox.addWidget(b)

b = QPushButton(_("Verify"))
Expand Down Expand Up @@ -2422,7 +2424,9 @@ def encrypt_message(self, address=None):
hbox.addWidget(b)

b = QPushButton(_("Decrypt"))
b.clicked.connect(partial(self.do_decrypt, message_e, pubkey_e, encrypted_e))
def do_decrypt(checked=False):
self.do_decrypt(message_e, pubkey_e, encrypted_e)
b.clicked.connect(do_decrypt)
hbox.addWidget(b)

b = QPushButton(_("Close"))
Expand Down

3 comments on commit 410ef3c

@SomberNight
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kyuupichan
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, but what pray apart from arbitrary spelling are those differences? Seems fragile.

@SomberNight
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from functools import partial

def f(x, y=0):
  return x+y

def test_partial():
  return partial(f, 11)(2)

def test_lambda():
  return (lambda: f(11))(2)

test_partial() returns 13, but test_lambda() raises a TypeError.

Please sign in to comment.