本文整理汇总了Golang中github.com/lxn/walk.NewIconFromResource函数的典型用法代码示例。如果您正苦于以下问题:Golang NewIconFromResource函数的具体用法?Golang NewIconFromResource怎么用?Golang NewIconFromResource使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewIconFromResource函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: NewElangGui
func NewElangGui() (this *ElangGui, err error) {
this = &ElangGui{Data: &ElangGuiData{"我学会了新的姿势", "厘侥氏阻仟议徊米", Mode1}}
var db *walk.DataBinder
update := func() {
src := this.mSrc.Text()
switch this.Data.Mode {
case Mode1:
src = zhconv.EncodeString(src)
src = elang.EncodeString(src)
src = zhconv.EncodeString(src)
case Mode2:
src = zhconv.DecodeString(src)
src = elang.DecodeString(src)
src = zhconv.EncodeString(src)
}
this.mTar.SetText(src)
}
wmodel := MainWindow{
AssignTo: &this.mw,
Title: "鹅语",
MinSize: Size{512, 450},
Layout: VBox{},
DataBinder: DataBinder{
AssignTo: &db,
DataSource: this.Data,
},
Children: []Widget{
TextEdit{
Text: Bind("Src"),
AssignTo: &this.mSrc,
},
RadioButtonGroupBox{
Title: "模式",
AssignTo: &this.mMode,
Layout: HBox{},
DataMember: "Mode",
Buttons: []RadioButton{
{Text: "模式一", Value: Mode1, OnClicked: update},
{Text: "模式二", Value: Mode2, OnClicked: update},
},
},
TextEdit{
Text: Bind("Dst"),
AssignTo: &this.mTar,
},
},
}
if err = wmodel.Create(); err != nil {
walk.MsgBox(nil, "错误", "创建窗口失败", walk.MsgBoxOK|walk.MsgBoxIconError)
return
}
if icon, err2 := walk.NewIconFromResource("ICON_MAIN"); err2 == nil {
this.mw.SetIcon(icon)
}
this.mSrc.TextChanged().Attach(update)
db.SetAutoSubmit(true)
return
}
开发者ID:pa001024,项目名称:elang,代码行数:58,代码来源:elang-gui.go
示例2: main
// Main entry and GUI construction
func main() {
LANG = queryRegLayoutId(LANG_ID)
var (
mw *walk.MainWindow
currentLayout = getKeyboardLayout() // Get current system layout.
layoutPresent = checkLanguage() // Check if installed language is present and can be loaded.
triggered = true
infoText string
ldtMain *walk.LineEdit
btnMain *walk.PushButton
)
if layoutPresent {
infoText = INFO_TEXT
} else {
infoText = "The layout does not seem to be present on your system. Please install it first."
}
MainWindow{
AssignTo: &mw,
Title: "kasahorow " + LANG_STRING + " Writer",
MaxSize: Size{600, 200},
MinSize: Size{600, 200},
Layout: VBox{},
Children: []Widget{
MultilineLabel{Text: infoText},
LineEdit{AssignTo: &ldtMain},
PushButton{
AssignTo: &btnMain,
Enabled: layoutPresent,
Text: "Switch back to default layout.",
OnClicked: func() {
if triggered {
triggered = false
activateKeyboardLayout(currentLayout, KFL_SETFORPROCESS)
btnMain.SetText("Switch to " + LANG_STRING + ".")
} else {
triggered = true
loadLanguage()
btnMain.SetText("Switch back to default layout.")
}
},
},
},
}.Create()
if layoutPresent {
mw.Synchronize(loadLanguage) // Load new layout in main GUI thread.
}
ic, _ := walk.NewIconFromResource("kasahorow")
mw.SetIcon(ic)
mw.Run()
}
开发者ID:amonmoce,项目名称:africakeyboards,代码行数:55,代码来源:keyboard.go
示例3: setWindow
func setWindow() {
// 绑定log输出界面
lv, err := NewLogView(mw)
if err != nil {
panic(err)
}
LogicApp.SetLog(lv)
log.SetOutput(lv)
// 设置左上角图标
if icon, err := walk.NewIconFromResource("ICON"); err == nil {
mw.SetIcon(icon)
}
}
开发者ID:kt3000,项目名称:pholcus,代码行数:13,代码来源:pholcus-gui.go
示例4: Run
//.........这里部分代码省略.........
},
},
VSplitter{
Children: []Widget{
Label{
Text: "*间隔基准:",
},
ComboBox{
Value: Bind("BaseSleeptime", SelRequired{}),
BindingMember: "Uint",
DisplayMember: "Key",
Model: GUIOpt.SleepTime,
},
},
},
VSplitter{
Children: []Widget{
Label{
Text: "*随机延迟:",
},
ComboBox{
Value: Bind("RandomSleepPeriod", SelRequired{}),
BindingMember: "Uint",
DisplayMember: "Key",
Model: GUIOpt.SleepTime,
},
},
},
RadioButtonGroupBox{
ColumnSpan: 2,
Title: "*输出方式",
Layout: HBox{},
DataMember: "OutType",
Buttons: []RadioButton{
{Text: GUIOpt.OutType[0].Key, Value: GUIOpt.OutType[0].String},
{Text: GUIOpt.OutType[1].Key, Value: GUIOpt.OutType[1].String},
{Text: GUIOpt.OutType[2].Key, Value: GUIOpt.OutType[2].String},
},
},
},
},
},
},
Composite{
Layout: HBox{},
Children: []Widget{
// 必填项错误检查
LineErrorPresenter{
AssignTo: &ep,
ColumnSpan: 2,
},
PushButton{
Text: "开始抓取",
AssignTo: &toggleSpecialModePB,
OnClicked: func() {
if toggleSpecialModePB.Text() == "取消" {
toggleSpecialModePB.SetEnabled(false)
toggleSpecialModePB.SetText("取消中…")
Stop()
} else {
if err := db.Submit(); err != nil {
log.Print(err)
return
}
Input.Spiders = spiderMenu.GetChecked()
if len(Input.Spiders) == 0 {
return
}
toggleSpecialModePB.SetText("取消")
Start()
}
},
},
},
},
},
}.Create()); err != nil {
log.Fatal(err)
}
// 绑定log输出界面
lv, err := NewLogView(mw)
if err != nil {
log.Fatal(err)
}
log.SetOutput(lv)
if icon, err := walk.NewIconFromResource("ICON"); err == nil {
mw.SetIcon(icon)
}
// 运行窗体程序
mw.Run()
}
开发者ID:zydudu,项目名称:pholcus,代码行数:101,代码来源:guimain.go
示例5: serverWindow
//.........这里部分代码省略.........
VSplitter{
Children: []Widget{
Label{
Text: "*分批输出大小:(1~5,000,000 条数据)",
},
NumberEdit{
Value: Bind("DockerCap", Range{1, 5000000}),
Suffix: "",
Decimals: 0,
},
},
},
VSplitter{
Children: []Widget{
Label{
Text: "*间隔基准:",
},
ComboBox{
Value: Bind("BaseSleeptime", SelRequired{}),
BindingMember: "Uint",
DisplayMember: "Key",
Model: GuiOpt.SleepTime,
},
},
},
VSplitter{
Children: []Widget{
Label{
Text: "*随机延迟:",
},
ComboBox{
Value: Bind("RandomSleepPeriod", SelRequired{}),
BindingMember: "Uint",
DisplayMember: "Key",
Model: GuiOpt.SleepTime,
},
},
},
RadioButtonGroupBox{
ColumnSpan: 1,
Title: "*输出方式",
Layout: HBox{},
DataMember: "OutType",
Buttons: []RadioButton{
{Text: GuiOpt.OutType[0].Key, Value: GuiOpt.OutType[0].String},
{Text: GuiOpt.OutType[1].Key, Value: GuiOpt.OutType[1].String},
{Text: GuiOpt.OutType[2].Key, Value: GuiOpt.OutType[2].String},
},
},
},
},
},
},
Composite{
Layout: HBox{},
Children: []Widget{
// 必填项错误检查
LineErrorPresenter{
AssignTo: &ep,
},
PushButton{
MinSize: Size{90, 0},
Text: serverBtnTxt(),
AssignTo: &toggleRunBtn,
OnClicked: serverStart,
},
},
},
},
}.Create()); err != nil {
log.Fatal(err)
}
// 绑定log输出界面
lv, err := NewLogView(mw)
if err != nil {
log.Fatal(err)
}
log.SetOutput(lv)
if icon, err := walk.NewIconFromResource("ICON"); err == nil {
mw.SetIcon(icon)
}
// 开启报告
reporter.Log.Run()
// 运行pholcus核心
PholcusRun()
// 运行窗体程序
mw.Run()
}
开发者ID:Huangyan9188,项目名称:pholcus,代码行数:101,代码来源:server.go
示例6: runmodeWindow
func runmodeWindow() {
if err := (MainWindow{
AssignTo: &mw,
DataBinder: DataBinder{
AssignTo: &db,
DataSource: Input,
ErrorPresenter: ErrorPresenterRef{&ep},
},
Title: config.APP_NAME,
MinSize: Size{450, 350},
Layout: VBox{ /*MarginsZero: true*/ },
Children: []Widget{
RadioButtonGroupBox{
AssignTo: &mode,
Title: "*运行模式",
Layout: HBox{},
MinSize: Size{0, 70},
DataMember: "RunMode",
Buttons: []RadioButton{
{Text: GuiOpt.RunMode[0].Key, Value: GuiOpt.RunMode[0].Int},
{Text: GuiOpt.RunMode[1].Key, Value: GuiOpt.RunMode[1].Int},
{Text: GuiOpt.RunMode[2].Key, Value: GuiOpt.RunMode[2].Int},
},
},
VSplitter{
AssignTo: &host,
MaxSize: Size{0, 120},
Children: []Widget{
VSplitter{
Children: []Widget{
Label{
Text: "分布式端口:(单机模式不填)",
},
NumberEdit{
Value: Bind("Port"),
Suffix: "",
Decimals: 0,
},
},
},
VSplitter{
Children: []Widget{
Label{
Text: "主节点 URL:(客户端模式必填)",
},
LineEdit{
Text: Bind("Master"),
},
},
},
},
},
PushButton{
Text: "确认开始",
MinSize: Size{0, 30},
AssignTo: &runStopBtn,
OnClicked: func() {
if err := db.Submit(); err != nil {
log.Println(err)
return
}
switch Input.RunMode {
case status.OFFLINE:
offlineWindow()
case status.SERVER:
serverWindow()
case status.CLIENT:
clientWindow()
}
},
},
},
}.Create()); err != nil {
log.Fatal(err)
}
if icon, err := walk.NewIconFromResource("ICON"); err == nil {
mw.SetIcon(icon)
}
// 运行窗体程序
mw.Run()
}
开发者ID:harryKong,项目名称:pholcus,代码行数:91,代码来源:runmode.go
示例7: main
func main() {
var le, le2 *walk.LineEdit
var lb1, lb2 *walk.Label
var ck1 *walk.CheckBox
var mw *walk.MainWindow
copytext, _ := walk.Clipboard().Text()
updateIcon := func() {
mainIcon, err := walk.NewIconFromResource("101")
if err != nil {
// do some work
}
mw.SetIcon(mainIcon)
}
if err := (MainWindow{
AssignTo: &mw,
Title: "模板下载器",
MinSize: Size{400, 100},
Layout: VBox{},
Children: []Widget{
CheckBox{
AssignTo: &ck1,
Name: "cksnap",
Text: "带截图抓取",
Checked: false,
},
Label{
AssignTo: &lb1,
Text: "网址",
},
LineEdit{
AssignTo: &le,
Text: copytext,
},
Label{
AssignTo: &lb2,
Text: "保存目录",
},
LineEdit{
AssignTo: &le2,
Text: `D:\APMServ5.2.6\www\htdocs\down\tpls\`,
},
PushButton{
Text: "开始抓取",
OnClicked: func() {
fmt.Println(ck1.Checked())
if ck1.Checked() {
command := flag.String("cmd", "phantomjs", "Set the command.")
patharr := strings.Split(le2.Text(), "\\")
args := flag.String("args", "rasterize.js "+le.Text()+" "+le2.Text()+"\\"+patharr[len(patharr)-1]+".png", "Set the args. (separated by spaces)")
var argArray []string
if *args != "" {
argArray = strings.Split(*args, " ")
} else {
argArray = make([]string, 0)
}
flag.Parse()
cmd := exec.Command(*command, argArray...)
buf, err := cmd.Output()
if err != nil {
fmt.Fprintf(os.Stderr, "The command failed to perform: %s (Command: %s, Arguments: %s)", err, *command, *args)
return
}
fmt.Fprintf(os.Stdout, "Result: %s", buf)
}
getTemplate(le.Text(), le2.Text())
},
},
开发者ID:sdgdsffdsfff,项目名称:tplspider,代码行数:74,代码来源:test.go
注:本文中的github.com/lxn/walk.NewIconFromResource函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论