Documentation ¶
Index ¶
- Constants
- Variables
- func AttachToolheadButtonsToGrid(toolheadButtons []*gtk.Button, grid *gtk.Grid)
- func CheckIfHotendTemperatureIsTooLow(client *octoprintApis.Client, extruderId, action string, ...) bool
- func CleanHTML(html string) string
- func CreateChangeToolheadButtonsAndAttachToGrid(toolheadCount int, grid *gtk.Grid) []*gtk.Button
- func CreateToolheadButton(num, toolheadCount int, clicked func()) *gtk.Button
- func CreateToolheadButtons(toolheadCount int) []*gtk.Button
- func CreateToolheadButtonsAndAttachToGrid(toolheadCount int, grid *gtk.Grid) []*gtk.Button
- func CreateUpdateTemperaturesBackgroundTask(temperatureDataDisplay interfaces.ITemperatureDataDisplay, ...)
- func DumpEnvironmentVariables()
- func DumpSystemInformation()
- func EmptyTheContainer(container *gtk.Container)
- func ErrorMessageDialogBox(parentWindow *gtk.Window, message string)
- func Extrude(client *octoprintApis.Client, isForward bool, extruderId string, ...)
- func FileExists(filename string) bool
- func FolderExists(filename string) bool
- func GetCurrentTemperatureData(client *octoprintApis.Client) (map[string]dataModels.TemperatureData, error)
- func GetDisplayNameForTool(toolName string) string
- func GetExtruderCount(client *octoprintApis.Client) int
- func GetExtruderFileName(hotendIndex, hotendCount int) string
- func GetHasSharedNozzle(client *octoprintApis.Client) bool
- func GetHotendCount(client *octoprintApis.Client) int
- func GetHotendFileName(hotendIndex, hotendCount int) string
- func GetNozzleFileName(hotendIndex, hotendCount int) string
- func GetObfuscatedValue(value string) string
- func GetTemperatureDataString(temperatureData dataModels.TemperatureData) string
- func GetToolTarget(client *octoprintApis.Client, tool string) (float64, error)
- func GetToolheadFileName(hotendIndex, hotendCount int) string
- func HotendTemperatureIsTooLow(temperatureData dataModels.TemperatureData, action string, ...) bool
- func ImageFromUrl(imageUrl string) (*gtk.Image, error)
- func InfoMessageDialogBox(parentWindow *gtk.Window, message string)
- func MustBox(orientation gtk.Orientation, spacing int) *gtk.Box
- func MustButton(image *gtk.Image, clicked func()) *gtk.Button
- func MustButtonImage(buttonlabel, imageFileName string, clicked func()) *gtk.Button
- func MustButtonImageStyle(buttonlabel, imageFileName string, style string, clicked func()) *gtk.Button
- func MustButtonText(label string, clicked func()) *gtk.Button
- func MustCSSProviderFromFile(css string) *gtk.CssProvider
- func MustConfirmDialogBox(parent *gtk.Window, msg string, cb func()) func()
- func MustGrid() *gtk.Grid
- func MustImageFromFile(imageFileName string) *gtk.Image
- func MustImageFromFileWithSize(imageFileName string, width, height int) *gtk.Image
- func MustLabel(format string, args ...interface{}) *gtk.Label
- func MustLabelWithCssClass(format string, className string, args ...interface{}) *gtk.Label
- func MustLabelWithCssClasses(format string, classNames []string, args ...interface{}) *gtk.Label
- func MustOverlay() *gtk.Overlay
- func MustProgressBar() *gtk.ProgressBar
- func MustToggleButton(label string, imageFileName string, clicked func()) *gtk.ToggleButton
- func MustWindow(windowType gtk.WindowType) *gtk.Window
- func NameOfMissingRequiredEnvironmentVariable(apiKey string) string
- func RegisterTemperatureStatusBox(temperatureDataDisplay interfaces.ITemperatureDataDisplay, ...)
- func ReplaceHTMLTag(html, from, to string) string
- func RequiredEnvironmentVariablesAreSet(apiKey string) bool
- func Round(num float64) int
- func SelectTool(client *octoprintApis.Client, extruderId string) error
- func SendExtrudeRrequest(client *octoprintApis.Client, isForward bool, length int) error
- func SetFlowRate(client *octoprintApis.Client, flowRatePercentage int) error
- func SetToolTarget(client *octoprintApis.Client, tool string, target float64) error
- func StrEllipsis(name string) string
- func StrEllipsisLen(name string, length int) string
- func StructToJson(obj interface{}) (string, error)
- func ToFixed(num float64, precision int) float64
- func TruncateString(str string, maxLength int) string
- func WarningMessageDialogBox(parentWindow *gtk.Window, message string)
- type BackgroundTask
- type FileResponsesSortedByDate
- type FileResponsesSortedByName
- type LabelWithImage
- type LocationHistory
Constants ¶
const ( EnvStylePath = "OCTOSCREEN_STYLE_PATH" EnvBaseURL = "OCTOPRINT_HOST" EnvAPIKey = "OCTOPRINT_APIKEY" )
Required environment variables
const ( EnvLogLevel = "OCTOSCREEN_LOG_LEVEL" EnvLogFilePath = "OCTOSCREEN_LOG_FILE_PATH" EnvResolution = "OCTOSCREEN_RESOLUTION" EnvConfigFile = "OCTOPRINT_CONFIG_FILE" EnvDisplayCursor = "DISPLAY_CURSOR" )
Optional (but good to have) environment variables
const ( ImageFolder = "images" CSSFilename = "style.css" )
const INVALID_ENV_TOKEN = "!!!INVALID!!!"
const LabelImageSize = 20
LabelImageSize default width and height of the image for a LabelWithImage
const MIN_HOTEND_TEMPERATURE = 150.0
const MISSING_ENV_TOKEN = ">>MISSING<<"
Variables ¶
var ( StylePath string WindowName = "OctoScreen" WindowWidth = 800 WindowHeight = 480 )
var OctoScreenVersion = "2.7.4"
OctoScreenVersion is set during compilation.
Functions ¶
func CreateToolheadButton ¶
func CreateToolheadButtons ¶
func CreateToolheadButtonsAndAttachToGrid ¶
**************************************************************************** Button Routines
func CreateUpdateTemperaturesBackgroundTask ¶
func CreateUpdateTemperaturesBackgroundTask( temperatureDataDisplay interfaces.ITemperatureDataDisplay, client *octoprintApis.Client, )
func DumpEnvironmentVariables ¶
func DumpEnvironmentVariables()
func DumpSystemInformation ¶
func DumpSystemInformation()
func EmptyTheContainer ¶
func ErrorMessageDialogBox ¶
func FileExists ¶
FileExists checks if a file exists and is not a directory. From https://golangcode.com/check-if-a-file-exists/
func FolderExists ¶
func GetCurrentTemperatureData ¶
func GetCurrentTemperatureData(client *octoprintApis.Client) (map[string]dataModels.TemperatureData, error)
func GetDisplayNameForTool ¶
func GetExtruderCount ¶
func GetExtruderCount(client *octoprintApis.Client) int
func GetExtruderFileName ¶
func GetHasSharedNozzle ¶
func GetHasSharedNozzle(client *octoprintApis.Client) bool
func GetHotendCount ¶
func GetHotendCount(client *octoprintApis.Client) int
func GetHotendFileName ¶
func GetNozzleFileName ¶
func GetObfuscatedValue ¶
func GetTemperatureDataString ¶
func GetTemperatureDataString(temperatureData dataModels.TemperatureData) string
func GetToolTarget ¶
func GetToolTarget(client *octoprintApis.Client, tool string) (float64, error)
func GetToolheadFileName ¶
func HotendTemperatureIsTooLow ¶
func HotendTemperatureIsTooLow( temperatureData dataModels.TemperatureData, action string, parentWindow *gtk.Window, ) bool
func InfoMessageDialogBox ¶
func MustBox ¶
func MustBox(orientation gtk.Orientation, spacing int) *gtk.Box
MustBox returns a new gtk.Box, with the given configuration, if err panics.
func MustButtonImage ¶
func MustButtonImageStyle ¶
func MustButtonImageStyle(buttonlabel, imageFileName string, style string, clicked func()) *gtk.Button
MustButtonImageStyle returns a new gtk.Button with the given label, image and clicked callback, if error panics.
func MustButtonText ¶
func MustCSSProviderFromFile ¶
func MustCSSProviderFromFile(css string) *gtk.CssProvider
MustCSSProviderFromFile returns a new gtk.CssProvider for a given css file, if error panics.
func MustConfirmDialogBox ¶
**************************************************************************** DialogBox Routines
func MustImageFromFile ¶
MustImageFromFile returns a new gtk.Image based on the given file, if error panics.
func MustLabelWithCssClass ¶
MustLabelWithCssClass returns a stylized new gtk.Label, if err panics.
func MustLabelWithCssClasses ¶
MustLabelWithCssClass returns a stylized new gtk.Label, if err panics.
func MustOverlay ¶
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 MustToggleButton ¶
func MustToggleButton(label string, imageFileName string, clicked func()) *gtk.ToggleButton
func MustWindow ¶
func MustWindow(windowType gtk.WindowType) *gtk.Window
MustWindow returns a new gtk.Window, if error panics.
func RegisterTemperatureStatusBox ¶
func RegisterTemperatureStatusBox(temperatureDataDisplay interfaces.ITemperatureDataDisplay, client *octoprintApis.Client)
func ReplaceHTMLTag ¶
func SelectTool ¶
func SelectTool( client *octoprintApis.Client, extruderId string, ) error
func SendExtrudeRrequest ¶
func SendExtrudeRrequest( client *octoprintApis.Client, isForward bool, length int, ) error
func SetFlowRate ¶
func SetFlowRate( client *octoprintApis.Client, flowRatePercentage int, ) error
func SetToolTarget ¶
func SetToolTarget(client *octoprintApis.Client, tool string, target float64) error
func StrEllipsis ¶
TODO: Clean up StrEllipsis(), StrEllipsisLen(), and TruncateString() and consolidate into a single function.
func StrEllipsisLen ¶
func StructToJson ¶
func TruncateString ¶
func WarningMessageDialogBox ¶
Types ¶
type BackgroundTask ¶
var UpdateTemperaturesBackgroundTask *BackgroundTask = nil
func CreateBackgroundTask ¶
func CreateBackgroundTask( duration time.Duration, task func(), ) *BackgroundTask
func (*BackgroundTask) Close ¶
func (this *BackgroundTask) Close()
func (*BackgroundTask) Start ¶
func (this *BackgroundTask) Start()
type FileResponsesSortedByDate ¶
type FileResponsesSortedByDate []*dataModels.FileResponse
func (FileResponsesSortedByDate) Len ¶
func (this FileResponsesSortedByDate) Len() int
func (FileResponsesSortedByDate) Less ¶
func (this FileResponsesSortedByDate) Less(i, j int) bool
func (FileResponsesSortedByDate) Swap ¶
func (this FileResponsesSortedByDate) Swap(i, j int)
type FileResponsesSortedByName ¶
type FileResponsesSortedByName []*dataModels.FileResponse
func (FileResponsesSortedByName) Len ¶
func (this FileResponsesSortedByName) Len() int
func (FileResponsesSortedByName) Less ¶
func (this FileResponsesSortedByName) Less(i, j int) bool
func (FileResponsesSortedByName) Swap ¶
func (this FileResponsesSortedByName) Swap(i, j int)
type LabelWithImage ¶
LabelWithImage represents a gtk.Label with a image to the right.
func MustLabelWithImage ¶
func MustLabelWithImage(imageFileName, format 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 LocationHistory ¶
type LocationHistory struct {
Locations []dataModels.Location
}
func (*LocationHistory) CurrentLocation ¶
func (this *LocationHistory) CurrentLocation() dataModels.Location
func (*LocationHistory) GoBack ¶
func (this *LocationHistory) GoBack()
func (*LocationHistory) GoForward ¶
func (this *LocationHistory) GoForward(folder string)
func (*LocationHistory) IsRoot ¶
func (this *LocationHistory) IsRoot() bool
func (*LocationHistory) Length ¶
func (this *LocationHistory) Length() int