gui

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2024 License: Unlicense Imports: 32 Imported by: 0

Documentation

Overview

package gui implements the SeedHammer controller user interface.

Index

Constants

This section is empty.

Variables

View Source
var (
	EngraveFirstSideA = []Instruction{
		{
			Body: "Make sure the fingerprint above represents the intended share.",
			Lead: "seedhammer.com/tip#1",
		},
		{
			Body: "Turn off the engraver and disconnect it from this device.",
			Lead: "seedhammer.com/tip#2",
		},
		{
			Body: "Manually move the hammerhead to the far upper left position.",
			Lead: "seedhammer.com/tip#3",
		},
		{
			Body:  "Place a {{.Name}} on top\nof a protective plate.",
			Image: assets.Sh01,
			Lead:  "seedhammer.com/tip#4",
		},
		{
			Body: "Tighten the nuts firmly.",
			Lead: "seedhammer.com/tip#4",
		},
		{
			Body: "Loosen the hammerhead finger screw. Adjust needle distance to ~1.5 mm above the plate.",
			Lead: "seedhammer.com/tip#5",
		},
		{
			Body: "Tighten the hammerhead finger screw and make sure the depth selector is set to \"Strong\".",
			Lead: "seedhammer.com/tip#6",
		},
		{
			Body: "Turn on the engraving machine and connect this device via the middle port.",
			Lead: "seedhammer.com/tip#7",
		},
		{
			Body: "Hold button to start the engraving process. The process is loud, use hearing protection.",
			Type: ConnectInstruction,
			Lead: "seedhammer.com/tip#8",
		},
		{
			Lead: "Engraving plate",
			Type: EngraveInstruction,
			Side: 0,
		},
	}

	EngraveSideA = []Instruction{
		{
			Body: "Make sure the fingerprint above represents the intended share.",
			Lead: "seedhammer.com/tip#1",
		},
		{
			Body:  "Place a {{.Name}} on top\nof a protective plate.",
			Image: assets.Sh01,
			Lead:  "seedhammer.com/tip#4",
		},
		{
			Body: "Tighten the nuts firmly.",
			Lead: "seedhammer.com/tip#4",
		},
		{
			Body: "Hold button to start the engraving process. The process is loud, use hearing protection.",
			Type: ConnectInstruction,
			Lead: "seedhammer.com/tip#8",
		},
		{
			Lead: "Engraving plate",
			Type: EngraveInstruction,
			Side: 0,
		},
	}

	EngraveSideB = []Instruction{
		{
			Body: "Unscrew the 4 nuts and flip the top metal plate horizontally.",
		},
		{
			Body: "Tighten the nuts firmly.",
		},
		{
			Body: "Hold button to start the engraving process. The process is loud, use hearing protection.",
			Type: ConnectInstruction,
		},
		{
			Lead: "Engraving plate",
			Type: EngraveInstruction,
			Side: 1,
		},
	}

	EngraveSuccess = []Instruction{
		{
			Body: "Engraving completed successfully.",
		},
	}
)

Functions

This section is empty.

Types

type AddressesScreen added in v0.12.0

type AddressesScreen struct {
	// contains filtered or unexported fields
}

func NewAddressesScreen added in v0.12.0

func NewAddressesScreen(desc urtypes.OutputDescriptor) *AddressesScreen

func (*AddressesScreen) Layout added in v0.12.0

func (s *AddressesScreen) Layout(ctx *Context, ops op.Ctx, dims image.Point) bool

type App

type App struct {
	// contains filtered or unexported fields
}

func NewApp

func NewApp(pl Platform, version string) (*App, error)

func (*App) Frame

func (a *App) Frame()

type Button added in v1.2.0

type Button int
const (
	Up Button = iota
	Down
	Left
	Right
	Center
	Button1
	Button2
	Button3
	CCW
	CW
	// Synthetic keys only generated in debug mode.
	Rune // Enter rune.
)

type ButtonEvent added in v1.2.0

type ButtonEvent struct {
	Button  Button
	Pressed bool
	// Rune is only valid if Button is Rune.
	Rune  rune
	Click bool
}

func (ButtonEvent) ImplementsEvent added in v1.2.0

func (ButtonEvent) ImplementsEvent()

type ButtonStyle

