Possible bug in GdlDockLayout or Python Bindings

View: New views
2 Messages — Rating Filter:   Alert me  

Possible bug in GdlDockLayout or Python Bindings

by Micah Carrick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey guys, I'm not quite sure who to contact regarding the gdl python
bindings or which project the bug should be submitted to (I don't know
much about language bindings). Another user posted this issue back in
Feb. of last year:
http://www.mail-archive.com/gnome-devtools@.../msg00335.html

However, it was left unresolved. I've done a little testing and have
some more information.

The problem is with loading a GdlDockLayout from a file. I've built a
little test application in C and another in Python. The one in C works,
where as the Python one does not. When the Python application loads the
layout from the file, it looses all dock items. I've attached the test
applications to this email. These test programs save the layout when to
close, so you'll have to run it once, close it, and then run it again to
see the bug.

If anyone could take a quick look and a) make sure I'm using gdl
properly (docs are limited) and b) suggest whom I might contact and/or
submit a bug regarding this problem and c) any suggestions for a quick
fix would be great. Who is maintaining the gdl python bindings?

Regards,

--
- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com


/* gcc -Wall -g `pkg-config --cflags --libs gtk+-2.0 gdl-1.0`-o gdl-test gdl-test.c  */

#include <gtk/gtk.h>
#include <gdl/gdl.h>

gboolean on_window_delete_event(GtkWindow *window, GdkEvent *event, GdlDockLayout *layout)
{
    gdl_dock_layout_save_layout (layout, "test");
    gdl_dock_layout_save_to_file (layout, "layout_c.xml");
    g_print("Saved layout XML to file.\n");
   
    return FALSE;
}

int main (int argc, char *argv[])
{
    GtkWidget *win, *dock, *label1, *item1, *label2, *item2;
    GdlDockLayout *layout;
   
    gtk_init (&argc, &argv);
   
    win = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    dock = gdl_dock_new ();
    layout = gdl_dock_layout_new (GDL_DOCK(dock));
   
    g_signal_connect (G_OBJECT(win), "destroy",
                      G_CALLBACK (gtk_main_quit), NULL);
   
    g_signal_connect (G_OBJECT(win), "delete-event",
                      G_CALLBACK (on_window_delete_event), layout);

    label1 = gtk_label_new ("Label 1");
    item1 = gdl_dock_item_new_with_stock ("item1",
                                          "Item 1",
                                          GTK_STOCK_OPEN,
                                          GDL_DOCK_ITEM_BEH_NORMAL);
                                         
    gtk_container_add (GTK_CONTAINER (item1), label1);
    gdl_dock_add_item (GDL_DOCK (dock), GDL_DOCK_ITEM (item1), GDL_DOCK_LEFT);
    gtk_widget_show_all (item1);
   
    label2 = gtk_label_new ("Label 21");
    item2 = gdl_dock_item_new_with_stock ("item2",
                                          "Item 2",
                                          GTK_STOCK_SAVE,
                                          GDL_DOCK_ITEM_BEH_NORMAL);
                                         
    gtk_container_add (GTK_CONTAINER (item2), label2);
    gdl_dock_add_item (GDL_DOCK (dock), GDL_DOCK_ITEM (item2), GDL_DOCK_RIGHT);
    gtk_widget_show_all (item2);
       
    gtk_container_add(GTK_CONTAINER(win), dock);
   
    gtk_widget_show_all(win);  
   
    if (gdl_dock_layout_load_from_file (layout, "layout_c.xml"))
    {
        gdl_dock_layout_load_layout (layout, "test");
        g_print("Loaded layout XML from file.\n");
    }

    gtk_main();

    return 0;
}

#!/usr/bin/python
import os
import pygtk
pygtk.require("2.0")
import gtk
import gdl

def on_window_delete_event(window, params):
    layout.save_layout('test')
    layout.save_to_file('layout_py.xml')
    print "Saved layout XML to file."

win = gtk.Window(gtk.WINDOW_TOPLEVEL)
win.connect('destroy', gtk.main_quit)
win.connect('delete-event', on_window_delete_event)
   
dock = gdl.Dock()
layout = gdl.DockLayout(dock)    
   
item1 = gdl.DockItem("item1", "Item 1", gtk.STOCK_OPEN, gdl.DOCK_ITEM_BEH_NORMAL)
item1.add(gtk.Label("Label 1"))
dock.add_item (item1, gdl.DOCK_LEFT)
item1.show_all()

item2 = gdl.DockItem("item2", "Item 2", gtk.STOCK_SAVE, gdl.DOCK_ITEM_BEH_NORMAL)
item2.add(gtk.Label("Label 2"))
dock.add_item (item2, gdl.DOCK_RIGHT)
item2.show_all()

if layout.load_from_file('layout_py.xml'):
    layout.load_layout('test')
    print "Loaded layout XML from file."
               
win.add(dock)
win.show_all()

gtk.main()

_______________________________________________
gnome-devtools mailing list
gnome-devtools@...
http://mail.gnome.org/mailman/listinfo/gnome-devtools

Re: Possible bug in GdlDockLayout or Python Bindings

by Johannes Schmid-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

Actually, I have no idea who really wrote the python bindings for gdl.
Anyway, as far as I know they should be mostly autogenerated but you
might want to have a look at the gnome-python-extras module on
git.gnome.org to see if there is any custom code that might break
things.

Regards,
Johannes

Am Samstag, den 12.09.2009, 15:07 -0700 schrieb Micah Carrick:

> Hey guys, I'm not quite sure who to contact regarding the gdl python
> bindings or which project the bug should be submitted to (I don't know
> much about language bindings). Another user posted this issue back in
> Feb. of last year:
> http://www.mail-archive.com/gnome-devtools@.../msg00335.html
>
> However, it was left unresolved. I've done a little testing and have
> some more information.
>
> The problem is with loading a GdlDockLayout from a file. I've built a
> little test application in C and another in Python. The one in C works,
> where as the Python one does not. When the Python application loads the
> layout from the file, it looses all dock items. I've attached the test
> applications to this email. These test programs save the layout when to
> close, so you'll have to run it once, close it, and then run it again to
> see the bug.
>
> If anyone could take a quick look and a) make sure I'm using gdl
> properly (docs are limited) and b) suggest whom I might contact and/or
> submit a bug regarding this problem and c) any suggestions for a quick
> fix would be great. Who is maintaining the gdl python bindings?
>
> Regards,
>
> _______________________________________________
> gnome-devtools mailing list
> gnome-devtools@...
> http://mail.gnome.org/mailman/listinfo/gnome-devtools


_______________________________________________
gnome-devtools mailing list
gnome-devtools@...
http://mail.gnome.org/mailman/listinfo/gnome-devtools

signature.asc (204 bytes) Download Attachment