Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
72df038
Merge branch 'develop' of github.com:ethereum/go-ethereum into develop
zelig May 23, 2014
50fdfb1
Merge branch 'develop' of github.com:ethereum/go-ethereum into develop
zelig Jun 14, 2014
a32a15a
Merge branch 'develop' of github.com:ethereum/go-ethereum into develop
zelig Jun 18, 2014
f90001e
add logging start/exit to js console
zelig Jun 23, 2014
7bcf875
add logging for jsre
zelig Jun 23, 2014
d060ae6
changed logger API, functions that allow Gui to implement ethlog.LogS…
zelig Jun 23, 2014
c67cdab
merge upstream
zelig Jun 23, 2014
456167a
fix gitignore to ignore executables
zelig Jun 23, 2014
1024766
refactor cli and gui wrapper code. Details:
zelig Jun 23, 2014
34284b7
merge upstream
zelig Jun 23, 2014
6f09a3e
fix imports in ui_lib and flags cos of defaultAssetPath move; fix log…
zelig Jun 23, 2014
08de13a
merge upstream
zelig Jun 25, 2014
39c0f7f
fix logSlider: now has 5 levels, initialized to gui.GetLogLevel which…
zelig Jun 25, 2014
8ee1abe
update log levels to include DebugDetail; correct default datadir for…
zelig Jun 25, 2014
096427c
Merge remote-tracking branch 'upstream/develop' into feature/logging
zelig Jun 25, 2014
bf57e96
add newline to help usage msg
zelig Jun 25, 2014
6763d28
repl.Stop() to only if running, fixes panic after js> exit followed b…
zelig Jun 25, 2014
9a06efd
new logger API for upstream merge
zelig Jun 25, 2014
2f96652
interrupt handlers now ordered
zelig Jun 26, 2014
c0a05fc
log slider
zelig Jun 26, 2014
21d86ca
gui stop
zelig Jun 26, 2014
648c418
Merge branch 'develop' of github.com:ethereum/go-ethereum into featur…
zelig Jun 26, 2014
ae5ace1
go fmt
zelig Jun 26, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
*un~
.DS_Store
*/**/.DS_Store
./ethereum/ethereum
ethereum/ethereum
ethereal/ethereal

4 changes: 2 additions & 2 deletions ethereal/assets/qml/wallet.qml
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ ApplicationWindow {

Slider {
id: logLevelSlider
value: 1
value: eth.getLogLevelInt()
anchors {
right: parent.right
top: parent.top
Expand All @@ -332,7 +332,7 @@ ApplicationWindow {
}

orientation: Qt.Vertical
maximumValue: 3
maximumValue: 5
stepSize: 1

onValueChanged: {
Expand Down
43 changes: 0 additions & 43 deletions ethereal/config.go

This file was deleted.

142 changes: 0 additions & 142 deletions ethereal/ethereum.go

This file was deleted.

95 changes: 95 additions & 0 deletions ethereal/flags.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package main

import (
"bitbucket.org/kardianos/osext"
"flag"
"fmt"
"github.com/ethereum/eth-go/ethlog"
"os"
"os/user"
"path"
"path/filepath"
"runtime"
)

var Identifier string
var StartRpc bool
var RpcPort int
var UseUPnP bool
var OutboundPort string
var ShowGenesis bool
var AddPeer string
var MaxPeer int
var GenAddr bool
var UseSeed bool
var ImportKey string
var ExportKey bool
var NonInteractive bool
var Datadir string
var LogFile string
var ConfigFile string
var DebugFile string
var LogLevel int

// flags specific to gui client
var AssetPath string

func defaultAssetPath() string {
var assetPath string
// If the current working directory is the go-ethereum dir
// assume a debug build and use the source directory as
// asset directory.
pwd, _ := os.Getwd()
if pwd == path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "ethereal") {
assetPath = path.Join(pwd, "assets")
} else {
switch runtime.GOOS {
case "darwin":
// Get Binary Directory
exedir, _ := osext.ExecutableFolder()
assetPath = filepath.Join(exedir, "../Resources")
case "linux":
assetPath = "/usr/share/ethereal"
case "window":
fallthrough
default:
assetPath = "."
}
}
return assetPath
}

func defaultDataDir() string {
usr, _ := user.Current()
return path.Join(usr.HomeDir, ".ethereal")
}

var defaultConfigFile = path.Join(defaultDataDir(), "conf.ini")

func Init() {
flag.Usage = func() {
fmt.Fprintf(os.Stderr, "%s [options] [filename]:\noptions precedence: default < config file < environment variables < command line\n", os.Args[0])
flag.PrintDefaults()
}

flag.StringVar(&Identifier, "id", "", "Custom client identifier")
flag.StringVar(&OutboundPort, "port", "30303", "listening port")
flag.BoolVar(&UseUPnP, "upnp", false, "enable UPnP support")
flag.IntVar(&MaxPeer, "maxpeer", 10, "maximum desired peers")
flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on")
flag.BoolVar(&StartRpc, "rpc", false, "start rpc server")
flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)")
flag.BoolVar(&UseSeed, "seed", true, "seed peers")
flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key")
flag.BoolVar(&ExportKey, "export", false, "export private key")
flag.StringVar(&LogFile, "logfile", "", "log file (defaults to standard output)")
flag.StringVar(&ImportKey, "import", "", "imports the given private key (hex)")
flag.StringVar(&Datadir, "datadir", defaultDataDir(), "specifies the datadir to use")
flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file")
flag.StringVar(&DebugFile, "debug", "", "debug file (no debugging if not set)")
flag.IntVar(&LogLevel, "loglevel", int(ethlog.InfoLevel), "loglevel: 0-5: silent,error,warn,info,debug,debug detail)")

flag.StringVar(&AssetPath, "asset_path", defaultAssetPath(), "absolute path to GUI assets directory")

flag.Parse()
}
61 changes: 61 additions & 0 deletions ethereal/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package main

import (
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/go-ethereum/ethereal/ui"
"github.com/ethereum/go-ethereum/utils"
"github.com/go-qml/qml"
"os"
"runtime"
)

func main() {
runtime.GOMAXPROCS(runtime.NumCPU())

qml.Init(nil)

var interrupted = false
utils.RegisterInterrupt(func(os.Signal) {
interrupted = true
})

utils.HandleInterrupt()

// precedence: code-internal flag default < config file < environment variables < command line
Init() // parsing command line
utils.InitConfig(ConfigFile, Datadir, Identifier, "ETH")

utils.InitDataDir(Datadir)

utils.InitLogging(Datadir, LogFile, LogLevel, DebugFile)

ethereum := utils.NewEthereum(UseUPnP, OutboundPort, MaxPeer)

// create, import, export keys
utils.KeyTasks(GenAddr, ImportKey, ExportKey, NonInteractive)

if ShowGenesis {
utils.ShowGenesis(ethereum)
}

if StartRpc {
utils.StartRpc(ethereum, RpcPort)
}

gui := ethui.New(ethereum, LogLevel)

utils.RegisterInterrupt(func(os.Signal) {
gui.Stop()
})
utils.StartEthereum(ethereum, UseSeed)
// gui blocks the main thread
gui.Start(AssetPath)
// we need to run the interrupt callbacks in case gui is closed
// this skips if we got here by actual interrupt stopping the GUI
if !interrupted {
utils.RunInterruptCallbacks(os.Interrupt)
}
// this blocks the thread
ethereum.WaitForShutdown()
ethlog.Flush()
}
Loading