コード例 #1
0
ファイル: ui_lib.go プロジェクト: jubbsy/go-ethereum
func (ui *UiLib) Connect(button qml.Object) {
	if !ui.connected {
		ui.eth.Start()
		ui.connected = true
		button.Set("enabled", false)
	}
}
コード例 #2
0
ファイル: snapweb.go プロジェクト: ntcong/qml
func (ctrl *Control) Snapshot(request qml.Object) {
	if request.Int("status") != 2 {
		return
	}
	f, err := os.Create(os.Args[2])
	if err != nil {
		ctrl.done <- err
		return
	}
	defer f.Close()
	img := ctrl.win.Snapshot()
	err = png.Encode(f, img)
	if err != nil {
		os.Remove(os.Args[2])
	}
	ctrl.done <- err
}
コード例 #3
0
ファイル: samegame.go プロジェクト: Kwan36011/samegame
func (g *Game) StartNewGame(parent qml.Object, dialog qml.Object) {
	for _, b := range g.Board {
		if b != nil {
			b.Destroy()
		}
	}

	g.parent = parent
	g.dialog = dialog

	score := 0
	g.parent.Set("score", score)
	g.Score.Set("text", "Score: "+strconv.Itoa(score))

	w := parent.Int("width")
	h := parent.Int("height")
	blockSize := parent.Int("blockSize")
	g.MaxColumn = w / blockSize
	g.MaxRow = h / blockSize
	g.MaxIndex = g.MaxColumn * g.MaxRow

	g.Block.BlockSize = blockSize

	g.Board = make([]qml.Object, g.MaxIndex, g.MaxIndex)
	for col := 0; col < g.MaxColumn; col++ {
		for row := 0; row < g.MaxRow; row++ {
			g.Board[g.index(col, row)] = g.Block.createBlock(col, row, parent)
		}
	}
	g.started = true
}
コード例 #4
0
ファイル: main.go プロジェクト: hahaya/qml
func (ctrl *Control) TextReleased(text *qml.Object) {
	x := text.Int("x")
	y := text.Int("y")
	width := text.Int("width")
	height := text.Int("height")

	ctrl.Emit(x+15, y+height/2)
	ctrl.Emit(x+width/2, 1.0*y+height/2)
	ctrl.Emit(x+width-15, 1.0*y+height/2)

	go func() {
		time.Sleep(500 * time.Millisecond)
		messages := []string{"Hello", "Hello", "Hacks"}
		ctrl.Message = messages[rand.Intn(len(messages))] + " from Go!"
		qml.Changed(ctrl, &ctrl.Message)
	}()
}
コード例 #5
0
ファイル: main.go プロジェクト: hernad/go-libreoffice
func (ctrl *Control) ChangedPolje1(text qml.Object) {

	fmt.Printf("changed %#v\n", text.String("text"))
}
コード例 #6
0
ファイル: main.go プロジェクト: hahaya/qml
func (ctrl *Control) Done(emitter *qml.Object) {
	emitter.Destroy()
}
コード例 #7
0
ファイル: samegame.go プロジェクト: Kwan36011/samegame
func (g *Game) DestroyBlock(block qml.Object, t int) {
	go func() {
		time.Sleep(time.Duration(t) * time.Millisecond)
		block.Destroy()
	}()
}