qt history tab txn drag and drop: fix #5635
This commit is contained in:
@@ -655,9 +655,12 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
|
|||||||
try:
|
try:
|
||||||
with open(fn) as f:
|
with open(fn) as f:
|
||||||
tx = self.parent.tx_from_text(f.read())
|
tx = self.parent.tx_from_text(f.read())
|
||||||
self.parent.save_transaction_into_wallet(tx)
|
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
self.parent.show_error(e)
|
self.parent.show_error(e)
|
||||||
|
return
|
||||||
|
if not tx:
|
||||||
|
return
|
||||||
|
self.parent.save_transaction_into_wallet(tx)
|
||||||
|
|
||||||
def export_history_dialog(self):
|
def export_history_dialog(self):
|
||||||
d = WindowModalDialog(self, _('Export History'))
|
d = WindowModalDialog(self, _('Export History'))
|
||||||
|
|||||||
@@ -2652,7 +2652,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
|||||||
d = PasswordDialog(parent, msg)
|
d = PasswordDialog(parent, msg)
|
||||||
return d.run()
|
return d.run()
|
||||||
|
|
||||||
def tx_from_text(self, txt):
|
def tx_from_text(self, txt) -> Optional[Transaction]:
|
||||||
from electrum.transaction import tx_from_str
|
from electrum.transaction import tx_from_str
|
||||||
try:
|
try:
|
||||||
tx = tx_from_str(txt)
|
tx = tx_from_str(txt)
|
||||||
@@ -2685,7 +2685,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
|||||||
return
|
return
|
||||||
self.show_transaction(tx)
|
self.show_transaction(tx)
|
||||||
|
|
||||||
def read_tx_from_file(self):
|
def read_tx_from_file(self) -> Optional[Transaction]:
|
||||||
fileName = self.getOpenFileName(_("Select your transaction file"), "*.txn")
|
fileName = self.getOpenFileName(_("Select your transaction file"), "*.txn")
|
||||||
if not fileName:
|
if not fileName:
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user