Gtk-server and Bash/Glade Project Generator 03

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

Gtk-server and Bash/Glade Project Generator 03

#1 Post by MU »

Tired now, so just short info:

You create a window with Glade.
You also add the callbacks in Glade (what function shall be executed, when e.g. a button is clicked).

Then you run my projectgenerator on the glade-file, and get a bash script, that immedeatly works.

You cannot only "read" the widgets, but also assign values from within bash, like setting text on a label.

This is achieved by using "gtk-server", a wrapper for Bash and other languages for Gtk.
http://www.gtk-server.org
http://www.gtk-server.org/GTK-server_Manual.html

1.) install the pet
2.) run "gtkservergenerator" from the "utilities" or "develop" menu (or using a filemanager: /usr/local/gtk-server-generator/generate-project)
3.) select a glade file, for example /usr/local/gtk-server-generator/test/project.glade. It MUST be named "project.glade"!
4.) click on the button, and after some seconds, rox shows the generated files.
5.) edit the "functions.inc" to your needs.

In the "test", I added two custom actions by hand:

Code: Select all

	gtk "gtk_entry_set_text $entry1 \"test 1\"" 
So when you click on a button, the text in the entry changes.
The default action is just to print the name of the current function to console.

You get an overview of the supported functions in the file /etc/gtk-server-glade.cfg

6.) click on "myproject" to run the generated program/script.

The generated projects use the "IPC" method, to communicate with Gtk-server. This is an internal Linux messaging system, using the process-IDs.
Like this STDOUT and STDIN remain free for your own purposes. I think this is quite an advantage compared to Gtkdialog for example.
http://en.wikipedia.org/wiki/Inter-proc ... munication


Please be aware, that I just finished it, and am tired now. So it is not well tested.
If you receive errors, try to kill gtk-server from console.

Some example-code can be found in the source-pack:
http://downloads.sourceforge.net/gtk-se ... -sr.tar.gz

I compiled the pet in Newyearspup02rc10, it also works in Puppy 4.3.1 and fluppy 005. Requires libglade2, that is part of Puppy as far as I remember..

Mark
Attachments
listdemo.jpg
a 2 column list demo
(26.14 KiB) Downloaded 1697 times
gtk-server-2.3.1-03.pet
(80.43 KiB) Downloaded 524 times
gtk-server-2.3.1generator.jpg
the generator is very simple to use...
(15.11 KiB) Downloaded 1740 times
gtk-server-2.3.1.jpg
here is an example testproject, opened in glade on the left, and the resulting files with the running example on the right.
(141.92 KiB) Downloaded 532 times
Last edited by MU on Sun 10 Oct 2010, 20:15, edited 4 times in total.
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#2 Post by Lobster »

Thanks Mark.

Miss your input. :cry:
This looks good.
How are things with you? :)

I knew I just installed the devx for a reason . . .
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#3 Post by MU »

Hi Lobster :D

Thanks, I'm fine.
I got a new job over a year ago, in a small financial institute. The network infrastructure based on Windows 2003 Server is too old meanwhile, and needed to be completely redesigned. My task was to set up all the services with Debian instead, so I created around 14 virtual machines with different purposes, like Domain Controller, Mailserver and such.

The servers work now, and we actually deactivate the first services on the Windows servers, and set the first Linux servers productive instead.

It is a pretty interesting task, as I had a lack of knowledge in networking, and had to research a lot of info on my own, to understand, how such a Windows Domain works in Detail.
Now Linux does the same and mimics the Windows behaviour. (we need to stay compatible with Windows, as our desktop-clients will stay with Windows).

I must drive 2 hours every day, so am tired in the evening, this is why I write so seldom.
I meanwhile also could establish first friendships here in the south, and really enjoy to visit old castles and villages in my spare time.

Some fotos from my trips:
http://dotpups.de/pics/2010-08-RothenburgObDerTauber/
http://dotpups.de/pics/2010-09-ludwigsburg/

