[Glade-users] Adding a custom widget to the pallete.



In python.

Hello, everyone. I've been checking the tutorials to do that with the
example given in PyGtk's tutorial[0].

The thing is, I copied the code verbatim, followed all the
instructions a few times, and Glade keeps trying to access my library
through an .so file (checked with strace).

Can anyone please help me with that? I have a deadline to a meeting
Friday where I need to present some results in the usage of this tool,
and I'm starting to get worried about it.

Here is the code I've been trying.

--- 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="Service View"
            name="ServiceView"
            generic-name="serviceview">
        </glade-widget-class>
    </glade-widget-classes>
    <glade-widget-group name="PythonWidgets"
        title="Python Widgets">
        <glade-widget-class-ref name="ServiceView"/>
    </glade-widget-group>
</glade-catalog>

-------

--- serviceview.py ---

import gtk

class ServiceView(gtk.VBox):

        __gtype_name__ = 'ServiceView'

        def __init__(self):
                self.frame = gtk.Frame()
                self.pack_start(self.frame)
                self._bb = gtk.HButtonBox()
                self._bb.set_layout(gtk.BUTTONBOX_END)
                self._bb.pack_start(gtk.Button(stock=gtk.STOCK_CLOSE))
                self.pack_start(self._bb, expand=False)

---------

--- pywidgets.py ---

from serviceview import ServiceView

---------

Problem with this is that Glade always comes up with these error messages:

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

(glade-3:4623): GladeUI-WARNING **: Failed to load external library 'pywidgets'

(glade-3:4623): GladeUI-WARNING **: We could not find the symbol
"service_view_get_type"

(glade-3:4623): GladeUI-WARNING **: Could not get the type from "ServiceView"

(glade-3:4623): GladeUI-WARNING **: Failed to load the GType for 'ServiceView'

(glade-3:4623): GladeUI-WARNING **: Tried to include undefined widget
class 'ServiceView' in a widget group

----

And in the STrace output I can see that it's trying to find
libpywidgets.so, which, of course, doesn't exist.

I have pywidgets.xml in my $GLADE_CATALOG_PATH, pywidgets.py in my
$GLADE_MODULES_PATH and serviceview.py $PYTHONPATH


Any help is happily welcome: I'm running out of options here.

[0]: http://www.pygtk.org/articles/custom-widgets-glade/Custom_PyGTK_Widgets_in_Glade3-part-2.html




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