[pygtk] Adding python widget to Glade3

Radomir Dopieralski pygtk at sheep.art.pl
Sat May 3 19:32:13 WST 2008


Greetings!

I recently tried to follow the two excellent tutorials from

 http://www.pygtk.org/articles/custom-widgets-glade/

and add a pygtksourceview2 widget to Glade's palette, so that I
can use in my applications. I did it like this:

I've created a catalog file /usr/share/glade3/catalogs/pywidgets.xml:
 
<?xml version="1.0" encoding="UTF-8"?>
<glade-catalog name="pywidgets" library="pywidgets" domain="glade-3"
depends="gtk+" language="python">
    <glade-widget-classes>
        <glade-widget-class title="Source View" name="SourceView"
generic-name="sourceview">
        </glade-widget-class>
    </glade-widget-classes>
    <glade-widget-group name="PythonWidgets" title="Python Widgets">
        <glade-widget-class-ref name="SourceView"/>
    </glade-widget-group>
</glade-catalog>
 
Then the module file /usr/lib/glade3/modules/pywidgets.py:
 
#!/usr/bin/python
from gtksourceview2 import View as SourceView
 
But when I try to run glade-3, I get this:


(glade-3:13406): GladeUI-CRITICAL **: Unable to load module 'pywidgets'
from any search paths
 
(glade-3:13406): GladeUI-WARNING **: Failed to load external library
'pywidgets'
 
(glade-3:13406): GladeUI-WARNING **: We could not find the symbol
"source_view_get_type"
 
(glade-3:13406): GladeUI-WARNING **: Could not get the type from
"SourceView"
 
(glade-3:13406): GladeUI-WARNING **: Failed to load the GType for
'SourceView'
 
(glade-3:13406): GladeUI-WARNING **: Tried to include undefined widget
class 'SourceView' in a widget group


It seems like the "language" attribute of the catalog is completely
ignored. 

glade-3 --version
glade3 3.4.2


Any ideas what may be wrong? Anybody actually succeeded in doing this?
Any help would be greatly appretiated.

-- 
Radomir `The Sheep' Dopieralski <http://sheep.art.pl>
    I abhor a system designed for the "user", if that word is
    a coded pejorative meaning "stupid and unsophisticated". -- Ken Thompson 


More information about the pygtk mailing list