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

Golang cdtype.Defaults类代码示例

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

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



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

示例1: Init

// Init load user configuration if needed and initialise applet.
//
func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) {
	// Uptoshare settings.
	app.up.SetHistoryFile(app.FileDataDir(cdglobal.DirUserAppData, uptoshare.HistoryFile))
	app.up.SetHistorySize(app.conf.UploadHistory)
	app.up.LimitRate = app.conf.UploadRateLimit
	app.up.PostAnonymous = app.conf.PostAnonymous
	app.up.FileForAll = app.conf.FileForAll
	app.up.SiteFile(app.conf.SiteFile)
	app.up.SiteImage(app.conf.SiteImage)
	app.up.SiteText(app.conf.SiteText)
	app.up.SiteVideo(app.conf.SiteVideo)

	// Video download settings.
	app.video.SetConfig(&app.conf.Config)
	app.video.SetEnabledWeb(videodl.WebState(app.conf.EnabledWeb))

	// Settings for poller and IOActivity (force renderer reset in case of reload).
	app.service.Settings(uint64(app.conf.UpdateDelay.Value()), app.conf.DisplayText,
		app.conf.DisplayValues, app.conf.GraphType, app.conf.GaugeName, app.conf.Devices...)

	// Defaults.
	def.PollerInterval = app.conf.UpdateDelay.Value()
	def.Commands = cdtype.Commands{
		cmdLeft:   cdtype.NewCommandStd(app.conf.LeftAction, app.conf.LeftCommand, app.conf.LeftClass),
		cmdMiddle: cdtype.NewCommandStd(app.conf.MiddleAction, app.conf.MiddleCommand),
	}
}
开发者ID:sqp,项目名称:godock,代码行数:29,代码来源:NetActivity.go


示例2: Init

// Init load user configuration if needed and initialise applet.
//
func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) {
	// Reset data to be sure our display will be refreshed.
	app.data.Clear()
	app.data.LoadLogin(app.FileDataDir(loginLocation))
	app.err = nil

	// Define the mail client action.
	if app.conf.MailClientName == "" { //  Set default to webpage if not provided.
		app.conf.MailClientAction = MailClientLocation
		app.conf.MailClientName = app.conf.DefaultMonitorName
	}

	// Defaults.
	def.Label = "Mail unchecked"
	def.PollerInterval = app.conf.UpdateDelay.Value()

	// Add 1 to action as we don't provide the none option.
	cmd := cdtype.NewCommandStd(app.conf.MailClientAction+1, app.conf.MailClientName, app.conf.MailClientClass)
	def.Commands = cdtype.Commands{cmdMailClient: cmd}

	// Create the renderer.
	switch app.conf.Renderer {
	case QuickInfo:
		app.render = NewRenderedQuick(app)

	case EmblemSmall, EmblemLarge:
		var e error
		app.render, e = NewRenderedSVG(app, app.conf.Renderer)
		app.Log().Err(e, "renderer svg")

	default: // NoDisplay case, but using default to be sure we have a valid renderer.
		app.render = NewRenderedNone()
	}
}
开发者ID:sqp,项目名称:godock,代码行数:36,代码来源:GoGmail.go


示例3: Init

// Init load user configuration if needed and initialise applet.
//
func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) {
	// Settings for poller and IOActivity (force renderer reset in case of reload).
	app.service.Settings(uint64(app.conf.UpdateDelay.Value()), cdtype.InfoPosition(app.conf.DisplayText), app.conf.DisplayValues, app.conf.GraphType, app.conf.GaugeName, app.conf.Disks...)

	// Defaults.
	def.PollerInterval = app.conf.UpdateDelay.Value()
	def.Commands = cdtype.Commands{
		cmdLeft:   cdtype.NewCommandStd(app.conf.LeftAction, app.conf.LeftCommand, app.conf.LeftClass),
		cmdMiddle: cdtype.NewCommandStd(app.conf.MiddleAction, app.conf.MiddleCommand),
	}
}
开发者ID:sqp,项目名称:godock,代码行数:13,代码来源:DiskActivity.go


示例4: Init

