Skip to content

Commit

Permalink
Fix NewWallet variable in PR #56 to MainWindow.NewWallet. Added destr…
Browse files Browse the repository at this point in the history
…oy Wallet screen upon creating a new wallet for Refresh.
  • Loading branch information
freQniK committed Nov 2, 2023
1 parent 8442040 commit 2d34649
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/typedef/konstants.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class IBCTokens():
#mu_coins = ["tsent", "udvpn", "uscrt", "uosmo", "uatom", "udec"]
class TextStrings():
dash = "-"
VERSION = "v0.14.0.7"
VERSION = "v0.14.1.0"

class MeileColors():
DIALOG_BG_COLOR = "#121212"
Expand Down
31 changes: 19 additions & 12 deletions src/ui/screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,31 @@ def build(self):
self.ids.restore_wallet_button.text = "Restore"

def restore_wallet_from_seed_phrase(self):
'''
wallet_password = unidecode(self.manager.get_screen(WindowNames.WALLET_RESTORE).ids.password.ids.wallet_password.text)
wallet_name = unidecode(self.manager.get_screen(WindowNames.WALLET_RESTORE).ids.name.ids.wallet_name.text)
seed_phrase = unidecode(self.manager.get_screen(WindowNames.WALLET_RESTORE).ids.seed.ids.seed_phrase.text)

'''

wallet_password = unidecode(self.ids.password.ids.wallet_password.text)
wallet_name = unidecode(self.ids.name.ids.wallet_name.text)
seed_phrase = unidecode(self.ids.seed.ids.seed_phrase.text)
if not wallet_name and not wallet_password:
'''
self.manager.get_screen(WindowNames.WALLET_RESTORE).ids.wallet_name_warning.opacity = 1
self.manager.get_screen(WindowNames.WALLET_RESTORE).ids.wallet_password_warning.opacity = 1
'''
self.ids.wallet_name_warning.opacity = 1
self.ids.wallet_password_warning.opacity = 1
return
elif not wallet_password:
self.manager.get_screen(WindowNames.WALLET_RESTORE).ids.wallet_password_warning.opacity = 1
self.ids.wallet_password_warning.opacity = 1
return
elif not wallet_name:
self.manager.get_screen(WindowNames.WALLET_RESTORE).ids.wallet_name_warning.opacity = 1
self.ids.wallet_name_warning.opacity = 1
return
elif len(wallet_password) < 8:
self.manager.get_screen(WindowNames.WALLET_RESTORE).ids.wallet_password_warning.opacity = 1
self.ids.wallet_password_warning.opacity = 1
return
else:
if not self.dialog:
Expand Down Expand Up @@ -144,9 +153,9 @@ def wallet_restore(self, inst):
except Exception as e:
print(str(e))

seed_phrase = unidecode(self.manager.get_screen(WindowNames.WALLET_RESTORE).ids.seed.ids.seed_phrase.text)
wallet_name = unidecode(self.manager.get_screen(WindowNames.WALLET_RESTORE).ids.name.ids.wallet_name.text)
keyring_passphrase = unidecode(self.manager.get_screen(WindowNames.WALLET_RESTORE).ids.password.ids.wallet_password.text)
seed_phrase = unidecode(self.ids.seed.ids.seed_phrase.text)
wallet_name = unidecode(self.ids.name.ids.wallet_name.text)
keyring_passphrase = unidecode(self.ids.password.ids.wallet_password.text)
if seed_phrase:
Wallet = hwf.create(wallet_name.lstrip().rstrip(),
keyring_passphrase.lstrip().rstrip(),
Expand Down Expand Up @@ -861,9 +870,6 @@ def __init__(self, ADDRESS, **kwargs):
print("WalletScreen, ADDRESS: %s" % self.ADDRESS)
self.wallet_address = self.ADDRESS

# This variable will be used by: open_wallet_restore_create
self.NewWallet = False

Clock.schedule_once(self.build)

def build(self, dt):
Expand Down Expand Up @@ -941,10 +947,11 @@ def destroy_wallet_open_wallet_dialog(self, _):

# duplicate of MainWindow.wallet_restore
def wallet_restore(self, new_wallet = False, _ = None):
# self.NewWallet will be read by WalletRestore in order to determine ui login
self.NewWallet = new_wallet
# Use Main_WIndow NewWallet boolean
Meile.app.manager.get_screen(WindowNames.MAIN_WINDOW).NewWallet = copy.deepcopy(new_wallet)
self.closeDialog(None) # arg is required (?)

Meile.app.root.remove_widget(self)
Meile.app.manager.add_widget(WalletRestore(name=WindowNames.WALLET_RESTORE))
Meile.app.root.transition = SlideTransition(direction = "right")
Meile.app.root.current = WindowNames.WALLET_RESTORE
Expand Down

0 comments on commit 2d34649

Please sign in to comment.