[Glade-users] GtkBuilder and Libglade status



So here's the issue. I'm not sure how to bug report this or if I even 
need to. I'm not sure if it's already addressed by Ubuntu bug #214267 
(https://bugs.launchpad.net/ubuntu/+source/gtk+2.0/+bug/214267) or by 
gtk+/GtkBuilder bug #527672 
(http://bugzilla.gnome.org/show_bug.cgi?id=527672). If I should bug 
report it, I don't know if it falls under gtk or glade.

The default GtkMenuBar you drop into Glade 3.4 will output the following 
for GtkImageMenuItems:

  <widget class="GtkImageMenuItem" id="new_menu_item">
    <property name="visible">True</property>
    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
    <property name="label" translatable="yes">_New</property>
    <property name="use_underline">True</property>
    <property name="use_stock">True</property>
    <signal name="activate" handler="on_new_menu_item_activate"/>
  </widget>

This crashes gtk-builder-convert with:

Traceback (most recent call last):
  File "/usr/bin/gtk-builder-convert", line 745, in <module>
    sys.exit(main(sys.argv))
  File "/usr/bin/gtk-builder-convert", line 733, in main
    conv.parse_file(input_filename)
  File "/usr/bin/gtk-builder-convert", line 161, in parse_file
    self._parse()
  File "/usr/bin/gtk-builder-convert", line 259, in _parse
    self._convert(node.getAttribute("class"), node)
  File "/usr/bin/gtk-builder-convert", line 284, in _convert
    self._convert_menu(node)
  File "/usr/bin/gtk-builder-convert", line 342, in _convert_menu
    item = self._convert_menuitem(uimgr, obj_node)
  File "/usr/bin/gtk-builder-convert", line 378, in _convert_menuitem
    item = self._convert_menuitem(uimgr, obj_node)
  File "/usr/bin/gtk-builder-convert", line 374, in _convert_menuitem
    self._add_action_from_menuitem(uimgr, obj_node)
  File "/usr/bin/gtk-builder-convert", line 425, in _add_action_from_menuitem
    properties['stock_id'] = child
UnboundLocalError: local variable 'child' referenced before assignment


However, if you change the "Stock Item" to None under "Properties" and 
instead use a stock image under "Internal Image Properties", manually 
putting '_New' as the label, then Glade outputs the following and 
gtk-builder-convert runs fine:

  <widget class="GtkImageMenuItem" id="new_menu_item">
    <property name="visible">True</property>
    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
    <property name="label" translatable="yes">_New</property>
    <property name="use_underline">True</property>
    <signal name="activate" handler="on_new_menu_item_activate"/>
    <child internal-child="image">
      <widget class="GtkImage" id="menu-item-image1">
        <property name="stock">gtk-new</property>
      </widget>
    </child>
  </widget>




Micah Carrick wrote:
Thanks for the reply. You'll have to forgive some of my lack of 
knowledge in regards to the development process. I get a little 
confused as to who is working on what in regards to 
gtk-builder-convert, GtkBuilder, and Glade.

It's been about 6 months since working on my Glade 3 tutorial (Glade 
portion has been done since then) and now I have some time to finish 
it up and want to briefly explain to users the evolution of glade, 
libglade, and gtkbuilder so they aren't confused by examples elsewhere 
using different methods.

I see questions in emails, on www.gtkforums.com and other forum sites 
regarding GtkBuilder and Glade that I feel like I could be better 
equipped to answer....

Tristan Van Berkom wrote:
Ok, first of all, I wouldnt officially say there is support for saving
in builder format
from glade, 3.5.x is the development series and I think we still have
3 good months
before a stable release. Albeit, initial support is there and some
glade files may
work.

On Fri, May 16, 2008 at 2:04 PM, Micah Carrick <email at micahcarrick.com> wrote:
[...]
  
Ultimately, I'm looking for known issues and status with saving to
GtkBuilder from glade and gtk-builder-convert, work arounds, and the
like. I'm hoping to get up to speed enough to help the people that are
trying to get into RAD with Glade but are scared by these errors. I
thought it would be good to jump into GtkBuilderConvert to stay up to
date, but perhaps it's better to change my tutorial to use Libglade?
    

I am hoping that gtk-builder-convert can be made completely
obsolete by the time we release Glade 3.6, I also dont want to encourage
people to use libglade so I would say I personally would rather not see
another tutorial about libglade, but that is up to you.
  
That's perfect... just the type of information I would like to know. I 
will keep the tutorial as is for now (uses gtk-builder-convert with 
Glade 3.4) with a mention of Glade developers working on built-in 
GtkBuilder support.
  
In either case, I would like to provide my readers with explanations as
much as I can and point them in the right direction to following the
status (related bug reports).

I'm using Glade 3.5.2, GTK+ 2.12.19, and Libglade 2.6.2 (using Python).

First, neither LibGlade nor GtkBuilder seem to like the <requires> tag
at the top of the file. I can't seem to find information on that. Is
that something that Libglade and GtkBuilder are going to support in the
future?
    

Libglade invented the <requires> tag, for purposes or requiring libglade modules
such as the libgnomeui module - I was under the impression that libglade was
not going to complain if I added a version="2.4" in the requires tag -
I also used
a separate tag to depict the required version of gtk+ specifically, since I knew
libglade would choke on that.

But anyway, we will have to change the way we save this data at least for
target versions of gtk+ <= 2.14 and probably be saving this info as comments,
since gtkbuilder also doesnt like unrecognized tags.

Also, if the required version tags dont work in libglade (dont they
?), please at least _file bugs_.
(can you believe were talking about documenting bugs in a tutorial,
but the developers were
not even notified that those bugs exist ? *cough*communication breakdown*cough*)

  
This is largely the intent of this post. From user emails and from 
www.gtkforums.com I see a lot of bugs come up. I am more than happy to 
help get these properly filed and point users to these bugs, however, 
I'm not quite clear where these should be filed and where I should 
search for them. This is where my ignorance comes in. I would prefer 
to write things like "Due to bug #xxxxxx, you may need to first 
delete..." or whatever so that the user can link to the bug and it's 
solutions. Here's my understanding...

If I find a bug in Glade, I should first check for it at bugzilla 
under glade3 product and if it's not found, file a new bug report.

If I find a bug when trying to run gtk-builder-convert, I should first 
check for it at bugzilla under gtk+ product and if it's not found, 
file a new bug report.

But then I sometimes find the bug in things like ubuntu's bug reports. 
Should I assume that bugs from there go to the same people and thus I 
don't need to worry about it being filed on bugzilla? As an example, I 
have seen Ubuntu bug #214267 
https://bugs.launchpad.net/ubuntu/+source/gtk+2.0/+bug/214267 in posts 
on my website, gtkforums.com, and ubuntuforums.com. Should this be on 
bugzilla instead?

When saving as GtkBuilder, after deleting the requires tag, GtkMenuBar
widgets always seem to crash. Even when dropping a GtkMenuBar into a
GtkWindow without any other widgets, it crashes:
    

I have a series of patches to gtk+ pending for GtkMenu/GtkMenuItem support
(i.e. better construct property handling etc.), but I stalled on this
- I'm not sure
how much time I will have in this release cycle, there is a chance we
wont support
native GtkMenu structuring in this round, and try to only get
GtkUIManager running
instead.

  
"GtkWarning: Attempting to add a widget with type GtkMenu to a container
of type GtkMenuItem, but the widget is already inside a container of
type GtkWindow, the GTK+ FAQ at http://www.gtk.org/faq/ explains how to
reparent a widget."

When taking that same file but saved as a Libglade file and running
through gtk-builder-convert you get:

"UnboundLocalError: local variable 'child' referenced before assignment"

Which you can get around by removing any "use_stock" property from
GtkImageMenuItem widget, but then you don't get the stock icons
(https://bugs.launchpad.net/ubuntu/+source/gtk+2.0/+bug/214267/comments/3)
    

Sounds like an awful lot of effort spent to document an unfinished
work, I really
wish people would spend this much effort to help finish the work.
  
Well, I'll try to get better at helping. :)

My intention is not to document unfinished work so much as provide an 
up-to-date tutorial with mention of what to expect down the road 
(since the tutorial may be read a year from now). I will try to focus 
on Glade 3.4 and gtk-builder-convert specifically (which is what it's 
based on now). I didn't even realize the Glade3 had the GtkBuilder 
saving option until today as a result of trying to help a new glade 
user on ubuntuforums.org who was having these same problems. I should 
have noticed I was using a development series... didn't even think of 
that (forgot I had installed that from source rather than using the 
one with the distro).
Cheers,
                       -Tristan

  
------------------------------------------------------------------------

_______________________________________________
Glade-users maillist  -  Glade-users at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-users
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20080516/7a587da7/attachment-0001.html 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]