Fixing interface issues and GajuDesk startup call
This commit is contained in:
parent
c6ab147d97
commit
a47a259135
@ -3,6 +3,6 @@
|
|||||||
{registered,[]},
|
{registered,[]},
|
||||||
{included_applications,[]},
|
{included_applications,[]},
|
||||||
{applications,[stdlib,kernel]},
|
{applications,[stdlib,kernel]},
|
||||||
{vsn,"0.3.6"},
|
{vsn,"0.4.0"},
|
||||||
{modules,[gajumine,gmc_con,gmc_conf,gmc_gui,gmc_sup]},
|
{modules,[gajumine,gmc_con,gmc_conf,gmc_gui,gmc_sup]},
|
||||||
{mod,{gajumine,[]}}]}.
|
{mod,{gajumine,[]}}]}.
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(gajumine).
|
-module(gajumine).
|
||||||
-vsn("0.3.6").
|
-vsn("0.4.0").
|
||||||
-behavior(application).
|
-behavior(application).
|
||||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||||
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(gmc_con).
|
-module(gmc_con).
|
||||||
-vsn("0.3.6").
|
-vsn("0.4.0").
|
||||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||||
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
||||||
-license("GPL-3.0-or-later").
|
-license("GPL-3.0-or-later").
|
||||||
@ -204,10 +204,7 @@ terminate(Reason, State) ->
|
|||||||
|
|
||||||
|
|
||||||
do_stop() ->
|
do_stop() ->
|
||||||
case is_pid(whereis(gd_con)) of
|
zx:stop().
|
||||||
false -> zx:stop();
|
|
||||||
true -> application:stop(gajumine)
|
|
||||||
end.
|
|
||||||
|
|
||||||
|
|
||||||
%%% Doers
|
%%% Doers
|
||||||
@ -251,7 +248,7 @@ do_start_stop(#s{acc = PubKey, keys = Keys, network = Network, max_cores = MaxCo
|
|||||||
ok = gmc_gui:message({notice, "Starting..."}),
|
ok = gmc_gui:message({notice, "Starting..."}),
|
||||||
ok = gmc_gui:message({notice, ["Miner: ", Miner]}),
|
ok = gmc_gui:message({notice, ["Miner: ", Miner]}),
|
||||||
{ok, Apps} = gmhc_app:start(Profile),
|
{ok, Apps} = gmhc_app:start(Profile),
|
||||||
Started = io_lib:format("Apps started: ~p", [Apps]),
|
Started = io_lib:format("Apps started:~n ~p", [Apps]),
|
||||||
ok = log(info, Started),
|
ok = log(info, Started),
|
||||||
ok = gmc_gui:message({notice, Started}),
|
ok = gmc_gui:message({notice, Started}),
|
||||||
Events =
|
Events =
|
||||||
@ -344,23 +341,10 @@ win_mem() ->
|
|||||||
|
|
||||||
|
|
||||||
do_gajudesk() ->
|
do_gajudesk() ->
|
||||||
ok = tell(info, "Running gajudesk"),
|
ok = log(info, "Running gajudesk"),
|
||||||
PID = spawn(fun run_gajudesk/0),
|
Command = "zx run gajudesk",
|
||||||
tell(info, "GajuDesk launched at PID: ~p", [PID]).
|
Out = os:cmd(Command),
|
||||||
|
log(info, "os:cmd(~w) -> ~w", [Command, Out]).
|
||||||
run_gajudesk() ->
|
|
||||||
R = "otpr",
|
|
||||||
N = "gajudesk",
|
|
||||||
{ok, V} = zx:latest({R, N}),
|
|
||||||
{ok, PackageString} = zx_lib:package_string({R, N, V}),
|
|
||||||
try
|
|
||||||
case zx:run(PackageString, []) of
|
|
||||||
ok -> ok;
|
|
||||||
Error -> tell(error, "gajudesk died with: ~p", [Error])
|
|
||||||
end
|
|
||||||
catch
|
|
||||||
E:R -> tell(error, "gajudesk died with: ~p", [{E, R}])
|
|
||||||
end.
|
|
||||||
|
|
||||||
|
|
||||||
run_gmc_conf(State = #s{gmc_conf = none, network = Net, acc = Acc, keys = Keys,
|
run_gmc_conf(State = #s{gmc_conf = none, network = Net, acc = Acc, keys = Keys,
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(gmc_conf).
|
-module(gmc_conf).
|
||||||
-vsn("0.3.6").
|
-vsn("0.4.0").
|
||||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||||
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
||||||
-license("GPL-3.0-or-later").
|
-license("GPL-3.0-or-later").
|
||||||
@ -60,27 +60,30 @@ init({Prefs, {Net, Acc, Keys, {AProcs, AMem, MProcs, MMem}}}) ->
|
|||||||
|
|
||||||
WX = wx:new(),
|
WX = wx:new(),
|
||||||
Frame = wxFrame:new(WX, ?wxID_ANY, Label),
|
Frame = wxFrame:new(WX, ?wxID_ANY, Label),
|
||||||
|
Panel = wxWindow:new(Frame, ?wxID_ANY),
|
||||||
|
TopSz = wxBoxSizer:new(?wxVERTICAL),
|
||||||
|
_ = wxBoxSizer:add(TopSz, Panel, zxw:flags(wide)),
|
||||||
MainSz = wxBoxSizer:new(?wxVERTICAL),
|
MainSz = wxBoxSizer:new(?wxVERTICAL),
|
||||||
|
|
||||||
AccSz = wxStaticBoxSizer:new(?wxVERTICAL, Frame, [{label, J("GajuMining Account ID")}]),
|
AccSz = wxStaticBoxSizer:new(?wxVERTICAL, Panel, [{label, J("GajuMining Account ID")}]),
|
||||||
AccTx = wxTextCtrl:new(Frame, ?wxID_ANY, [{value, acc(Acc)}]),
|
AccTx = wxTextCtrl:new(Panel, ?wxID_ANY, [{value, acc(Acc)}]),
|
||||||
_ = wxStaticBoxSizer:add(AccSz, AccTx, wide(5)),
|
_ = wxStaticBoxSizer:add(AccSz, AccTx, wide(5)),
|
||||||
KeysSz = wxStaticBoxSizer:new(?wxVERTICAL, Frame, [{label, J("Additional Account IDs (optional)")}]),
|
KeysSz = wxStaticBoxSizer:new(?wxVERTICAL, Panel, [{label, J("Additional Account IDs (optional)")}]),
|
||||||
KeysTx = wxTextCtrl:new(Frame, ?wxID_ANY, [{style, ?wxTE_MULTILINE}, {value, keys(Keys)}]),
|
KeysTx = wxTextCtrl:new(Panel, ?wxID_ANY, [{style, ?wxTE_MULTILINE}, {value, keys(Keys)}]),
|
||||||
_ = wxStaticBoxSizer:add(KeysSz, KeysTx, wide(5)),
|
_ = wxStaticBoxSizer:add(KeysSz, KeysTx, wide(5)),
|
||||||
StatSz = wxStaticBoxSizer:new(?wxVERTICAL, Frame, [{label, J("Max System Committment (optional)")}]),
|
StatSz = wxStaticBoxSizer:new(?wxVERTICAL, Panel, [{label, J("Max System Committment (optional)")}]),
|
||||||
AProcsS = i_to_l(AProcs),
|
AProcsS = i_to_l(AProcs),
|
||||||
MProcsS = i_to_l(MProcs),
|
MProcsS = i_to_l(MProcs),
|
||||||
AMemS = gigs(AMem),
|
AMemS = gigs(AMem),
|
||||||
MMemS = gigs(MMem),
|
MMemS = gigs(MMem),
|
||||||
Labels = [{J("HW Cores"), J("Max Cores"), AProcsS, MProcsS}, {J("Memory (GB)"), J("Max Memory"), AMemS, MMemS}],
|
Labels = [{J("HW Cores"), J("Max Cores"), AProcsS, MProcsS}, {J("Memory (GB)"), J("Max Memory"), AMemS, MMemS}],
|
||||||
{Grid, [CoresTx, MemoryTx]} = display_box(Frame, Labels),
|
{Grid, [CoresTx, MemoryTx]} = display_box(Panel, Labels),
|
||||||
Network = wxRadioBox:new(Frame, ?wxID_ANY, J("Network"), {0, 0}, {50, 50}, [J("Mainnet"), J("Testnet")]),
|
Network = wxRadioBox:new(Panel, ?wxID_ANY, J("Network"), {0, 0}, {50, 50}, [J("Mainnet"), J("Testnet")]),
|
||||||
ok = wxRadioBox:setSelection(Network, net_num(Net)),
|
ok = wxRadioBox:setSelection(Network, net_num(Net)),
|
||||||
|
|
||||||
ButtSz = wxBoxSizer:new(?wxHORIZONTAL),
|
ButtSz = wxBoxSizer:new(?wxHORIZONTAL),
|
||||||
Affirm = wxButton:new(Frame, ?wxID_OK),
|
Affirm = wxButton:new(Panel, ?wxID_OK),
|
||||||
Cancel = wxButton:new(Frame, ?wxID_CANCEL),
|
Cancel = wxButton:new(Panel, ?wxID_CANCEL),
|
||||||
_ = wxBoxSizer:add(StatSz, Grid, wide(5)),
|
_ = wxBoxSizer:add(StatSz, Grid, wide(5)),
|
||||||
_ = wxBoxSizer:add(ButtSz, Affirm, wide(5)),
|
_ = wxBoxSizer:add(ButtSz, Affirm, wide(5)),
|
||||||
_ = wxBoxSizer:add(ButtSz, Cancel, wide(5)),
|
_ = wxBoxSizer:add(ButtSz, Cancel, wide(5)),
|
||||||
@ -89,7 +92,8 @@ init({Prefs, {Net, Acc, Keys, {AProcs, AMem, MProcs, MMem}}}) ->
|
|||||||
_ = wxBoxSizer:add(MainSz, StatSz, base(5)),
|
_ = wxBoxSizer:add(MainSz, StatSz, base(5)),
|
||||||
_ = wxBoxSizer:add(MainSz, Network, base(5)),
|
_ = wxBoxSizer:add(MainSz, Network, base(5)),
|
||||||
_ = wxBoxSizer:add(MainSz, ButtSz, base(5)),
|
_ = wxBoxSizer:add(MainSz, ButtSz, base(5)),
|
||||||
ok = wxFrame:setSizer(Frame, MainSz),
|
ok = wxWindow:setSizer(Panel, MainSz),
|
||||||
|
ok = wxFrame:setSizer(Frame, TopSz),
|
||||||
ok = wxBoxSizer:layout(MainSz),
|
ok = wxBoxSizer:layout(MainSz),
|
||||||
ok = wxFrame:connect(Frame, command_button_clicked),
|
ok = wxFrame:connect(Frame, command_button_clicked),
|
||||||
ok = wxFrame:connect(Frame, close_window),
|
ok = wxFrame:connect(Frame, close_window),
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(gmc_gui).
|
-module(gmc_gui).
|
||||||
-vsn("0.3.6").
|
-vsn("0.4.0").
|
||||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||||
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
||||||
-license("GPL-3.0-or-later").
|
-license("GPL-3.0-or-later").
|
||||||
@ -99,18 +99,21 @@ init(Prefs) ->
|
|||||||
VSN = proplists:get_value(vsn, ?MODULE:module_info(attributes)),
|
VSN = proplists:get_value(vsn, ?MODULE:module_info(attributes)),
|
||||||
WX = wx:new(),
|
WX = wx:new(),
|
||||||
Frame = wxFrame:new(WX, ?wxID_ANY, AppName ++ " v" ++ VSN),
|
Frame = wxFrame:new(WX, ?wxID_ANY, AppName ++ " v" ++ VSN),
|
||||||
|
Panel = wxWindow:new(Frame, ?wxID_ANY),
|
||||||
|
TopSz = wxBoxSizer:new(?wxVERTICAL),
|
||||||
|
_ = wxBoxSizer:add(TopSz, Panel, zxw:flags(wide)),
|
||||||
MainSz = wxBoxSizer:new(?wxVERTICAL),
|
MainSz = wxBoxSizer:new(?wxVERTICAL),
|
||||||
LeftRight = wxBoxSizer:new(?wxHORIZONTAL),
|
LeftRight = wxBoxSizer:new(?wxHORIZONTAL),
|
||||||
Left = wxBoxSizer:new(?wxVERTICAL),
|
Left = wxBoxSizer:new(?wxVERTICAL),
|
||||||
Right = wxBoxSizer:new(?wxVERTICAL),
|
Right = wxBoxSizer:new(?wxVERTICAL),
|
||||||
|
|
||||||
Labels = [J("ID"), J("Target"), J("Maps/s"), J("Candidate"), J("Height"), J("BlockHash")],
|
Labels = [J("ID"), J("Target"), J("Graphs/s"), J("Candidate"), J("Height"), J("BlockHash")],
|
||||||
{Grid, [ID_C, DiffC, PerfC, CandyC, HeightC, BlockC]} = display_box(Frame, Labels),
|
{Grid, [ID_C, DiffC, PerfC, CandyC, HeightC, BlockC]} = display_box(Panel, Labels),
|
||||||
|
|
||||||
Style = ?wxTE_MULTILINE bor ?wxTE_READONLY,
|
Style = ?wxTE_MULTILINE bor ?wxTE_READONLY,
|
||||||
MessSz = wxStaticBoxSizer:new(?wxVERTICAL, Frame, [{label, J("Messages")}]),
|
MessSz = wxStaticBoxSizer:new(?wxVERTICAL, Panel, [{label, J("Messages")}]),
|
||||||
MessC = wxTextCtrl:new(Frame, ?wxID_ANY, [{style, Style}]),
|
MessC = wxTextCtrl:new(Panel, ?wxID_ANY, [{style, Style}]),
|
||||||
_ = wxStaticBoxSizer:add(MessSz, MessC, zxw:flags(wide)),
|
_ = wxStaticBoxSizer:add(MessSz, MessC, zxw:flags({wide, 5})),
|
||||||
|
|
||||||
ButtonTemplates =
|
ButtonTemplates =
|
||||||
[{start_stop, J("Start")},
|
[{start_stop, J("Start")},
|
||||||
@ -121,26 +124,27 @@ init(Prefs) ->
|
|||||||
|
|
||||||
MakeButton =
|
MakeButton =
|
||||||
fun({Name, Label}) ->
|
fun({Name, Label}) ->
|
||||||
B = wxButton:new(Frame, ?wxID_ANY, [{label, Label}]),
|
B = wxButton:new(Panel, ?wxID_ANY, [{label, Label}]),
|
||||||
#w{name = Name, id = wxButton:getId(B), wx = B}
|
#w{name = Name, id = wxButton:getId(B), wx = B}
|
||||||
end,
|
end,
|
||||||
|
|
||||||
Buttons = lists:map(MakeButton, ButtonTemplates),
|
Buttons = lists:map(MakeButton, ButtonTemplates),
|
||||||
|
|
||||||
_ = wxBoxSizer:add(Left, Grid, zxw:flags(base)),
|
_ = wxBoxSizer:add(Left, Grid, zxw:flags({base, 5})),
|
||||||
_ = wxBoxSizer:add(Left, MessSz, zxw:flags(wide)),
|
_ = wxBoxSizer:add(Left, MessSz, zxw:flags({wide, 5})),
|
||||||
Add = fun(#w{wx = Button}) -> wxBoxSizer:add(Right, Button, zxw:flags(wide)) end,
|
Add = fun(#w{wx = Button}) -> wxBoxSizer:add(Right, Button, zxw:flags(wide)) end,
|
||||||
ok = lists:foreach(Add, Buttons),
|
ok = lists:foreach(Add, Buttons),
|
||||||
_ = wxBoxSizer:add(LeftRight, Left, zxw:flags(wide)),
|
_ = wxBoxSizer:add(LeftRight, Left, zxw:flags(wide)),
|
||||||
_ = wxBoxSizer:add(LeftRight, Right, zxw:flags(base)),
|
_ = wxBoxSizer:add(LeftRight, Right, zxw:flags(base)),
|
||||||
_ = wxBoxSizer:add(MainSz, LeftRight, zxw:flags(wide)),
|
_ = wxBoxSizer:add(MainSz, LeftRight, zxw:flags({wide, 5})),
|
||||||
|
|
||||||
ok = wxFrame:setSizer(Frame, MainSz),
|
ok = wxWindow:setSizer(Panel, MainSz),
|
||||||
ok = wxSizer:layout(MainSz),
|
ok = wxFrame:setSizer(Frame, TopSz),
|
||||||
|
ok = wxBoxSizer:layout(MainSz),
|
||||||
|
|
||||||
ok = wxFrame:connect(Frame, command_button_clicked),
|
ok = wxFrame:connect(Frame, command_button_clicked),
|
||||||
ok = wxFrame:connect(Frame, close_window),
|
ok = wxFrame:connect(Frame, close_window),
|
||||||
ok = wxFrame:setSize(Frame, {650, 300}),
|
ok = wxFrame:setSize(Frame, {780, 350}),
|
||||||
ok = wxFrame:center(Frame),
|
ok = wxFrame:center(Frame),
|
||||||
true = wxFrame:show(Frame),
|
true = wxFrame:show(Frame),
|
||||||
State =
|
State =
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(gmc_sup).
|
-module(gmc_sup).
|
||||||
-vsn("0.3.6").
|
-vsn("0.4.0").
|
||||||
-behaviour(supervisor).
|
-behaviour(supervisor).
|
||||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||||
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
{prefix,"gmc"}.
|
{prefix,"gmc"}.
|
||||||
{desc,"Mining client for the Gajumaru Root"}.
|
{desc,"Mining client for the Gajumaru Root"}.
|
||||||
{author,"Craig Everett"}.
|
{author,"Craig Everett"}.
|
||||||
{package_id,{"qpq","gajumine",{0,3,6}}}.
|
{package_id,{"qpq","gajumine",{0,4,0}}}.
|
||||||
{deps,[{"uwiger","gmhive_client",{0,9,3}},
|
{deps,[{"uwiger","gmhive_client",{0,9,3}},
|
||||||
{"uwiger","gmhive_protocol",{0,2,0}},
|
{"uwiger","gmhive_protocol",{0,2,0}},
|
||||||
{"uwiger","gmcuckoo",{1,2,4}},
|
{"uwiger","gmcuckoo",{1,2,4}},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user