From 58027986e656098e6bdf2c6de7118ca03cf8cc86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B0=D1=82=D0=BE=D0=BB=D0=B8=D0=B9=20=D0=A2?= =?UTF-8?q?=D1=83=D1=85=D1=82=D0=B0=D1=80=D0=BE=D0=B2?= Date: Wed, 13 Mar 2024 14:42:46 +0500 Subject: [PATCH] =?UTF-8?q?=D1=83=D1=82=D0=B8=D0=BB=D0=B8=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.go | 23 +++++++++++- frontend/src/App.svelte | 62 +++++++++++++++++++++++++------ frontend/src/servers.js | 7 ++++ frontend/wailsjs/go/main/App.d.ts | 4 ++ frontend/wailsjs/go/main/App.js | 8 ++++ 5 files changed, 91 insertions(+), 13 deletions(-) diff --git a/app.go b/app.go index 687ca80..142df3d 100644 --- a/app.go +++ b/app.go @@ -61,7 +61,7 @@ func (a *App) StartServer(s string) string { runtime.LogInfo(a.ctx, s) var server Server if err := json.Unmarshal([]byte(s), &server); err != nil { - runtime.LogInfo(a.ctx, err.Error()) + runtime.LogError(a.ctx, err.Error()) } runtime.LogInfo(a.ctx, fmt.Sprintf("server: %v", server)) @@ -71,3 +71,24 @@ func (a *App) StartServer(s string) string { return "starting server" } + +func (a *App) Weed() { + os.Chdir("d:\\projects\\sw4-nano\\util") + //s := subprocess.New(".\\"+name+".exe") + cmd := "py scanpics.py" + s := subprocess.New(cmd) + err := s.Exec() + if err != nil { + runtime.LogError(a.ctx, err.Error()) + } + runtime.LogInfo(a.ctx, fmt.Sprintf("команда выполнена успешно")) +} + +func (a *App) GetStatus() string { + pics, err := os.ReadDir("d:\\pics") + if err != nil { + runtime.LogError(a.ctx, err.Error()) + return "error: " + err.Error() + } + return fmt.Sprint(len(pics)) +} diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index 1a39684..60eb6bd 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -1,17 +1,14 @@ -
+

СЕРВЕРА

- {#each servers as server} + {#each local as server}
{/each} -
+ + +
+ +
+

УТИЛИТЫ

+
+ + +
+ + {cnt_pic} + +
+
+
diff --git a/frontend/src/servers.js b/frontend/src/servers.js index 1fd0df4..d8aa01b 100644 --- a/frontend/src/servers.js +++ b/frontend/src/servers.js @@ -27,6 +27,13 @@ const servers = [ port: "4323", run: "idle" }, + { + name: "sw4-nano", + dir: "d:\\projects\\sw4-nano", + cmd: ".\\sw4-nano.exe", + port: "4321", + run: "idle" + }, ]; export default servers; \ No newline at end of file diff --git a/frontend/wailsjs/go/main/App.d.ts b/frontend/wailsjs/go/main/App.d.ts index 9d7b500..b012bda 100644 --- a/frontend/wailsjs/go/main/App.d.ts +++ b/frontend/wailsjs/go/main/App.d.ts @@ -1,6 +1,10 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +export function GetStatus():Promise; + export function Greet(arg1:string):Promise; export function StartServer(arg1:string):Promise; + +export function Weed():Promise; diff --git a/frontend/wailsjs/go/main/App.js b/frontend/wailsjs/go/main/App.js index ee3e2b1..cdb0333 100644 --- a/frontend/wailsjs/go/main/App.js +++ b/frontend/wailsjs/go/main/App.js @@ -2,6 +2,10 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +export function GetStatus() { + return window['go']['main']['App']['GetStatus'](); +} + export function Greet(arg1) { return window['go']['main']['App']['Greet'](arg1); } @@ -9,3 +13,7 @@ export function Greet(arg1) { export function StartServer(arg1) { return window['go']['main']['App']['StartServer'](arg1); } + +export function Weed() { + return window['go']['main']['App']['Weed'](); +}