Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #25 from govm-net/lengzhao
Browse files Browse the repository at this point in the history
dynamic ui
  • Loading branch information
lengzhao authored Dec 20, 2020
2 parents 44999a6 + 5391ac2 commit de1c496
Show file tree
Hide file tree
Showing 13 changed files with 1,342 additions and 114 deletions.
2 changes: 1 addition & 1 deletion bin/gui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

1. fyne.exe package -os windows -name govm.net -icon ./assets/govm.png
2. mv gui.exe govm.exe
2. tar zcvf govm_windows_$(date +'%Y%m%d_%H%M%S').tar.gz govm.exe assets conf.json
3. tar zcvf govm_windows_$(date +'%Y%m%d_%H%M%S').tar.gz govm.exe assets conf.json

## add local language

Expand Down
1 change: 1 addition & 0 deletions bin/gui/assets/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"Reward":"奖励",
"Life":"有效期",
"Message":"信息",
"Customize":"自定义",
"":"",
"Number":"数量"
}
2 changes: 2 additions & 0 deletions bin/gui/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ mkdir $folder
mv govm.exe $folder
cp assets $folder -rf
cp conf.json $folder -rf
cp dynamic_ui.json $folder -rf
cp usage.txt $folder -rf
zip -r govm_windows_wallet_$(date +'%Y%m%d_%H%M%S').zip $folder
echo Enter to exit
read k
Expand Down
3 changes: 2 additions & 1 deletion bin/gui/conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"chains": [
"1",
"2"
]
],
"dynamic_ui_file": "dynamic_ui.json"
}
15 changes: 8 additions & 7 deletions bin/gui/conf/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ const Vserion = "v0.5.6"

// Config config
type Config struct {
APIServer string `json:"api_server,omitempty"`
WalletFile string `json:"wallet_file,omitempty"`
Langure string `json:"langure,omitempty"`
LangureList []string `json:"langure_list,omitempty"`
CoinUnit string `json:"coin_unit,omitempty"`
DefaultChain string `json:"default_chain,omitempty"`
Chains []string `json:"chains,omitempty"`
APIServer string `json:"api_server,omitempty"`
WalletFile string `json:"wallet_file,omitempty"`
Langure string `json:"langure,omitempty"`
LangureList []string `json:"langure_list,omitempty"`
CoinUnit string `json:"coin_unit,omitempty"`
DefaultChain string `json:"default_chain,omitempty"`
Chains []string `json:"chains,omitempty"`
DynamicUIFile string `json:"dynamic_ui_file,omitempty"`
}

