当前位置: 首页>>代码示例>>Golang>>正文


Golang View.Name方法代码示例

本文整理汇总了Golang中github.com/jroimartin/gocui.View.Name方法的典型用法代码示例。如果您正苦于以下问题:Golang View.Name方法的具体用法?Golang View.Name怎么用?Golang View.Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/jroimartin/gocui.View的用法示例。


在下文中一共展示了View.Name方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: CreateViews

func (c *column) CreateViews(g *gocui.Gui, colv *gocui.View) error {
	if c.isActive {
		colv.FgColor = gocui.ColorCyan | gocui.AttrBold
	} else {
		colv.FgColor = gocui.ColorDefault
	}
	x, y, maxX, maxY, err := g.ViewPosition(colv.Name())
	y = y + 2
	if err != nil {
		return err
	}
	maxIssues := maxY / LinesPerEntry
	c.maxIssues = maxIssues
	for i := 0; i < maxIssues; i++ {
		v, err := g.SetView(fmt.Sprintf("col-%s-%d", c.name, i),
			x, y+(i*LinesPerEntry), maxX, y+((i+1)*LinesPerEntry))
		if err != nil {
			if err != gocui.ErrorUnkView {
				return err
			}
		}
		v.SelBgColor = gocui.ColorRed
		v.Frame = false
		v.Wrap = true
	}
	return c.redraw(g)
}
开发者ID:pombredanne,项目名称:stroop,代码行数:27,代码来源:column.go

示例2: nextView

func nextView(g *gocui.Gui, v *gocui.View) error {

	if v == nil {
		return g.SetCurrentView(vPlatforms)
	}
	getLine(g, v)

	switch v.Name() {
	case vPlatforms:
		return g.SetCurrentView(vTranscripts)
	case vTranscripts:
		return g.SetCurrentView(vDestinations)
	case vDestinations:
		if x, err := g.View(vTop); err == nil {
			x.Clear()
			fmt.Fprintf(x, "Hit enter to submit selections")
		}
		return g.SetCurrentView(vSubmit)
	case vSubmit:
		return g.SetCurrentView(vText)
	case vText:
		return g.SetCurrentView(vPlatforms)
	}
	return g.SetCurrentView(vPlatforms)
}
开发者ID:metalogic-software,项目名称:go-examples,代码行数:25,代码来源:main.go

示例3: removeTrackCommand

func removeTrackCommand(g *gocui.Gui, v *gocui.View) error {
	switch v.Name() {
	case VIEW_PLAYLISTS:
		if playlist := gui.getSelectedPlaylist(); playlist != nil {
			playlists.Remove(playlist.Name())
			gui.updatePlaylistsView()
			gui.updateTracksView()
		}
	case VIEW_TRACKS:
		if playlist, index := gui.getSelectedPlaylistAndTrack(); index > -1 {
			for i := 1; i <= getOffsetFromTypedNumbers(); i++ {
				playlist.RemoveTrack(index)
			}
			gui.updateTracksView()
			goTo(g, v, index+1)
		}
	case VIEW_QUEUE:
		if index := gui.getQueueSelectedTrackIndex(); index > -1 {
			for i := 1; i <= getOffsetFromTypedNumbers(); i++ {
				if queue.Remove(index) != nil {
					continue
				}
			}
			gui.updateQueueView()
		}
	}
	return nil
}
开发者ID:ialbors,项目名称:sconsify,代码行数:28,代码来源:cui_actions.go

示例4: confirmStringDetail

func (runner *appRunner) confirmStringDetail(gui *gocui.Gui, view *gocui.View) error {
	text := strings.TrimSpace(view.Buffer())

	runner.activeStringDetailController.Confirm(text)
	runner.restoreMainView()
	runner.gui.DeleteView(view.Name())
	return nil
}
开发者ID:inkyblackness,项目名称:shocked-client,代码行数:8,代码来源:Run.go

示例5: toggleButton

func toggleButton(g *gocui.Gui, v *gocui.View) error {
	nextview := "butdown"
	if v != nil && v.Name() == "butdown" {
		nextview = "butup"
	}
	_, err := g.SetCurrentView(nextview)
	return err
}
开发者ID:jroimartin,项目名称:gocui,代码行数:8,代码来源:widgets.go

示例6: nextView

func nextView(g *gocui.Gui, v *gocui.View) error {
	if v == nil || v.Name() == "side" {
		_, err := g.SetCurrentView("main")
		return err
	}
	_, err := g.SetCurrentView("side")
	return err
}
开发者ID:jroimartin,项目名称:gocui,代码行数:8,代码来源:demo.go

示例7: confirmListDetail

