GNOME Bugzilla – Bug 447995
Add a script that converts libglade files
Last modified: 2011-02-04 16:11:04 UTC
There should be a migration path for interfaces created using ui builders only supporting the libglade format.
Created attachment 90034 [details] [review] patch A python converter which can do a simple conversion of libglade/gazpacho interfaces. Still missing menus/toolsbars -> uimanager+actions.
The script fails for me with the following backtrace: Traceback (most recent call last):
+ Trace 141738
main()
conv.convert()
self._convert(node.getAttribute("class"), node)
func(node)
self._packing_prop_to_child_attr(node, "type", "tab")
assert len(packing_props) == 1 AssertionError
The length of packing props was 13, btw. Looks like that packing_props = child.getElementsByTagName("packing") is to blame, since it searches recursively. I understood that we are only interested the node's own packing properties here, right?
Created attachment 90175 [details] [review] Changed the converter to search internal children only when updating packings.
The script fails for me when trying to convert the following file: http://svn.gnome.org/viewcvs/gnome-control-center/trunk/capplets/appearance/appearance.glade?revision=7759&view=markup Traceback (most recent call last):
+ Trace 143125
self._default_widget_converter(node)
"tooltip", attrs)
assert glade_iface, ("Bad formed XML, there are "
Created attachment 90588 [details] [review] update patch I updated this script to; * Fix the bug mentioned above * Convert tooltips properties to tooltips-text * Remove <accessibility> tags which we do not support yet It still doesn't do menus so we're still not getting very far when parsing apperance.glade.
I committed an updated version which can also convert menus, it's getting pretty close at converting the whole control center glade file Dennis attached. Revision 18232
Thanks for this, but I think it doesn't support UTF8.
(In reply to comment #7) > Thanks for this, but I think it doesn't support UTF8. > Can you please open up a new bug and attach a file with included UTF-8 data which the script fails to parse. Thanks.
The fix I just verified is just to tack at the end `.encode('utf-8')' on the line 355 to read: print conv.to_xml().encode('utf-8')
Perhaps this is doable as XSLT program as well?