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
4be75b18
Commit
4be75b18
authored
Aug 23, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved methods
parent
444c9eff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
145 deletions
+0
-145
gui.go
ethereal/gui.go
+0
-145
No files found.
ethereal/gui.go
View file @
4be75b18
...
@@ -5,7 +5,6 @@ import (
...
@@ -5,7 +5,6 @@ import (
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"math/big"
"math/big"
"os"
"runtime"
"runtime"
"strconv"
"strconv"
"strings"
"strings"
...
@@ -20,17 +19,11 @@ import (
...
@@ -20,17 +19,11 @@ import (
"github.com/ethereum/eth-go/ethreact"
"github.com/ethereum/eth-go/ethreact"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/go-ethereum/utils"
"gopkg.in/qml.v1"
"gopkg.in/qml.v1"
)
)
var
logger
=
ethlog
.
NewLogger
(
"GUI"
)
var
logger
=
ethlog
.
NewLogger
(
"GUI"
)
type
plugin
struct
{
Name
string
`json:"name"`
Path
string
`json:"path"`
}
type
Gui
struct
{
type
Gui
struct
{
// The main application window
// The main application window
win
*
qml
.
Window
win
*
qml
.
Window
...
@@ -147,24 +140,6 @@ func (gui *Gui) Stop() {
...
@@ -147,24 +140,6 @@ func (gui *Gui) Stop() {
logger
.
Infoln
(
"Stopped"
)
logger
.
Infoln
(
"Stopped"
)
}
}
func
(
gui
*
Gui
)
ToggleMining
()
{
var
txt
string
if
gui
.
eth
.
Mining
{
utils
.
StopMining
(
gui
.
eth
)
txt
=
"Start mining"
gui
.
getObjectByName
(
"miningLabel"
)
.
Set
(
"visible"
,
false
)
}
else
{
utils
.
StartMining
(
gui
.
eth
)
gui
.
miner
=
utils
.
GetMiner
()
txt
=
"Stop mining"
gui
.
getObjectByName
(
"miningLabel"
)
.
Set
(
"visible"
,
true
)
}
gui
.
win
.
Root
()
.
Set
(
"miningButtonText"
,
txt
)
}
func
(
gui
*
Gui
)
showWallet
(
context
*
qml
.
Context
)
(
*
qml
.
Window
,
error
)
{
func
(
gui
*
Gui
)
showWallet
(
context
*
qml
.
Context
)
(
*
qml
.
Window
,
error
)
{
component
,
err
:=
gui
.
engine
.
LoadFile
(
gui
.
uiLib
.
AssetPath
(
"qml/wallet.qml"
))
component
,
err
:=
gui
.
engine
.
LoadFile
(
gui
.
uiLib
.
AssetPath
(
"qml/wallet.qml"
))
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -178,44 +153,9 @@ func (gui *Gui) showWallet(context *qml.Context) (*qml.Window, error) {
...
@@ -178,44 +153,9 @@ func (gui *Gui) showWallet(context *qml.Context) (*qml.Window, error) {
return
gui
.
win
,
nil
return
gui
.
win
,
nil
}
}
func
(
self
*
Gui
)
DumpState
(
hash
,
path
string
)
{
var
stateDump
[]
byte
if
len
(
hash
)
==
0
{
stateDump
=
self
.
eth
.
StateManager
()
.
CurrentState
()
.
Dump
()
}
else
{
var
block
*
ethchain
.
Block
if
hash
[
0
]
==
'#'
{
i
,
_
:=
strconv
.
Atoi
(
hash
[
1
:
])
block
=
self
.
eth
.
BlockChain
()
.
GetBlockByNumber
(
uint64
(
i
))
}
else
{
block
=
self
.
eth
.
BlockChain
()
.
GetBlock
(
ethutil
.
Hex2Bytes
(
hash
))
}
if
block
==
nil
{
logger
.
Infof
(
"block err: not found %s
\n
"
,
hash
)
return
}
stateDump
=
block
.
State
()
.
Dump
()
}
file
,
err
:=
os
.
OpenFile
(
path
[
7
:
],
os
.
O_CREATE
|
os
.
O_RDWR
,
os
.
ModePerm
)
if
err
!=
nil
{
logger
.
Infoln
(
"dump err: "
,
err
)
return
}
defer
file
.
Close
()
logger
.
Infof
(
"dumped state (%s) to %s
\n
"
,
hash
,
path
)
file
.
Write
(
stateDump
)
}
// The done handler will be called by QML when all views have been loaded
// The done handler will be called by QML when all views have been loaded
func
(
gui
*
Gui
)
Done
()
{
func
(
gui
*
Gui
)
Done
()
{
gui
.
qmlDone
=
true
gui
.
qmlDone
=
true
}
}
func
(
gui
*
Gui
)
ImportKey
(
filePath
string
)
{
func
(
gui
*
Gui
)
ImportKey
(
filePath
string
)
{
...
@@ -535,11 +475,6 @@ NumGC: %d
...
@@ -535,11 +475,6 @@ NumGC: %d
))
))
}
}
func
(
gui
*
Gui
)
CopyToClipboard
(
data
string
)
{
//clipboard.WriteAll("test")
fmt
.
Println
(
"COPY currently BUGGED. Here are the contents:
\n
"
,
data
)
}
func
(
gui
*
Gui
)
setPeerInfo
()
{
func
(
gui
*
Gui
)
setPeerInfo
()
{
gui
.
win
.
Root
()
.
Call
(
"setPeers"
,
fmt
.
Sprintf
(
"%d / %d"
,
gui
.
eth
.
PeerCount
(),
gui
.
eth
.
MaxPeers
))
gui
.
win
.
Root
()
.
Call
(
"setPeers"
,
fmt
.
Sprintf
(
"%d / %d"
,
gui
.
eth
.
PeerCount
(),
gui
.
eth
.
MaxPeers
))
...
@@ -556,83 +491,3 @@ func (gui *Gui) privateKey() string {
...
@@ -556,83 +491,3 @@ func (gui *Gui) privateKey() string {
func
(
gui
*
Gui
)
address
()
[]
byte
{
func
(
gui
*
Gui
)
address
()
[]
byte
{
return
gui
.
eth
.
KeyManager
()
.
Address
()
return
gui
.
eth
.
KeyManager
()
.
Address
()
}
}
func
(
gui
*
Gui
)
Transact
(
recipient
,
value
,
gas
,
gasPrice
,
d
string
)
(
*
ethpipe
.
JSReceipt
,
error
)
{
var
data
string
if
len
(
recipient
)
==
0
{
code
,
err
:=
ethutil
.
Compile
(
d
,
false
)
if
err
!=
nil
{
return
nil
,
err
}
data
=
ethutil
.
Bytes2Hex
(
code
)
}
else
{
data
=
ethutil
.
Bytes2Hex
(
utils
.
FormatTransactionData
(
d
))
}
return
gui
.
pipe
.
Transact
(
gui
.
privateKey
(),
recipient
,
value
,
gas
,
gasPrice
,
data
)
}
func
(
gui
*
Gui
)
SetCustomIdentifier
(
customIdentifier
string
)
{
gui
.
clientIdentity
.
SetCustomIdentifier
(
customIdentifier
)
gui
.
config
.
Save
(
"id"
,
customIdentifier
)
}
func
(
gui
*
Gui
)
GetCustomIdentifier
()
string
{
return
gui
.
clientIdentity
.
GetCustomIdentifier
()
}
func
(
gui
*
Gui
)
ToggleTurboMining
()
{
gui
.
miner
.
ToggleTurbo
()
}
// functions that allow Gui to implement interface ethlog.LogSystem
func
(
gui
*
Gui
)
SetLogLevel
(
level
ethlog
.
LogLevel
)
{
gui
.
logLevel
=
level
gui
.
stdLog
.
SetLogLevel
(
level
)
gui
.
config
.
Save
(
"loglevel"
,
level
)
}
func
(
gui
*
Gui
)
GetLogLevel
()
ethlog
.
LogLevel
{
return
gui
.
logLevel
}
func
(
self
*
Gui
)
AddPlugin
(
pluginPath
string
)
{
self
.
plugins
[
pluginPath
]
=
plugin
{
Name
:
"SomeName"
,
Path
:
pluginPath
}
json
,
_
:=
json
.
MarshalIndent
(
self
.
plugins
,
""
,
" "
)
ethutil
.
WriteFile
(
ethutil
.
Config
.
ExecPath
+
"/plugins.json"
,
json
)
}
func
(
self
*
Gui
)
RemovePlugin
(
pluginPath
string
)
{
delete
(
self
.
plugins
,
pluginPath
)
json
,
_
:=
json
.
MarshalIndent
(
self
.
plugins
,
""
,
" "
)
ethutil
.
WriteFile
(
ethutil
.
Config
.
ExecPath
+
"/plugins.json"
,
json
)
}
// this extra function needed to give int typecast value to gui widget
// that sets initial loglevel to default
func
(
gui
*
Gui
)
GetLogLevelInt
()
int
{
return
int
(
gui
.
logLevel
)
}
func
(
gui
*
Gui
)
Println
(
v
...
interface
{})
{
gui
.
printLog
(
fmt
.
Sprintln
(
v
...
))
}
func
(
gui
*
Gui
)
Printf
(
format
string
,
v
...
interface
{})
{
gui
.
printLog
(
fmt
.
Sprintf
(
format
,
v
...
))
}
// Print function that logs directly to the GUI
func
(
gui
*
Gui
)
printLog
(
s
string
)
{
/*
str := strings.TrimRight(s, "\n")
lines := strings.Split(str, "\n")
view := gui.getObjectByName("infoView")
for _, line := range lines {
view.Call("addLog", line)
}
*/
}
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