self._close_electrum = False
self.lite = None
-
- self.icon = QIcon(':icons/electrum_light_icon.png')
+
+ if sys.platform == 'darwin':
+ self.icon = QIcon(":icons/electrum_dark_icon.png")
+ #self.icon = QIcon(":icons/lock.png")
+ else:
+ self.icon = QIcon(':icons/electrum_light_icon.png')
+
self.tray = QSystemTrayIcon(self.icon, self)
self.tray.setToolTip('Electrum')
self.tray.activated.connect(self.tray_activated)
run_hook('load_wallet', wallet)
- def select_wallet_file(self):
- wallet_folder = self.wallet.storage.path
- re.sub("(\/\w*.dat)$", "", wallet_folder)
- file_name = unicode( QFileDialog.getOpenFileName(self, "Select your wallet file", wallet_folder) )
- return file_name
-
-
def open_wallet(self):
-
- filename = self.select_wallet_file()
+ wallet_folder = self.wallet.storage.path
+ filename = unicode( QFileDialog.getOpenFileName(self, "Select your wallet file", wallet_folder) )
if not filename:
return
import shutil
path = self.wallet.storage.path
wallet_folder = os.path.dirname(path)
- new_filename, ok = QInputDialog.getText(self, _('Filename'), _('Current directory') + ': ' + wallet_folder + '\n' + _('Enter a filename for the copy of your wallet') + ':')
- new_filename = unicode(new_filename)
- if not ok or not new_filename:
+ filename = unicode( QFileDialog.getSaveFileName(self, _('Enter a filename for the copy of your wallet'), wallet_folder) )
+ if not filename:
return
- new_path = os.path.join(wallet_folder, new_filename)
+ new_path = os.path.join(wallet_folder, filename)
if new_path != path:
try:
shutil.copy2(path, new_path)
import installwizard
wallet_folder = os.path.dirname(self.wallet.storage.path)
- filename, ok = QInputDialog.getText(self, _('Filename'), _('Current directory') + ': ' + wallet_folder + '\n'+_('Enter a new file name') + ':')
- filename = unicode(filename)
- if not ok or not filename:
+ filename = unicode( QFileDialog.getSaveFileName(self, _('Enter a new file name'), wallet_folder) )
+ if not filename:
return
filename = os.path.join(wallet_folder, filename)
storage = WalletStorage({'wallet_path': filename})
- assert not storage.file_exists
+ if storage.file_exists:
+ QMessageBox.critical(None, "Error", _("File exists"))
+ return
wizard = installwizard.InstallWizard(self.config, self.network, storage)
wallet = wizard.run()
if conf > 0:
try:
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
- except:
+ except Exception:
time_str = _("error")
if conf == -1:
try:
amount = self.read_amount(unicode( self.amount_e.text()))
- except:
+ except Exception:
QMessageBox.warning(self, _('Error'), _('Invalid Amount'), _('OK'))
return
try:
fee = self.read_amount(unicode( self.fee_e.text()))
- except:
+ except Exception:
QMessageBox.warning(self, _('Error'), _('Invalid Fee'), _('OK'))
return
try:
tx = self.wallet.mktx_from_account( [(to_address, amount)], password, fee, self.current_account)
- except BaseException, e:
+ except Exception as e:
traceback.print_exc(file=sys.stdout)
self.show_message(str(e))
return
else:
QMessageBox.warning(self, _('Error'), msg, _('OK'))
else:
- filename = label + '.txn' if label else 'unsigned_%s.txn' % (time.mktime(time.gmtime()))
- try:
- fileName = self.getSaveFileName(_("Select a transaction filename"), filename, "*.txn")
- with open(fileName,'w') as f:
- f.write(json.dumps(tx.as_dict(),indent=4) + '\n')
- QMessageBox.information(self, _('Unsigned transaction created'), _("Unsigned transaction was saved to file:") + " " +fileName, _('OK'))
- except:
- QMessageBox.warning(self, _('Error'), _('Could not write transaction to file'), _('OK'))
+
+ self.show_transaction(tx)
# add recipient to addressbook
if to_address not in self.wallet.addressbook and not self.wallet.is_mine(to_address):
if self.wallet.seed:
try:
mnemonic = self.wallet.get_mnemonic(password)
- except:
+ except Exception:
QMessageBox.warning(self, _('Error'), _('Incorrect Password'), _('OK'))
return
from seed_dialog import SeedDialog
if not address: return
try:
pk_list = self.wallet.get_private_key(address, password)
- except BaseException, e:
+ except Exception as e:
self.show_message(str(e))
return
QMessageBox.information(self, _('Private key'), _('Address')+ ': ' + address + '\n\n' + _('Private key') + ': ' + '\n'.join(pk_list), _('OK'))
try:
sig = self.wallet.sign_message(str(address.text()), message, password)
signature.setText(sig)
- except BaseException, e:
+ except Exception as e:
self.show_message(str(e))
def sign_message(self, address):
txt.decode('hex')
tx = Transaction(txt)
return tx
- except:
+ except Exception:
pass
try:
input_info = json.loads(tx_dict['input_info'])
tx.add_input_info(input_info)
return tx
- except:
+ except Exception:
pass
QMessageBox.critical(None, _("Unable to parse transaction"), _("Electrum was unable to parse your transaction"))
try:
tx = self.wallet.make_unsigned_transaction(outputs, None, None)
- except BaseException, e:
+ except Exception as e:
self.show_message(str(e))
return
export_error_label = _("Electrum was unable to produce a private key-export.")
QMessageBox.critical(None, _("Unable to create csv"), export_error_label + "\n" + str(reason))
- except BaseException, e:
+ except Exception as e:
self.show_message(str(e))
return
for key in text:
try:
addr = self.wallet.import_key(key, password)
- except BaseException as e:
+ except Exception as e:
badkeys.append(key)
continue
if not addr:
lang_combo.addItems(languages.values())
try:
index = languages.keys().index(self.config.get("language",''))
- except:
+ except Exception:
index = 0
lang_combo.setCurrentIndex(index)
grid.addWidget(lang_combo, 1, 1)
fee = unicode(fee_e.text())
try:
fee = self.read_amount(fee)
- except:
+ except Exception:
QMessageBox.warning(self, _('Error'), _('Invalid value') +': %s'%fee, _('OK'))
return
try:
nz = int( nz )
if nz>8: nz=8
- except:
+ except Exception:
QMessageBox.warning(self, _('Error'), _('Invalid value')+':%s'%nz, _('OK'))
return
w = None
cb.clicked.connect(mk_toggle(cb,p,w))
grid.addWidget(HelpButton(p.description()), i, 2)
- except:
+ except Exception:
print_msg(_("Error: cannot display plugin"), p)
traceback.print_exc(file=sys.stdout)
grid.setRowStretch(i+1,1)