// Init load user configuration if needed and initialise applet.
//
func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) {
	// Settings for service.
	app.service.Settings(app.conf.DisplayText, app.conf.DisplayValues, app.conf.GraphType, app.conf.GaugeName)
	app.service.SetSize(countTrue(app.conf.ShowRAM, app.conf.ShowSwap))

	// Defaults.
	def.PollerInterval = app.conf.UpdateDelay.Value()
	def.Commands = cdtype.Commands{
		cmdLeft:   cdtype.NewCommandStd(app.conf.LeftAction, app.conf.LeftCommand, app.conf.LeftClass),
		cmdMiddle: cdtype.NewCommandStd(app.conf.MiddleAction, app.conf.MiddleCommand),
	}
}
开发者ID:sqp,项目名称:godock,代码行数:14,代码来源:Mem.go


示例5: Init

// Init loads user configuration if needed and initialise applet.
//
func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) {
	// Settings for DiskFree.
	app.service.Settings(app.conf.DisplayText, 0, 0, app.conf.GaugeName)
	app.service.SetParts(app.conf.Partitions, app.conf.AutoDetect)

	// Defaults.
	def.PollerInterval = app.conf.UpdateDelay.Value()
	def.Commands = cdtype.Commands{
		cmdLeft:   cdtype.NewCommandStd(app.conf.LeftAction, app.conf.LeftCommand, app.conf.LeftClass),
		cmdMiddle: cdtype.NewCommandStd(app.conf.MiddleAction, app.conf.MiddleCommand),
	}
}
开发者ID:sqp,项目名称:godock,代码行数:14,代码来源:DiskFree.go


示例6: Init

// Load user configuration if needed and initialise applet.
//
func (app *AppletGmail) Init(loadConf bool) {
	if loadConf { // Try to load config. Exit if not found.
		app.conf = &mailConf{}
		log.Fatal(app.LoadConfig(&app.conf, dock.GetKey), "config")
	}
	log.SetDebug(app.conf.Debug)

	// Reset data to be sure our display will be refreshed.
	app.data.Clear()
	app.err = nil

	// Fill config empty settings.
	if app.conf.MonitorName == "" {
		app.conf.MonitorName = app.conf.DefaultMonitorName
	}
	if app.conf.AlertSoundFile == "" {
		app.conf.AlertSoundFile = app.conf.DefaultAlertSoundFile
	}
	if app.conf.UpdateDelay == 0 {
		app.conf.UpdateDelay = defaultUpdateDelay
	}

	// Set defaults to dock icon: display and controls.
	def := cdtype.Defaults{
		Shortkeys: []string{app.conf.ShortkeyOpen, app.conf.ShortkeyCheck},
		Label:     "Mail unchecked",
		Templates: []string{"InternalDialog"},
	}
	if app.conf.Icon != "" && app.conf.Renderer != EmblemSmall && app.conf.Renderer != EmblemLarge { // User selected icon.
		def.Icon = app.conf.Icon
	}
	if app.conf.MonitorEnabled {
		def.MonitorName = app.conf.MonitorName
	}
	app.SetDefaults(def)

	// Create the renderer.
	switch app.conf.Renderer {
	case QuickInfo:
		app.render = NewRenderedQuick(app.CDApplet)

	case EmblemSmall, EmblemLarge:
		app.render = NewRenderedSVG(app.CDApplet, app.conf.Renderer)

	default: // NoDisplay case, but using default to be sure we have a valid renderer.
		app.render = NewRenderedNone()
	}

	// Configure the mail polling loop.
	app.poller.SetInterval(app.conf.UpdateDelay)
}
开发者ID:jcswart,项目名称:godock,代码行数:53,代码来源:GoGmail.go


示例7: Init

