GtkBuilder-Fortran code sketcher #13

Closed
bonanza opened this Issue Mar 29, 2011 · 15 comments

Comments

Projects
None yet
3 participants
Collaborator

bonanza commented Mar 29, 2011

I started to write an GtkBuilder example which uses a XML file created by Glade to construct the GUI (will be commited in the next days).
However, I found an interesting sketcher application, which creates Freebasic raw code from a Glade XML file (http://www.freebasic.net/forum/viewtopic.php?t=14856), where only the code in the handler functions have to be added by the programmer. Should be not very difficult to do the same thing with Fortran (programmed in Fortran or Python?). Maybe this is another interesting way to allow more rapid application development with gtk-fortran.

Collaborator

vmagnin commented Mar 29, 2011

See also https://launchpad.net/gladex/

"Gladex is a Python application which takes a .glade file written in the Glade User Interface Builder and generates code in Perl, Python, or Ruby. The generated code uses libglade to draw a GUI and is not raw pygtk code. Support for additional languages can be added through the plugin API."

Collaborator

bonanza commented Mar 29, 2011

I think, using Gladex is not a good idea since it is using libglade, which is deprecated (http://mail.gnome.org/archives/devel-announce-list/2009-May/msg00003.html). Furthermore, Gladex seems not to support further expansion or reviews of the GUI-XML-file like GTK+tobac2, which is imho an important point for larger projects.

Collaborator

bonanza commented May 18, 2011

I pushed a draft version of a sketcher to the gtk3 branch.
However, I think this will not work with windows since the system commands mkdir and cp are used in the current version.
I think, this stuff can be replaced by platform independent calls to functions of the flibs collection (http://flibs.sourceforge.net/m_vfile.html). Any other ideas?

Collaborator

vmagnin commented May 19, 2011

Perhaps you may find some solutions in the GLib:

http://developer.gnome.org/glib/unstable/glib-File-Utilities.html#g-mkdir-with-parents
http://developer.gnome.org/glib/unstable/glib-File-Utilities.html#g-mkdir
(only the first seems to be in gtk-fortran)

I found no "cp"-like function.

Collaborator

vmagnin commented May 20, 2011

Nice piece of code !
I tried it under Ubuntu 11.04 - 32 bits with the example.glade file: the only little problem is that it did not succeed copying example.glade in the example directory. Perhaps because there is a space in one of the directory name in my working dir path.

Collaborator

jtappin commented May 20, 2011

One issue I did notice was that if I try to open a second file, there is a runtime error at line 244 because connections is already allocated.

Collaborator

bonanza commented May 30, 2011

I fixed the allocation issue and pushed a new version without system calls to the gtk3 branch.
However, I tried to use the glib function g_file_get_contents to implement system independent file copy (Indeed there is no one-call-routine for file copy in glib). Unfortunately, I got this not to work (I obtained strange characters in "contents") and the current version is now using standard fortran file access routines.
Did anyone ever tried the g_file_get_contents function?

Collaborator

bonanza commented May 30, 2011

I tried also to reproduce the copy error using a directory with a blank in the name. On my system this works well, at least with the current version.

Collaborator

vmagnin commented Jun 3, 2011

Hi Jens,
the copy error has disappeared... It now works fine.

Collaborator

jtappin commented Jun 4, 2011

Hi Jens,
In the newest version, there are a number of places in gtkf-sketcher.glade where the line:

<property name="ubuntu_local">True</property>

occurs. However since this is not portable, on Debian Sid it generates a warning:

Gtk-WARNING **: Unknown property: GtkMenuBar.ubuntu-local

(or similar depending on the widget), I'd suggest removing it or finding a system-independent equivalent.

P.S. I've added a target for default.options to CMakeLists.txt so that it works properly with the cmake build.

Collaborator

vmagnin commented Jun 4, 2011

Same warnings under Fedora 15 (gtk3 branch).

Collaborator

bonanza commented Jun 5, 2011

I just deleted the respective lines in gtkf-sketcher.glade, since this seems to be some Ubuntu bug (http://lists.ximian.com/pipermail/glade-users/2011-March/005235.html).

Collaborator

vmagnin commented Jun 5, 2011

OK, the warnings have disappeared.
I found another problem: when "Create file for each handler function" is selected, I obtain this error for each handler function:

handler_delete_event.f90:3.8:

print*,"handler function: delete_event
        1
Error: Unterminated character constant beginning at (1)

No problem when there is no handler files.

Collaborator

bonanza commented Jun 5, 2011

I resolved that - the reason was a too long line in gtkf-sketcher.f90.

Collaborator

bonanza commented Jun 7, 2011

I committed a new version with some more options.

@vmagnin vmagnin closed this Feb 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment