X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=lib%2Futil.py;h=0415b1ce2b693e39cef81197d7f7b2196927e848;hb=HEAD;hp=e734341387cd0d905e11d25a01d2166e71f75b8d;hpb=8ad7a5a08591a7306973660743e481f93cd80145;p=electrum-nvc.git diff --git a/lib/util.py b/lib/util.py index e734341..0415b1c 100644 --- a/lib/util.py +++ b/lib/util.py @@ -43,11 +43,11 @@ def print_json(obj): def user_dir(): if "HOME" in os.environ: - return os.path.join(os.environ["HOME"], ".electrum") + return os.path.join(os.environ["HOME"], ".electrum-nvc") elif "APPDATA" in os.environ: - return os.path.join(os.environ["APPDATA"], "Electrum") + return os.path.join(os.environ["APPDATA"], "Electrum-NVC") elif "LOCALAPPDATA" in os.environ: - return os.path.join(os.environ["LOCALAPPDATA"], "Electrum") + return os.path.join(os.environ["LOCALAPPDATA"], "Electrum-NVC") elif 'ANDROID_DATA' in os.environ: return "/sdcard/electrum/" else: @@ -57,15 +57,15 @@ def user_dir(): def appdata_dir(): """Find the path to the application data directory; add an electrum folder and return path.""" if platform.system() == "Windows": - return os.path.join(os.environ["APPDATA"], "Electrum") + return os.path.join(os.environ["APPDATA"], "Electrum-NVC") elif platform.system() == "Linux": - return os.path.join(sys.prefix, "share", "electrum") + return os.path.join(sys.prefix, "share", "electrum-nvc") elif (platform.system() == "Darwin" or platform.system() == "DragonFly" or platform.system() == "OpenBSD" or platform.system() == "FreeBSD" or platform.system() == "NetBSD"): - return "/Library/Application Support/Electrum" + return "/Library/Application Support/Electrum-NVC" else: raise Exception("Unknown system") @@ -82,7 +82,7 @@ def local_data_dir(): return local_data -def format_satoshis(x, is_diff=False, num_zeros = 0, decimal_point = 8, whitespaces=False): +def format_satoshis(x, is_diff=False, num_zeros = 0, decimal_point = 6, whitespaces=False): from decimal import Decimal s = Decimal(x) sign, digits, exp = s.as_tuple() @@ -159,7 +159,6 @@ def age(from_date, since_date = None, target_tz=None, include_seconds=False): def parse_URI(uri): import urlparse - import urllib import bitcoin from decimal import Decimal @@ -187,13 +186,13 @@ def parse_URI(uri): k = int(m.group(2)) - 8 amount = Decimal(m.group(1)) * pow( Decimal(10) , k) else: - amount = Decimal(am) * 100000000 + amount = Decimal(am) * 1000000 if 'message' in pq: message = pq['message'][0] if 'label' in pq: label = pq['label'][0] if 'r' in pq: - request_url = urllib.quote(pq['r'][0], '/:?') + request_url = pq['r'][0] if request_url != '': return address, amount, label, message, request_url