func (runner *appRunner) confirmListDetail(gui *gocui.Gui, view *gocui.View) error {
	_, originY := view.Origin()
	_, cursorY := view.Cursor()
	runner.activeListDetailController.Confirm(originY + cursorY)
	runner.restoreMainView()
	runner.gui.DeleteView(view.Name())
	return nil
}
开发者ID:inkyblackness,项目名称:shocked-client,代码行数:8,代码来源:Run.go

示例8: moveView

func moveView(g *gocui.Gui, v *gocui.View, dx, dy int) error {
	name := v.Name()
	x0, y0, x1, y1, err := g.ViewPosition(name)
	if err != nil {
		return err
	}
	if _, err := g.SetView(name, x0+dx, y0+dy, x1+dx, y1+dy); err != nil {
		return err
	}
	return nil
}
开发者ID:repos-go,项目名称:gocui,代码行数:11,代码来源:delete.go

示例9: pageUpDownJumpCount

func pageUpDownJumpCount(v *gocui.View) int {
	var jump int
	switch v.Name() {
	case "side", "summary":
		jump = 8
	case "detail":
		jump = 30
	default:
		jump = 8
	}
	return jump
}
开发者ID:Rompei,项目名称:vuls,代码行数:12,代码来源:tui.go

示例10: onMovingCursorRedrawView

// redraw views
func onMovingCursorRedrawView(g *gocui.Gui, v *gocui.View) error {
	switch v.Name() {
	case "summary":
		if err := redrawDetail(g); err != nil {
			return err
		}
	case "side":
		if err := changeHost(g, v); err != nil {
			return err
		}
	}
	return nil
}
开发者ID:Rompei,项目名称:vuls,代码行数:14,代码来源:tui.go

示例11: previousView

func previousView(g *gocui.Gui, v *gocui.View) error {
	if v == nil {
		return g.SetCurrentView("side")
	}
	switch v.Name() {
	case "side":
		return g.SetCurrentView("side")
	case "summary":
		return g.SetCurrentView("side")
	case "detail":
		return g.SetCurrentView("summary")
	default:
		return g.SetCurrentView("side")
	}
}
开发者ID:Rompei,项目名称:vuls,代码行数:15,代码来源:tui.go

示例12: removeAllTracksCommand

func removeAllTracksCommand(g *gocui.Gui, v *gocui.View) error {
	switch v.Name() {
	case VIEW_PLAYLISTS:
	case VIEW_TRACKS:
		if playlist, index := gui.getSelectedPlaylistAndTrack(); index > -1 {
			playlist.RemoveAllTracks()
			gui.updateTracksView()
			return gui.enableSideView()
		}
	case VIEW_QUEUE:
		queue.RemoveAll()
		gui.updateQueueView()
		return gui.enableTracksView()
	}
	return nil
}
开发者ID:ialbors,项目名称:sconsify,代码行数:16,代码来源:cui_actions.go

示例13: nextView

func nextView(g *gocui.Gui, v *gocui.View) error {
	g.Cursor = false
	v.Highlight = false
	log.Println("nextView: " + v.Name())
	var err error
	switch v.Name() {
	case "channels":
		err = g.SetCurrentView("input")
		g.Cursor = true
	case "input":
		err = g.SetCurrentView("channels")
		g.CurrentView().Highlight = true
	}
	//	g.Flush()
	return err
}
开发者ID:robert-butts,项目名称:slackterm,代码行数:16,代码来源:gui.go

示例14: keyPressed

func keyPressed(key rune, g *gocui.Gui, v *gocui.View) error {
	multipleKeysBuffer.WriteRune(key)
	keyCombination := multipleKeysBuffer.String()

	if handler := keyboard.SequentialKeys[v.Name()+" "+keyCombination]; handler != nil {
		multipleKeysBuffer.Reset()
		err := handler(g, v)
		multipleKeysNumber = 0
		return err
	}

	if len(keyCombination) >= 2 {
		multipleKeysBuffer.Reset()
		return keyPressed(rune(keyCombination[1]), g, v)
	}
	return nil
}
开发者ID:gitter-badger,项目名称:sconsify,代码行数:17,代码来源:cui_actions.go

示例15: moveView

func moveView(g *gocui.Gui, v *gocui.View, dx, dy int) error {

	name := v.Name()

	// x0, y0, x1, y1, err := g.ViewPosition(name)
	// if err != nil {
	// return err
	// }

	// logger.Logger.Printf("RESIZE %d %d %d %d\n", x0+dx, y0+dy, x1+dx, y1+dy)

	if _, err := g.SetView(name, 0, 0, 0, 0); err != nil {
		return err
	}

	return nil
}
开发者ID:mephux,项目名称:komanda-cli,代码行数:17,代码来源:util.go


注:本文中的github.com/jroimartin/gocui.View.Name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。