• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang wini.Key类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/pascience/wingo/wini.Key的典型用法代码示例。如果您正苦于以下问题:Golang Key类的具体用法?Golang Key怎么用?Golang Key使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: getLastString

func getLastString(k wini.Key) (string, bool) {
	vals := k.Strings()
	if len(vals) == 0 {
		logger.Warning.Println(k.Err("No values found."))
		return "", false
	}

	return vals[len(vals)-1], true
}
开发者ID:pascience,项目名称:foci,代码行数:9,代码来源:config_theme_setters.go


示例2: loadSlimOption

func loadSlimOption(theme *ThemeConfig, k wini.Key) {
	switch k.Name() {
	case "border_size":
		setInt(k, &theme.Slim.borderSize)
	case "a_border_color":
		setNoGradient(k, &theme.Slim.aBorderColor)
	case "i_border_color":
		setNoGradient(k, &theme.Slim.iBorderColor)
	}
}
开发者ID:pascience,项目名称:foci,代码行数:10,代码来源:theme.go


示例3: getLastFloat

func getLastFloat(k wini.Key) (float64, bool) {
	vals, err := k.Floats()
	if err != nil {
		logger.Warning.Println(err)
		return 0.0, false
	} else if len(vals) == 0 {
		logger.Warning.Println(k.Err("No values found."))
		return 0.0, false
	}

	return vals[len(vals)-1], true
}
开发者ID:pascience,项目名称:foci,代码行数:12,代码来源:config_theme_setters.go


示例4: getLastBool

func getLastBool(k wini.Key) (bool, bool) {
	vals, err := k.Bools()
	if err != nil {
		logger.Warning.Println(err)
		return false, false
	} else if len(vals) == 0 {
		logger.Warning.Println(k.Err("No values found."))
		return false, false
	}

	return vals[len(vals)-1], true
}
开发者ID:pascience,项目名称:foci,代码行数:12,代码来源:config_theme_setters.go


示例5: loadBorderOption

func loadBorderOption(theme *ThemeConfig, k wini.Key) {
	switch k.Name() {
	case "border_size":
		setInt(k, &theme.Borders.borderSize)
	case "a_thin_color":
		setNoGradient(k, &theme.Borders.aThinColor)
	case "i_thin_color":
		setNoGradient(k, &theme.Borders.iThinColor)
	case "a_border_color":
		setGradient(k, &theme.Borders.aBorderColor)
	case "i_border_color":
		setGradient(k, &theme.Borders.iBorderColor)
	}
}
开发者ID:pascience,项目名称:foci,代码行数:14,代码来源:theme.go


示例6: loadFullOption

func loadFullOption(theme *ThemeConfig, k wini.Key) {
	switch k.Name() {
	case "font":
		setFont(k, &theme.Full.font)
	case "font_size":
		setFloat(k, &theme.Full.fontSize)
	case "a_font_color":
		setNoGradient(k, &theme.Full.aFontColor)
	case "i_font_color":
		setNoGradient(k, &theme.Full.iFontColor)
	case "title_size":
		setInt(k, &theme.Full.titleSize)
	case "title_top_margin":
		logger.Warning.Printf("title_top_margin option has been removed.")
	case "a_title_color":
		setGradient(k, &theme.Full.aTitleColor)
	case "i_title_color":
		setGradient(k, &theme.Full.iTitleColor)
	case "close":
		setImage(k, &theme.Full.aCloseButton)
		setImage(k, &theme.Full.iCloseButton)
	case "a_close_color":
		setNoGradient(k, &theme.Full.aCloseColor)
	case "i_close_color":
		setNoGradient(k, &theme.Full.iCloseColor)
	case "maximize":
		setImage(k, &theme.Full.aMaximizeButton)
		setImage(k, &theme.Full.iMaximizeButton)
	case "a_maximize_color":
		setNoGradient(k, &theme.Full.aMaximizeColor)
	case "i_maximize_color":
		setNoGradient(k, &theme.Full.iMaximizeColor)
	case "minimize":
		setImage(k, &theme.Full.aMinimizeButton)
		setImage(k, &theme.Full.iMinimizeButton)
	case "a_minimize_color":
		setNoGradient(k, &theme.Full.aMinimizeColor)
	case "i_minimize_color":
		setNoGradient(k, &theme.Full.iMinimizeColor)
	case "border_size":
		setInt(k, &theme.Full.borderSize)
	case "a_border_color":
		setNoGradient(k, &theme.Full.aBorderColor)
	case "i_border_color":
		setNoGradient(k, &theme.Full.iBorderColor)
	}
}
开发者ID:pascience,项目名称:foci,代码行数:47,代码来源:theme.go


示例7: setGradient

