Skip to content

Commit 34e2ab9

Browse files
committed
Added block update
1 parent 44296c0 commit 34e2ab9

File tree

3 files changed

+47
-23
lines changed

3 files changed

+47
-23
lines changed

ethereal/assets/qml/wallet.qml

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -419,36 +419,48 @@ ApplicationWindow {
419419
}
420420
}
421421

422+
Label {
423+
y: 6
424+
id: lastBlockLabel
425+
objectName: "lastBlockLabel"
426+
visible: true
427+
text: ""
428+
font.pixelSize: 10
429+
anchors.right: peerGroup.left
430+
anchors.rightMargin: 5
431+
}
432+
422433
ProgressBar {
423434
id: syncProgressIndicator
424435
visible: false
425436
objectName: "syncProgressIndicator"
426437
y: 3
427438
width: 140
428439
indeterminate: true
429-
anchors.right: peerLabel.left
440+
anchors.right: peerGroup.left
430441
anchors.rightMargin: 5
431442
}
432443

433-
Label {
434-
y: 7
435-
anchors.right: peerImage.left
436-
anchors.rightMargin: 5
437-
id: peerLabel
438-
font.pixelSize: 8
439-
text: "0 / 0"
440-
}
441-
Image {
442-
y: 7
443-
id: peerImage
444-
anchors.right: parent.right
445-
width: 10; height: 10
446-
MouseArea {
447-
onDoubleClicked: peerWindow.visible = true
448-
anchors.fill: parent
449-
}
450-
source: "../network.png"
451-
}
444+
RowLayout {
445+
id: peerGroup
446+
y: 7
447+
anchors.right: parent.right
448+
MouseArea {
449+
onDoubleClicked: peerWindow.visible = true
450+
anchors.fill: parent
451+
}
452+
453+
Label {
454+
id: peerLabel
455+
font.pixelSize: 8
456+
text: "0 / 0"
457+
}
458+
Image {
459+
id: peerImage
460+
width: 10; height: 10
461+
source: "../network.png"
462+
}
463+
}
452464
}
453465

454466
Window {

ethereal/debugger.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ type DebuggerWindow struct {
1717

1818
vm *ethchain.Vm
1919
Db *Debugger
20+
21+
state *ethchain.State
2022
}
2123

2224
func NewDebuggerWindow(lib *UiLib) *DebuggerWindow {
@@ -53,6 +55,7 @@ func (self *DebuggerWindow) SetCode(code string) {
5355
func (self *DebuggerWindow) SetData(data string) {
5456
self.win.Set("dataText", data)
5557
}
58+
5659
func (self *DebuggerWindow) SetAsm(data []byte) {
5760
self.win.Root().Call("clearAsm")
5861

ethereal/gui.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,10 @@ func (gui *Gui) setWalletValue(amount, unconfirmedFunds *big.Int) {
266266
gui.win.Root().Call("setWalletValue", str)
267267
}
268268

269+
func (self *Gui) getObjectByName(objectName string) qml.Object {
270+
return self.win.Root().ObjectByName(objectName)
271+
}
272+
269273
// Simple go routine function that updates the list of peers in the GUI
270274
func (gui *Gui) update() {
271275
reactor := gui.eth.Reactor()
@@ -289,13 +293,16 @@ func (gui *Gui) update() {
289293
}
290294
reactor.Subscribe("peerList", peerChan)
291295

292-
ticker := time.NewTicker(5 * time.Second)
296+
peerUpdateTicker := time.NewTicker(5 * time.Second)
297+
generalUpdateTicker := time.NewTicker(1 * time.Second)
293298

294299
state := gui.eth.StateManager().TransState()
295300

296301
unconfirmedFunds := new(big.Int)
297302
gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Amount)))
298-
gui.win.Root().ObjectByName("syncProgressIndicator").Set("visible", !gui.eth.IsUpToDate())
303+
gui.getObjectByName("syncProgressIndicator").Set("visible", !gui.eth.IsUpToDate())
304+
305+
lastBlockLabel := gui.getObjectByName("lastBlockLabel")
299306

300307
for {
301308
select {
@@ -345,8 +352,10 @@ func (gui *Gui) update() {
345352
gui.loadAddressBook()
346353
case <-peerChan:
347354
gui.setPeerInfo()
348-
case <-ticker.C:
355+
case <-peerUpdateTicker.C:
349356
gui.setPeerInfo()
357+
case <-generalUpdateTicker.C:
358+
lastBlockLabel.Set("text", "#"+gui.eth.BlockChain().CurrentBlock.Number.String())
350359
}
351360
}
352361
}

0 commit comments

Comments
 (0)