I even can't read any more all messages here, but still enjoy Puppys development, e.g. I love using eeepup from Jemimah on my netbook :)

Hope you're fine, too!

Best wishes, Mark :)
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#4 Post by MU »

I updated the pet to version 02.

The first one could just analyze 1 event per widget.
For example in the test entry, you just could check for "changed" OR "backspace".
Now, each event can be assigned to an own function.
Note, that the "backspace" event in the testentry is assigned "after" in Glade (that is a small checkbox on the right in the signals tab). Just like this it works. The checkbox is only recognized, if you also set something for the "objectname" value (I used "xxx" here). I don't know yet, how this objectname is requested, so it currently has no value in your scripts, but it is required in Glade so that the "after" checkbox works.

Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
drongo
Posts: 374
Joined: Sat 10 Dec 2005, 23:35
Location: UK

Samba Guru

#5 Post by drongo »

Nice to hear from you Mark,

With your new-found knowledge you could probably write a useful book "Converting Windows infrastructure to Linux".

Not that I'd curse anybody with book-writing!

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#6 Post by big_bass »

Hey Mark (MU)

Glad to hear all is well with you and those are nice pics you posted

I will test out your package we always need other ways to make small apps
thanks

I am trying some examples require the korn shell ksh
so I packaged it as a simple tgz ( the latest bin) no sources from the main page
http://www.puppy2.org/slaxer/ksh-2010-0 ... 3_SLXR.tgz


a side note:
*I don know if you already saw this or not but it fits in with what you are doing
it worked on my slackware 13.1 box so I thought it should work fine with debian too

here is something that is easy to work with for your severs to create an app launch panel
http://www.rillion.net/tabble/index.html
I was able to take the control panel from dpup (which is tabble)
and get a GUI up in running in a hour so for you it should be minutes/seconds :D

I packaged up one for my use recompiled from the source I added a lot of nice icons
here http://www.puppy2.org/slaxer/tabble_TXZ ... 3_SLXR.txz if you want to take the icons out
or just get a test run of what it does

if you compile from source look here to change the name
tabble-0.42/tabble-0.42/src/world.h


Joe
Last edited by big_bass on Sun 10 Oct 2010, 19:24, edited 2 times in total.

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#7 Post by Lobster »

Hope you're fine, too!
:D Yes.
I liked your picture
Image
I am using it as my desktop.
Good to see a woman in the pics. :)

My imaginary psychiatrist only lets me out on rare occasions
of temporary sanity
. . . I managed to create some vids of my summer
http://bit.ly/9QvjO1
click and drag - created with Openshot in Puppy :)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#8 Post by MU »

uploaded version 03:

- fixed a bug with widgets, that had no events (like labels)
- added a "demos" folder, that contains an example of a sortable list with 2 columns. This was taken from the gtkserver examples, but integrated to a glade-generated window and slightly enhanced. E.g. you now can get the selected text of the first column. To achieve this, I added a macro to /etc/gtk-server-glade.cfg.

-----------------------------------
Lob, thanks for the videos, very nice!
And yes, there is a lady on some fotos, she is from england, but lives here since 20 years. So I actually must teach her english again :lol:

Drongo, no, I have no time for a book, but there is meanwhile pretty good documentation available, e.g. here:
http://www.howtoforge.com/howtos/linux/debian

Joe, the tool looks fine, I cannot use it on the servers, as the are console-based, but it might be a cool utility for Puppy :)

Greets, Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#9 Post by big_bass »

just got started testing examples only

some of the official unedited examples in gtk-server-2.3.1-sr/gtk-server-2.3.1-sr/demo-gtk hang and repeat and can be difficult to kill

so this code came in handy for those times

Code: Select all

pid=`ps aux| grep gtk-server | awk '{print $2}'`&&kill -9 $pid
*changing the string "gtk-server" for any other app name works well too
to kill by name

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#10 Post by technosaurus »

