473,602 Members | 2,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

(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**********@y ahoo.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 2667
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**********@y ahoo.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.shel l> William Park <op**********@y ahoo.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**********@y ahoo.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
2404
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: One of the library files needed to run this application cannot be found.
2
8651
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 pyGTK and GTK+ for win32 from the above locations. Folowing the instructions, I import pygtk first, run pygtk.require('2.0') second and then import
6
3379
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 and is caught at the end of try-block. Now, Bash has similiar feature. I've added try-block and 'raise' builtin into Bash-3.0. Typical usage would go something like try
0
1718
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 form of list comprehension where you can contruct an array from another array, using some sort of test or filtering. Usage is arrayfilter command array where 'command' is a function, shell script, or external executable, which takes one...
1
1387
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 more. One thing I'd like python to do is: attach the *python code* of a function to a function object. The same for class. This can be done in python as it is but it doesn't feel very right. I
1
2471
by: kristian.hermansen | last post by:
keherman@ibmlnx20:/tmp$ cat helloworld.py #!/usr/bin/env python import pygtk pygtk.require('2.0')
0
330
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 ( +4) / 253 closed ( +2) / 525 total ( +6) New / Reopened Patches ______________________
6
8899
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 directory I may have just added to my path. For example I have copied the example program from http://www.gtk.org/tutorial/c39.html and when I compiled it, the compiler couldn't find gtk/gtk.h.
0
1242
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 offset_y to anything other than 0, the resulting image is heavily distorted and the offset is wrong. I've searched the internet for any snippet of code that uses this function with nonzero offset, but even after several hours of searching I've...
0
7993
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7920
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8404
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8054
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5867
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3900
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2418
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.