fileName=QFileDialog.getOpenFileName(QWidget(),_("Select your transaction file"),os.path.expanduser('~'))
ifnotfileName:
return
try:
withopen(fileName,"r")asf:
file_content=f.read()
except(ValueError,IOError,os.error),reason:
QMessageBox.critical(None,"Unable to read file or no transaction found",_("Electrum was unable to open your transaction file")+"\n"+str(reason))
fileName=QFileDialog.getSaveFileName(QWidget(),_("Select where to save your signed transaction"),os.path.expanduser('~/signed_tx_%s'%(tx.hash()[0:8])))
fileName=QFileDialog.getSaveFileName(QWidget(),_("Select where to save your signed transaction"),os.path.expanduser('~/signed_tx_%s'%(tx.hash()[0:8])))
vbox.addWidget(QLabel(_("This transaction is not signed yet.")))
else:
vbox.addWidget(EnterButton(_("Send this transaction"),self.send_raw_transaction))
vbox.addWidget(QLabel(_("Broadcast this transaction")))
vbox.addLayout(ok_cancel_buttons(dialog))
ifdialog.exec_():
self.send_raw_transaction(tx_dict["hex"])
ifnotdialog.exec_():return
defdo_send_from_file(self):
try:
fileName=QFileDialog.getOpenFileName(QWidget(),_("Select your transaction file"),os.path.expanduser('~'))
iffileName:
withopen(fileName,"r")astransaction_file:
file_content=transaction_file.read()
tx=json.loads(str(file_content))
self.create_send_transaction_window(tx)
tx_dict=self.read_tx_from_file()
iftx_dict:
self.create_send_transaction_window(tx_dict)
except(ValueError,IOError,os.error),reason:
QMessageBox.critical(None,"Unable to read file or no transaction found",_("Electrum was unable to read your transaction file")+"\n"+str(reason))
defdo_send_from_text(self):
tx,ok=QInputDialog.getText(QTextEdit(),_('Send raw transaction'),_('Transaction data in JSON')+':')
try:
tx=json.loads(unicode(tx))
except(ValueError,IOError,os.error),reason:
QMessageBox.critical(None,"Unable to read transaction",_("Electrum was unable to read your transaction:")+"\n"+str(reason))
txt,ok=QInputDialog.getText(QTextEdit(),_('Send raw transaction'),_('Transaction data in JSON')+':')
ifnotok:
return
tx_dict=self.tx_dict_from_text(unicode(txt))
iftx_dict:
self.create_send_transaction_window(tx_dict)
self.create_send_transaction_window(tx)
defdo_export_privkeys(self):
self.show_message("%s\n%s\n%s"%(_("WARNING: ALL your private keys are secret."),_("Exposing a single private key can compromise your entire wallet!"),_("In particular, DO NOT use 'redeem private key' services proposed by third parties.")))
@ -2155,15 +2167,16 @@ class ElectrumWindow(QMainWindow):