fix flake8-bugbear B008
B008 Do not perform function calls in argument defaults. The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call. If this is intended, assign the function call to a module-level variable and use that variable as a default value.
This commit is contained in:
@@ -1119,7 +1119,7 @@ class ElectrumWindow(App, Logger, EventListener):
|
||||
arrow_pos=arrow_pos)
|
||||
|
||||
@scheduled_in_gui_thread
|
||||
def show_info_bubble(self, text=_('Hello World'), pos=None, duration=0,
|
||||
def show_info_bubble(self, text=None, pos=None, duration=0,
|
||||
arrow_pos='bottom_mid', width=None, icon='', modal=False, exit=False):
|
||||
'''Method to show an Information Bubble
|
||||
|
||||
@@ -1130,6 +1130,8 @@ class ElectrumWindow(App, Logger, EventListener):
|
||||
width: width of the Bubble
|
||||
arrow_pos: arrow position for the bubble
|
||||
'''
|
||||
if text is None:
|
||||
text = _('Hello World')
|
||||
text = str(text) # so that we also handle e.g. Exception
|
||||
info_bubble = self.info_bubble
|
||||
if not info_bubble:
|
||||
|
||||
@@ -1294,8 +1294,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
|
||||
else:
|
||||
self.show_message(message)
|
||||
|
||||
def query_choice(self, msg, choices, title=_('Question'), default_choice=None):
|
||||
def query_choice(self, msg, choices, title=None, default_choice=None):
|
||||
# Needed by QtHandler for hardware wallets
|
||||
if title is None:
|
||||
title = _('Question')
|
||||
dialog = WindowModalDialog(self.top_level_window(), title=title)
|
||||
dialog.setMinimumWidth(400)
|
||||
clayout = ChoicesLayout(msg, choices, checked_index=default_choice)
|
||||
@@ -1918,10 +1920,12 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
|
||||
d = SeedDialog(self, seed, passphrase, config=self.config)
|
||||
d.exec_()
|
||||
|
||||
def show_qrcode(self, data, title = _("QR code"), parent=None, *,
|
||||
def show_qrcode(self, data, title=None, parent=None, *,
|
||||
help_text=None, show_copy_text_btn=False):
|
||||
if not data:
|
||||
return
|
||||
if title is None:
|
||||
title = _("QR code")
|
||||
d = QRDialog(
|
||||
data=data,
|
||||
parent=parent or self,
|
||||
|
||||
Reference in New Issue
Block a user