This commit is contained in:
Craig Everett 2025-01-08 14:49:22 +09:00
parent 95015eb50c
commit bfa8cc91c2
5 changed files with 26 additions and 26 deletions

View File

@ -58,9 +58,11 @@
-record(tx,
{id = none :: none | clutch:id(),
amount = 0 :: non_neg_integer(),
type = spend :: spend | atom()}).
{id = none :: none | clutch:id(),
amount = 0 :: non_neg_integer(),
type = spend :: atom(),
status = submitted :: submitted | mined | rejected | failed,
meta = "" :: string()}).
-record(spend_tx,

View File

@ -1,7 +1,5 @@
%%% @doc
%%% Clutch Controller
%%%
%%% This process is a in charge of maintaining the program's state.
%%% @end
-module(gmc_con).
@ -40,14 +38,15 @@
mon = none :: none | reference()}).
-record(s,
{version = 1 :: integer(),
window = none :: none | wx:wx_object(),
tasks = [] :: [#ui{}],
picked = 0 :: non_neg_integer(),
wallet = none :: none | #wallet{},
pass = none :: none | binary(),
prefs = #{} :: #{module() := term()},
wallets = [] :: [#wr{}]}).
{version = 1 :: integer(),
window = none :: none | wx:wx_object(),
tasks = [] :: [#ui{}],
picked = 0 :: non_neg_integer(),
wallet = none :: none | #wallet{},
pass = none :: none | binary(),
prefs = #{} :: #{module() := term()},
wallets = [] :: [#wr{}],
in_flight = [] :: [#tx{}]}).
-type state() :: #s{}.

View File

@ -1,9 +1,5 @@
%%% @doc
%%% Clutch GUI
%%%
%%% This process is responsible for creating the main GUI frame displayed to the user.
%%%
%%% Reference: http://erlang.org/doc/man/wx_object.html
%%% @end
-module(gmc_gui).

View File

@ -36,11 +36,11 @@ start_link() ->
init([]) ->
RestartStrategy = {one_for_one, 0, 60},
Clients = {gmc_con,
{gmc_con, start_link, []},
permanent,
5000,
worker,
[gmc_con]},
Children = [Clients],
Controller = {gmc_con,
{gmc_con, start_link, []},
permanent,
5000,
worker,
[gmc_con]},
Children = [Controller],
{ok, {RestartStrategy, Children}}.

View File

@ -282,14 +282,17 @@ terminate(Reason, State) ->
clicked(State = #s{book = {Notebook, Pages}}, Name, Button) ->
case wxNotebook:getSelection(Notebook) of
?wxNOT_FOUND ->
ok = tell("Inconcievable! No notebook page is selected!"),
ok = tell(warning, "Inconcievable! No notebook page is selected!"),
State;
Index ->
Page = lists:nth(Index + 1, Pages),
clicked(State, Page, Name, Button)
end.
clicked(State, #p{instances = Is, funs = {_, Funs}, builds = Builds}, {<<"init">>, call}) ->
clicked(State,
#p{instances = Is, funs = {_, Funs}, builds = Builds},
{<<"init">>, call},
Button) ->
Label = wxChoice:getStringSelection(Is),
Build = maps:get(Label, Builds),
#f{args = Args} = lists:keyfind(<<"init">>, #f.name, Funs),