Added block update

This commit is contained in:
obscuren 2014-07-18 11:57:58 +02:00
parent 44296c0b33
commit 34e2ab9f9f
3 changed files with 47 additions and 23 deletions

View File

@ -419,6 +419,17 @@ ApplicationWindow {
} }
} }
Label {
y: 6
id: lastBlockLabel
objectName: "lastBlockLabel"
visible: true
text: ""
font.pixelSize: 10
anchors.right: peerGroup.left
anchors.rightMargin: 5
}
ProgressBar { ProgressBar {
id: syncProgressIndicator id: syncProgressIndicator
visible: false visible: false
@ -426,30 +437,31 @@ ApplicationWindow {
y: 3 y: 3
width: 140 width: 140
indeterminate: true indeterminate: true
anchors.right: peerLabel.left anchors.right: peerGroup.left
anchors.rightMargin: 5 anchors.rightMargin: 5
} }
Label { RowLayout {
id: peerGroup
y: 7 y: 7
anchors.right: peerImage.left anchors.right: parent.right
anchors.rightMargin: 5 MouseArea {
onDoubleClicked: peerWindow.visible = true
anchors.fill: parent
}
Label {
id: peerLabel id: peerLabel
font.pixelSize: 8 font.pixelSize: 8
text: "0 / 0" text: "0 / 0"
} }
Image { Image {
y: 7
id: peerImage id: peerImage
anchors.right: parent.right
width: 10; height: 10 width: 10; height: 10
MouseArea {
onDoubleClicked: peerWindow.visible = true
anchors.fill: parent
}
source: "../network.png" source: "../network.png"
} }
} }
}
Window { Window {
id: popup id: popup

View File

@ -17,6 +17,8 @@ type DebuggerWindow struct {
vm *ethchain.Vm vm *ethchain.Vm
Db *Debugger Db *Debugger
state *ethchain.State
} }
func NewDebuggerWindow(lib *UiLib) *DebuggerWindow { func NewDebuggerWindow(lib *UiLib) *DebuggerWindow {
@ -53,6 +55,7 @@ func (self *DebuggerWindow) SetCode(code string) {
func (self *DebuggerWindow) SetData(data string) { func (self *DebuggerWindow) SetData(data string) {
self.win.Set("dataText", data) self.win.Set("dataText", data)
} }
func (self *DebuggerWindow) SetAsm(data []byte) { func (self *DebuggerWindow) SetAsm(data []byte) {
self.win.Root().Call("clearAsm") self.win.Root().Call("clearAsm")

View File

@ -266,6 +266,10 @@ func (gui *Gui) setWalletValue(amount, unconfirmedFunds *big.Int) {
gui.win.Root().Call("setWalletValue", str) gui.win.Root().Call("setWalletValue", str)
} }
func (self *Gui) getObjectByName(objectName string) qml.Object {
return self.win.Root().ObjectByName(objectName)
}
// Simple go routine function that updates the list of peers in the GUI // Simple go routine function that updates the list of peers in the GUI
func (gui *Gui) update() { func (gui *Gui) update() {
reactor := gui.eth.Reactor() reactor := gui.eth.Reactor()
@ -289,13 +293,16 @@ func (gui *Gui) update() {
} }
reactor.Subscribe("peerList", peerChan) reactor.Subscribe("peerList", peerChan)
ticker := time.NewTicker(5 * time.Second) peerUpdateTicker := time.NewTicker(5 * time.Second)
generalUpdateTicker := time.NewTicker(1 * time.Second)
state := gui.eth.StateManager().TransState() state := gui.eth.StateManager().TransState()
unconfirmedFunds := new(big.Int) unconfirmedFunds := new(big.Int)
gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Amount))) gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Amount)))
gui.win.Root().ObjectByName("syncProgressIndicator").Set("visible", !gui.eth.IsUpToDate()) gui.getObjectByName("syncProgressIndicator").Set("visible", !gui.eth.IsUpToDate())
lastBlockLabel := gui.getObjectByName("lastBlockLabel")
for { for {
select { select {
@ -345,8 +352,10 @@ func (gui *Gui) update() {
gui.loadAddressBook() gui.loadAddressBook()
case <-peerChan: case <-peerChan:
gui.setPeerInfo() gui.setPeerInfo()
case <-ticker.C: case <-peerUpdateTicker.C:
gui.setPeerInfo() gui.setPeerInfo()
case <-generalUpdateTicker.C:
lastBlockLabel.Set("text", "#"+gui.eth.BlockChain().CurrentBlock.Number.String())
} }
} }
} }