Octave-GTK
24/02/05 © Octave-GTK Team
24/02/05 Octave-GTK Team
Octave-GTK, a language bindings project
Hemant Muthu Rams Manik {gnufied, gnumuthu, chaosglare,manickam}@users.sourceforge.net]
Step in
24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project
➔ Aims ➔ Rationale/Need➔ Project Overview➔ Development Tools➔ Octave-GTK Today➔ Octave-GTK demo➔ What can you do?➔ More Information
Agenda
24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project
Aims➢Integrate Scientific programming environment with a world-class GUI.
➢Octave+GTK = Octave-GTK
➢Octave bindings for GTK+
➢Octave GUI
24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project
Terms➢Scientific Computing➢Octave➢GTK➢GUI➢Language Bindings➢Language Interoperability➢Advantages
24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project
Rationale/Need ➢A Software EcoSystem based around Octave.
➔Integration of free tools & librariesEnviroments: Lush, SciLab, NumPythonLibraries: GD , GTK, Fann, ImageMagick, Audiofile
➔Octave-GUIOctave-GUI using Octave-GTK itself.
➔Make porting easierOctave-SWIG: for autogenerating bindings.
➢Principle of least surprise➔A Matlab clone.
➢RAD for scientific Applications➔Stop Re-Inventing the wheel.➔Reduce Reuse Recycle. GNU Way.
Why start Octave-GTK ?
24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project
Project Overview➢Octave-GTK:
➔Octave bindings to GTK✔GTK function calls from Octave.✔Function call marshalling✔Type conversion between Octave & C
➔Octave bindings to LibGlade, LibGnomeUi, GDK
✔Language bindings to LibGlade, for easier GUI programming✔LibGnome for real GNOME programs✔LibGDK for graphics & color. LibGD already ported.✔Octave-SWIG: for autogenerating bindings.
➢Octave-GUI➔Octave-GUI using Octave-GTK itself.
➢#1 Fun project!➔All code under this project is GPL'ed
24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project
➢Octave Bindings produced by Octave-GTK team.➔Octave-GTK
Octave bindings to GTK. Write GUI code from Octave.➔Octave-libGlade
Use Glade UI designer .glade files➔GD-Octave
Image processing from Octave.➔Octave-Glade
Glade UI Editor customised.➢Octave Bindings due from Octave-GTK team
➔LibGnome for real GNOME programs
➔LibGDK for graphics & color. LibGD already ported.
➔LibAtk, LibPango, LibGlib, LibGObjectCompletes the GTK bindings set.
Development Tools
24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project
Octave-GTK Today
➔Octave-GTK works today.➔Maps about 2083 functions automagically.
➔Python code generator➔Custom lexer.➔Bindings autogenerated.
➔Exports C API directly.➔Part of functions manually wrapped.
➔Glue code of 35,208 lines of code.➔gtk.cpp size 1336Kb.➔Binding library, gtk.oct 5572 Kb
24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project
Design Issues➢Callbacks are AdHoc
➢Must Write a custom Marshaller.
➢Type Mapping➢Integer to Pointer
➢Memory Management➢Reference counting problem
➢Quality of binding,GObject.➢Native to C, and Octave.
➢Lag between releases.
➢C API always newer.
➢Library Size, Speed➢Octave marshalling slow
24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project
Components➢Octave-GTK (40%)
➔Difficult to write GUI's.➔ Repetitive code➔ Suitable for autogeneration➔Tough API to learn.➔Version 0.1➔2083 functions.
➢Octave-LibGlade (80%)➔Easy to write GUI's.➔Only Event Handlers➔GUI Builder➔Easy simple API to learn.➔Version 0.1➔13 functions
➢Gd-Octave (80%)➔Read/Write Image files.➔Easy Image Processing.
➔Convolution, FFT, DFT➔Filtering, Analysis/Synthesis
➔Fairly mature.➔Concise API to learn.➔Version 0.5➔75 functions
➢Octave-Glade (5%)➔Glade Hacked➔History added?➔Customised Window creation➔Eliminate Boxed widget building.➔Auto-Code generation of octave.➔Version 0.1
24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project
Demo➢Gd-Octave (80%)
➔Read/Write Image files.➔Easy Image Processing.
➔Convolution, FFT, DFT➔Filtering, Analysis/Synthesis
➔Fairly mature.➔Concise API to learn.➔Version 0.5➔75 functions
#! /usr/bin/octave -qfunction main() gd() fp=fopen("mail.png","wb") ip=gdImageCreate(200,40); color=gdImageColorAllocate( ip,0xcc,0xdd,0xff)
%draws a square grid for i=0:20:190 gdImageLine(ip,0,i/5,200,i/5,color); gdImageLine(ip,i,0,i,40,color); end
gdImageString(ip,"Large",0,20, "[email protected]",color);
gdImagePng(ip,fp); fclose(fp); gdFree(ip);endmain()
24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project
Demo➢Octave-GTK (40%)
➔Difficult to write GUI's.➔ Repetitive code➔ Suitable for autogeneration➔Tough API to learn.➔Version 0.1➔2083 functions.
#! /usr/bin/octave -qfunction main() gtk() %load library gtk_init() %initation w=gtk_window_new(0) b=gtk_vbox_new(0,0) gtk_window_set_title(w, "Welcome to Octave-GTK"); entry=gtk_entry_new(); gtk_entry_set_text(entry,"Hello World"); okb=gtk_button_new_with_label("ok"); gtk_container_add(w,b); gtk_container_add(b,entry); gtk_container_add(b,okb); %hookup the signals g_signal_connect(okb, "clicked","gtk_main_quit"); g_signal_connect(w, "destroy","gtk_main_quit"); gtk_widget_show_all(w); gtk_main() %enter main loopend
main()
24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project
Demo [LibGlade]➢Octave-LibGlade (80%)
➔Easy to write GUI's.➔Only Event Handlers➔GUI Builder➔Easy simple API to learn.➔Version 0.1➔13 functions
function main() global xml gtk() %Load GTK Library glade() %Load LibGlade gtk_init() %Initialize GTK Type system.
xml=glade_xml_new("ohms.glade","window1",""); win1=glade_xml_get_widget(xml,"window1"); glade_xml_signal_autoconnect(xml); gtk_widget_show_all(win1); gtk_main()end
main()
24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project
Demo [LibGlade ...]➢Octave-LibGlade (80%)
➔Easy to write GUI's.➔Only Event Handlers➔GUI Builder➔Easy simple API to learn.➔Version 0.1➔13 functions
#! /usr/bin/octave -q
xml=""disp('Ohms law example with octave-libglade')
function calculate_cb() global xml disp('Hello World') i=glade_xml_get_widget(xml,"current") r=glade_xml_get_widget(xml,"resistance") v=glade_xml_get_widget(xml,"voltage")
amp=str2num(gtk_entry_get_text(i)) ohm=str2num(gtk_entry_get_text(r)) gtk_entry_set_text(v,num2str(amp*ohm)) end
24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project
Demo [Complete App]➢Design the GUI with Octave-Glade
➢Glade hacked & customised.➢Use the .glade file in your octave program.
➢Standard LibGlade useage.➢Generate GUI from this using Octave-LibGlade
➢Standard LibGlade useage.➢Write callbacks in Octave.
➢Your Job! Application Logic➢ Most of this stuff can easily be automated.
➢Done in Octave-Glade.
➢Octave-Glade (5%)➔Glade Hacked➔History added?➔Customised Window creation➔Eliminate Boxed widget building.➔Auto-Code generation of octave.➔Version 0.1
24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project
Time Line
20 July 2004
ProjectLaunched
29 July 2004
First Octave-GTKPrototype
17 Oct 2004
First Gd-Octaveautogenerated code
Gd-Octave ported toGNU Autotools.
20 Nov 2004
First Octave-GTK autogenerated
08 Feb 2005First Octave-libGlade autogenerated/released
21 Feb 2005
7 Jan 2005Glade hacked
Listed as part of Debian Project
http://aliot.debian.org/octave-gtk/GTK Project
http://www.gtk.org/bindings.htmlOctave Project: ?GNOME Project: ?
24/02/05 © Octave-GTK Team
Octave-GTK, a language bindings project
What can you do?
➢Use Octave-LibGlade/Octave-GTK➔For your science/Engineering projects➔Make applications wit Octave-GTK.➔Use Octave-GTK for your work.
➢Request features➔Ask for newer libraries for Octave-GTK.➔Ask for new type of API
➔ Ask for code/example/documents/demos.
➢Write new Applications➔Stress test Octave-GTK.➔Report errors/results.
➢ Write Documentation➔ Well how else could you get
started?➔ Support us!
➢ Write Code!➔Hack with us!
Evolution/Conclusion➢ Octave-GTK Project is Evolving. 0.1
➢ Octave-GTK will be industrial strength
➢ Version 0.2 slated for March 1st
➢ We are working!
➢ Furiously Hacking?
➢ GtkExtra, GtkWidgetFactory
➢ SWIG : Simplified Wrapper Generator
➢ Debugger: Octave Debugger
➢ Profiler: Profiler for Octave.
➢ Octave# compiler/Interpreter:
12/27/04 © ECE NIT-T, Muthiah A
Octave-GTK, a language bindings project
Information
➢ http://octave-gtk.sourceforge.net
➢ http://www.sf.net/projects/octave-gtk/
➢ [email protected], [email protected],
[email protected], [email protected]
➢ www.octave.org,www.gtk.org
12/27/04 © ECE NIT-T, Muthiah A
Octave-GTK, a language bindings project
The Team
12/27/04 © ECE NIT-T, Muthiah A
Hemant Kumar Chemical Engineer NIT-T C++, OOP, Octave [email protected]
Ramasamy Chemical Engineer NIT-T C++, GUI,Octave
Muthiah Electronics Engineer NIT-T GTK, C, [email protected]
et
Saravana Manickam Mechanical Engineer NIT-T Python, SWIG, C
Octave-GTK, a language bindings project
Thanks● The GNU movement, and free software.
– Dr Richard Stallman
● GNU Octave John Eaton
● GTK Peter Mattis, Spencer Kimball, Havoc Pennington, OwenTaylor et-al
● The GNU/Linux OS Linus Torvalds et-al
● PyGTK James Henstridge
● GNOME Miguel De Icaza
● CSG Head Mr.Arun, Mr.Pradeep & Mr. Victor
12/27/04 © ECE NIT-T, Muthiah A
Octave-GTK, a language bindings project
12/27/04 © ECE NIT-T, Muthiah A
Octave-GTK, a language bindings project
Q &A
● Contents of this slides are licensed under GNU FDL