ui

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2018 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ImageFolder = "images"
	CSSFilename = "style.css"
)
View Source
const LabelImageSize = 20

LabelImageSize default width and height of the image for a LabelWithImage

Variables

View Source
var (
	StylePath    string
	WindowName   = "OctoPrint-TFT"
	WindowHeight = 320
	WindowWidth  = 480
)
View Source
var Build = "no-set"
View Source
var Logger *logrus.Entry
View Source
var Version = "0.1.x"

Set at compilation time.

Functions

func CleanHTML

func CleanHTML(html string) string

func EmptyContainer

func EmptyContainer(c *gtk.Container)

func MustBox

func MustBox(o gtk.Orientation, spacing int) *gtk.Box

MustBox returns a new gtk.Box, with the given configuration, if err panics.

func MustButton

func MustButton(img *gtk.Image, clicked func()) *gtk.Button

func MustButtonImage

func MustButtonImage(label, img string, clicked func()) *gtk.Button

MustButtonImage returns a new gtk.Button with the given label, image and clicked callback. If error panics.

func MustButtonImageFromImage

func MustButtonImageFromImage(label string, img *gtk.Image, clicked func()) *gtk.Button

MustButtonImageFromImage returns a new gtk.Button with the given label, image and clicked callback. If error panics.

func MustCSSProviderFromFile

func MustCSSProviderFromFile(css string) *gtk.CssProvider

MustCSSProviderFromFile returns a new gtk.CssProvider for a given css file, If error panics.

func MustConfirmDialog

func MustConfirmDialog(parent *gtk.Window, msg string, cb func()) func()

func MustGrid

func MustGrid() *gtk.Grid

MustGrid returns a new gtk.Grid, if error panics.

func MustImageFromFile

func MustImageFromFile(img string) *gtk.Image

MustImageFromFile returns a new gtk.Image based on the given file, If error panics.

func MustImageFromFileWithSize

func MustImageFromFileWithSize(img string, w, h int) *gtk.Image

MustImageFromFileWithSize returns a new gtk.Image based on rescaled version of the given file.

func MustLabel

func MustLabel(label string, args ...interface{}) *gtk.Label

MustLabel returns a new gtk.Label, if err panics.

func MustOverlay

func MustOverlay() *gtk.Overlay

MustOverlay returns a new gtk.Overlay, if error panics.

func MustProgressBar

func MustProgressBar() *gtk.ProgressBar

MustProgressBar returns a new gtk.ProgressBar, if err panics.

func MustWindow

func MustWindow(t gtk.WindowType) *gtk.Window

MustWindow returns a new gtk.Window, if error panics.

func SystemPanel

func SystemPanel(ui *UI, parent Panel) *systemPanel

Types

type BackgroundTask

type BackgroundTask struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewBackgroundTask

func NewBackgroundTask(d time.Duration, task func()) *BackgroundTask

func (*BackgroundTask) Close

func (t *BackgroundTask) Close()

func (*BackgroundTask) Start

func (t *BackgroundTask) Start()

type CommonPanel

type CommonPanel struct {
	UI *UI
	// contains filtered or unexported fields
}

func NewCommonPanel

func NewCommonPanel(ui *UI, parent Panel) CommonPanel

func (*CommonPanel) AddButton

func (p *CommonPanel) AddButton(b gtk.IWidget)

func (*CommonPanel) Grid

func (p *CommonPanel) Grid() *gtk.Grid

func (*CommonPanel) Hide

func (p *CommonPanel) Hide()

func (*CommonPanel) Initialize

func (p *CommonPanel) Initialize()

func (*CommonPanel) Parent

func (p *CommonPanel) Parent() Panel

func (*CommonPanel) Show

func (p *CommonPanel) Show()

type ContextHook

type ContextHook struct{}

func (ContextHook) Fire

func (hook ContextHook) Fire(entry *logrus.Entry) error

func (ContextHook) Levels

func (hook ContextHook) Levels() []logrus.Level

type LabelWithImage

type LabelWithImage struct {
	Label *gtk.Label
	*gtk.Box
}

LabelWithImage represents a gtk.Label with a image to the right.

func MustLabelWithImage

func MustLabelWithImage(img, label string, args ...interface{}) *LabelWithImage

MustLabelWithImage returns a new LabelWithImage based on a gtk.Box containing a gtk.Label with a gtk.Image, the image is scaled at LabelImageSize.

type Notifications

type Notifications struct {
	*gtk.Box
}

func NewNotifications

func NewNotifications() *Notifications

func (*Notifications) Show

func (n *Notifications) Show(style, msg string, d time.Duration)

type NotificationsHook

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

func NewNotificationsHook

func NewNotificationsHook(n *Notifications) *NotificationsHook

func (NotificationsHook) Fire

func (h NotificationsHook) Fire(entry *logrus.Entry) error

func (NotificationsHook) Levels

func (h NotificationsHook) Levels() []logrus.Level

type Panel

type Panel interface {
	Grid() *gtk.Grid
	Show()
	Hide()
	Parent() Panel
}

func ControlPanel

func ControlPanel(ui *UI, parent Panel) Panel

func DefaultPanel

func DefaultPanel(ui *UI) Panel

func FilamentPanel

func FilamentPanel(ui *UI, parent Panel) Panel

func FilesPanel

func FilesPanel(ui *UI, parent Panel) Panel

func HomePanel

func HomePanel(ui *UI, parent Panel) Panel

func MovePanel

func MovePanel(ui *UI, parent Panel) Panel

func ProfilesPanel

func ProfilesPanel(ui *UI, parent Panel) Panel

func StatusPanel

func StatusPanel(ui *UI, parent Panel) Panel

func TemperaturePanel

func TemperaturePanel(ui *UI, parent Panel) Panel

type SplashPanel

type SplashPanel struct {
	CommonPanel
	Label *gtk.Label
}

func NewSplashPanel

func NewSplashPanel(ui *UI) *SplashPanel

type Step

type Step struct {
	Label string
	Value interface{}
}

type StepButton

type StepButton struct {
	Current  int
	Steps    []Step
	Callback func()

	*gtk.Button
	sync.RWMutex
}

func MustStepButton

func MustStepButton(image string, s ...Step) *StepButton

func (*StepButton) AddStep

func (b *StepButton) AddStep(s Step)

func (*StepButton) Label

func (b *StepButton) Label() string

func (*StepButton) Value

func (b *StepButton) Value() interface{}

type UI

type UI struct {
	Current       Panel
	Printer       *octoprint.Client
	State         octoprint.ConnectionState
	Notifications *Notifications

	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(endpoint, key string) *UI

func (*UI) Add

func (ui *UI) Add(p Panel)

func (*UI) GoHistory

func (ui *UI) GoHistory()

func (*UI) Remove

func (ui *UI) Remove(p Panel)

Jump to

Keyboard shortcuts

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