pashua

package module
v0.0.0-...-caaf493 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2020 License: MIT Imports: 8 Imported by: 0

README

Pashua-Binding-Go

Binding code to use Pashua from Go programms

Overview

This is the binding (glue code) for using Pashua from Go programs. Pashua is a macOS application for using native GUI dialog windows in various programming languages.

This code can be found in a GitHub repository at https://github.com/derLinkshaender/Pashua-Binding-Go. For examples in other programming languages, see https://github.com/BlueM/Pashua-Bindings.

Other related links:

Usage

The file pashua.go contains the binding code itself as a package

The folder example contains an example, which does not do much more than define how the dialog window should look like and use the functions in the pashua.go file.

You need to have Pashua installed on your Mac to make use of this repository. The code expects Pashua.app in one of the “typical” locations, such as the global or the user’s “Applications” folder, or in the folder which contains example.go.

Compatibility

This code

It is compatible and has been tested with Pashua 0.11. It requires a version of Pashua that handles UTF-8 encoded input.

Author

This code was written by Armin Hanisch. You can reach the author on Twitter

License

MIT License, see the file LICENSE

Documentation

Index

Constants

View Source
const (
	NoCompletion    CompletionMode = "0"
	CaseSensitive                  = "1"
	CaseInsensitive                = "2"
)
View Source
const (
	Regular FontSize = "regular"
	Small            = "small"
	Mini             = "mini"
)

Variables

This section is empty.

Functions

func LocatePashua

func LocatePashua(pashuaPath string) (string, error)

LocatePashua is one of the two main binding function and tries to find the Pashua.app and the executable contained within the app container by iterating over the standard file locations. Returns the location path and an error code

func RunPashua

func RunPashua(configData string, pashuaPath string) (map[string]string, error)

RunPashua is one of the two main binding function. it sets up a pipe and executes Pashua as an external command, then converts the STdOut and StdErr to strings and parses the output

func RunPashuaWithStruct

func RunPashuaWithStruct(pashuaWindow *PashuaWindow, pashuaPath string) (map[string]string, error)

RunPashuaWithStruct is a convenience function that saves you from having to convert a struct-based window definition to a string first

Types

type CompletionMode

type CompletionMode string

CompletionMode is a type to store the completion mode for a combobox

type FontSize

type FontSize string

FontSize is a type to store the fontsize of a Pashua window

type PashuaButton

type PashuaButton struct {
	Label    string
	X        int
	Y        int
	Disabled bool
	Tooltip  string
}

PashuaButton is a structure that holds all information for a PashuaButton

func (*PashuaButton) ToString

func (btn *PashuaButton) ToString(key string) string

type PashuaCancelButton

type PashuaCancelButton struct {
	Label    string
	Disabled bool
	Tooltip  string
}

PashuaCancelButton is a structure that holds all information for a PashuaCancelButton

func (*PashuaCancelButton) ToString

func (txt *PashuaCancelButton) ToString(key string) string

type PashuaCheckbox

type PashuaCheckbox struct {
	Label    string
	Default  bool
	Disabled bool
	Tooltip  string
	X        int
	Y        int
	RelX     int
	RelY     int
}

PashuaCheckbox is a structure that holds all information for a PashuaCheckbox

func (*PashuaCheckbox) ToString

func (txt *PashuaCheckbox) ToString(key string) string

type PashuaCombobox

type PashuaCombobox struct {
	Label          string
	Option         []string
	CompletionMode CompletionMode
	Mandatory      bool
	Rows           int
	Placeholder    string
	Disabled       bool
	Tooltip        string
	Width          int
	X              int
	Y              int
	RelX           int
	RelY           int
}

PashuaCombobox is a structure that holds all information for a PashuaCombobox

func (*PashuaCombobox) ToString

func (txt *PashuaCombobox) ToString(key string) string

type PashuaComponents

type PashuaComponents map[string]interface{}

PashuaComponents is type for th elist of components contained in a Pashua window

type PashuaDate

type PashuaDate struct {
	Label    string
	Textual  bool
	UseDate  bool
	UseTime  bool
	Default  string
	Disabled bool
	Tooltip  string
	X        int
	Y        int
}

PashuaDate is a structure that holds all information for a PashuaDate

func (*PashuaDate) ToString

func (btn *PashuaDate) ToString(key string) string

type PashuaDefaultButton

type PashuaDefaultButton struct {
	Label    string
	Disabled bool
	Tooltip  string
}