type ButtonStyle int
const (
	StyleNone ButtonStyle = iota
	StyleSecondary
	StylePrimary
)

type ChoiceScreen

type ChoiceScreen struct {
	Title   string
	Lead    string
	Choices []string
	// contains filtered or unexported fields
}

func (*ChoiceScreen) Layout

func (s *ChoiceScreen) Layout(ctx *Context, ops op.Ctx, th *Colors, dims image.Point, active bool) (int, Result)

type Colors

type Colors struct {
	Background color.NRGBA
	Text       color.NRGBA
	Primary    color.NRGBA
}

type ConfirmDelay

type ConfirmDelay struct {
	// contains filtered or unexported fields
}

func (*ConfirmDelay) Progress

func (c *ConfirmDelay) Progress(ctx *Context) float32

func (*ConfirmDelay) Running

func (c *ConfirmDelay) Running() bool

func (*ConfirmDelay) Start

func (c *ConfirmDelay) Start(ctx *Context, delay time.Duration)

type ConfirmResult

type ConfirmResult int
const (
	ConfirmNone ConfirmResult = iota
	ConfirmNo
	ConfirmYes
)

type ConfirmWarningScreen

type ConfirmWarningScreen struct {
	Title string
	Body  string
	Icon  image.RGBA64Image
	// contains filtered or unexported fields
}

func (*ConfirmWarningScreen) Layout

func (s *ConfirmWarningScreen) Layout(ctx *Context, ops op.Ctx, th *Colors, dims image.Point)

func (*ConfirmWarningScreen) Update added in v1.2.0

func (s *ConfirmWarningScreen) Update(ctx *Context) ConfirmResult

type Context

type Context struct {
	Buttons      [nbuttons]bool
	Repeats      [nbuttons]time.Time
	Platform     Platform
	Styles       Styles
	Version      string
	Calibrated   bool
	NoSDCard     bool
	RotateCamera bool
	// contains filtered or unexported fields
}

func NewContext

func NewContext(pl Platform) *Context

func (*Context) Events

func (c *Context) Events(evts ...Event)

func (*Context) Frame added in v1.2.0

func (c *Context) Frame() (FrameEvent, bool)

func (*Context) Next

func (c *Context) Next(btns ...Button) (ButtonEvent, bool)

func (*Context) Repeat

func (c *Context) Repeat()

func (*Context) Reset added in v1.2.0

func (c *Context) Reset()

func (*Context) WakeupAt added in v1.2.0

func (c *Context) WakeupAt(t time.Time)

type DescriptorScreen

type DescriptorScreen struct {
	Descriptor urtypes.OutputDescriptor
	Mnemonic   bip39.Mnemonic
	// contains filtered or unexported fields
}

func (*DescriptorScreen) Layout

func (s *DescriptorScreen) Layout(ctx *Context, ops op.Ctx, dims image.Point) (int, Result)

type EngraveScreen

type EngraveScreen struct {
	// contains filtered or unexported fields
}

func NewEngraveScreen

func NewEngraveScreen(ctx *Context, plate Plate) *EngraveScreen

func (*EngraveScreen) Layout

func (s *EngraveScreen) Layout(ctx *Context, ops op.Ctx, dims image.Point) Result

type ErrorScreen

type ErrorScreen struct {
	Title string
	Body  string
	// contains filtered or unexported fields
}

func NewErrorScreen

func NewErrorScreen(err error) *ErrorScreen

func (*ErrorScreen) Layout

func (s *ErrorScreen) Layout(ctx *Context, ops op.Ctx, th *Colors, dims image.Point)

func (*ErrorScreen) Update added in v1.2.0

func (s *ErrorScreen) Update(ctx *Context) bool

type Event

type Event interface {
	ImplementsEvent()
}

type FrameEvent added in v1.2.0

type FrameEvent interface {
	Error() error
	Image() image.Image
	Event
}

type Instruction

type Instruction struct {
	Body  string
	Lead  string
	Type  InstructionType
	Side  int
	Image image.RGBA64Image
	// contains filtered or unexported fields
}

type InstructionType

type InstructionType int
const (
	PrepareInstruction InstructionType = iota
	ConnectInstruction
	EngraveInstruction
)

type Keyboard