// Init load user configuration if needed and initialise applet.
//
func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) {
	// Defaults.
	def.PollerInterval = app.conf.VersionPollingTimer.Value()
	def.Commands[cmdShowDiff] = cdtype.NewCommand(app.conf.DiffMonitored, app.conf.DiffCommand)

	// Version polling state.
	if app.conf.VersionPollingEnabled {
		app.Poller().Start()
	} else {
		app.Poller().Stop()
	}

	// Branches for versions checking.
	app.version.Clear()
	app.version.AddSources(
		versions.NewRepo(app.Log(), "cairo-dock-core", path.Join(app.conf.SourceDir, app.conf.DirCore)),
		versions.NewRepo(app.Log(), "cairo-dock-plug-ins", path.Join(app.conf.SourceDir, app.conf.DirApplets)),
	)
	for _, src := range app.conf.SourceExtra {
		app.version.AddSources(versions.NewRepo(app.Log(), path.Base(src), src))
	}

	// Build targets. Allow actions on sources and displays emblem on top left for togglable target.
	app.setBuildTarget()

	// Build globals.
	build.CmdSudo = app.conf.CommandSudo
	build.IconMissing = app.FileLocation("img", app.conf.IconMissing)
}
开发者ID:sqp,项目名称:godock,代码行数:31,代码来源:update.go


示例8: Init

// Init load user configuration if needed and initialise applet.
//
func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) {
	// Settings for poller and renderer.
	app.service.Settings(app.conf.DisplayText, app.conf.DisplayValues, app.conf.GraphType, app.conf.GaugeName)
	app.service.SetSize(1)
	app.service.interval = app.conf.UpdateDelay.Value()

	// Defaults.
	def.PollerInterval = app.conf.UpdateDelay.Value()
	def.Commands[cmdLeft] = cdtype.NewCommandStd(app.conf.LeftAction, app.conf.LeftCommand, app.conf.LeftClass)
	def.Commands[cmdMiddle] = cdtype.NewCommandStd(app.conf.MiddleAction, app.conf.MiddleCommand)
}
开发者ID:sqp,项目名称:godock,代码行数:13,代码来源:Cpu.go


示例9: Init

// Init is called after load config. We'll set the poller interval.
//
func (app *PollerApplet) Init(def *cdtype.Defaults, confLoaded bool) {
	// In Init, we'll use the Defaults as it's already provided.
	def.PollerInterval = app.conf.UpdateInterval.Value()

	// But you can also set a poller interval directly anytime.
	app.Poller().SetInterval(app.conf.UpdateInterval.Value())

	// Set your other defaults here...

	// Set your other variable settings here...
}
开发者ID:sqp,项目名称:godock,代码行数:13,代码来源:example_poller_test.go


示例10: Init

// Applet init
//
// Then we will have to declare the mandatory Init(loadConf bool) method:
//
// Init is called at startup and every time the applet is moved or asked to
// reload by the dock.
// When called, the config struct has already been filled from the config file,
// and some Defaults fields may already be set.
// You may still have to set the poller interval, some commands or declare
// shortkeys callbacks.
//
// Defaults fields not set will be reset to icon defaults (apply even if blank).
//
//   -The config data isn't available before the first Init.
//   -Use PreInit event if you need to act on the previous config before deletion.
//   -cdtype.ConfGroupIconBoth sets those def fields: Label, Icon and Debug.
//   -Don't forget that you may have to clean up some old display or data.
//
func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) {
	// Set defaults to dock icon: display and controls.
	def.Commands = cdtype.Commands{
		cmdClickLeft: cdtype.NewCommandStd(
			app.conf.LeftAction,
			app.conf.LeftCommand,
			app.conf.LeftClass),

		cmdClickMiddle: cdtype.NewCommandStd(
			app.conf.MiddleAction,
			app.conf.MiddleCommand),
	}

	// Set your other variable settings here...
}
开发者ID:sqp,项目名称:godock,代码行数:33,代码来源:example_cdtype_test.go


示例11: Init

// Init load user configuration if needed and initialise applet.
//
func (app *Applet) Init(def *cdtype.Defaults, confLoaded bool) {
	// Defaults.
	def.PollerInterval = app.conf.UpdateDelay.Value()

	// Share the conf with the weather service.
	app.weather.SetConfig(&app.conf.Config)
	app.weather.Clear()

	// if app.conf.WeatherTheme == "" {
	app.conf.WeatherTheme = defaultTheme
	// }

	// Set theme full path.
	app.conf.WeatherTheme = app.ThemePath(app.conf.WeatherTheme)

	if app.conf.LocationCode == "" {
		app.DetectLocation()
	}
}
开发者ID:sqp,项目名称:godock,代码行数:21,代码来源:clouds.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang cdtype.Events类代码示例发布时间:2022-05-28
下一篇:
Golang xio.PacketReader类代码示例发布时间: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