Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 23 Sep 2014, 10:47
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Gtk-server and Bash/Glade Project Generator 03
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [14 Posts]  
Author Message
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Sat 09 Oct 2010, 21:50    Post subject:  Gtk-server and Bash/Glade Project Generator 03
Subject description: create Gtk/Bash scripts with some mouseclicks
 

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:
   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-process_communication


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-server/gtk-server-2.3.1-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
listdemo.jpg
 Description   a 2 column list demo
 Filesize   26.14 KB
 Viewed   1381 Time(s)

listdemo.jpg

gtk-server-2.3.1-03.pet
Description 
pet

 Download 
Filename  gtk-server-2.3.1-03.pet 
Filesize  80.43 KB 
Downloaded  298 Time(s) 
gtk-server-2.3.1generator.jpg
 Description   the generator is very simple to use...
 Filesize   15.11 KB
 Viewed   1451 Time(s)

gtk-server-2.3.1generator.jpg

gtk-server-2.3.1.jpg
Description  here is an example testproject, opened in glade on the left, and the resulting files with the running example on the right.
jpg

 Download 
Filename  gtk-server-2.3.1.jpg 
Filesize  141.92 KB 
Downloaded  283 Time(s) 

_________________
my recommended links

Last edited by MU on Sun 10 Oct 2010, 16:15; edited 4 times in total
Back to top
View user's profile Send private message Visit poster's website 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Sun 10 Oct 2010, 00:08    Post subject:  

Thanks Mark.

Miss your input. Crying or Very sad
This looks good.
How are things with you? Smile

I knew I just installed the devx for a reason . . .

_________________
Puppy WIKI
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Sun 10 Oct 2010, 07:27    Post subject:  

Hi Lobster Very Happy

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 Smile

Hope you're fine, too!

Best wishes, Mark Smile

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Sun 10 Oct 2010, 11:26    Post subject:  

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

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
drongo


Joined: 10 Dec 2005
Posts: 353
Location: UK

PostPosted: Sun 10 Oct 2010, 11:34    Post subject: Samba Guru  

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!
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Sun 10 Oct 2010, 13:04    Post subject:  

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-03-09-i486-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 Very Happy

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_pup-1-i486-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

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though

Last edited by big_bass on Sun 10 Oct 2010, 15:24; edited 2 times in total
Back to top
View user's profile Send private message 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Sun 10 Oct 2010, 14:49    Post subject:  

Quote:
Hope you're fine, too!


Very Happy Yes.
I liked your picture

I am using it as my desktop.
Good to see a woman in the pics. Smile

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 Smile

_________________
Puppy WIKI
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Sun 10 Oct 2010, 16:13    Post subject:  

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 Laughing

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 Smile

Greets, Mark

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Sun 10 Oct 2010, 16:25    Post subject:  

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:
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

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4351

PostPosted: Sun 10 Oct 2010, 21:47    Post subject:  

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

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6435
Location: Auckland, New Zealand

PostPosted: Mon 11 Oct 2010, 00:56    Post subject:  

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?

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Mon 11 Oct 2010, 11:08    Post subject:  

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

_________________
my recommended links
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4351

PostPosted: Mon 11 Oct 2010, 13:23    Post subject:  

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:
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;
}

gtkapp.tar.gz
Description  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
gz

 Download 
Filename  gtkapp.tar.gz 
Filesize  3.55 KB 
Downloaded  251 Time(s) 

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6435
Location: Auckland, New Zealand

PostPosted: Tue 12 Oct 2010, 00:47    Post subject:  

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 Smile

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [14 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1287s ][ Queries: 12 (0.0283s) ][ GZIP on ]