type Keyboard struct {
	Word string
	// contains filtered or unexported fields
}

func NewKeyboard

func NewKeyboard(ctx *Context) *Keyboard

func (*Keyboard) Clear

func (k *Keyboard) Clear()

func (*Keyboard) Complete

func (k *Keyboard) Complete() (bip39.Word, bool)

func (*Keyboard) Layout

func (k *Keyboard) Layout(ctx *Context, ops op.Ctx, th *Colors) image.Point

func (*Keyboard) Update added in v1.2.0

func (k *Keyboard) Update(ctx *Context)

func (*Keyboard) Valid

func (k *Keyboard) Valid(r rune) bool

type MainScreen

type MainScreen struct {
	// contains filtered or unexported fields
}

func (*MainScreen) Layout

func (s *MainScreen) Layout(ctx *Context, ops op.Ctx, dims image.Point, err error)

func (*MainScreen) Select

func (s *MainScreen) Select(ctx *Context)
type NavButton struct {
	Button Button
	Style  ButtonStyle
	Icon   image.Image
}

type Plate added in v1.2.0

type Plate struct {
	Size              backup.PlateSize
	MasterFingerprint uint32
	Sides             []engrave.Command
}

type Platform

type Platform interface {
	Events() []Event
	Wakeup()
	Engraver() (io.ReadWriteCloser, error)
	CameraFrame(size image.Point)
	Now() time.Time
	DisplaySize() image.Point
	// Dirty begins a refresh of the content
	// specified by r.
	Dirty(r image.Rectangle) error
	// NextChunk returns the next chunk of the refresh.
	NextChunk() (draw.RGBA64Image, bool)
	ScanQR(qr *image.Gray) ([][]byte, error)
	Debug() bool
}

type ProgressImage

type ProgressImage struct {
	Progress float32
	Src      image.RGBA64Image
}

func (ProgressImage) At

func (p ProgressImage) At(x, y int) color.Color

func (ProgressImage) Bounds

func (p ProgressImage) Bounds() image.Rectangle

func (ProgressImage) ColorModel

func (p ProgressImage) ColorModel() color.Model

func (ProgressImage) RGBA64At

func (p ProgressImage) RGBA64At(x, y int) color.RGBA64

type Result added in v0.11.1

type Result int
const (
	ResultNone Result = iota
	ResultCancelled
	ResultComplete
)

type SDCardEvent added in v1.2.0

type SDCardEvent struct {
	Inserted bool
}

func (SDCardEvent) ImplementsEvent added in v1.2.0

func (SDCardEvent) ImplementsEvent()

type ScanScreen

type ScanScreen struct {
	Title string
	Lead  string
	// contains filtered or unexported fields
}

func (*ScanScreen) Layout

func (s *ScanScreen) Layout(ctx *Context, ops op.Ctx, dims image.Point) (any, Result)

type SeedScreen

type SeedScreen struct {
	Mnemonic bip39.Mnemonic
	// contains filtered or unexported fields
}

func NewEmptySeedScreen

func NewEmptySeedScreen(title string) *SeedScreen

func (*SeedScreen) Layout

func (s *SeedScreen) Layout(ctx *Context, ops op.Ctx, th *Colors, dims image.Point) (bip39.Mnemonic, Result)

type Styles

type Styles struct {
	// contains filtered or unexported fields
}

func NewStyles

func NewStyles() Styles

type Warning added in v1.2.0

type Warning struct {
	// contains filtered or unexported fields
}

func (*Warning) Layout added in v1.2.0

func (w *Warning) Layout(ctx *Context, ops op.Ctx, th *Colors, dims image.Point, title, txt string) image.Point

func (*Warning) Update added in v1.2.0

func (w *Warning) Update(ctx *Context)

type WordKeyboardScreen

type WordKeyboardScreen struct {
	Mnemonic bip39.Mnemonic
	// contains filtered or unexported fields
}

func (*WordKeyboardScreen) Layout

func (s *WordKeyboardScreen) Layout(ctx *Context, ops op.Ctx, th *Colors, dims image.Point) Result

Directories

Path Synopsis
Code generated by gui/assets/gen.go; DO NOT EDIT.
Code generated by gui/assets/gen.go; DO NOT EDIT.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL