aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-02-25 17:54:15 +0800
committerobscuren <geffobscura@gmail.com>2014-02-25 17:54:15 +0800
commite60ff6ca41832c8124acfab6b8408516d60ac140 (patch)
treeb3d599932e94ed12870d59c728eccefa47a49f3d /ui
parentfe9eb472887baec464cc50657affd85b13bcbeba (diff)
downloadgo-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.go38
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)
+}