ui

package
v2.5.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2019 License: AGPL-3.0 Imports: 23 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   = "OctoScreen"
	WindowHeight = 480
	WindowWidth  = 800
)
View Source
var Build = "no-set"
View Source
var Logger *logrus.Entry
View Source
var Version = "2.2"

Set at compilation time.

Functions

func CleanHTML

func CleanHTML(html string) string

func ConfirmStopDialog

func ConfirmStopDialog(parent *gtk.Window, msg string, ma *printStatusPanel) func()

func EmptyContainer

func EmptyContainer(c *gtk.Container)

func MessageDialog

func MessageDialog(parent *gtk.Window, msg string)

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, imgName string, clicked func()) *gtk.Button

func MustButtonImageStyle

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

func MustButtonText

func MustButtonText(label string, clicked func()) *gtk.Button

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

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 MustPressedButton

func MustPressedButton(label, i string, pressed func(), speed time.Duration) *gtk.Button

func MustProgressBar

func MustProgressBar() *gtk.ProgressBar

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

func MustToogleButton

func MustToogleButton(label string, imgName string, clicked func()) *gtk.ToggleButton

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) Scaled

func (p *CommonPanel) Scaled(s int) int

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 BedLevelPanel

func BedLevelPanel(ui *UI, parent Panel) Panel

func ConnectionPanel

func ConnectionPanel(ui *UI, parent Panel, SSID string) Panel

func ControlPanel

func ControlPanel(ui *UI, parent Panel) Panel

func ExtrudeMultitoolPanel

func ExtrudeMultitoolPanel(ui *UI, parent Panel) Panel

func ExtrudePanel

func ExtrudePanel(ui *UI, parent Panel) Panel

func FanPanel

func FanPanel(ui *UI, parent Panel) Panel

func FilamentMultitoolPanel

func FilamentMultitoolPanel(ui *UI, parent Panel) 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 IdleStatusPanel

func IdleStatusPanel(ui *UI) Panel
func MenuPanel(ui *UI, parent Panel, items []octoprint.MenuItem) Panel

func MovePanel

func MovePanel(ui *UI, parent Panel) Panel

func NetworkPanel

func NetworkPanel(ui *UI, parent Panel) Panel

func NozzleCalibrationPanel

func NozzleCalibrationPanel(ui *UI, parent Panel) Panel

func PrintMenuPanel

func PrintMenuPanel(ui *UI, parent Panel) Panel

func PrintStatusPanel

func PrintStatusPanel(ui *UI) Panel

func ProfilesPanel

func ProfilesPanel(ui *UI, parent Panel) Panel

func TemperaturePanel

func TemperaturePanel(ui *UI, parent Panel) Panel

func ToolchangerPanel

func ToolchangerPanel(ui *UI, parent Panel) Panel

type SplashPanel

type SplashPanel struct {
	CommonPanel
	Label       *gtk.Label
	RetryButton *gtk.Button
}

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 ToolHeatup

type ToolHeatup struct {
	*gtk.Button
	sync.RWMutex
	// contains filtered or unexported fields
}

func ToolHeatupNew

func ToolHeatupNew(num int, printer *octoprint.Client) *ToolHeatup

func (*ToolHeatup) SetTemperatures

func (t *ToolHeatup) SetTemperatures(actual float64, target float64)

type UI

type UI struct {
	Current  Panel
	Printer  *octoprint.Client
	State    octoprint.ConnectionState
	Settings *octoprint.GetSettingsResponse
	UIState  string

	OctoPrintPlugin bool

	Notifications *Notifications

	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(endpoint, key string, width, height int) *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