示例#1
0
文件: wm.go 项目: thomasf/alkasir
func (w *WMGUI) init() {
	icn := "img/alkasir-icon-16x16.png"
	if runtime.GOOS == "windows" {
		icn = "img/alkasir-icon-128x128.ico"
	}

	icon, err := res.Asset(icn)
	if err != nil {
		panic(err)
	}
	systray.SetIcon(icon)
	w.onReady()
}
示例#2
0
文件: i18n.go 项目: thomasf/alkasir
func loadTranslations(languages ...string) {

	for _, lang := range languages {
		filename := fmt.Sprintf("messages/%s/messages.json", lang)
		lg.V(6).Infoln("Loading translation", lang, filename)
		data, err := res.Asset(filename)
		if err != nil {
			panic(err)
		}
		err = i18n.AddBundle(lang, data)
		if err != nil {
			panic(err)
		}
	}
}
示例#3
0
文件: http.go 项目: thomasf/alkasir
// load all html templates from bindata.
func loadTemplates() (t *template.Template) {
	lg.V(30).Infoln("Loading templates...")
	t = template.New("_asdf")
	allAssets := res.AssetNames()

	for _, path := range allAssets {
		if strings.HasPrefix(path, "templates/") &&
			strings.HasSuffix(path, "html") {
			data, err := res.Asset(path)
			if err != nil {
				panic(err)
			}
			_, err = t.New(strings.TrimPrefix(path, "templates/")).Parse(string(data))
			if err != nil {
				panic(err)
			}
		}
	}
	return
}