Beispiel #1
0
func ErrorWindow(err error) {
	engine := qml.NewEngine()
	component, e := engine.LoadString("local", qmlErr)
	if e != nil {
		fmt.Println("err:", err)
		os.Exit(1)
	}

	win := component.CreateWindow(nil)
	win.Root().ObjectByName("label").Set("text", err.Error())
	win.Show()
	win.Wait()
}
Beispiel #2
0
func (gui *Gui) Start(assetPath, libPath string) {
	defer gui.txDb.Close()

	guilogger.Infoln("Starting GUI")

	go gui.service()

	// Register ethereum functions
	qml.RegisterTypes("Ethereum", 1, 0, []qml.TypeSpec{{
		Init: func(p *xeth.Block, obj qml.Object) { p.Number = 0; p.Hash = "" },
	}, {
		Init: func(p *xeth.Transaction, obj qml.Object) { p.Value = ""; p.Hash = ""; p.Address = "" },
	}, {
		Init: func(p *xeth.KeyVal, obj qml.Object) { p.Key = ""; p.Value = "" },
	}})
	// Create a new QML engine
	gui.engine = qml.NewEngine()
	context := gui.engine.Context()
	gui.uiLib = NewUiLib(gui.engine, gui.eth, assetPath, libPath)
	gui.whisper = qwhisper.New(gui.eth.Whisper())

	// Expose the eth library and the ui library to QML
	context.SetVar("gui", gui)
	context.SetVar("eth", gui.uiLib)
	context.SetVar("shh", gui.whisper)
	//clipboard.SetQMLClipboard(context)

	win, err := gui.showWallet(context)
	if err != nil {
		guilogger.Errorln("asset not found: you can set an alternative asset path on the command line using option 'asset_path'", err)

		panic(err)
	}

	gui.open = true
	win.Show()

	win.Wait()
	gui.open = false
}
func NewHtmlApplication(path string, lib *UiLib) *HtmlApplication {
	engine := qml.NewEngine()

	return &HtmlApplication{engine: engine, lib: lib, path: path}

}
func NewQmlApplication(path string, lib *UiLib) *QmlApplication {
	engine := qml.NewEngine()
	return &QmlApplication{engine: engine, path: path, lib: lib}
}