// Public key of config
Expand Down
246 changes: 246 additions & 0 deletions bin/gui/dynamic_ui.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
{
"view_ui": [
{
"name": "Category",
"app": "cdc09c276df3af32f8f60c33d57710374fe126f482fa50db61271bac0886e348",
"description": "category of flag",
"struct": "tCategory",
"chain": 1,
"show_expiration": true,
"hide": false,
"input": [
{
"mode": "string",
"title": "key"
}
],
"view": [
{
"mode": "map",
"title": "",
"sub": [
{
"mode": "string",
"title": "ID",
"key": "id"
},
{
"mode": "string",
"title": "Description",
"key": "desc"
}
]
}
]
},
{
"name": "Flag",
"app": "cdc09c276df3af32f8f60c33d57710374fe126f482fa50db61271bac0886e348",
"description": "flag of address",
"struct": "tUser",
"chain": 1,
"show_key": true,
"show_expiration": true,
"input": [
{
"mode": "address",
"title": "Address",
"value": "01ccaf415a3a6dc8964bf935a1f40e55654a4243ae99c709"
},
{
"mode": "string",
"title": "Category",
"value": "discord"
},
{
"mode": "hash",
"hide": true
}
],
"view": [
{
"mode": "map",
"title": "",
"sub": [
{
"mode": "hex",
"title": "Address",
"key": "addr"
},
{
"mode": "string",
"title": "Category",
"key": "category"
},
{
"mode": "string",
"title": "ID",
"key": "id"
},
{
"mode": "string",
"title": "Desc",
"key": "desc"
}
]
}
]
},
{
"name": "LastAction",
"app": "c11b3b8aa630a7fbfccec9e023c363749e9c60db43d7678f43c96075e5c2ddc0",
"description": "accept one task to new one action",
"struct": "tActionStatus",
"chain": 1,
"show_key": true,
"show_expiration": true,
"input": [
{
"mode": "address",
"title": "Address"
}
],
"view": [
{
"mode": "number",
"title": "Action ID"
}
]
}
],
"run_ui": [
{
"name": "Flag",
"app": "cdc09c276df3af32f8f60c33d57710374fe126f482fa50db61271bac0886e348",
"description": "Tag yourself and let others know you",
"chains": [
1
],
"energy": 0.1,
"hide": false,
"input": [
{
"mode": "hex",
"title": "Prefix",
"value": "02",
"hide": true
},
{
"mode": "map",
"sub": [
{
"mode": "string",
"title": "Category",
"key": "category",
"value":"discord"
},
{
"mode": "string",
"title": "ID",
"key": "id",
"value":""
},
{
"mode": "string",
"title": "Description",
"key": "desc",
"value": "",
"empty_enable": true
}
]
}
]
},
{
"name": "Category",
"app": "cdc09c276df3af32f8f60c33d57710374fe126f482fa50db61271bac0886e348",
"description": "add new category of flag",
"chains": [
1
],
"energy": 0.1,
"hide": false,
"input": [
{
"mode": "hex",
"title": "Prefix",
"value": "00",
"hide": true
},
{
"mode": "map",
"sub": [
{
"mode": "string",
"title": "Category",
"key": "id"
},
{
"mode": "string",
"title": "Desc",
"key": "desc",
"empty_enable": true
}
]
}
]
},
{
"name": "AcceptTask",
"app": "c11b3b8aa630a7fbfccec9e023c363749e9c60db43d7678f43c96075e5c2ddc0",
"description": "accept task",
"chains": [
1
],
"energy": 0.1,
"hide": false,
"input": [
{
"mode": "hex",
"title": "Option",
"value": "02",
"hide":true
},
{
"mode": "uint64",
"title": "TaskID",
"value": "1"
}
]
},
{
"name": "CommitAction",
"app": "c11b3b8aa630a7fbfccec9e023c363749e9c60db43d7678f43c96075e5c2ddc0",
"description": "add new category of flag",
"chains": [
1
],
"energy": 0.1,
"hide": false,
"input": [
{
"mode": "hex",
"title": "Prefix",
"value": "03",
"hide": true
},
{
"mode": "map",
"sub": [
{
"mode": "string",
"title": "ActionID",
"key": "id"
},
{
"mode": "string",
"title": "Proof",
"key": "msg",
"empty_enable": true
}
]
}
]
}
]
}
9 changes: 7 additions & 2 deletions bin/gui/screens/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ func makeNewAPPTab(w fyne.Window) fyne.Widget {
fd.SetFilter(storage.NewExtensionFileFilter([]string{".go", ".govm"}))
fd.Show()
})
var chainID uint64 = 1
chain := widget.NewSelect(c.Chains, func(s string) {
chainID, _ = strconv.ParseUint(s, 10, 64)
})
chain.SetSelected(c.DefaultChain)
energy := widget.NewEntry()
energy.SetText("1")
unit := widget.NewLabel(c.CoinUnit)
Expand Down Expand Up @@ -311,7 +316,7 @@ func makeNewAPPTab(w fyne.Window) fyne.Widget {
base := res.GetBaseOfUnit(c.CoinUnit)

myWlt := conf.GetWallet()
ts := trans.NewTransaction(1, myWlt.Address, 0)
ts := trans.NewTransaction(chainID, myWlt.Address, 0)
ts.Energy = uint64(engF * float64(base))
ts.Ops = trans.OpsNewApp
ts.Data = code
Expand All @@ -332,7 +337,7 @@ func makeNewAPPTab(w fyne.Window) fyne.Widget {
result.SetText(fmt.Sprintf("%x", key))
},
}

form.Append(res.GetLocalString("Chain"), chain)
form.Append(res.GetLocalString("Description"), desc)
borderLayout := layout.NewBorderLayout(nil, nil, nil, btnOpen)
form.Append(res.GetLocalString("Code"), fyne.NewContainerWithLayout(borderLayout, btnOpen, codeEntry))
Expand Down
Loading

0 comments on commit de1c496

Please sign in to comment.