[Kde-bindings] Ruby Plasmoid article

Richard Dale rdale at foton.es
Sun Aug 10 16:40:31 UTC 2008


On Friday 08 August 2008 09:11:00 Declan McGrath wrote:
> On Wednesday 06 August 2008 12:28:05 Richard Dale wrote:
> > On Wednesday 06 August 2008 10:46:28 Richard Dale wrote:
> > > On Wednesday 06 August 2008 03:33:39 Sebastian Sauer wrote:
> > > > forwarded to kde-bindings at kde.org since probably someone there knows
> > > > why Ruby Plasma Applets don't work any longer?! Looks as something
> > > > essential was changed right after our bindings-sprint and before the
> > > > 4.1.0 release (yay, I love feature-freezes).
> > > >
> > > > On Wednesday 06 August 2008, Sebastian Sauer wrote:
> > > > > On Saturday 02 August 2008, Declan McGrath wrote:
> > > > > > Hi Sebastian,
> > > > >
> > > > > and hi Declan,
> > > > >
> > > > > first sorry for the long time till I replied. I am atm quit busy
> > > > > with so much things that it's hard to react on more complex things
> > > > > in realtime ;)
> > > > >
> > > > > > Loved your article on the Ruby Plasmoids at
> > > > > > http://techbase.kde.org/Development/Tutorials/Plasma/RubyApplet.
> > > > > > Thanks!
> > > > >
> > > > > Thank you too! Feedback is a rather useful thing since it shows
> > > > > that it's really worth and needed(!!!) to write such tutorials.
> > > > >
> > > > > > I had a couple of difficulties whilst trying to get the tutorial
> > > > > > to work though. I've put up a blog post on my site at
> > > > > > http://www.theirishpenguin.com/2008/08/02/getting-ruby-plasmoids-
> > > > > >up -a nd -r un ning-in-kde-41-on-kubuntu
> > > > >
> > > > > wow.
> > > > >
> > > > > > The main issue I had was around the CMakeLists.txt file
> > > > > > initially. But now I'm stuck getting a 'findServiceByDesktopPath:
> > > > > >  not found' error when trying to run the plasmoid? Everything
> > > > > > seems to have installed correctly.
> > > > > >
> > > > > > Once I get it working I can tidy up my blog post or perhaps
> > > > > > better still migrate some of the content into your Techbase wiki
> > > > > > article to add a little more explananation to things like cmake
> > > > > > and how to install the plasmoid.
> > > > >
> > > > > uhm, seems I get something similar now;
> > > > >
> > > > > plasmoidviewer(20804)/libplasma Plasma::isPluginVersionCompatible:
> > > > > plugin is compiled against incompatible Plasma version   4294967295
> > > > > plasmoidviewer(20804)/libplasma
> > > > > Plasma::ContainmentPrivate::addApplet: Applet
> > > > > "plasma-ruby-web-applet" could not be loaded.
> > > > > findServiceByDesktopPath:  not found
> > > > >
> > > > > The interesting part here is the "incompatible Plasma version"
> > > > > which was not the case ~2 weeks ago :-/
> > > > > hmmm... since I use trunk I try to recompile bindings right now
> > > > > what may take a while. Else I would suggest to ask at the
> > > > > kde-bindings mailinglist (http://www.kde.org/mailinglists/) where
> > > > > more developers hang around ;)
> > > >
> > > > I keep to get that error in trunk too :-/
> > >
> > > The C++ clock .desktop file has this line in it:
> > >
> > > X-KDE-PluginInfo-Version=pre0.1
> > >
> > > Does adding that to the ruby applet's .desktop make it work? But we
> > > really should be switching to the ScriptEngine based api for Ruby
> > > applets. I haven't had time to convert some examples and generally try
> > > it out yet though.
> >
> > I've confirmed that script engine based ruby plasmoids don't have any
> > versioning problem at the moment, although C++ style Ruby plasmoids do.
> >
> > I've done some more investigating and found out what the problem is.
> > There is a macro you can add to a compiled C++ plugin that gives its
> > version number. But the krubypluginfactory.cpp source doesn't have it
> > because it is supposed to work for any KDE plugin. Which is a bit of a
> > problem. So as a workround you can add these lines to kpluginfactory.cpp
> > to get just plasma plugins working:
> >
> > Index: krubypluginfactory.cpp
> > ===================================================================
> > --- krubypluginfactory.cpp      (revision 842545)
> > +++ krubypluginfactory.cpp      (working copy)
> > @@ -93,6 +93,8 @@
> >          static QByteArray camelize(QByteArray name);
> >  };
> >  K_EXPORT_PLUGIN(KRubyPluginFactory)
> > +#include <plasma/version.h>
> > +K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
> >
> >  KRubyPluginFactory::KRubyPluginFactory()
> >
> >      : KPluginFactory() // no useful KComponentData object for now
> >
> > The macro looks like this:
> >
> > #define K_EXPORT_PLUGIN_VERSION(version) \
> > Q_EXTERN_C KDE_EXPORT const quint32 kde_plugin_version = version;
> >
> > So what we will need to do is to be able to set 'kde_plugin_version' for
> > an individual plugin at runtime, by reading the value from somewhere in
> > the directory where the plugin Ruby code is installed. Maybe a one line
> > text file called 'KDE_PLUGIN_VERSION' or something? We have the same
> > problem with C# plugins too.
>
> Hi all,
>
> Thanks for the update on this which was confusing the hell out of me. What
> do I need to do to get the Ruby bindings working on my desktop (running
> Kubuntu Hardy with KDE 4.1.0)? As you are mentioning .cpp files I take it
> that some sort of a recompile would be necessary. As I'm not familiar with
> doing that will this fix be released soon into a future version of KDE?
Yes, it will be fixed in the next release of KDE - 4.1.1.

> Also, you mentioned Script Engine vs C++ style plasmoids. Am I correct in
> assuming that the the problems mentioned above affect only the C++ style?
Yes, the script engine bindings in the kde svn trunk work fine. But I haven't 
ported various fixes to the KDE 4.1 branch yet.

> If the Script Engine style is better is there any good resources that I can
> use to switch to using this for my Ruby plasmids? I'd be happy to help out
> with a TechBase tutorial article or two, time permitting.
Yes, tutorial articles would be really good. I recently converted the C++ 
analog clock example to both the old style ruby bindings and the new ones. 
The sources are identical apart from two lines, so it should be very easy to 
convert an existing ruby applet.
See kdebindings/ruby/plasma/examples/applets/plasma_applet_ruby_clock in the 
svn trunk.

> Anyway, keep up the great work. KDE 4.1.0 is fantastic (despite my Ruby
> binding issues :-)
Thanks - I hope you manage to get it working sometime soon..

-- Richard



More information about the Kde-bindings mailing list