Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
31ffca6d
Commit
31ffca6d
authored
Mar 15, 2015
by
zelig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove jsre from mist
parent
da440978
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
193 deletions
+63
-193
main.qml
cmd/mist/assets/qml/main.qml
+51
-150
gui.go
cmd/mist/gui.go
+2
-23
main.go
cmd/mist/main.go
+2
-1
ui_lib.go
cmd/mist/ui_lib.go
+8
-19
No files found.
cmd/mist/assets/qml/main.qml
View file @
31ffca6d
This diff is collapsed.
Click to expand it.
cmd/mist/gui.go
View file @
31ffca6d
...
@@ -25,9 +25,7 @@ import "C"
...
@@ -25,9 +25,7 @@ import "C"
import
(
import
(
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"io/ioutil"
"math/big"
"math/big"
"os"
"path"
"path"
"runtime"
"runtime"
"sort"
"sort"
...
@@ -99,7 +97,7 @@ func NewWindow(ethereum *eth.Ethereum) *Gui {
...
@@ -99,7 +97,7 @@ func NewWindow(ethereum *eth.Ethereum) *Gui {
return
gui
return
gui
}
}
func
(
gui
*
Gui
)
Start
(
assetPath
string
)
{
func
(
gui
*
Gui
)
Start
(
assetPath
,
libPath
string
)
{
defer
gui
.
txDb
.
Close
()
defer
gui
.
txDb
.
Close
()
guilogger
.
Infoln
(
"Starting GUI"
)
guilogger
.
Infoln
(
"Starting GUI"
)
...
@@ -117,7 +115,7 @@ func (gui *Gui) Start(assetPath string) {
...
@@ -117,7 +115,7 @@ func (gui *Gui) Start(assetPath string) {
// Create a new QML engine
// Create a new QML engine
gui
.
engine
=
qml
.
NewEngine
()
gui
.
engine
=
qml
.
NewEngine
()
context
:=
gui
.
engine
.
Context
()
context
:=
gui
.
engine
.
Context
()
gui
.
uiLib
=
NewUiLib
(
gui
.
engine
,
gui
.
eth
,
assetPath
)
gui
.
uiLib
=
NewUiLib
(
gui
.
engine
,
gui
.
eth
,
assetPath
,
libPath
)
gui
.
whisper
=
qwhisper
.
New
(
gui
.
eth
.
Whisper
())
gui
.
whisper
=
qwhisper
.
New
(
gui
.
eth
.
Whisper
())
// Expose the eth library and the ui library to QML
// Expose the eth library and the ui library to QML
...
@@ -292,25 +290,6 @@ func (self *Gui) getObjectByName(objectName string) qml.Object {
...
@@ -292,25 +290,6 @@ func (self *Gui) getObjectByName(objectName string) qml.Object {
return
self
.
win
.
Root
()
.
ObjectByName
(
objectName
)
return
self
.
win
.
Root
()
.
ObjectByName
(
objectName
)
}
}
func
loadJavascriptAssets
(
gui
*
Gui
)
(
jsfiles
string
)
{
for
_
,
fn
:=
range
[]
string
{
"ext/q.js"
,
"ext/eth.js/main.js"
,
"ext/eth.js/qt.js"
,
"ext/setup.js"
}
{
f
,
err
:=
os
.
Open
(
gui
.
uiLib
.
AssetPath
(
fn
))
if
err
!=
nil
{
fmt
.
Println
(
err
)
continue
}
content
,
err
:=
ioutil
.
ReadAll
(
f
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
continue
}
jsfiles
+=
string
(
content
)
}
return
}
func
(
gui
*
Gui
)
SendCommand
(
cmd
ServEv
)
{
func
(
gui
*
Gui
)
SendCommand
(
cmd
ServEv
)
{
gui
.
serviceEvents
<-
cmd
gui
.
serviceEvents
<-
cmd
}
}
...
...
cmd/mist/main.go
View file @
31ffca6d
...
@@ -65,6 +65,7 @@ func init() {
...
@@ -65,6 +65,7 @@ func init() {
utils
.
NodeKeyFileFlag
,
utils
.
NodeKeyFileFlag
,
utils
.
RPCListenAddrFlag
,
utils
.
RPCListenAddrFlag
,
utils
.
RPCPortFlag
,
utils
.
RPCPortFlag
,
utils
.
JSpathFlag
,
}
}
}
}
...
@@ -111,7 +112,7 @@ func run(ctx *cli.Context) {
...
@@ -111,7 +112,7 @@ func run(ctx *cli.Context) {
gui
:=
NewWindow
(
ethereum
)
gui
:=
NewWindow
(
ethereum
)
utils
.
RegisterInterrupt
(
func
(
os
.
Signal
)
{
gui
.
Stop
()
})
utils
.
RegisterInterrupt
(
func
(
os
.
Signal
)
{
gui
.
Stop
()
})
// gui blocks the main thread
// gui blocks the main thread
gui
.
Start
(
ctx
.
GlobalString
(
assetPathFlag
.
Name
))
gui
.
Start
(
ctx
.
GlobalString
(
assetPathFlag
.
Name
)
,
ctx
.
GlobalString
(
utils
.
JSpathFlag
.
Name
)
)
return
nil
return
nil
})
})
}
}
cmd/mist/ui_lib.go
View file @
31ffca6d
...
@@ -21,7 +21,6 @@
...
@@ -21,7 +21,6 @@
package
main
package
main
import
(
import
(
"fmt"
"io/ioutil"
"io/ioutil"
"path"
"path"
...
@@ -29,7 +28,6 @@ import (
...
@@ -29,7 +28,6 @@ import (
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event/filter"
"github.com/ethereum/go-ethereum/event/filter"
"github.com/ethereum/go-ethereum/javascript"
"github.com/ethereum/go-ethereum/xeth"
"github.com/ethereum/go-ethereum/xeth"
"github.com/obscuren/qml"
"github.com/obscuren/qml"
)
)
...
@@ -49,15 +47,19 @@ type UiLib struct {
...
@@ -49,15 +47,19 @@ type UiLib struct {
// The main application window
// The main application window
win
*
qml
.
Window
win
*
qml
.
Window
jsEngine
*
javascript
.
JSRE
filterCallbacks
map
[
int
][]
int
filterCallbacks
map
[
int
][]
int
filterManager
*
filter
.
FilterManager
filterManager
*
filter
.
FilterManager
}
}
func
NewUiLib
(
engine
*
qml
.
Engine
,
eth
*
eth
.
Ethereum
,
assetPath
string
)
*
UiLib
{
func
NewUiLib
(
engine
*
qml
.
Engine
,
eth
*
eth
.
Ethereum
,
assetPath
,
libPath
string
)
*
UiLib
{
x
:=
xeth
.
New
(
eth
,
nil
)
x
:=
xeth
.
New
(
eth
,
nil
)
lib
:=
&
UiLib
{
XEth
:
x
,
engine
:
engine
,
eth
:
eth
,
assetPath
:
assetPath
,
jsEngine
:
javascript
.
NewJSRE
(
x
),
filterCallbacks
:
make
(
map
[
int
][]
int
)}
//, filters: make(map[int]*xeth.JSFilter)}
lib
:=
&
UiLib
{
XEth
:
x
,
engine
:
engine
,
eth
:
eth
,
assetPath
:
assetPath
,
filterCallbacks
:
make
(
map
[
int
][]
int
),
}
lib
.
filterManager
=
filter
.
NewFilterManager
(
eth
.
EventMux
())
lib
.
filterManager
=
filter
.
NewFilterManager
(
eth
.
EventMux
())
go
lib
.
filterManager
.
Start
()
go
lib
.
filterManager
.
Start
()
...
@@ -76,19 +78,6 @@ func (self *UiLib) ImportTx(rlpTx string) {
...
@@ -76,19 +78,6 @@ func (self *UiLib) ImportTx(rlpTx string) {
}
}
}
}
func
(
self
*
UiLib
)
EvalJavascriptFile
(
path
string
)
{
self
.
jsEngine
.
LoadExtFile
(
path
[
7
:
])
}
func
(
self
*
UiLib
)
EvalJavascriptString
(
str
string
)
string
{
value
,
err
:=
self
.
jsEngine
.
Run
(
str
)
if
err
!=
nil
{
return
err
.
Error
()
}
return
fmt
.
Sprintf
(
"%v"
,
value
)
}
func
(
ui
*
UiLib
)
Muted
(
content
string
)
{
func
(
ui
*
UiLib
)
Muted
(
content
string
)
{
component
,
err
:=
ui
.
engine
.
LoadFile
(
ui
.
AssetPath
(
"qml/muted.qml"
))
component
,
err
:=
ui
.
engine
.
LoadFile
(
ui
.
AssetPath
(
"qml/muted.qml"
))
if
err
!=
nil
{
if
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment