473,394 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

(patch for Bash) GTK+2 + Bash


I'm very excited to announce shell interface to GTK+2 (2.6.1) for Bash.
It read XML syntax describing the widget layout, and returns user selection as
shell variable or runs shell command as callback. It's designed for
simple GUI dialog or layout, with the emphasis on getting the user data
back into shell.

For the moment, the shell variable and command are disabled. It just
prints to stdout, instead. But, you can change it easily.
Ref:
http://freshmeat.net/projects/bashdiff/
http://home.eol.ca/~parkw/index.html#gtk

Usage:
gtk < file.xml
gtk file.xml...
For example, GTK+2 tutorial has 2 button 'helloworld2.c',

http://www.gtk.org/tutorial/sec-anup...elloworld.html
http://www.gtk.org/tutorial/images/helloworld2.png

You can now build the same thing with

<window border="10" label="Hello Buttons!">
<hbox>
<button label="Button 1" clicked="echo Button 1 was pressed" />
<button label="Button 2" clicked="echo Button 2 was pressed" />
</hbox>
</window>

Or,

gtk << EOF
<window>
...
</window>
EOF
Feedbacks are welcome. Enjoy!

--
William Park <op**********@yahoo.ca>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
http://freshmeat.net/projects/bashdiff/
Jul 20 '05 #1
3 2654
Hello William,
http://www.gtk.org/tutorial/images/helloworld2.png

You can now build the same thing with

<window border="10" label="Hello Buttons!">
<hbox>
<button label="Button 1" clicked="echo Button 1 was pressed" />
<button label="Button 2" clicked="echo Button 2 was pressed" />
</hbox>
</window>


Do you have a pointer to a description of the XML
data that is accepted by GTK and by your extended bash ?
Is this some kind of competition for Mozilla's XUL ?
Jul 20 '05 #2
J?rgen Kahrs <Ju**********************@vr-web.de> wrote:
Hello William,
http://www.gtk.org/tutorial/images/helloworld2.png

You can now build the same thing with

<window border="10" label="Hello Buttons!">
<hbox>
<button label="Button 1" clicked="echo Button 1 was pressed" />
<button label="Button 2" clicked="echo Button 2 was pressed" />
</hbox>
</window>
Do you have a pointer to a description of the XML
data that is accepted by GTK and by your extended bash ?

Hi Juergen,

It uses Expat to parse the input syntax. As for the actual format, you
can only have 2 variations:
<tag att="value" ...></tag>
<tag att="value"/>
where
<tag></tag> is used for widget which contains child widget.

Currently supported tags are listed in
http://home.eol.ca/~parkw/index.html#gtk
It's the same help file that you get from
help gtk

I'll add more examples to the website. Right now, it can do most
'dialog' and 'Xdialog' stuffs, except for calendar. I'll add it soon.
It's really designed for presenting relatively static and simple GUI
layout or dialog. And, getting the info back into shell script.

Is this some kind of competition for Mozilla's XUL ?


Unfortunately, no. I looked at XUL, and couldn't understand it. You
can display buttons or text fields. Okey, so user clicks a button or
types some text. How do you find out which button he clicked or what he
typed? Because I need that info in my shell script.

I looked at Tk + Ksh. I could've done the same thing for GTK+, that is,
function for function binding. But, it's downright criminal to force
that kind of details onto users.

The best comparison is 'gtkdialog'. It also uses XML syntax, but uses
lex/yacc to parse it. Because it's separate program, I have the same
problem of getting data back into shell, as using 'awk' or 'sed'.

Since I do Expat already, I used the same mechanism. Expat calls
start_handler
end_handler
data_handler
as it encounters various tags. From here, I call relevant GTK+
functions and in right order. 'start_handler' is massive. :-)
Fortunately, the order of GTK+ call is pretty much in sync with the
order of Expat callbacks. You don't have to fake it much.

--
William Park <op**********@yahoo.ca>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
http://freshmeat.net/projects/bashdiff/
Jul 20 '05 #3
In <comp.unix.shell> William Park <op**********@yahoo.ca> wrote:
Ref:
http://freshmeat.net/projects/bashdiff/
http://home.eol.ca/~parkw/index.html#gtk


More widgets, documentation, examples, snapshots have been added. It
now has pretty good range of widgets for "dialog" situation.

--
William Park <op**********@yahoo.ca>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
http://freshmeat.net/projects/bashdiff/
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Wil Koenen | last post by:
Hi, When importing (parts of) gtk, here's what I get: >>> import gobject Traceback (most recent call last): File "<pyshell#13>", line 1, in ? import gobject ImportError: DLL load failed:...
2
by: Dennis | last post by:
The setup: Windows XP Pro Python 2.3 GTK+ 2.2.1.2 and pyGTK 1.99.17 for Python 2.3 from http://www.pcpm.ucl.ac.be/~gustin/win32_ports/ I've downloaded and installed per the instructions the...
6
by: William Park | last post by:
(crossposted to comp.lang.python, because this may be of interest to them.) Python has try-block, within which you can raise exception. Once it's raised, execution breaks out of the try-block...
0
by: William Park | last post by:
1. Here is shell version of Python filter() for array. Essentially, you apply a command on each array element, and extract only those elements which it returns success (0). This is specialized...
1
by: Stelios Xanthakis | last post by:
Hi all. Basically, I'd like to use python as my system shell. It's not suitable for a general purpose shell but since it is very programmable it can eventually do whatever bash does and even...
1
by: kristian.hermansen | last post by:
keherman@ibmlnx20:/tmp$ cat helloworld.py #!/usr/bin/env python import pygtk pygtk.require('2.0')
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 380 open (-36) / 3658 closed (+65) / 4038 total (+29) Bugs : 965 open ( -9) / 6555 closed (+35) / 7520 total (+26) RFE : 272 open...
6
by: johnmmcparland | last post by:
Hi all, I am doing some C / C++ programming in cygwin and I notice when I add something to my path then try to compile, the gcc / g++ compiler cannot find some files, even though they are in the...
0
by: Joel Hedlund | last post by:
Hi! I'm developing a pygtk application where I need to show images zoomed in so that the user can see individual pixels. gtk.gdk.Pixbuf.scale() seemed ideal for this, but if I set offset_x and...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.