Easier Plasma themes creation

Graphics

One pretty long task of plasma themes is to manually rename all the SVG sub elements with the proper names. Let’s say we want to theme a button, we will need a SVG file with the following elements: normal-top, normal-topleft, normal-left, normal-bottomleft, normal-bottom, normal-bottomright, normal-right, normal-topright and normal-center.

This is for the button in normal status, then you need the same thing with active-, pressed- and focus- prefixes

This makes Plasma themes quite powerful (and always looking pixel perfect) but it’s quite fainful to rename over a hundred of elements by hand

Since usually the themes are designed in inkscape and it has a pretty neat system to write plugins in python, i’ve decided to write a little extension that eases the ain a lot: if you select 9 elements it will rename them with the usual topleft, left, top etc names, with an optional prefix asked by a dialog. If you select 4 items, it will instead rename them as hint-top-margin, hint-left-margin etc.

The extension is located at this address, to use it you have to copy those 2 files in the ~/.inkscape/extensions folder.

Unfortunately it requires a recent snapshot of inkscape 0.47, since the python scripts used have some bugs.

As usual a video is worth 1024 words 🙂

Ogg version

10 thoughts on “Easier Plasma themes creation

  1. Alec

    I have Inkscape 0.47pre4, and instead of the “Effects” and “Whiteboard” menus it has “Filters” and “Extensions”… And after dropping the two files into ~/.inkscape/extensions, the new Plasma submenu does not show up anywhere 🙁

    Reply
  2. TheBlackCat

    Does plasma supporting clipping in the SVG files? I tried making a theme by building the entire object, duplicating it, and clipping it to the right size for each part, but it didn’t work. Plasma showed the entire object for each piece, rather than just the clipped portion. Did I do something incorrectly?

    Reply
  3. Marco Martin

    @alec:
    i tried it now with a more recent inkscape, it seems it doesn’t support anymore extensions in the user home so it should be put in the system folder, like /usr/share/inkscape/extensions/
    @TheBlackCat: plasma uses QSvg, that unfortunately supports only SVG tiny, that is pretty limited (the usual speed and efficiency versus features)

    Reply
  4. TheBlackCat

    So is there a way to completely remove the data instead of just using a clip layer? It would be extremely difficult to go through and modify each picture by hand to remove the lines.

    Reply
  5. Thorsten Wilms

    Couldn’t you use the IDs of (hidden/zero-alpha) rectangles on their own layer to identify the parts, as they share coordinates / cover the same area?

    (This assuming that the SVG will be used directly, not via exports to bitmaps).

    Reply
  6. Martin

    Why make this plugin for Inkscape and not Karbon ? Making a KDE theme in a gtk+ app is … ? Well a bit strange 🙂

    Reply
  7. Anton

    This is very helpful! Altough sometimes it doesn’t work at all and I get the following error:

    Traceback (most recent call last):
    File “/home/anton/.inkscape/extensions/plasmarename.py”, line 97, in
    effect.affect()
    File “/usr/share/inkscape/extensions/inkex.py”, line 154, in affect
    self.effect()
    File “/home/anton/.inkscape/extensions/plasmarename.py”, line 68, in effect
    nodeBox = self.nodeBBox(node)
    File “/home/anton/.inkscape/extensions/plasmarename.py”, line 46, in nodeBBox
    return computeBBox([path])
    File “/usr/share/inkscape/extensions/simpletransform.py”, line 161, in computeBBox
    bbox=boxunion(computeBBox(node,m),bbox)
    File “/usr/share/inkscape/extensions/simpletransform.py”, line 146, in computeBBox
    m = parseTransform(node.get(‘transform’))
    File “/usr/share/inkscape/extensions/simpletransform.py”, line 70, in parseTransform
    matrix=composeTransform(mat,matrix)
    UnboundLocalError: local variable ‘matrix’ referenced before assignment

    Reply
  8. tobaj

    I’ve been looking for updated version of this extension (or something similar), which could work with Inkscape 0.48. I can’t find anything on the web. Maybe all the functionalities have been merged into Inkscape so the extension is not required anymore? If it is so, how can I find and use them? I would appreciate if someone could help me. My e-mail address: tobaj33@gmail.com

    Regards,
    Tomasz B.

    Reply

Comments are closed.