X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=gui%2Fqt%2Flite_window.py;h=4d7997a1639ae07e326114adbf0998df47f61fe8;hb=3cbe11a42473af52e7c5e002c36aaaf32646f627;hp=e2d56789fe1a5bab04a86fc1cd34004d8d394072;hpb=6e26fb0198f9ddddfe993ea47526445f60951601;p=electrum-nvc.git diff --git a/gui/qt/lite_window.py b/gui/qt/lite_window.py index e2d5678..4d7997a 100644 --- a/gui/qt/lite_window.py +++ b/gui/qt/lite_window.py @@ -13,32 +13,31 @@ except ImportError: sys.exit(0) from decimal import Decimal as D -from electrum.util import get_resource_path as rsrc -from electrum.bitcoin import is_valid -from electrum.i18n import _ +from electrum_nvc.util import get_resource_path as rsrc +from electrum_nvc.bitcoin import is_valid +from electrum_nvc.i18n import _ import decimal import json import os.path import random import re import time -from electrum.wallet import Wallet, WalletStorage +from electrum_nvc.wallet import Wallet, WalletStorage import webbrowser import history_widget import receiving_widget -from electrum import util -import csv +from electrum_nvc import util import datetime -from electrum.version import ELECTRUM_VERSION as electrum_version -from electrum.util import format_satoshis, age +from electrum_nvc.version import ELECTRUM_VERSION as electrum_version +from electrum_nvc.util import format_satoshis, age from main_window import ElectrumWindow import shutil from util import * -bitcoin = lambda v: v * 100000000 +bitcoin = lambda v: v * 1000000 def IconButton(filename, parent=None): pixmap = QPixmap(filename) @@ -83,51 +82,6 @@ def load_theme_paths(): return theme_paths -def csv_transaction(wallet): - try: - select_export = _('Select file to export your wallet transactions to') - fileName = QFileDialog.getSaveFileName(QWidget(), select_export, os.path.expanduser('~/electrum-history.csv'), "*.csv") - if fileName: - with open(fileName, "w+") as csvfile: - transaction = csv.writer(csvfile) - transaction.writerow(["transaction_hash","label", "confirmations", "value", "fee", "balance", "timestamp"]) - for item in wallet.get_tx_history(): - tx_hash, confirmations, is_mine, value, fee, balance, timestamp = item - if confirmations: - if timestamp is not None: - try: - time_string = datetime.datetime.fromtimestamp(timestamp).isoformat(' ')[:-3] - except [RuntimeError, TypeError, NameError] as reason: - time_string = "unknown" - pass - else: - time_string = "unknown" - else: - time_string = "pending" - - if value is not None: - value_string = format_satoshis(value, True) - else: - value_string = '--' - - if fee is not None: - fee_string = format_satoshis(fee, True) - else: - fee_string = '0' - - if tx_hash: - label, is_default_label = wallet.get_label(tx_hash) - label = label.encode('utf-8') - else: - label = "" - - balance_string = format_satoshis(balance, False) - transaction.writerow([tx_hash, label, confirmations, value_string, fee_string, balance_string, time_string]) - QMessageBox.information(None,_("CSV Export created"), _("Your CSV export has been successfully created.")) - except (IOError, os.error), reason: - export_error_label = _("Electrum was unable to produce a transaction export.") - QMessageBox.critical(None,_("Unable to create csv"), export_error_label + "\n" + str(reason)) - class TransactionWindow(QDialog): @@ -188,14 +142,14 @@ class MiniWindow(QDialog): # Bitcoin address code self.address_input = QLineEdit() - self.address_input.setPlaceholderText(_("Enter a Bitcoin address or contact")) + self.address_input.setPlaceholderText(_("Enter a Novacoin address or contact")) self.address_input.setObjectName("address_input") self.address_input.setFocusPolicy(Qt.ClickFocus) self.address_input.textChanged.connect(self.address_field_changed) resize_line_edit_width(self.address_input, - "1BtaFUr3qVvAmwrsuDuu5zk6e4s2rxd2Gy") + "4LJgtjeXMjLA6nVzYMJh1LEkwxMFsRtnP4") self.address_completions = QStringListModel() address_completer = QCompleter(self.address_input) @@ -300,7 +254,7 @@ class MiniWindow(QDialog): self.toggle_receiving_layout(show_hist) self.setWindowIcon(QIcon(":icons/electrum.png")) - self.setWindowTitle("Electrum") + self.setWindowTitle("Electrum-NVC") self.setWindowFlags(Qt.Window|Qt.MSWindowsFixedSizeDialogHint) self.layout().setSizeConstraint(QLayout.SetFixedSize) self.setObjectName("main_window") @@ -354,10 +308,14 @@ class MiniWindow(QDialog): self.actuator.g.closeEvent(event) qApp.quit() - def set_payment_fields(self, dest_address, amount): + def pay_from_URI(self, URI): + try: + dest_address, amount, label, message, request_url = util.parse_URI(URI) + except: + return self.address_input.setText(dest_address) self.address_field_changed(dest_address) - self.amount_input.setText(amount) + self.amount_input.setText(str(amount)) def activate(self): pass @@ -430,7 +388,7 @@ class MiniWindow(QDialog): def create_quote_text(self, btc_balance): """Return a string copy of the amount fiat currency the user has in bitcoins.""" - from electrum.plugins import run_hook + from electrum_nvc.plugins import run_hook r = {} run_hook('get_fiat_balance_text', btc_balance, r) return r.get(0,'') @@ -617,7 +575,7 @@ class ReceivePopup(QDialog): self.close() def setup(self, address): - label = QLabel(_("Copied your Bitcoin address to the clipboard!")) + label = QLabel(_("Copied your Novacoin address to the clipboard!")) address_display = QLineEdit(address) address_display.setReadOnly(True) resize_line_edit_width(address_display, address) @@ -627,7 +585,7 @@ class ReceivePopup(QDialog): main_layout.addWidget(address_display) self.setMouseTracking(True) - self.setWindowTitle("Electrum - " + _("Receive Bitcoin payment")) + self.setWindowTitle("Electrum - " + _("Receive Novacoin payment")) self.setWindowFlags(Qt.Window|Qt.FramelessWindowHint| Qt.MSWindowsFixedSizeDialogHint) self.layout().setSizeConstraint(QLayout.SetFixedSize) @@ -739,7 +697,7 @@ class MiniActuator: if dest_address is None or not is_valid(dest_address): QMessageBox.warning(parent_window, _('Error'), - _('Invalid Bitcoin Address') + ':\n' + address, _('OK')) + _('Invalid Novacoin Address') + ':\n' + address, _('OK')) return False amount = D(unicode(amount)) * (10*self.g.decimal_point) @@ -755,9 +713,9 @@ class MiniActuator: password = None fee = 0 - # 0.1 BTC = 10000000 + # 0.1 NVC = 100000 if amount < bitcoin(1) / 10: - # 0.001 BTC + # 0.001 NVC fee = bitcoin(1) / 1000 try: @@ -766,7 +724,7 @@ class MiniActuator: QMessageBox.warning(parent_window, _('Error'), str(error), _('OK')) return False - if tx.is_complete: + if tx.is_complete(): h = self.g.wallet.send_tx(tx) self.waiting_dialog(lambda: False if self.g.wallet.tx_event.isSet() else _("Sending transaction, please wait..."))