Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new dui: drawfcall.New: exec: "devdraw": executable file not found in $PATH #20

Open
hellojukay opened this issue Jul 29, 2020 · 1 comment

Comments

@hellojukay
Copy link

hellojukay commented Jul 29, 2020

hellojukay@local test $ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/hellojukay/.cache/go-build"
GOENV="/home/hellojukay/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
package main

import (
	"flag"
	"io"
	"log"
	"os"

	"github.com/mjl-/duit"
)

func check(err error, msg string) {
	if err != nil {
		log.Fatalf("%s: %s\n", msg, err)
	}
}

func main() {
	log.SetFlags(0)
	flag.Usage = func() {
		log.Println("usage: duitedit file")
		flag.PrintDefaults()
	}
	flag.Parse()
	args := flag.Args()
	if len(args) != 1 {
		flag.Usage()
		os.Exit(2)
	}

	f, err := os.Open(args[0])
	check(err, "open")

	dui, err := duit.NewDUI("ex/edit", nil)
	check(err, "new dui")

	edit, err := duit.NewEdit(f)
	check(err, "new edit")

	print := &duit.Button{
		Text: "print",
		Click: func() (e duit.Event) {
			rd := edit.Reader()
			n, err := io.Copy(os.Stdout, rd)
			if err != nil {
				log.Printf("error copying text: %s\n", err)
			}
			log.Printf("copied %d bytes\n", n)
			return
		},
	}

	dui.Top.UI = &duit.Box{Kids: duit.NewKids(print, edit)}
	dui.Render()

	for {
		select {
		case e := <-dui.Inputs:
			dui.Input(e)

		case err, ok := <-dui.Error:
			if !ok {
				return
			}
			log.Printf("duit: %s\n", err)
		}
	}
}
hellojukay@local test $ go build main.go 
hellojukay@local test $ ./main 
usage: duitedit file
hellojukay@local test $ ./main main.go 
new dui: drawfcall.New: exec: "devdraw": executable file not found in $PATH

pure golang ???????

@mjl-
Copy link
Owner

mjl- commented Dec 14, 2020

true, you need devdraw. that's why it is "pure go (*)" with the asterisk explained.
quite some time ago i attempted to replace devdraw with pure go native ui code. clearly i didn't finish it...
it seems possible to do so on win32, x11, wayland, plan9. i didn't find a way to do so on macos. i think my plan was to use pure go native ui code when available, and still fall back to devdraw otherwise (eg macos).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants