forked from cerc-io/plugeth
Some minor corrections
This commit is contained in:
parent
4e6defd657
commit
893e9256a0
@ -3,7 +3,7 @@ var Filter = function(options) {
|
|||||||
this.seed = Math.floor(Math.random() * 1000000);
|
this.seed = Math.floor(Math.random() * 1000000);
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
|
||||||
if(options == "chain") {
|
if(options === "chain") {
|
||||||
eth.registerFilterString(options, this.seed);
|
eth.registerFilterString(options, this.seed);
|
||||||
} else if(typeof options === "object") {
|
} else if(typeof options === "object") {
|
||||||
eth.registerFilter(options, this.seed);
|
eth.registerFilter(options, this.seed);
|
||||||
|
@ -98,15 +98,18 @@ Rectangle {
|
|||||||
|
|
||||||
|
|
||||||
function addBlock(block, initial) {
|
function addBlock(block, initial) {
|
||||||
var txs = JSON.parse(block.transactions);
|
|
||||||
var amount = 0
|
|
||||||
if(initial == undefined){
|
if(initial == undefined){
|
||||||
initial = false
|
initial = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
var txs = JSON.parse(block.transactions);
|
||||||
if(txs != null){
|
if(txs != null){
|
||||||
amount = txs.length
|
amount = txs.length
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
var txs = block.transactions;
|
||||||
|
var amount = block.transactions.length;
|
||||||
|
|
||||||
if(initial){
|
if(initial){
|
||||||
blockModel.append({size: block.size, number: block.number, name: block.name, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)})
|
blockModel.append({size: block.size, number: block.number, name: block.name, gasLimit: block.gasLimit, gasUsed: block.gasUsed, coinbase: block.coinbase, hash: block.hash, txs: txs, txAmount: amount, time: block.time, prettyTime: convertToPretty(block.time)})
|
||||||
@ -241,8 +244,8 @@ Rectangle {
|
|||||||
singleBlock.set(0,block)
|
singleBlock.set(0,block)
|
||||||
popup.height = 300
|
popup.height = 300
|
||||||
transactionModel.clear()
|
transactionModel.clear()
|
||||||
if(block.txs != undefined){
|
if(block.txs !== undefined){
|
||||||
for(var i = 0; i < block.txs.count; ++i) {
|
for(var i = 0; i < block.txs.length; i++) {
|
||||||
transactionModel.insert(0, block.txs.get(i))
|
transactionModel.insert(0, block.txs.get(i))
|
||||||
}
|
}
|
||||||
if(block.txs.get(0).data){
|
if(block.txs.get(0).data){
|
||||||
|
@ -157,6 +157,7 @@ Rectangle {
|
|||||||
|
|
||||||
addTxs(filter.messages())
|
addTxs(filter.messages())
|
||||||
}
|
}
|
||||||
|
|
||||||
function addTxs(messages) {
|
function addTxs(messages) {
|
||||||
for(var i = 0; i < messages.length; i++) {
|
for(var i = 0; i < messages.length; i++) {
|
||||||
var message = messages[i];
|
var message = messages[i];
|
||||||
|
@ -18,7 +18,7 @@ ApplicationWindow {
|
|||||||
height: 600
|
height: 600
|
||||||
minimumHeight: 300
|
minimumHeight: 300
|
||||||
|
|
||||||
title: "Ether browser"
|
title: "Ethegate"
|
||||||
|
|
||||||
// This signal is used by the filter API. The filter API connects using this signal handler from
|
// This signal is used by the filter API. The filter API connects using this signal handler from
|
||||||
// the different QML files and plugins.
|
// the different QML files and plugins.
|
||||||
@ -55,25 +55,28 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addPlugin(path, options) {
|
function addPlugin(path, options) {
|
||||||
var component = Qt.createComponent(path);
|
try {
|
||||||
if(component.status != Component.Ready) {
|
var component = Qt.createComponent(path);
|
||||||
if(component.status == Component.Error) {
|
if(component.status != Component.Ready) {
|
||||||
console.debug("Error:"+ component.errorString());
|
if(component.status == Component.Error) {
|
||||||
|
console.debug("Error:"+ component.errorString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
var views = mainSplit.addComponent(component, options)
|
||||||
|
views.menuItem.path = path
|
||||||
|
|
||||||
|
mainSplit.views.push(views);
|
||||||
|
|
||||||
|
if(!options.noAdd) {
|
||||||
|
gui.addPlugin(path)
|
||||||
|
}
|
||||||
|
|
||||||
|
return views.view
|
||||||
|
} catch(e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var views = mainSplit.addComponent(component, options)
|
|
||||||
views.menuItem.path = path
|
|
||||||
|
|
||||||
mainSplit.views.push(views);
|
|
||||||
|
|
||||||
if(!options.noAdd) {
|
|
||||||
gui.addPlugin(path)
|
|
||||||
}
|
|
||||||
|
|
||||||
return views.view
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuBar {
|
MenuBar {
|
||||||
|
@ -78,7 +78,7 @@ func (gui *Gui) GetLogLevel() ethlog.LogLevel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *Gui) AddPlugin(pluginPath string) {
|
func (self *Gui) AddPlugin(pluginPath string) {
|
||||||
self.plugins[pluginPath] = plugin{Name: "SomeName", Path: pluginPath}
|
self.plugins[pluginPath] = plugin{Name: pluginPath, Path: pluginPath}
|
||||||
|
|
||||||
json, _ := json.MarshalIndent(self.plugins, "", " ")
|
json, _ := json.MarshalIndent(self.plugins, "", " ")
|
||||||
ethutil.WriteFile(ethutil.Config.ExecPath+"/plugins.json", json)
|
ethutil.WriteFile(ethutil.Config.ExecPath+"/plugins.json", json)
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -63,12 +64,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden
|
|||||||
|
|
||||||
pipe := ethpipe.NewJSPipe(ethereum)
|
pipe := ethpipe.NewJSPipe(ethereum)
|
||||||
gui := &Gui{eth: ethereum, txDb: db, pipe: pipe, logLevel: ethlog.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config, plugins: make(map[string]plugin)}
|
gui := &Gui{eth: ethereum, txDb: db, pipe: pipe, logLevel: ethlog.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config, plugins: make(map[string]plugin)}
|
||||||
data, err := ethutil.ReadAllFile(ethutil.Config.ExecPath + "/plugins.json")
|
data, _ := ethutil.ReadAllFile(path.Join(ethutil.Config.ExecPath, "plugins.json"))
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
}
|
|
||||||
fmt.Println("plugins:", string(data))
|
|
||||||
|
|
||||||
json.Unmarshal([]byte(data), &gui.plugins)
|
json.Unmarshal([]byte(data), &gui.plugins)
|
||||||
|
|
||||||
return gui
|
return gui
|
||||||
@ -339,6 +335,8 @@ func (gui *Gui) update() {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
for _, plugin := range gui.plugins {
|
for _, plugin := range gui.plugins {
|
||||||
|
logger.Infoln("Loading plugin ", plugin.Name)
|
||||||
|
|
||||||
gui.win.Root().Call("addPlugin", plugin.Path, "")
|
gui.win.Root().Call("addPlugin", plugin.Path, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,10 @@ func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib {
|
|||||||
return &UiLib{JSPipe: ethpipe.NewJSPipe(eth), engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth), filterCallbacks: make(map[int][]int), filters: make(map[int]*GuiFilter)}
|
return &UiLib{JSPipe: ethpipe.NewJSPipe(eth), engine: engine, eth: eth, assetPath: assetPath, jsEngine: javascript.NewJSRE(eth), filterCallbacks: make(map[int][]int), filters: make(map[int]*GuiFilter)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *UiLib) Note(msg string) {
|
||||||
|
logger.Infoln(msg)
|
||||||
|
}
|
||||||
|
|
||||||
func (self *UiLib) LookupDomain(domain string) string {
|
func (self *UiLib) LookupDomain(domain string) string {
|
||||||
world := self.World()
|
world := self.World()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user