From 6a1c8ecf62ecd6dfb138498765c634afe3e7497d Mon Sep 17 00:00:00 2001 From: Craig Everett Date: Fri, 17 Oct 2025 19:35:55 +0900 Subject: [PATCH] WIP --- src/gd_v_wallman.erl | 78 ++++++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 32 deletions(-) diff --git a/src/gd_v_wallman.erl b/src/gd_v_wallman.erl index cdf8514..ffb60f6 100644 --- a/src/gd_v_wallman.erl +++ b/src/gd_v_wallman.erl @@ -318,41 +318,55 @@ do_open2(Selected, State = #s{wallets = Wallets}) -> do_open3(Path, State = #s{frame = Frame, j = J}) -> Label = J("Password"), - Dialog = wxDialog:new(Frame, ?wxID_ANY, Label), - Sizer = wxBoxSizer:new(?wxVERTICAL), - PassSz = wxStaticBoxSizer:new(?wxVERTICAL, Dialog, [{label, Label}]), - PassTx = wxTextCtrl:new(Dialog, ?wxID_ANY, [{style, ?wxTE_PASSWORD}]), - _ = wxStaticBoxSizer:add(PassSz, PassTx, zxw:flags(wide)), - ButtSz = wxBoxSizer:new(?wxHORIZONTAL), - Affirm = wxButton:new(Dialog, ?wxID_OK), - _ = wxBoxSizer:add(ButtSz, Affirm, zxw:flags(wide)), - _ = wxBoxSizer:add(Sizer, PassSz, zxw:flags(base)), - _ = wxBoxSizer:add(Sizer, ButtSz, zxw:flags(wide)), - ok = wxDialog:setSizer(Dialog, Sizer), - ok = wxBoxSizer:layout(Sizer), - ok = wxDialog:setSize(Dialog, {500, 130}), - ok = wxDialog:center(Dialog), - ok = wxStyledTextCtrl:setFocus(PassTx), - case wxDialog:showModal(Dialog) of - ?wxID_OK -> - case wxTextCtrl:getValue(PassTx) of - "" -> - ok = wxDialog:destroy(Dialog), - ensure_shown(Frame); - Phrase -> - ok = wxDialog:destroy(Dialog), - case gd_con:open_wallet(Path, Phrase) of - ok -> - do_close(State); - Error -> - ok = ensure_shown(Frame), - trouble(Error) - end + case zxw_text_modal:show(Frame, Label, [{password, true}]) of + {ok, ""} -> + ensure_shown(Frame); + {ok, Phrase} -> + case gd_con:open_wallet(Path, Phrase) of + ok -> + do_close(State); + Error -> + ok = ensure_shown(Frame), + trouble(Error) end; - ?wxID_CANCEL -> - ok = wxDialog:destroy(Dialog), + cancel -> ensure_shown(Frame) end. +% Dialog = wxDialog:new(Frame, ?wxID_ANY, Label), +% Sizer = wxBoxSizer:new(?wxVERTICAL), +% PassSz = wxStaticBoxSizer:new(?wxVERTICAL, Dialog, [{label, Label}]), +% PassTx = wxTextCtrl:new(Dialog, ?wxID_ANY, [{style, ?wxTE_PASSWORD}]), +% _ = wxStaticBoxSizer:add(PassSz, PassTx, zxw:flags(wide)), +% ButtSz = wxBoxSizer:new(?wxHORIZONTAL), +% Affirm = wxButton:new(Dialog, ?wxID_OK), +% _ = wxBoxSizer:add(ButtSz, Affirm, zxw:flags(wide)), +% _ = wxBoxSizer:add(Sizer, PassSz, zxw:flags(base)), +% _ = wxBoxSizer:add(Sizer, ButtSz, zxw:flags(wide)), +% ok = wxDialog:setSizer(Dialog, Sizer), +% ok = wxBoxSizer:layout(Sizer), +% ok = wxDialog:setSize(Dialog, {500, 130}), +% ok = wxDialog:center(Dialog), +% ok = wxStyledTextCtrl:setFocus(PassTx), +% case wxDialog:showModal(Dialog) of +% ?wxID_OK -> +% case wxTextCtrl:getValue(PassTx) of +% "" -> +% ok = wxDialog:destroy(Dialog), +% ensure_shown(Frame); +% Phrase -> +% ok = wxDialog:destroy(Dialog), +% case gd_con:open_wallet(Path, Phrase) of +% ok -> +% do_close(State); +% Error -> +% ok = ensure_shown(Frame), +% trouble(Error) +% end +% end; +% ?wxID_CANCEL -> +% ok = wxDialog:destroy(Dialog), +% ensure_shown(Frame) +% end. do_wiz(State = #s{wx = WX, lang = Lang, wiz = none}) ->