Merge pull request #111 from newtonick/qr_background_color

fix to support another output descriptor format
This commit is contained in:
SeedSigner
2021-10-19 15:21:26 -05:00
committed by GitHub
3 changed files with 11 additions and 5 deletions
+7 -2
View File
@@ -836,12 +836,17 @@ class Controller(Singleton):
if decoder2.isComplete() and decoder2.isWalletDescriptor():
desc_str = decoder2.getWalletDescriptor()
desc_str = desc_str.replace("\n","").replace(" ","")
try:
if len(re.findall(r'\[([0-9,a-f,A-F]+?)(\/[0-9,\/,h\']+?)\].*?(\/0\/\*)', desc_str)) > 0:
if len(re.findall (r'\[([0-9,a-f,A-F]+?)(\/[0-9,\/,h\']+?)\].*?(\/0\/\*)', desc_str)) > 0:
p = re.compile(r'(\[[0-9,a-f,A-F]+?\/[0-9,\/,h\']+?\].*?)(\/0\/\*)')
desc_str = p.sub(r'\1/{0,1}/*', desc_str)
elif len(re.findall (r'(\[[0-9,a-f,A-F]+?\/[0-9,\/,h,\']+?\][a-z,A-Z,0-9]*?)([\,,\)])', desc_str)) > 0:
p = re.compile(r'(\[[0-9,a-f,A-F]+?\/[0-9,\/,h,\']+?\][a-z,A-Z,0-9]*?)([\,,\)])')
desc_str = p.sub(r'\1/{0,1}/*\2', desc_str)
except:
desc_str = decoder2.getWalletDescriptor()
desc_str = decoder2.getWalletDescriptor()
print(desc_str)
desc = Descriptor.from_string(desc_str)
else:
return Path.MAIN_MENU
+3 -2
View File
@@ -255,10 +255,11 @@ class DecodeQR:
return QRType.PSBTBASE64
# Wallet Descriptor
elif re.search(r'^p(\d+)of(\d+) ', s, re.IGNORECASE):
desc_str = s.replace("\n","").replace(" ","")
if re.search(r'^p(\d+)of(\d+) ', s, re.IGNORECASE):
# when not a SPECTER Base64 PSBT from above, assume it's json
return QRType.SPECTERWALLETQR
elif re.search(r'^\{\"label\".*\"descriptor\"\:.*', s, re.IGNORECASE):
elif re.search(r'^\{\"label\".*\"descriptor\"\:.*', desc_str, re.IGNORECASE):
# if json starting with label and contains descriptor, assume specter wallet json
return QRType.SPECTERWALLETQR
+1 -1
View File
@@ -6,7 +6,7 @@ persistent_settings = False
[display]
text_color = ORANGE
qr_background_color = FFFFFF
camera_rotation = 180
camera_rotation = 0
[wallet]
network = main