mirror of
https://gitee.com/energye/energy.git
synced 2024-12-02 03:37:48 +08:00
U: touchbar demo
This commit is contained in:
parent
6af7f2ba7d
commit
54459cd3cf
@ -2,6 +2,7 @@ package bar
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/energye/energy/v2/cef/ipc"
|
||||
|
||||
"github.com/energye/energy/v2/pkgs/touchbar/barbuilder"
|
||||
"github.com/energye/energy/v2/pkgs/touchbar/barutils"
|
||||
@ -30,6 +31,7 @@ func makeSliderCatalog(switcher barutils.Switcher) barbuilder.Item {
|
||||
MaximumValue: 100,
|
||||
OnChange: func(value float64) {
|
||||
result.Content = &barbuilder.ContentLabel{Text: fmt.Sprintf("value: %v", value)}
|
||||
ipc.Emit("touchbar", 4, "touch bar Slider: "+fmt.Sprintf("%v", value))
|
||||
switcher.Update()
|
||||
},
|
||||
},
|
||||
@ -50,6 +52,7 @@ func makeSliderCatalog(switcher barutils.Switcher) barbuilder.Item {
|
||||
AccessoryWidth: barbuilder.SliderAccessoryWide,
|
||||
OnChange: func(value float64) {
|
||||
result.Content = &barbuilder.ContentLabel{Text: fmt.Sprintf("value: %v", value)}
|
||||
ipc.Emit("touchbar", 4, "touch bar All options: "+fmt.Sprintf("%v", value))
|
||||
switcher.Update()
|
||||
},
|
||||
},
|
||||
|
@ -2,6 +2,7 @@ package bar
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/energye/energy/v2/cef/ipc"
|
||||
"github.com/energye/energy/v2/pkgs/touchbar/barutils"
|
||||
"sync"
|
||||
"time"
|
||||
@ -82,6 +83,8 @@ func MakeDemo(switcher barutils.Switcher) barbuilder.Item {
|
||||
reel3.Content = &barbuilder.ContentLabel{Text: *value3}
|
||||
switcher.Update()
|
||||
|
||||
ipc.Emit("touchbar", 5, "touch bar 🎰 Spin: "+fmt.Sprintf("%v %v %v", *value1, *value2, *value3))
|
||||
|
||||
time.Sleep(timeBetweenSpin)
|
||||
if time.Since(start) >= 4*time.Second {
|
||||
break
|
||||
@ -111,6 +114,7 @@ func MakeDemo(switcher barutils.Switcher) barbuilder.Item {
|
||||
Text: "🙁 Spin Again",
|
||||
}
|
||||
}
|
||||
ipc.Emit("touchbar", 6, "touch bar 🎰 Spin: "+fmt.Sprintf("%v %v %v : %v", *value1, *value2, *value3, result.Content.(*barbuilder.ContentLabel).Text))
|
||||
switcher.Update()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user