[Glade-users] adding custom widgets

I found a better resource:


At least it makes more sense to me than the first one.  I followed the
instructions, saved my catalog and module like the ones there, then
fired up Glade-3.

I set the environment variables:

$ env |grep -i GLA

Here's the catalog

$ cat catalogs/grampswidgets.xml
<?xml version="1.0" encoding="UTF-8"?>
<glade-catalog name="grampswidgets" library="grampswidgets"
                            domain="glade-3" depends="gtk+" language="python">
        title="Latitude Longitude"
        title="Date Entry"
  <glade-widget-group name="GrampsWidgets" title="Gramps Widgets">
    <glade-widget-class-ref name="LatitudeLongitude"/>
    <glade-widget-class-ref name="DateEntry"/>

Here's the module:

$ cat modules/grampswidgets.py
from date_entry import DateEntry

But at startup I get:

(glade-3:20805): GladeUI-CRITICAL **: Unable to load module
'grampswidgets' from any search paths

(glade-3:20805): GladeUI-WARNING **: Failed to load external library

I also copied the module name without the ".py" but it made no
difference.  So, where is it looking for the module?

On Tue, Apr 21, 2009 at 3:37 PM, Gerald Britton
<gerald.britton at gmail.com> wrote:
OK -- I found I needed an additional package (libgladeui-1-dev)

Now I'm trying to set up a catalog. ?The difficulty for me at this
point is that I want to use it with Python. ?Following the docs, and
another tutorial I found,


I built a catalog, adding language="python" to the glade-catalog
element. ?But, I can't see how the Python code for the module would
work, knowing what I do about Python imports.

I'd sure love to see an end-to-end example. ?Starting with vanilla
glade-3, add a catalog and custom widgets, build a glade file using
glade-3 using the custom widgets then see what the gtk+ application
code looks like -- all with Python as the implementation language.

On Tue, Apr 21, 2009 at 2:49 PM, Tristan Van Berkom
<tristan.van.berkom at gmail.com> wrote:
On Tue, Apr 21, 2009 at 2:00 PM, Gerald Britton
<gerald.britton at gmail.com> wrote:
I'm just reading through:


After reading the three pages under this heading and trying a few
things out, its obvious to me that I have no idea what I'm doing. ?My
goal is to be able to design and use custom widgets using Glade-3 for
my gtk-builder applications. ?So, I thought I just play the dummy and
do what is in the documentation by rote to see what happened. ?I got
to the part about "Validating and installing" and hit some snags right

The command:

? ?xmllint --dtdvalid glade-catalog.dtd --noout my-catalog.xml

failed because I can't find glade-catalog.dtd on my system. ?Any idea
where to get it or what package it might be in?

Its in the tarball, but current versions are out of date for the catalog DTD
(I've actually never used it...) but someone has written a patch against
the current DTD here http://bugzilla.gnome.org/show_bug.cgi?id=578465,
which just needs a little work since it defines an ordering of tag which
is not mandatory (with an updated DTD, I'll introduce it to our Makefiles
so that our catalogs get validated at build time).

If you are creating custom virtual properties by way of the catalog
(i.e. in the case you may be faking a class purely by catalog without
loading the actual widget type into Glade), then please look at
plugins/gtk+/gtk+.xml.in for better examples, we have better support
for that now but I havent yet brought the docs up to date in that respect.

The command:

? ?pkg-config --variable=catalogdir gladeui-1.0

just exits without printing any directory. ?Guess I'm missing
something here as well. Same thing with the other pkg-config commands.

Do you have Glade headers and pc files installed ? if you built from sources;
where did you install Glade ? if you installed Glade in /opt for instance,
you will need to set PKG_CONFIG_PATH=/opt/lib/pkgconfig:/usr/lib/pkgconfig

Alternatively you can just set GLADE_CATALOG_PATH=~/catalogs when
firing up Glade and it should pickup any catalogs you put in ~/catalogs

? ? ? ? -Tristan

Gerald Britton

Gerald Britton

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