GForm , zenity like gui maker for shell scripts using pipe to talk to script.
Posted: Wednesday 19th August 2020 1:05am
Pre Note...
All uploads except the latest version of this app i uploaded to this thread i've deleted.
for one i was having a problem with my executable files being too large because of things i had in the source dir so they were wasting Gambas ones storage space.
Plus i think people may download the older versions by mistake.
Scroll down the thread to find the latest version
GForm (was thinking of calling it Genity)
zenity like form maker using a pipe for shell interaction
Work in progress. (Started it 2 days ago)
With this app you can simply (kind of) create GUI's in a shell script and
monitor/react to the actions in the script using a pipe.
The goal is to be able to make functional GUI apps simply just with scripting in bash.
It currently lacks lots of features but is still useable.
It creates a form/window and currently only adds objects to it vertically.
you can create a HBox and add objects to that horizontally.
currently supported objects are Button, ToggleButton, TextBox, ComboBox, Label, HBox (more to come)
Arguments are....
title="Title for window top"
box , makes a Horizontal box, subsequent objects go in the box until unboxed
unbox , finishes the box
button="name|text|close" , makes a button (close makes button close the window)
tbutton="name|text|on or off" , makes a ToggleButton, use 'on' to make it down
input="name|text" , makes a TextBox
checkbox="name|text|on or off" , makes a CheckBox , use 'on' for ticked
combobox="name|comma,seperated,list|index" , makes a read-only combobox, index is selected number
label="text" , makes a label.
pipe="path/to/pipe" , name of the pipe file (Usually /tmp/fifo1)
Provided is a demo bash script.
The GForm.gambas program is run from within the script with a few args to make a GUI.
The pipe=/tmp/fifo1 argument makes the app create a pipe that the script then opens and
waits for messages from the GUI.
The GForm.gambas command is finished with '&sleep 1' this is important as the & makes the app
run in the background while the script continues. the 'Sleep 1' part gives the app a second to
load and make the pipe before the script tries to read the messages.
Messages come in the form of name|text or name|text|value depending on the calling object
A Snapshot.png image is in the folder. the arguments for this were...
tbutton="B1|Hello|on" input="Inp3|some text" box tbutton="B2|Goodbye" button="B3|oooh" unbox button="b4|well then" box label="This box" input="I3|more txt" label="another label" input="I4|will 2 be ok" unbox box checkbox="cb1|Check box this|on" combobox="cmb1|l1,list 2,the third|2" unbox button="BQ|Quit|close" pipe=/tmp/fifo1 Like i said, lots to add to this.
Vertical layout features/objects are missing (like vbox and multi-line labels,textareas,lists,etc)
because i've not written the routines yet to work out the apps height.
currently it's working things out simply.
also plan to provide a way for the script to talk to the app.
also plan to make it useable like zenity where it doesn't create the pipe and just
gives all the data when closed.
Could have some potential this app, who knows?
Bruce
Edit ...
Above is the original old version , Find the Latest version here..
GitHub https://github.com/BruceSteers/GForm
All uploads except the latest version of this app i uploaded to this thread i've deleted.
for one i was having a problem with my executable files being too large because of things i had in the source dir so they were wasting Gambas ones storage space.
Plus i think people may download the older versions by mistake.
Scroll down the thread to find the latest version
GForm (was thinking of calling it Genity)
zenity like form maker using a pipe for shell interaction
Work in progress. (Started it 2 days ago)
With this app you can simply (kind of) create GUI's in a shell script and
monitor/react to the actions in the script using a pipe.
The goal is to be able to make functional GUI apps simply just with scripting in bash.
It currently lacks lots of features but is still useable.
It creates a form/window and currently only adds objects to it vertically.
you can create a HBox and add objects to that horizontally.
currently supported objects are Button, ToggleButton, TextBox, ComboBox, Label, HBox (more to come)
Arguments are....
title="Title for window top"
box , makes a Horizontal box, subsequent objects go in the box until unboxed
unbox , finishes the box
button="name|text|close" , makes a button (close makes button close the window)
tbutton="name|text|on or off" , makes a ToggleButton, use 'on' to make it down
input="name|text" , makes a TextBox
checkbox="name|text|on or off" , makes a CheckBox , use 'on' for ticked
combobox="name|comma,seperated,list|index" , makes a read-only combobox, index is selected number
label="text" , makes a label.
pipe="path/to/pipe" , name of the pipe file (Usually /tmp/fifo1)
Provided is a demo bash script.
The GForm.gambas program is run from within the script with a few args to make a GUI.
The pipe=/tmp/fifo1 argument makes the app create a pipe that the script then opens and
waits for messages from the GUI.
The GForm.gambas command is finished with '&sleep 1' this is important as the & makes the app
run in the background while the script continues. the 'Sleep 1' part gives the app a second to
load and make the pipe before the script tries to read the messages.
Messages come in the form of name|text or name|text|value depending on the calling object
A Snapshot.png image is in the folder. the arguments for this were...
tbutton="B1|Hello|on" input="Inp3|some text" box tbutton="B2|Goodbye" button="B3|oooh" unbox button="b4|well then" box label="This box" input="I3|more txt" label="another label" input="I4|will 2 be ok" unbox box checkbox="cb1|Check box this|on" combobox="cmb1|l1,list 2,the third|2" unbox button="BQ|Quit|close" pipe=/tmp/fifo1 Like i said, lots to add to this.
Vertical layout features/objects are missing (like vbox and multi-line labels,textareas,lists,etc)
because i've not written the routines yet to work out the apps height.
currently it's working things out simply.
also plan to provide a way for the script to talk to the app.
also plan to make it useable like zenity where it doesn't create the pipe and just
gives all the data when closed.
Could have some potential this app, who knows?
Bruce
Edit ...
Above is the original old version , Find the Latest version here..
GitHub https://github.com/BruceSteers/GForm