Added open js option for repetitive tasks in ethereal
This commit is contained in:
@@ -63,6 +63,16 @@ ApplicationWindow {
|
||||
txImportDialog.visible = true
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Run JS file"
|
||||
onTriggered: {
|
||||
generalFileDialog.callback = function(path) {
|
||||
eth.evalJavascriptFile(path)
|
||||
}
|
||||
generalFileDialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
@@ -452,6 +462,16 @@ ApplicationWindow {
|
||||
onAccepted: {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FileDialog {
|
||||
id: generalFileDialog
|
||||
property var callback;
|
||||
onAccepted: {
|
||||
var path = this.fileUrl.toString()
|
||||
callback.call(this, path)
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: importDialog
|
||||
|
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/ethereum/eth-go/ethreact"
|
||||
"github.com/ethereum/eth-go/ethutil"
|
||||
"github.com/ethereum/eth-go/ethwire"
|
||||
"github.com/ethereum/go-ethereum/javascript"
|
||||
"github.com/ethereum/go-ethereum/utils"
|
||||
"github.com/go-qml/qml"
|
||||
)
|
||||
@@ -47,6 +48,8 @@ type Gui struct {
|
||||
config *ethutil.ConfigManager
|
||||
|
||||
miner *ethminer.Miner
|
||||
|
||||
jsEngine *javascript.JSRE
|
||||
}
|
||||
|
||||
// Create GUI, but doesn't start it
|
||||
@@ -58,7 +61,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden
|
||||
|
||||
pub := ethpub.NewPEthereum(ethereum)
|
||||
|
||||
return &Gui{eth: ethereum, txDb: db, pub: pub, logLevel: ethlog.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config}
|
||||
return &Gui{eth: ethereum, txDb: db, pub: pub, logLevel: ethlog.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config, jsEngine: javascript.NewJSRE(ethereum)}
|
||||
}
|
||||
|
||||
func (gui *Gui) Start(assetPath string) {
|
||||
@@ -121,6 +124,9 @@ func (gui *Gui) Stop() {
|
||||
gui.open = false
|
||||
gui.win.Hide()
|
||||
}
|
||||
|
||||
gui.jsEngine.Stop()
|
||||
|
||||
logger.Infoln("Stopped")
|
||||
}
|
||||
|
||||
@@ -464,6 +470,13 @@ func (self *Gui) ImportTx(rlpTx string) {
|
||||
self.eth.TxPool().QueueTransaction(tx)
|
||||
}
|
||||
|
||||
func (self *Gui) SearchChange(blockHash, address, storageAddress string) {
|
||||
}
|
||||
|
||||
func (self *Gui) EvalJavascriptFile(path string) {
|
||||
self.jsEngine.LoadExtFile(path[7:])
|
||||
}
|
||||
|
||||
func (gui *Gui) SetCustomIdentifier(customIdentifier string) {
|
||||
gui.clientIdentity.SetCustomIdentifier(customIdentifier)
|
||||
gui.config.Save("id", customIdentifier)
|
||||
|
Reference in New Issue
Block a user