func setGradient(k wini.Key, clr *render.Color) {
	// Check to make sure we have a value for this key
	vals := k.Strings()
	if len(vals) == 0 {
		logger.Warning.Println(k.Err("No values found."))
		return
	}

	// Use the last value
	val := vals[len(vals)-1]

	// If there are no spaces, it can't be a gradient.
	if strings.Index(val, " ") == -1 {
		if start, ok := getLastInt(k); ok {
			clr.ColorSet(start)
		}
		return
	}

	// Okay, now we have to do things manually.
	// Split up the value into two pieces separated by whitespace and parse
	// each piece as an int.
	splitted := strings.Split(val, " ")
	if len(splitted) != 2 {
		logger.Warning.Println(k.Err("Expected a gradient value (two colors "+
			"separated by a space), but found '%s' "+
			"instead.", val))
		return
	}

	start, err := strconv.ParseInt(strings.TrimSpace(splitted[0]), 0, 0)
	if err != nil {
		logger.Warning.Println(k.Err("'%s' is not an integer. (%s)",
			splitted[0], err))
		return
	}

	end, err := strconv.ParseInt(strings.TrimSpace(splitted[1]), 0, 0)
	if err != nil {
		logger.Warning.Println(k.Err("'%s' is not an integer. (%s)",
			splitted[1], err))
		return
	}

	// finally...
	clr.GradientSet(int(start), int(end))
}
开发者ID:pascience,项目名称:foci,代码行数:47,代码来源:config_theme_setters.go


示例8: loadPromptOption

func loadPromptOption(theme *ThemeConfig, k wini.Key) {
	switch k.Name() {
	case "bg_color":
		setNoGradient(k, &theme.Prompt.bgColor)
	case "border_color":
		setNoGradient(k, &theme.Prompt.borderColor)
	case "border_size":
		setInt(k, &theme.Prompt.borderSize)
	case "padding":
		setInt(k, &theme.Prompt.padding)
	case "font":
		setFont(k, &theme.Prompt.font)
	case "font_size":
		setFloat(k, &theme.Prompt.fontSize)
	case "font_color":
		setNoGradient(k, &theme.Prompt.fontColor)
	case "cycle_icon_size":
		setInt(k, &theme.Prompt.cycleIconSize)
	case "cycle_icon_border_size":
		setInt(k, &theme.Prompt.cycleIconBorderSize)
	case "cycle_icon_transparency":
		setInt(k, &theme.Prompt.cycleIconTransparency)

		// naughty!
		if theme.Prompt.cycleIconTransparency < 0 ||
			theme.Prompt.cycleIconTransparency > 100 {
			logger.Warning.Printf("Illegal value '%s' provided for " +
				"'cycle_icon_transparency'. Transparency " +
				"values must be in the range [0, 100], " +
				"inclusive. Using 100 by default.")
			theme.Prompt.cycleIconTransparency = 100
		}
	case "select_active_font_color":
		setNoGradient(k, &theme.Prompt.selectActiveFontColor)
	case "select_active_bg_color":
		setNoGradient(k, &theme.Prompt.selectActiveBgColor)
	case "select_group_bg_color":
		setNoGradient(k, &theme.Prompt.selectGroupBgColor)
	case "select_group_font":
		setFont(k, &theme.Prompt.selectGroupFont)
	case "select_group_font_size":
		setFloat(k, &theme.Prompt.selectGroupFontSize)
	case "select_group_font_color":
		setNoGradient(k, &theme.Prompt.selectGroupFontColor)
	}
}
开发者ID:pascience,项目名称:foci,代码行数:46,代码来源:theme.go


示例9: setNoGradient

func setNoGradient(k wini.Key, clr *render.Color) {
	// Check to make sure we have a value for this key
	vals := k.Strings()
	if len(vals) == 0 {
		logger.Warning.Println(k.Err("No values found."))
		return
	}

	// Use the last value
	val := vals[len(vals)-1]

	// If there are no spaces, it can't be a gradient.
	if strings.Index(val, " ") == -1 {
		if start, ok := getLastInt(k); ok {
			clr.ColorSet(start)
		}
		return
	}

	logger.Warning.Println(
		k.Err("Gradients are not supported for this theme option."))
}
开发者ID:pascience,项目名称:foci,代码行数:22,代码来源:config_theme_setters.go


示例10: loadMiscOption

func loadMiscOption(theme *ThemeConfig, k wini.Key) {
	switch k.Name() {
	case "default_icon":
		setImage(k, &theme.DefaultIcon)
	}
}
开发者ID:pascience,项目名称:foci,代码行数:6,代码来源:theme.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang dns.Msg类代码示例发布时间:2022-05-28
下一篇:
Golang parsecli.Env类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap