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
1257e8b4
Commit
1257e8b4
authored
Mar 27, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into develop
parents
e65c4ee9
1323f60c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
9 deletions
+22
-9
config.go
ethereal/config.go
+2
-0
ethereum.go
ethereal/ethereum.go
+2
-2
gui.go
ethereal/ui/gui.go
+7
-4
ui_lib.go
ethereal/ui/ui_lib.go
+11
-3
No files found.
ethereal/config.go
View file @
1257e8b4
...
...
@@ -16,6 +16,7 @@ var UseSeed bool
var
ImportKey
string
var
ExportKey
bool
var
DataDir
string
var
AssetPath
string
func
Init
()
{
flag
.
BoolVar
(
&
StartConsole
,
"c"
,
false
,
"debug and testing console"
)
...
...
@@ -29,6 +30,7 @@ func Init() {
flag
.
StringVar
(
&
DataDir
,
"dir"
,
".ethereal"
,
"ethereum data directory"
)
flag
.
StringVar
(
&
ImportKey
,
"import"
,
""
,
"imports the given private key (hex)"
)
flag
.
IntVar
(
&
MaxPeer
,
"x"
,
5
,
"maximum desired peers"
)
flag
.
StringVar
(
&
AssetPath
,
"asset_path"
,
""
,
"absolute path to GUI assets directory"
)
flag
.
Parse
()
}
ethereal/ethereum.go
View file @
1257e8b4
...
...
@@ -100,11 +100,11 @@ func main() {
os
.
Exit
(
0
)
}
log
.
Printf
(
"Starting Ethereum v%s
\n
"
,
ethutil
.
Config
.
Ver
)
log
.
Printf
(
"Starting Ethereum
GUI
v%s
\n
"
,
ethutil
.
Config
.
Ver
)
// Set the max peers
ethereum
.
MaxPeers
=
MaxPeer
gui
:=
ethui
.
New
(
ethereum
)
gui
.
Start
()
gui
.
Start
(
AssetPath
)
}
ethereal/ui/gui.go
View file @
1257e8b4
...
...
@@ -53,6 +53,7 @@ type Gui struct {
txDb
*
ethdb
.
LDBDatabase
addr
[]
byte
}
// Create GUI, but doesn't start it
...
...
@@ -71,7 +72,7 @@ func New(ethereum *eth.Ethereum) *Gui {
return
&
Gui
{
eth
:
ethereum
,
lib
:
lib
,
txDb
:
db
,
addr
:
addr
}
}
func
(
ui
*
Gui
)
Start
()
{
func
(
ui
*
Gui
)
Start
(
assetPath
string
)
{
defer
ui
.
txDb
.
Close
()
// Register ethereum functions
...
...
@@ -89,14 +90,16 @@ func (ui *Gui) Start() {
// Expose the eth library and the ui library to QML
context
.
SetVar
(
"eth"
,
ui
.
lib
)
context
.
SetVar
(
"ui"
,
&
UiLib
{
engine
:
ui
.
engine
,
eth
:
ui
.
eth
})
uiLib
:=
NewUiLib
(
ui
.
engine
,
ui
.
eth
,
assetPath
)
context
.
SetVar
(
"ui"
,
uiLib
)
// Load the main QML interface
component
,
err
:=
ui
.
engine
.
LoadFile
(
AssetPath
(
"qml/wallet.qml"
))
component
,
err
:=
ui
.
engine
.
LoadFile
(
uiLib
.
AssetPath
(
"qml/wallet.qml"
))
if
err
!=
nil
{
ethutil
.
Config
.
Log
.
Infoln
(
"FATAL: asset not found: you can set an alternative asset path on on the command line using option 'asset_path'"
)
panic
(
err
)
}
ui
.
engine
.
LoadFile
(
AssetPath
(
"qml/transactions.qml"
))
ui
.
engine
.
LoadFile
(
uiLib
.
AssetPath
(
"qml/transactions.qml"
))
ui
.
win
=
component
.
CreateWindow
(
nil
)
...
...
ethereal/ui/ui_lib.go
View file @
1257e8b4
...
...
@@ -16,6 +16,14 @@ type UiLib struct {
engine
*
qml
.
Engine
eth
*
eth
.
Ethereum
connected
bool
assetPath
string
}
func
NewUiLib
(
engine
*
qml
.
Engine
,
eth
*
eth
.
Ethereum
,
assetPath
string
)
*
UiLib
{
if
assetPath
==
""
{
assetPath
=
DefaultAssetPath
()
}
return
&
UiLib
{
engine
:
engine
,
eth
:
eth
,
assetPath
:
assetPath
}
}
// Opens a QML file (external application)
...
...
@@ -45,10 +53,10 @@ func (ui *UiLib) ConnectToPeer(addr string) {
}
func
(
ui
*
UiLib
)
AssetPath
(
p
string
)
string
{
return
AssetPath
(
p
)
return
path
.
Join
(
ui
.
assetPath
,
p
)
}
func
AssetPath
(
p
string
)
string
{
func
DefaultAssetPath
(
)
string
{
var
base
string
// If the current working directory is the go-ethereum dir
...
...
@@ -72,5 +80,5 @@ func AssetPath(p string) string {
}
}
return
path
.
Join
(
base
,
p
)
return
base
}
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