Documentation
¶
Overview ¶
package gui implements the SeedHammer controller user interface.
Index ¶
- Variables
- func Run(pl Platform, version string) func(yield func() bool)
- func ShowAddressesScreen(ctx *Context, ops op.Ctx, th *Colors, desc *bip380.Descriptor)
- type Button
- type ButtonEvent
- type ButtonStyle
- type ChoiceScreen
- type Colors
- type ConfirmDelay
- type ConfirmResult
- type ConfirmWarningScreen
- type Context
- type DescriptorScreen
- type EngraveScreen
- type Engraver
- type ErrorScreen
- type Event
- type FrameEvent
- type InputTracker
- type Instruction
- type InstructionType
- type Keyboard
- type NavButton
- type Plate
- type Platform
- type ProgressImage
- type QRDecoder
- type SDCardEvent
- type ScanScreen
- type SeedScreen
- type Styles
- type Warning
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 the machine.", Image: assets.Sh02, 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 the machine.", Image: assets.Sh02, 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.", }, } )
View Source
var ProgressImageGen = op.RegisterParameterizedImage(func(args op.ImageArguments, x, y int) color.RGBA64 { src := args.Refs[0].(image.RGBA64Image) progress := math.Float32frombits(args.Args[0]) b := src.Bounds() c := b.Max.Add(b.Min).Div(2) d := image.Pt(x, y).Sub(c) angle := float32(math.Atan2(float64(d.X), float64(d.Y))) angle = math.Pi - angle if angle > 2*math.Pi*progress { return color.RGBA64{} } return src.RGBA64At(x, y) })
Functions ¶
func ShowAddressesScreen ¶ added in v1.3.2
Types ¶
type ButtonEvent ¶ added in v1.2.0
type ButtonEvent struct {
Button Button
Pressed bool
// Rune is only valid if Button is Rune.
Rune rune
}
func (ButtonEvent) Event ¶ added in v1.3.0
func (b ButtonEvent) Event() Event
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
}
type ConfirmDelay ¶
type ConfirmDelay struct {
// contains filtered or unexported fields
}
func (*ConfirmDelay) Progress ¶
func (c *ConfirmDelay) Progress(ctx *Context) float32
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) ConfirmResult
type Context ¶
type Context struct {
Platform Platform
Styles Styles
Wakeup time.Time
Frame func()
// Global UI state.
Version string
Calibrated bool
EmptySDSlot bool
RotateCamera bool
LastDescriptor *bip380.Descriptor
// contains filtered or unexported fields
}
func NewContext ¶
func (*Context) FrameEvent ¶ added in v1.3.0
func (c *Context) FrameEvent() (FrameEvent, bool)
type DescriptorScreen ¶
type DescriptorScreen struct {
Descriptor *bip380.Descriptor
Mnemonic bip39.Mnemonic
}
type EngraveScreen ¶
type EngraveScreen struct {
// contains filtered or unexported fields
}
func NewEngraveScreen ¶
func NewEngraveScreen(ctx *Context, plate Plate) *EngraveScreen
type ErrorScreen ¶
func NewErrorScreen ¶
func NewErrorScreen(err error) *ErrorScreen
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
func (Event) AsButton ¶ added in v1.3.0
func (e Event) AsButton() (ButtonEvent, bool)
func (Event) AsFrame ¶ added in v1.3.0
func (e Event) AsFrame() (FrameEvent, bool)
func (Event) AsSDCard ¶ added in v1.3.0
func (e Event) AsSDCard() (SDCardEvent, bool)
type FrameEvent ¶ added in v1.2.0
func (FrameEvent) Event ¶ added in v1.3.0
func (f FrameEvent) Event() Event
type InputTracker ¶ added in v1.3.0
type InputTracker struct {
Pressed [nbuttons]bool
// contains filtered or unexported fields
}
func (*InputTracker) Clicked ¶ added in v1.3.0
func (t *InputTracker) Clicked(b Button) bool
func (*InputTracker) Next ¶ added in v1.3.0
func (t *InputTracker) Next(c *Context, btns ...Button) (ButtonEvent, bool)
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 ¶
type Platform ¶
type Platform interface {
AppendEvents(deadline time.Time, evts []Event) []Event
Wakeup()
PlateSizes() []backup.PlateSize
Engraver() (Engraver, error)
EngraverParams() engrave.Params
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) Add ¶ added in v1.3.2
func (p *ProgressImage) Add(ctx op.Ctx)
type QRDecoder ¶ added in v1.3.0
type QRDecoder struct {
// contains filtered or unexported fields
}
type SDCardEvent ¶ added in v1.2.0
type SDCardEvent struct {
Inserted bool
}
func (SDCardEvent) Event ¶ added in v1.3.0
func (s SDCardEvent) Event() Event
type ScanScreen ¶
type SeedScreen ¶
type SeedScreen struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.