diff options
author | obscuren <geffobscura@gmail.com> | 2014-02-25 17:54:15 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-02-25 17:54:15 +0800 |
commit | e60ff6ca41832c8124acfab6b8408516d60ac140 (patch) | |
tree | b3d599932e94ed12870d59c728eccefa47a49f3d /ui | |
parent | fe9eb472887baec464cc50657affd85b13bcbeba (diff) | |
download | go-tangerine-e60ff6ca41832c8124acfab6b8408516d60ac140.tar go-tangerine-e60ff6ca41832c8124acfab6b8408516d60ac140.tar.gz go-tangerine-e60ff6ca41832c8124acfab6b8408516d60ac140.tar.bz2 go-tangerine-e60ff6ca41832c8124acfab6b8408516d60ac140.tar.lz go-tangerine-e60ff6ca41832c8124acfab6b8408516d60ac140.tar.xz go-tangerine-e60ff6ca41832c8124acfab6b8408516d60ac140.tar.zst go-tangerine-e60ff6ca41832c8124acfab6b8408516d60ac140.zip |
Moved ui lib
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ui_lib.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/ui/ui_lib.go b/ui/ui_lib.go new file mode 100644 index 000000000..93712eba2 --- /dev/null +++ b/ui/ui_lib.go @@ -0,0 +1,38 @@ +package ethui + +import ( + "github.com/ethereum/eth-go" + "github.com/ethereum/eth-go/ethutil" + "github.com/niemeyer/qml" +) + +// UI Library that has some basic functionality exposed +type UiLib struct { + engine *qml.Engine + eth *eth.Ethereum + connected bool +} + +// Opens a QML file (external application) +func (ui *UiLib) Open(path string) { + component, err := ui.engine.LoadFile(path[7:]) + if err != nil { + ethutil.Config.Log.Debugln(err) + } + win := component.CreateWindow(nil) + + go func() { + win.Show() + win.Wait() + }() +} + +func (ui *UiLib) Connect() { + if !ui.connected { + ui.eth.Start() + } +} + +func (ui *UiLib) ConnectToPeer(addr string) { + ui.eth.ConnectToPeer(addr) +} |