Nice work - it seems that with this glade is required to run ... not just to build? Is it possible to use the gtk-2.12+ builtin gtkbuilder functionality instead?(recent versions of glade have the ability to generate both formats)

There is a vala example to use a gtkbuilder ui, so no big deal if glade is easier.link
It just needs to be modified to use argv[1] as the xml file instead of a hard-coded filename.

I previously posted some fixed up versions of the demos that I could find in the gtkdialog tips thread - here is the direct link to the tarball if anyone wants to play:link
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#11 Post by disciple »

Hi Mark,
MU wrote:Now Linux does the same and mimics the Windows behaviour. (we need to stay compatible with Windows
I am interested how far you took this compatibility. Is the new mail server like MS Exchange, or just a normal mailserver?
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#12 Post by MU »

technosaurus,

I think Gtkserver has no support for Gtkbuilder.


disciple ,

we replace Exchange 2003 standard with Zarafa and Postfix:
http://zarafa.com/


Zarafa does all the groupware, Postfix is just used as SMTP-Server to send the mails and to retrieve them.

Postfix runs on an own server in the DMZ, the Zarafa server in our internal server-network. The mails are received then using a polling method based on getmail.
So mails arrive in postfix in temporary postboxes, and 3 minutes later getmail fetches them, and transports them to the real postboxes of Zarafa.

The User authentification uses OpenLDAP, the replacement of Active Directory. AD is supported, too, so you could use Zarafa with a Windows PDC (Primary Domain Controller).
We instead use a Debian Server with Samba3 and OpenLDAP as PDC, and other Debian Servers for DNS and DHCP, and as fileserver. Even a SDC (Secondary Domain Controller) as fallback is available.
We decided to split the services on as many virtual machines as possible, to get a clear separation for easier maintainance lateron. (they run on two IBM ESX4 Servers with 48 GB, far fore than we actually need, but there will follow other stuff like a new DMS (Document Management System))
We will keep just 1 Windows Server for MS-SQL, as some of our apps need that database.

A test installation with 250.000 mails works fine.
We exported them as .pst files using Outlook, and then imported those .psts with Zarafas own convertertool.
Mails, contacts, tasks - all there.
While Exchange meanwhile reaches the limit of 75 GB, Zarafas space seems to be limited only by the hardware specs (somewhen the MySQL database might become slow).
We miss no functionality, everything we do with Exchange, also works with Zarafa.

While Zarafa replaces Exchange, we will stay with Outlook as client, as our users prefer it, and we use some addons, e.g. for our domument management systems (ELO and Saperion).
Zarafa has an own, webbased client, but it has several limitations.
Drag'n'Drop is just partially implemented using an addon, contacts cannot be sent as attachments, and more.
I would not bother with that, but for our users this is not acceptable.

You can look at the webclient in this onlinedemo:
http://demo.zarafa.com/

Greets, Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#13 Post by technosaurus »

here is a gtkbuilder vala example that will work with the gtkbuilder xml versions if you are interested (compiles to a 4kb binary)

EDIT - now closes app with Alt+F4

Code: Select all

using Gtk;

int main (string[] args) {     
    Gtk.init (ref args);

    try {
        var builder = new Builder ();
        builder.add_from_file (args[1]);
        builder.connect_signals (null);
        var window = builder.get_object ("window1") as Window;
        window.destroy.connect(Gtk.main_quit);
        window.show_all ();
        Gtk.main ();
    } catch (Error e) {
        stderr.printf ("Could not load UI: %s\n", e.message);
        return 1;
    }
    return 0;
}

Attachments
gtkapp.tar.gz
contains binary, vala and c code along with a sample.ui and build script - use code above instead to allow full closeout with Alt-F4
(3.55 KiB) Downloaded 426 times
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#14 Post by disciple »

MU wrote:You can look at the webclient in this onlinedemo:
http://demo.zarafa.com/
Cool. It isn't crippled when using a real browser. That makes it much better than the rubbish exchange web client :)
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

Post Reply