WIP
This commit is contained in:
parent
acd84d65a8
commit
a4db8d9a95
@ -54,7 +54,7 @@ mono_text(Parent, Name, Value) ->
|
||||
ok =
|
||||
case wxStaticText:setFont(Text, Font) of
|
||||
true -> ok;
|
||||
false -> log(info, "wxStaticText ~p is already monospace.", [Text)
|
||||
false -> tell(info, "wxStaticText ~p is already monospace.", [Text)
|
||||
end,
|
||||
#w{name = Name, id = wxStaticText:getId(Text), wx = Text}.
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
build = none :: none | map(),
|
||||
args = [] :: [#w{}],
|
||||
kp = #w{} :: #w{},
|
||||
params = [] :: [param()],
|
||||
ttl = #w{} :: #w{},
|
||||
gasprice = #w{} :: #w{},
|
||||
gas = #w{} :: #w{},
|
||||
@ -43,6 +44,7 @@
|
||||
-type fun_name() :: string().
|
||||
-type fun_type() :: call | dryr | init.
|
||||
-type fun_def() :: {fun_name(), fun_type()}.
|
||||
-type param() :: {Label :: string(), Check :: fun(), #w{}}.
|
||||
|
||||
|
||||
%%% Interface
|
||||
@ -247,7 +249,7 @@ handle_troubling(State = #s{frame = Frame}, Info) ->
|
||||
State.
|
||||
|
||||
|
||||
engage(State = #s{j = J}) ->
|
||||
engage(State) ->
|
||||
case gd_con:chain_id() of
|
||||
{ok, ChainID} -> engage(State, ChainID);
|
||||
Error -> handle_troubling(State, Error)
|
||||
@ -285,23 +287,28 @@ params(State = #s{kp = #w{wx = KeyPicker}}) ->
|
||||
Error -> handle_troubling(State, Error)
|
||||
end.
|
||||
|
||||
params2(State, PK, Nonce) ->
|
||||
Params = extract(State),
|
||||
params2(#s{ttl = #w{wx = TTL_T},
|
||||
gasprice = #w{wx = GasPriceT},
|
||||
gas = #w{wx = GasT},
|
||||
amount = #w{wx = AmountT}},
|
||||
PK,
|
||||
Nonce) ->
|
||||
TTL = wxTextCtrl:getValue(TTL_T),
|
||||
GasPrice = wxTextCtrl:getValue(GasPriceT),
|
||||
ToExtract =
|
||||
[{ttl, fun gte_0/1, TTL_T},
|
||||
{gasprice, fun gt_0/1, GasPriceT},
|
||||
{gas, fun gt_0/1, GasT},
|
||||
{amount, fun gt_0/1, AmountT}],
|
||||
case lists:foldl(fun extract/2, {ok, []}, ToCheck) of
|
||||
{ok, [TTL, GasPrice, Gas, Amount]} ->
|
||||
{error, Out} ->
|
||||
end.
|
||||
|
||||
extract(State) -> extract(State, {none, none, none, none}).
|
||||
extract({Name, Check, Widget}, {Status, Out}) ->
|
||||
case Check(wxTextCtrl:getValue(Widget)) of
|
||||
{ok, Value} -> {Status, [Value | Out]};
|
||||
Error -> {error, [{Name, Error}, Out]}
|
||||
end.
|
||||
|
||||
extract(State = #s{ttl = W}, {none, none, none, none}) ->
|
||||
extract(State = #s{gasprice = W}, {TTL, none, none, none}) ->
|
||||
extract(State = #s{gas = W}, {TTL, GP, none, none}) ->
|
||||
extract(State = #s{amount = W}, {TTL, GP, Gas, none}) ->
|
||||
|
||||
args(#s{args = ArgFields}) ->
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user