This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Plasmoids: Where to put SVGs?

Tags: None
(comma "," separated)
ralphb
Registered Member
Posts
16
Karma
0
OS

Plasmoids: Where to put SVGs?

Thu Sep 01, 2011 3:35 pm
Hello,

I'm trying to display a SVG in my plasmoid, like this:

Code: Select all
class Meter(Applet):

    def init(self):
        ...
        self.bg = Plasma.Svg(self.applet)
        self.bg.setImagePath("meter")
        print self.bg.isValid()
        ...


My package structure looks like this:

Code: Select all
metadata.desktop
contents/
contents/images/
contents/images/meter.svg
contents/code/
contents/code/main.py


Alas, the image is never loaded, and isValid() always returns false. Moving meter.svg around the file hierarchy doesn't help either. If I use an absolute path, the SVG is shown.

Where inside my package do I have to put the SVG file so that it is found with a relative path? (Strangely enough, above seems to work on Fedora, but not on Kubuntu?!)

Regards
Ralph
User avatar
Hans
Administrator
Posts
3304
Karma
24
OS

Re: Plasmoids: Where to put SVGs?

Thu Sep 01, 2011 4:09 pm


Problem solved? Please click on "Accept this answer" below the post with the best answer to mark your topic as solved.

10 things you might want to do in KDE | Open menu with Super key | Mouse shortcuts
ralphb
Registered Member
Posts
16
Karma
0
OS

Re: Plasmoids: Where to put SVGs?

Thu Sep 01, 2011 5:36 pm
Yes, I have, and all the tutorials on TechBase as well. But the information isn't there.

From the API:
If the parent object of this Svg is a Plasma::Applet, relative paths will be searched for in the applet's package first.

Searched where -- the package root? The contents directory? Why isn't the file found in any position I've tried?

Ralph
User avatar
Hans
Administrator
Posts
3304
Karma
24
OS

Re: Plasmoids: Where to put SVGs?

Fri Sep 02, 2011 2:47 pm
Unfortunately I'm not very knowledgeable in this area (especially not scripted widgets), but you can look at other widgets for examples, e.g. http://kde-look.org/content/show.php/gm ... ent=101229 and http://kde-look.org/content/show.php/Now+Rocking?content=106304.


Problem solved? Please click on "Accept this answer" below the post with the best answer to mark your topic as solved.

10 things you might want to do in KDE | Open menu with Super key | Mouse shortcuts


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot]