-
Notifications
You must be signed in to change notification settings - Fork 0
/
PKTWallet.py
3246 lines (2674 loc) · 131 KB
/
PKTWallet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (c) 2020 Vishnu J. Seesahai
# Use of this source code is governed by an MIT
# license that can be found in the LICENSE file.
from PyQt5 import QtWidgets, uic
from MainWindow import Ui_MainWindow
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from functools import partial
import os, sys, subprocess, json, threading, time, random, signal, traceback, re, psutil
import platform, transactions, estimate, ingest, signMultiSigTrans, sendMultiSigTrans, sendCombMultiSigTrans, fold, createWallet, getSeed, resync, peerinf
import balances, addresses, balanceAddresses, rpcworker, privkey, pubkey, password, wlltinf, send, time, datetime, genMultiSig, createMultiSigTrans, sendCombMultiSigTrans
from pixMp import *
from genAddress import *
from config import MIN_CONF, MAX_CONF
import qrcode
from pyzbar.pyzbar import decode
from PIL import Image
from shutil import copyfile
from pathlib import Path
from os import path
from rpcworker import progress_fn, thread_complete
# !!
import paramiko
from scp import SCPClient
CONNECTED = False
LOCAL_WALLET_PATH = "."
REMOTE_WALLET_PATH = "Wallets"
WALLET_NAME = "wallet.db"
WALLET_NAME_E = "wallet.db.gpg"
MAGIC_WALLET = False
WALLET_COPY = False
ssh = None
# !!
WAIT_SECONDS = 10
VERSION_NUM = "1.0.0"
AUTO_RESTART_WALLET = True
CREATE_NEW_WALLET = False
SHUTDOWN_CYCLE = False
WALLET_SYNCING = False
PKTD_SYNCING = False
COUNTER = 1
FEE = ".00000001"
STATUS_INTERVAL = 10
passphrase = ''
passphrase_ok = False
# Password visiblity toggle
password_shown = False
ver_password_shown = False
old_password_shown = False
new_password_shown = False
v_password_shown = False
pwd_action = None
ver_pwd_action = None
pwd_vsbl_icon = None
pwd_invsbl_icon = None
pwd_old_action = None
pwd_new_action = None
pwd_ver_action = None
def resource_path(relative_path):
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative_path)
return os.path.join(os.path.abspath('.'), relative_path)
# Check if pkt wallet sync in progress
def pktwllt_synching(info):
global WALLET_SYNCING
if info != {}:
status = (info["WalletStats"]["Syncing"])
WALLET_SYNCING = bool(status)
#print('WALLET_SYNCING',WALLET_SYNCING)
return WALLET_SYNCING
else:
print('Unable to get wallet status.\n')
WALLET_SYNCING = False
#print('WALLET_SYNCING',WALLET_SYNCING)
return WALLET_SYNCING
# Check if pktd sync in progress
def pktd_synching(info):
global PKTD_SYNCING
if info != {}:
status = (info["IsSyncing"])
PKTD_SYNCING = bool(status)
#print('PKTD_SYNCING',PKTD_SYNCING)
return PKTD_SYNCING
else:
print('Unable to get pktd status.\n')
PKTD_SYNCING = False
#print('PKTD_SYNCING',PKTD_SYNCING)
return PKTD_SYNCING
# Message box for wallet sync
def sync_msg(msg):
sync_msg_box = QtWidgets.QMessageBox()
sync_msg_box.setText(msg)
sync_msg_box.setWindowTitle('Sync Info')
sync_msg_box.setStandardButtons(QtWidgets.QMessageBox.Yes)
sync_ok_btn = sync_msg_box.button(QtWidgets.QMessageBox.Yes)
sync_ok_btn.setText("Ok")
sync_msg_box.exec()
# Add a new send recipient
class SendRcp(QtWidgets.QFrame):
def __init__(self, obj_num, item, item_nm, *args, **kwargs):
super(SendRcp, self).__init__(*args, **kwargs)
self.obj_num = obj_num
self.item = item
self.name = item_nm
self.setObjectName(self.name)
self.setStyleSheet("background-color: rgb(228, 234, 235); margin-bottom: 0px; margin-right: 0px")
self.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.setFrameShadow(QtWidgets.QFrame.Plain)
self.verticalLayout_21 = QtWidgets.QFormLayout(self)
self.verticalLayout_21.setObjectName("verticalLayout_21")
self.verticalLayout_21.setAlignment(Qt.AlignVCenter)
self.label_9 = QtWidgets.QLabel(self)
self.label_9.setStyleSheet("font: 75 15pt 'Gill Sans'; padding-bottom: 4px;")
self.label_9.setObjectName("label_9")
self.label_9.setText("Pay To:")
self.label_9.setAlignment(Qt.AlignLeft|Qt.AlignVCenter)
self.lineEdit_6 = QtWidgets.QLineEdit(self)
self.lineEdit_6.setMinimumSize(QSize(0, 35))
self.lineEdit_6.setMaximumSize(QSize(16777215, 35))
self.lineEdit_6.setStyleSheet("background-color: rgb(253, 253, 255); border: 1px solid rgb(210, 216, 216); border-radius: 4px;")
self.lineEdit_6.setObjectName("lineEdit_6")
self.lineEdit_6.setToolTip("Enter Address of Payee")
self.verticalLayout_21.addRow(self.label_9, self.lineEdit_6)
self.verticalLayout_21.setFormAlignment(Qt.AlignLeft)
self.verticalLayout_21.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
self.label_10 = QtWidgets.QLabel(self)
self.label_10.setStyleSheet("font: 75 15pt 'Gill Sans';padding-bottom: 4px;")
self.label_10.setObjectName("label_10")
self.label_10.setText("Amount:")
self.send_amt_input = QtWidgets.QLineEdit(self)
self.send_amt_input.setMinimumSize(QSize(0, 35))
self.send_amt_input.setMaximumSize(QSize(16777215, 35))
self.send_amt_input.setStyleSheet("background-color: rgb(253, 253, 255); border: 1px solid rgb(210, 216, 216); border-radius: 4px;")
self.send_amt_input.setToolTip("Enter Amount to Pay")
self.send_amt_input.setObjectName("send_amt_input")
self.verticalLayout_21.addRow(self.label_10, self.send_amt_input)
self.frme = QtWidgets.QFrame(self)
self.frme.setFrameShape(QtWidgets.QFrame.NoFrame)
self.frme.setMinimumHeight(5)
self.frme.setMaximumHeight(5)
self.del_rcp_1 = QtWidgets.QPushButton(self)
self.del_rcp_1.setObjectName("pushButton")
self.del_rcp_1.setText("Delete Recipient")
self.del_rcp_1.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
self.del_rcp_1.setMinimumHeight(40)
self.verticalLayout_21.addRow(self.frme, self.del_rcp_1)
self.del_rcp_1.clicked.connect(self.del_clicked)
def del_fields(self):
self.lineEdit_6.clear()
self.send_amt_input.clear()
def del_clicked(self):
self.lineEdit_6.clear()
self.send_amt_input.clear() #sdfsd
class_id = self.name.split('_')[0]
chld_num = window.rcp_list.count() if (class_id == 'send') else window.rcp_list_2.count()
if chld_num > 1 and class_id == 'send':
window.rcp_list.removeItemWidget(self.item)
window.rcp_list.takeItem(window.rcp_list.row(self.item))
window.rcp_list.update()
rcp_list_dict.pop(self.name)
try:
if pay_dict:
pay_dict.pop(self.lineEdit_6.text())
except:
print('unable to pop pay_dict', pay_dict)
elif chld_num > 1 and class_id == 'multisig':
window.rcp_list_2.removeItemWidget(self.item)
window.rcp_list_2.takeItem(window.rcp_list_2.row(self.item))
window.rcp_list_2.update()
rcp_list_dict2.pop(self.name)
try:
if pay_dict2:
pay_dict2.pop(self.lineEdit_6.text())
except:
print('unable to pop pay_dict2', pay_dict2)
# Add a new public key entry field to multisig create
class PKLine(QtWidgets.QFrame):
def __init__(self, obj_num, item, *args, **kwargs):
super(PKLine, self).__init__(*args, **kwargs)
self.item = item
self.name = 'm_pkline_' + obj_num
self.setObjectName(self.name)
# New lineEdit
self.pk_line = QtWidgets.QLineEdit(self)
self.pk_line.setObjectName("pk_line_"+obj_num)
self.pk_line.setStyleSheet("QLineEdit {background-color: rgb(253, 253, 255);}")
self.pk_line.setMinimumHeight(40)
# Del button
self.del_btn = QtWidgets.QPushButton(self)
self.del_btn.setObjectName("del_btn_"+obj_num)
self.del_btn.setText("delete")
self.del_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 16pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 16pt 'Futura'; background-color: #022D93; color: #FF6600;}")
self.del_btn.setMinimumSize(60, 40)
# Form layout
self.form_layout = QtWidgets.QGridLayout(self)
self.form_layout.addWidget(self.pk_line, 0, 0, 1, 1)
self.form_layout.addWidget(self.del_btn, 0, 1, 1, 1)
self.del_btn.clicked.connect(self.del_clicked)
def del_clicked(self):
chld_num = window.multisig_list.count()
if chld_num > 1:
if pk_list_dict:
pk_list_dict.pop(self.name)
window.multisig_list.removeItemWidget(self.item)
window.multisig_list.takeItem(window.multisig_list.row(self.item))
window.multisig_list.update()
class SideMenuBtn(QtWidgets.QPushButton):
def __init__(self, obj_name, obj_text, icon_name, ttip, *args, **kwargs):
super(SideMenuBtn, self).__init__(*args, **kwargs)
self.text = obj_text
self.name = obj_name
self.icon_name = icon_name
self.icon = icons[self.icon_name]
self.ttip = ttip
self.setText(self.text)
self.setObjectName(self.name)
self.setIcon(QIcon(self.icon))
self.setIconSize(QSize(70,25))
self.setStyleSheet("QPushButton#"+self.name+"{border-radius: 3px; border: 1px solid #D6E4FF; color: #D6E4FF; font: 57 20pt 'Futura'; text-align: left;} QToolTip { color: #000; background-color: #fff; border: none; }")
self.setMaximumSize(QSize(16777215,50))
self.setMinimumSize(QSize(16777215,50))
self.setToolTip(_translate("MainWindow", self.ttip))
def mousePressEvent(self, event):
self.setText(self.text)
self.setObjectName(self.name)
self.alt_name = self.icon_name + '2'
self.icon2 = icons[self.alt_name]
self.setIcon(QIcon(self.icon2))
self.setIconSize(QSize(70,25))
self.setStyleSheet("QPushButton#"+self.name+" {border-radius: 3px; border: 1px solid #FF6600; color: #FF6600; font: 57 20pt 'Futura'; background-color: #022D93; text-align: left;} QToolTip { color: #000; background-color: #fff; border: none; }")
self.setMaximumSize(QSize(16777215,50))
self.setMinimumSize(QSize(16777215,50))
def mouseReleaseEvent(self, event):
self.setText(self.text)
self.setObjectName(self.name)
self.setIcon(QIcon(self.icon))
self.setIconSize(QSize(70,25))
self.setStyleSheet("QPushButton#"+self.name+" {border-radius: 3px; border: 1px solid #D6E4FF; color: #D6E4FF; font: 57 20pt 'Futura'; text-align: left;} QToolTip { color: #000; background-color: #fff; border: none; }")
self.setMaximumSize(QSize(16777215,50))
self.setMinimumSize(QSize(16777215,50))
side_menu_clicked(self)
def side_menu_clicked(btn):
if btn.objectName().strip() == 'Balances':
i = window.stackedWidget.indexOf(window.balance_page)
show_balance()
add_addresses(['balances'])
window.stackedWidget.setCurrentIndex(i)
elif btn.objectName().strip() == 'Send':
window.label_6.clear()
i = window.stackedWidget.indexOf(window.send_page)
init_send_rcp()
set_fee_est()
window.stackedWidget.setCurrentIndex(i)
elif btn.objectName().strip() == 'Magic':
print("Detecting magic wallet...\n")
dct_msg_box = QtWidgets.QMessageBox()
dct_msg_box.setText("Attach your magic wallet and click \"Connect\" to connect it.\n")
dct_msg_box.setInformativeText("If your wallet is attached to your computer, you may need to wait a minute and click the magic button again to connect to it.\n")
dct_msg_box.setStandardButtons(QtWidgets.QMessageBox.Ok)
dct_msg_btn = dct_msg_box.button(QtWidgets.QMessageBox.Ok)
dct_msg_btn.setText("Connect")
dct_msg_box.exec()
detect_magic_wllt(QtWidgets)
elif btn.objectName().strip() == 'Receive':
i = window.stackedWidget.indexOf(window.receive_page)
window.receive_amt_line.clear()
window.receive_hist_tree2.clear()
window.msg_line.clear()
window.label_26.clear()
window.stackedWidget.setCurrentIndex(i)
elif btn.objectName().strip() == 'Transactions':
global iteration
i = window.stackedWidget.indexOf(window.transactions_page)
iteration = 0
item_0 = QtWidgets.QTreeWidgetItem(window.transaction_hist_tree)
font = QFont()
font.setFamily("Gill Sans")
font.setPointSize(15)
item_0.setFont(0, font)
if pktd_synching(wlltinf.get_inf(uname, pwd)):
sync_msg("Transactions aren\'t available until wallet has completely sync\'d")
else:
get_transactions()
window.stackedWidget.setCurrentIndex(i)
def get_transactions():
global iteration
try:
transactions.history(uname, pwd, iteration, window, worker_state_active, threadpool)
iteration += 1
except:
msg = "Unable to get transactions. \n\nHave any transactions been executed?"
trns_msg_box = QtWidgets.QMessageBox()
trns_msg_box.setWindowTitle("Transaction History Failed")
trns_msg_box.setText(msg)
trns_msg_box.exec()
print('Unable to get transactions\n')
def show_balance():
info = wlltinf.get_inf(uname, pwd)
if pktd_synching(info):
sync_msg("Wallet daemon is currently syncing. Some features may not work until sync is complete.")
elif pktwllt_synching(info):
sync_msg('Wallet is currently synching to chain. Some balances may be inaccurate until chain sync\'s fully.')
print("Getting balance...")
window.balance_amount.clear()
worker_state_active['GET_BALANCE'] = False
total_balance = balances.get_balance_thd(uname, pwd, window, worker_state_active, threadpool)
def set_fee_est():
global FEE
estimate.fee(uname, pwd, window, FEE, worker_state_active, threadpool)
# Append addresses to list
def add_addresses(type):
for item in type:
if item == "balances" or item == "all":
if WALLET_SYNCING:
sync_msg('Wallet is synching, balances will take a while to return.')
elif PKTD_SYNCING:
sync_msg('Wallet is synching, balances will take a while to return.')
# Add loading message
load_label= QtWidgets.QLabel()
load_label.setStyleSheet("font: 15pt \'Gill Sans\'; padding-bottom: 4px; text-align: center;")
load_label.setText("Addresses loading please wait...")
load_label.setAlignment(Qt.AlignHCenter|Qt.AlignVCenter)
balanceAddresses.get_addresses(uname, pwd, window, item, worker_state_active, threadpool)
elif item == "addresses":
addresses.get_addresses(uname, pwd, window, item, worker_state_active, threadpool)
def get_priv_key(address, passphrase):
# Get private key
privkey.get_key(uname, pwd, address, passphrase, window, worker_state_active, threadpool)
def get_pub_key(address):
# Get private key
pubkey.get_key(uname, pwd, address, window, worker_state_active, threadpool)
# !!
def change_pass(old_pass, new_pass):
# Attempt to change password.
global passphrase
passphrase = ""
success = False
if path.exists(get_correct_path(".magic.cfg")):
if not (MAGIC_WALLET and CONNECTED and ssh):
# Ask user to attach and connect to wallet before attempting to change password
pwd_chg_msg_box = QtWidgets.QMessageBox()
pwd_chg_msg = 'It seems you own a magic wallet. Make sure it\'s attached and click the "Magic" button connect it.'
pwd_chg_msg_box.setText(pwd_chg_msg)
pwd_chg_msg_box.exec()
else:
if not (old_pass == new_pass):
print("About to change local password... \n")
password.change(uname, pwd, old_pass, new_pass, window, worker_state_active, threadpool, True)
print("Changed wallet password... \n")
res = change_mgk_passphrase(new_pass, ssh)
if res:
print("Changed magic password... \n")
passphrase = new_pass
success = True
else:
password.change(uname, pwd, old_pass, new_pass, window, worker_state_active, threadpool, False)
passphrase = new_pass
success = True
return success
# Additional customizations
def add_custom_styles():
global pwd_action, ver_pwd_action, pwd_vsbl_icon, pwd_invsbl_icon, pwd_old_action, pwd_new_action, pwd_ver_action
window.label_25.setPixmap(QPixmap(resource_path('img/app_icon.png')))
# Password visiblity toggle
pwd_vsbl_icon = QIcon(QPixmap(resource_path('img/glyphicons_051_eye_open.png')))
pwd_invsbl_icon = QIcon(QPixmap(resource_path('img/glyphicons_052_eye_close.png')))
pwd_action = window.lineEdit_2.addAction(pwd_vsbl_icon, QtWidgets.QLineEdit.TrailingPosition)
ver_pwd_action = window.lineEdit_11.addAction(pwd_vsbl_icon, QtWidgets.QLineEdit.TrailingPosition)
pwd_old_action = window.lineEdit_10.addAction(pwd_vsbl_icon, QtWidgets.QLineEdit.TrailingPosition)
pwd_new_action = window.lineEdit_4.addAction(pwd_vsbl_icon, QtWidgets.QLineEdit.TrailingPosition)
pwd_ver_action = window.lineEdit_5.addAction(pwd_vsbl_icon, QtWidgets.QLineEdit.TrailingPosition)
# Frame customizations
window.send_exec_group.setStyleSheet("QGroupBox#send_exec_group {border-radius: 5px; background-color: rgb(228, 234, 235);}")
window.send_exec_group.setMinimumHeight(73)
window.send_exec_group.setMaximumHeight(73)
# Button cusomizations
window.clear_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.clear_btn.setMinimumSize(50, 40)
window.fold_btn_1.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.fold_btn_1.setMinimumSize(80, 40)
#window.fold_again_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
#window.fold_again_btn.setMinimumSize(80, 40)
window.snd_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.snd_btn.setMinimumSize(50, 40)
window.add_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.add_btn.setMinimumSize(50, 40)
window.multi_clear_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.multi_clear_btn.setMinimumSize(50, 40)
window.fee_est2_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.fee_est2_btn.setMinimumSize(100, 40)
window.fee_est_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.fee_est_btn.setMinimumSize(100, 40)
window.import_keys_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.import_keys_btn.setMinimumSize(80, 40)
window.multi_add_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.multi_add_btn.setMinimumSize(50, 40)
window.multi_create_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.multi_create_btn.setMinimumSize(50, 40)
window.multi_sign_btn2.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.multi_sign_btn2.setMinimumSize(50, 40)
window.multi_sign_btn3.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.multi_sign_btn3.setMinimumSize(50, 40)
window.multi_sign_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.multi_sign_btn.setMinimumSize(160, 40)
window.import_trans_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.import_trans_btn.setMinimumSize(160, 40)
window.multi_send_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.multi_send_btn.setMinimumSize(160, 40)
window.combine_trans_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.combine_trans_btn.setMinimumSize(180, 40)
window.add_trns_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.add_trns_btn.setMinimumSize(180, 40)
window.comb_clear_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.comb_clear_btn.setMinimumSize(180, 40)
window.combine_send_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.combine_send_btn.setMinimumSize(180, 40)
window.rtr_pubk_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.rtr_pubk_btn.setFixedSize(180, 40)
window.rtr_prvk_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.rtr_prvk_btn.setFixedSize(180, 40)
window.file_loc_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.file_loc_btn.setFixedSize(100, 40)
window.multi_create_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.multi_create_btn.setMinimumSize(100, 40)
window.address_gen_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.address_gen_btn.setFixedSize(100, 40)
window.multi_qr_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.multi_qr_btn.setFixedSize(100, 40)
window.address_gen_btn2.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.address_gen_btn2.setMinimumHeight(40)
window.all_addr_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.all_addr_btn.setMinimumHeight(40)
window.bal_addr_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.bal_addr_btn.setMinimumHeight(40)
window.receive_rqst_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.receive_rqst_btn.setFixedSize(200, 40)
window.multisig_gen_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.multisig_gen_btn.setFixedSize(100, 40)
window.add_multisig_pk_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.add_multisig_pk_btn.setFixedSize(140, 40)
window.pwd_ok_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.pwd_ok_btn.setMinimumSize(50, 40)
window.pwd_cancel_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.pwd_cancel_btn.setMinimumSize(50, 40)
window.sign_dec_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.sign_dec_btn.setMinimumSize(50, 40)
window.sign_enc_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.sign_enc_btn.setMinimumSize(50, 40)
window.load_trns_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.load_trns_btn.setFixedSize(100, 40)
window.wllt_cr8_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.wllt_cr8_btn.setFixedSize(120, 40)
window.passphrase_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.passphrase_btn.setFixedSize(120, 40)
window.seed_next_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.seed_next_btn.setMinimumSize(150, 40)
window.no_seed_next_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.no_seed_next_btn.setMinimumSize(150, 40)
window.open_wllt_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.open_wllt_btn.setFixedSize(100, 40)
window.recalc_btn.setStyleSheet("QPushButton {border-radius: 5px; border: 1px solid rgb(2, 45, 147); font: 57 14pt 'Futura';} QPushButton:pressed {border-radius: 5px; border: 1px solid #FF6600; font: 57 14pt 'Futura'; background-color: #022D93; color: #FF6600;}")
window.recalc_btn.setFixedSize(100, 25)
# Listen for static buttons
def button_listeners():
window.snd_btn.clicked.connect(btn_released)
window.clear_btn.clicked.connect(btn_released)
window.multi_clear_btn.clicked.connect(btn_released)
window.fee_est2_btn.clicked.connect(btn_released)
window.fee_est_btn.clicked.connect(btn_released)
window.add_btn.clicked.connect(btn_released)
window.add_multisig_pk_btn.clicked.connect(btn_released)
window.multi_add_btn.clicked.connect(btn_released)
window.address_gen_btn.clicked.connect(btn_released)
window.address_gen_btn2.clicked.connect(btn_released)
window.all_addr_btn.clicked.connect(btn_released)
window.bal_addr_btn.clicked.connect(btn_released)
window.multi_create_btn.clicked.connect(btn_released)
window.multi_sign_btn2.clicked.connect(btn_released)
window.multi_sign_btn3.clicked.connect(btn_released)
window.import_trans_btn.clicked.connect(btn_released)
window.combine_trans_btn.clicked.connect(btn_released)
window.combine_send_btn.clicked.connect(btn_released)
window.multi_sign_btn.clicked.connect(btn_released)
window.add_trns_btn.clicked.connect(btn_released)
window.comb_clear_btn.clicked.connect(btn_released)
window.fold_btn_1.clicked.connect(btn_released)
#window.fold_again_btn.clicked.connect(btn_released)
window.multi_send_btn.clicked.connect(btn_released)
window.rtr_prvk_btn.clicked.connect(btn_released)
window.rtr_pubk_btn.clicked.connect(btn_released)
window.pwd_cancel_btn.clicked.connect(btn_released)
window.pwd_ok_btn.clicked.connect(btn_released)
window.load_trns_btn.clicked.connect(btn_released)
window.import_keys_btn.clicked.connect(btn_released)
window.receive_rqst_btn.clicked.connect(btn_released)
window.multisig_gen_btn.clicked.connect(btn_released)
window.multi_qr_btn.clicked.connect(btn_released)
window.wllt_cr8_btn.clicked.connect(btn_released)
window.passphrase_btn.clicked.connect(btn_released)
window.seed_next_btn.clicked.connect(btn_released)
window.no_seed_next_btn.clicked.connect(btn_released)
window.open_wllt_btn.clicked.connect(btn_released)
window.recalc_btn.clicked.connect(btn_released)
# Menu listeners
def menubar_listeners():
window.actionAddress_2.triggered.connect(menubar_released)
window.actionMultiSig_Address.triggered.connect(menubar_released)
window.actionCreate_Transaction.triggered.connect(menubar_released)
window.actionPassword.triggered.connect(menubar_released)
window.actionPay_to_Many.triggered.connect(menubar_released)
window.actionSign_Verify_Message.triggered.connect(menubar_released)
window.actionCombine_Multisig_Transactions.triggered.connect(menubar_released)
window.actionExport_Private_Key.triggered.connect(menubar_released)
window.actionImport_Keys.triggered.connect(menubar_released)
window.actionDelete.triggered.connect(menubar_released)
window.actionInformation_2.triggered.connect(menubar_released)
window.actionGet_Public_Key.triggered.connect(menubar_released)
window.actionEncrypt_Decrypt_Message.triggered.connect(menubar_released)
window.actionSave.triggered.connect(menubar_released)
window.actionGet_Private_Key.triggered.connect(menubar_released)
window.actionSeed.triggered.connect(menubar_released)
window.actionFrom_Text_2.triggered.connect(menubar_released)
window.actionFrom_QR_Code.triggered.connect(menubar_released)
window.actionFold_Address.triggered.connect(menubar_released)
window.actionWebsite.triggered.connect(menubar_released)
window.actionManual_Resync.triggered.connect(menubar_released)
app.aboutToQuit.connect(quit_app)
pwd_action.triggered.connect(on_toggle_password_action)
ver_pwd_action.triggered.connect(on_toggle_ver_password_action)
pwd_old_action.triggered.connect(on_toggle_old_password_action)
pwd_new_action.triggered.connect(on_toggle_new_password_action)
pwd_ver_action.triggered.connect(on_toggle_v_password_action)
def on_toggle_password_action(self):
global password_shown
if not password_shown:
window.lineEdit_2.setEchoMode(QtWidgets.QLineEdit.Normal)
password_shown = True
pwd_action.setIcon(pwd_invsbl_icon)
else:
window.lineEdit_2.setEchoMode(QtWidgets.QLineEdit.Password)
password_shown = False
pwd_action.setIcon(pwd_vsbl_icon)
def on_toggle_ver_password_action(self):
global ver_password_shown
if not ver_password_shown:
window.lineEdit_11.setEchoMode(QtWidgets.QLineEdit.Normal)
ver_password_shown = True
ver_pwd_action.setIcon(pwd_invsbl_icon)
else:
window.lineEdit_11.setEchoMode(QtWidgets.QLineEdit.Password)
ver_password_shown = False
ver_pwd_action.setIcon(pwd_vsbl_icon)
def on_toggle_old_password_action(self):
global old_password_shown
if not old_password_shown:
window.lineEdit_10.setEchoMode(QtWidgets.QLineEdit.Normal)
old_password_shown = True
pwd_old_action.setIcon(pwd_invsbl_icon)
else:
window.lineEdit_10.setEchoMode(QtWidgets.QLineEdit.Password)
old_password_shown = False
pwd_old_action.setIcon(pwd_vsbl_icon)
def on_toggle_new_password_action(self):
global new_password_shown
print("toggle new", new_password_shown)
if not new_password_shown:
window.lineEdit_4.setEchoMode(QtWidgets.QLineEdit.Normal)
new_password_shown = True
pwd_new_action.setIcon(pwd_invsbl_icon)
else:
window.lineEdit_4.setEchoMode(QtWidgets.QLineEdit.Password)
new_password_shown = False
pwd_new_action.setIcon(pwd_vsbl_icon)
def on_toggle_v_password_action(self):
global v_password_shown
if not v_password_shown:
window.lineEdit_5.setEchoMode(QtWidgets.QLineEdit.Normal)
v_password_shown = True
pwd_ver_action.setIcon(pwd_invsbl_icon)
else:
window.lineEdit_5.setEchoMode(QtWidgets.QLineEdit.Password)
v_password_shown = False
pwd_ver_action.setIcon(pwd_vsbl_icon)
class CustomInputDialog(QtWidgets.QDialog):
def __init__(self, *args, **kwargs):
super(CustomInputDialog, self).__init__(*args, **kwargs)
self.pass_shown = False
self.passphrase = None
self.type = type
self.label = QtWidgets.QLabel(self)
'''
if SHUTDOWN_CYCLE:
self.label.setText("Backing up your wallet...\n\nPlease enter your wallet passphrase:")
else:
self.label.setText("Please enter your wallet passphrase:")
'''
self.label.setText("Please enter your wallet passphrase:")
self.label.setStyleSheet("font: 14pt Bold 'Gill Sans'")
self.setWindowTitle("Wallet Passphrase")
self.line = QtWidgets.QLineEdit(self)
self.line_action = self.line.addAction(pwd_vsbl_icon, QtWidgets.QLineEdit.TrailingPosition)
self.line.setEchoMode(QtWidgets.QLineEdit.Password)
self.line.setFixedWidth(200)
self.cncl_btn = QtWidgets.QPushButton(self)
self.cncl_btn.setObjectName("cncl_btn")
self.cncl_btn.setText("Cancel")
self.cncl_btn.setFixedWidth(80)
self.ok_btn = QtWidgets.QPushButton(self)
self.ok_btn.setObjectName("ok_btn")
self.ok_btn.setText("Ok")
self.ok_btn.setDefault(True)
self.ok_btn.setFixedWidth(80)
self.form_layout = QtWidgets.QGridLayout(self)
self.form_layout.addWidget(self.label, 0, 0, 1, 1)
self.form_layout.addWidget(self.line, 1, 0, 1, 1)
self.frame = QtWidgets.QFrame(self)
self.sub_form_layout = QtWidgets.QGridLayout(self.frame)
self.sub_form_layout.addWidget(self.cncl_btn, 0, 0, 1, 1)
self.sub_form_layout.addWidget(self.ok_btn, 0, 1, 1, 1)
self.form_layout.addWidget(self.frame, 2, 0, 1, 1)
# Actions
self.cncl_btn.clicked.connect(self.cncl_clicked)
self.ok_btn.clicked.connect(self.ok_clicked)
self.line_action.triggered.connect(self.toggle_clicked)
def cncl_clicked(self):
self.passphrase = None
self.close()
def ok_clicked(self):
passphrase = self.line.text()
self.passphrase = passphrase
self.close()
def toggle_clicked(self):
if not self.pass_shown:
self.line.setEchoMode(QtWidgets.QLineEdit.Normal)
self.pass_shown = True
self.line_action.setIcon(pwd_invsbl_icon)
else:
self.line.setEchoMode(QtWidgets.QLineEdit.Password)
self.pass_shown = False
self.line_action.setIcon(pwd_vsbl_icon)
def get_pass():
global passphrase, passphrase_ok
passphrase = ""
ok = passphrase_ok
dialog = CustomInputDialog()
dialog.exec()
passphrase = dialog.passphrase
if passphrase and not passphrase_ok:
# see if passphrase is valid, we are using the same passphrase for the wallet.
try:
cmd = "bin/pktctl -u "+ uname +" -P "+ pwd +" --wallet walletpassphrase " + passphrase + ' 1000'
result, err = (subprocess.Popen(resource_path(cmd), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate())
result = result.decode('utf-8')
err = err.decode('utf-8')
if not err:
ok = True
passphrase_ok = ok
try:
lock = "bin/pktctl -u "+ uname +" -P "+ pwd +" --wallet walletlock"
result_lock, err_lock = subprocess.Popen(resource_path(lock), shell=True, stdout=subprocess.PIPE).communicate()
except:
print("Wallet lock failed.\n")
else:
passphrase = ""
bad_pass()
except:
print("Passphrase failed.\n")
passphrase = ""
bad_pass()
elif passphrase and passphrase_ok:
ok = passphrase_ok
else:
passphrase = ""
ok = False
passphrase_ok = ok
return passphrase, ok
def bad_pass():
pwd_msg = "The password you entered is incorrect."
pwd_msg_box = QtWidgets.QMessageBox()
pwd_msg_box.setText(pwd_msg)
pwd_msg_box.exec()
# Quit app
def quit_app():
global SHUTDOWN_CYCLE
SHUTDOWN_CYCLE = True
exit_handler()
# Handler for menu item click
def btn_released(self):
global FEE, passphrase
clicked_widget = window.sender()
#print('pressed button:', clicked_widget.objectName())
if clicked_widget.objectName() == 'add_multisig_pk_btn':
#print('add new pk line here')
if window.multisig_list.count() < 12:
item_num = window.multisig_list.count() + 1
item_line_N = QtWidgets.QListWidgetItem(window.multisig_list)
item_line_N.setSizeHint(QSize(window.multisig_list.width() - 30, 60))
window.multisig_list.addItem(item_line_N)
item_nm = "m_pkline_"+ str(item_num)
vars()[item_nm] = PKLine(str(item_num), item_line_N)
window.multisig_list.setItemWidget(item_line_N, vars()[item_nm])
pk_list_dict[item_nm] = vars()[item_nm]
elif clicked_widget.objectName() == 'multisig_gen_btn':
global pk_arr, pk_count
pk_arr = []
for val in list(pk_list_dict.values()):
itm = val.pk_line.text().strip()
if itm:
pk_arr.append(itm)
pk_count = int(window.sig_box.currentText())
msg_box_16 = QtWidgets.QMessageBox()
print('Key count:', len(pk_arr), pk_count)
if len(pk_arr) >= pk_count:
print("Correct number of public keys entered.")
for i, item in enumerate(pk_arr):
if not item:
msg = "All public keys must be valid. Delete any extra input fields you don't need."
msg_box_16.setText(msg)
msg_box_16.exec()
return
#Get passphrase
if passphrase == '':
passphrase, ok = get_pass()
else:
ok = True
if ok:
msg = "Create new multisig address?"
msg_box_16.setText(msg)
msg_box_16.exec()
genMultiSig.create(uname, pwd, window, pk_count, pk_arr, passphrase, worker_state_active, threadpool)
else:
msg = "Incorrect number of public keys."
msg_box_16.setText(msg)
msg_box_16.exec()
print("Incorrect number of public keys.")
elif clicked_widget.objectName() == 'add_trns_btn':
import_qr2()
elif clicked_widget.objectName() == 'comb_clear_btn':
clear_comb()
elif clicked_widget.objectName() == 'clear_btn':
clear_send_rcp()
elif clicked_widget.objectName() == 'multi_clear_btn':
clear_multi_rcp()
elif clicked_widget.objectName() == 'fee_est_btn':
set_fee_est()
elif clicked_widget.objectName() == 'fee_est2_btn':
set_fee_est()
elif clicked_widget.objectName() == 'wllt_cr8_btn':
window.lineEdit_2.clear()
window.lineEdit_11.clear()
i = window.stackedWidget.indexOf(window.wllt_pwd_page)
window.stackedWidget.setCurrentIndex(i)
elif clicked_widget.objectName() == 'passphrase_btn':
global wllt_pass
wllt_pass = window.lineEdit_2.text().strip()
wllt_pass_conf = window.lineEdit_11.text().strip()
if not (wllt_pass or wllt_pass_conf):
wllt_pass = ''
wll_pass_conf = ''
msg_box_24 = QtWidgets.QMessageBox()
msg_box_24.setText('You must enter both a password and a confirmation.')
msg_box_24.exec()
return
if wllt_pass == wllt_pass_conf:
msg = ''
if len(wllt_pass) < 8:
msg = "Make sure your password is at least 8 letters"
elif re.search('[0-9]',wllt_pass) is None:
msg = "Make sure your password has a number in it"
elif re.search('[A-Z]',wllt_pass) is None:
msg = "Make sure your password has a capital letter in it"
if msg:
msg_box_24 = QtWidgets.QMessageBox()
msg_box_24.setText(msg)
msg_box_24.exec()
return
window.imprt_seed_txt.clear()
window.old_pass_line.clear()
i = window.stackedWidget.indexOf(window.imprt_seed_page)
window.stackedWidget.setCurrentIndex(i)
imp_msg_box = QtWidgets.QMessageBox()
text = "Select \"Continue Without Seed\" if you are not importing a previous wallet seed."
imp_msg_box.setText(text)
imp_msg_box.setWindowTitle("Notification")
ret = imp_msg_box.exec()
else:
wllt_pass = ''
wll_pass_conf = ''
msg_box_24 = QtWidgets.QMessageBox()
msg_box_24.setText('Password and password confirmation do not match.')
msg_box_24.exec()
elif clicked_widget.objectName() == 'no_seed_next_btn':
try:
pp = wllt_pass
window.seed_txt.clear()
seed = createWallet.execute(uname,pwd, pp)["seed"]
window.seed_txt.setText(seed)
i = window.stackedWidget.indexOf(window.wllt_done_page)
window.stackedWidget.setCurrentIndex(i)
except:
seed_msg_box = QtWidgets.QMessageBox()
seed_msg_box.setText('Your wallet could not be created. Verify seed and/or old password.')
seed_msg_box.exec()
elif clicked_widget.objectName() == 'seed_next_btn':
pp = wllt_pass
seed_entry = window.imprt_seed_txt.toPlainText().strip()
old_pass_line = window.old_pass_line.text().strip()
if not old_pass_line:
seed_msg_box = QtWidgets.QMessageBox()
seed_msg_box.setText('You failed to enter your old password.')
seed_msg_box.exec()
return
try:
seed = createWallet.seed_execute(uname, pwd, pp, old_pass_line, seed_entry)["seed"]
if not seed:
seed_msg_box = QtWidgets.QMessageBox()
seed_msg_box.setText('Your wallet could not be created. Verify seed and/or old password.')
seed_msg_box.exec()
else:
window.seed_txt.setText(seed)
i = window.stackedWidget.indexOf(window.wllt_done_page)
window.stackedWidget.setCurrentIndex(i)
except:
seed_msg_box = QtWidgets.QMessageBox()
seed_msg_box.setText('Your wallet could not be created. Verify seed and/or old password.')
seed_msg_box.exec()