10 def print_error(*args):
11 if not is_verbose: return
13 args = [str(item) for item in args]
14 sys.stderr.write(" ".join(args) + "\n")
19 if "HOME" in os.environ:
20 return os.path.join(os.environ["HOME"], ".electrum")
21 elif "LOCALAPPDATA" in os.environ:
22 return os.path.join(os.environ["LOCALAPPDATA"], "Electrum")
23 elif "APPDATA" in os.environ:
24 return os.path.join(os.environ["APPDATA"], "Electrum")
26 raise BaseException("No home directory found in environment variables.")
30 """Find the path to the application data directory; add an electrum folder and return path."""
31 if platform.system() == "Windows":
32 return os.path.join(os.environ["APPDATA"], "Electrum")
33 elif platform.system() == "Linux":
34 return os.path.join(sys.prefix, "share", "electrum")
35 elif (platform.system() == "Darwin" or
36 platform.system() == "DragonFly"):
37 return "/Library/Application Support/Electrum"
39 raise Exception("Unknown system")
42 def get_resource_path(*args):
43 return os.path.join(".", *args)
47 """Return path to the data folder."""
49 prefix_path = os.path.dirname(sys.argv[0])
50 local_data = os.path.join(prefix_path, "data")
54 def format_satoshis(x, is_diff=False, num_zeros = 0):
55 from decimal import Decimal
57 sign, digits, exp = s.as_tuple()
58 digits = map(str, digits)
59 while len(digits) < 9:
62 s = ''.join(digits).rstrip('0')
69 s += "0"*( 1 + num_zeros - ( len(s) - p ))
70 s += " "*( 9 - ( len(s) - p ))
71 s = " "*( 5 - ( p )) + s