PashuaDefaultButton is a structure that holds all information for a PashuaDefaultButton

func (*PashuaDefaultButton) ToString

func (btn *PashuaDefaultButton) ToString(key string) string

type PashuaImage

type PashuaImage struct {
	Label     string
	Path      string
	Border    bool
	Width     int
	Height    int
	MaxWidth  int
	MaxHeight int
	UpScale   bool
	Tooltip   string
	X         int
	Y         int
	RelX      int
	RelY      int
}

PashuaImage is a structure that holds all information for a PashuaImage

func (*PashuaImage) ToString

func (txt *PashuaImage) ToString(key string) string

type PashuaOpenBrowser

type PashuaOpenBrowser struct {
	Label       string
	DefaultPath string
	Width       int
	Filetype    string
	Placeholder string
	Mandatory   bool
	X           int
	Y           int
	RelX        int
	RelY        int
}

PashuaOpenBrowser is a structure that holds all information for a PashuaOpenBrowser

func (*PashuaOpenBrowser) ToString

func (txt *PashuaOpenBrowser) ToString(key string) string

type PashuaPassword

type PashuaPassword struct {
	Label     string
	Default   bool
	Disabled  bool
	Mandatory bool
	Tooltip   string
	Width     int
	X         int
	Y         int
	RelX      int
	RelY      int
}

PashuaPassword is a structure that holds all information for a PashuaPassword

func (*PashuaPassword) ToString

func (txt *PashuaPassword) ToString(key string) string

type PashuaPopup

type PashuaPopup struct {
	Option    []string
	Default   string
	Label     string
	Disabled  bool
	Tooltip   string
	Mandatory bool
	Width     int
	X         int
	Y         int
	RelX      int
	RelY      int
}

PashuaPopup is a structure that holds all information for a PashuaPopup

func (*PashuaPopup) ToString

func (txt *PashuaPopup) ToString(key string) string

type PashuaRadioButton

type PashuaRadioButton struct {
	Option    []string
	Default   string
	Label     string
	Disabled  bool
	Tooltip   string
	Mandatory bool
	X         int
	Y         int
	RelX      int
	RelY      int
}

PashuaRadioButton is a structure that holds all information for a PashuaRadioButton

func (*PashuaRadioButton) ToString

func (txt *PashuaRadioButton) ToString(key string) string

type PashuaSaveBrowser

type PashuaSaveBrowser struct {
	Label       string
	DefaultPath string
	Width       int
	Filetype    string
	Placeholder string
	Mandatory   bool
	X           int
	Y           int
	RelX        int
	RelY        int
}

PashuaSaveBrowser is a structure that holds all information for a PashuaSaveBrowser

func (*PashuaSaveBrowser) ToString

func (txt *PashuaSaveBrowser) ToString(key string) string

type PashuaText

type PashuaText struct {
	Label   string
	Text    string
	Tooltip string
	Width   int
	X       int
	Y       int
	RelX    int
	RelY    int
}

PashuaText is a structure that holds all information for a PashuaText

func (*PashuaText) ToString

func (txt *PashuaText) ToString(key string) string

type PashuaTextBox

type PashuaTextBox struct {
	Label     string
	Default   string
	Tooltip   string
	FixedFont bool
	FontSize  FontSize // regular small mini
	Mandatory bool
	Disabled  bool
	Width     int
	Height    int
	X         int
	Y         int
	RelX      int
	RelY      int
}

PashuaTextBox is a structure that holds all information for a PashuaTextBox

func (*PashuaTextBox) ToString

func (txt *PashuaTextBox) ToString(key string) string

type PashuaTextField

type PashuaTextField struct {
	Label     string
	Default   string
	Tooltip   string
	Mandatory bool
	Disabled  bool
	Width     int
	X         int
	Y         int
	RelX      int
	RelY      int
}

PashuaTextField is a structure that holds all information for a PashuaTextField

func (*PashuaTextField) ToString

func (txt *PashuaTextField) ToString(key string) string

type PashuaWindow

type PashuaWindow struct {
	AutoCloseTime int
	AutoSaveKey   string
	Floating      bool
	Title         string
	Transparency  float64
	X             int
	Y             int
	Components    PashuaComponents
}

PashuaWindow is the top-most structure when defininng a dialog window for Pashua

func (*PashuaWindow) ToString

func (win *PashuaWindow) ToString() string

func (*PashuaWindow) WindowToString

func (win *PashuaWindow) WindowToString() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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