Răsfoiți Sursa

SVI Начало добавления WUI; 100.0%

SVI 1 an în urmă
părinte
comite
6863ccebe9
5 a modificat fișierele cu 63 adăugiri și 0 ștergeri
  1. 27 0
      wui/wctx/wctx.go
  2. 16 0
      wui/wctx/wctx_test.go
  3. 11 0
      wui/wtypes/iwui_ctx.go
  4. 7 0
      wui/wtypes/wtypes_test.go
  5. 2 0
      wui/wui.go

+ 27 - 0
wui/wctx/wctx.go

@@ -0,0 +1,27 @@
+// package wctx -- глобальный контекст графики
+package wctx
+
+import (
+	"sync"
+
+	"gitp78su.ipnodns.ru/svi/kern/kc/local_ctx"
+	"gitp78su.ipnodns.ru/svi/kern/krn/kctx"
+	. "gitp78su.ipnodns.ru/svi/kern/wui/wtypes"
+)
+
+var (
+	wCtx  IWuiCtx
+	block sync.Mutex
+)
+
+// GetWuiCtx -- возвращает глобальный контекст графики
+func GetWuiCtx() IWuiCtx {
+	block.Lock()
+	defer block.Unlock()
+	if wCtx != nil {
+		return wCtx
+	}
+	kCtx := kctx.GetKernelCtx()
+	wCtx = local_ctx.NewLocalCtx(kCtx.Ctx())
+	return wCtx
+}

+ 16 - 0
wui/wctx/wctx_test.go

@@ -0,0 +1,16 @@
+package wctx
+
+import (
+	"testing"
+)
+
+func TestWctx(t *testing.T) {
+	ctx_ := GetWuiCtx()
+	if ctx_ == nil {
+		t.Fatalf("wCtx==nil")
+	}
+	ctx_ = GetWuiCtx()
+	if ctx_ == nil {
+		t.Fatalf("wCtx==nil")
+	}
+}

+ 11 - 0
wui/wtypes/iwui_ctx.go

@@ -0,0 +1,11 @@
+// package wtypes -- интерфейсы WebUI
+package wtypes
+
+import (
+	. "gitp78su.ipnodns.ru/svi/kern/krn/ktypes"
+)
+
+// IWuiCtx -- контекст веб-интерфейса
+type IWuiCtx interface {
+	ILocalCtx
+}

+ 7 - 0
wui/wtypes/wtypes_test.go

@@ -0,0 +1,7 @@
+package wtypes
+
+import (
+	"testing"
+)
+
+func TestWtypes(t *testing.T) {}

+ 2 - 0
wui/wui.go

@@ -0,0 +1,2 @@
+// package wui -- пакет веб-интерфейса
+package wui