Publié en octobre 2011
Plasmoïde pour multiprises USB
La multiprise Silver Shield Gembird's : réglage sous Linux (KDE4) à partir du fond d'écran au moyen du plasmoïde USB-Steckdose.
... plus [télécharger comme ZIP]
... plus [télécharger comme ZIP]
What is this plasmoid for?
The plasmoid "USB-Steckdose" allows you to click icons at the desktop to switch the sockets of your power outlet strip (Revolt INtelli-Plug, Gembird SIS-PM, 4 sockets) on and off. The icons show the states of the sockets (on/off).
You should have installed
-
Linux, KDE4 --- the plasmoid was developed on Debian Squeeze, KDE 4.4. Other distributions were not tested, but should work as well.
- Outlet strip:
-
A USB power outlet strip (Revolt INtelli-Plug, Gembird SIS-PM).
- The programm: sispmctl (http://sispmctl.sourceforge.net).
- Both plugged and installed in a full functional way. For exemple, it should be possible to work in the terminal as root with
sispmctl -o 1
-
A USB power outlet strip (Revolt INtelli-Plug, Gembird SIS-PM).
-
The programm/package: sudo.
In /etc/sudoers (to edit only with the command "visudo", not in an ordinary editor!!! Read the man-page of visudo!!!) should be a line like:
username ALL=NOPASSWD: /usr/bin/sispmctl
Take care of writing this line behind other lines as for exemple
root ALL=(ALL) ALL
because order of the line is relevant in processing /etc/sudoers! After this it should be possible to run
sudo sispmctl -o 1
as non-root user in the terminal.
- Other programs/packages:
- debian package "plasma-scriptengine-python" (packages.debian.org/squeeze/plasma-scriptengine-python)
- Therefor you need "phython" and "python-kde4" what is normally already installed. Otherwise it will be installed automatically while installing "plasma-scriptengine-python".
- Other programs/packages:
To get the plasmoid work
- Unpack "steckdose-plasma.zip" in your home folder, e.g. run in the terminal in your home folder:
unp steckdose-plasma.zip
- Install the plasmoid with "plasmapkg":
plasmapkg -i steckdose-plasma/
- Add the plasmoid as an plasma applet to the desktop:
- Push the right mouse button on the empty desktop
- Add applet ...
- Drag and drop the "USB-Steckdose" onto the Desktop
- Install the plasmoid with "plasmapkg":
Problem solving
- Problem: "Script does not run"
Solution: Possibly you use Latin-9 font encoding and these files are written in UTF8. Try to replace or get rid of all ä/ö/ü special characters.
- Problem: "The plasmoid works but is not showing any pictures. The images are successfully installed."
Solution: In debian jessie plasmoids are run in $HOME. Paths of the images should be relative to $HOME or absolute. - Problem: "In debian jessie the plasmoidviewer is missing."
Lösung: plasmoidviewer has apparently been moved to the PlasMate project with the KDE 4.10 release. In a blog entry of 2012 it says you can still get it from the plasmate git repository. You could also try plasma-windowed (part of the package kde-workspace-bin in jessie) in order to run individual plasmoids in a window.
To use the plasmoid
- The icons show the state of evey socket of your power outlet strip, that means ON or OFF.
- Click at one icon, to switch the socket, that means OFF or ON.
- If you switch the socket by other means than this plasmoid (e.g. another programs or via terminal) the state of the buttons will be automatically updated after 5 seconds.
To customize the plasmoid
Deinstall the plasmoid: plasmapkg -r steckdose-plasma/
Edit the source code. Reinstall the plasmoid.
Edit the source code. Reinstall the plasmoid.
- If you want to change the icon in the control panel of the plasma applet:
In steckdose-plasma/metadata.desktop:
- adapt the line "Icon=/salz-on.png"
- If you want to change the time intervall (5 seconds) of the automatic updates:
In steckdose-plasma/contents/code/steckdosen.py:
- adapt "RefreshInMilliSekunden=5000" in section "1.FIXME"
Shorter intervalls (z.B. 500) could lead to a high system load caused by the sudo calls!
- If you need to change the assignment without changing the buttons:
In steckdose-plasma/contents/code/steckdosen.py:
- adapt the string variables of the socket (=Steckplatz) in section "2.FIXME"
- If you want to change the images of the buttons:
In steckdose-plasma/contents/code/steckdosen.py:
- adapt the paths of the icons in section "3.FIXME"
Parameter of the icons: 100x100 Pixel, resolution: 72x72 Pixel/Inch
- If you need less sockets, because your outlet strip has less sockets:
Remove or adapt the source code of steckdose-plasma/contents/code/steckdosen.py:
- delete/adapt the global variables
- delete/adapt string variables of the socket (=Steckplatz)
- delete/adapt the paths of the images
- delete/adapt the position of the icons in the widget
- adapt the function changeXyzZustand
- adapt the buttons in initExtenderItem
- adapt/delete the functions clicked1, clicked2, ...
- adapt the function dataUpdated
Plasmoid test runs
An easy way to actually work on the source code of steckdose-plasma/contents/code/steckdosen.py and steckdose-plasma/metadata.desktop would be:
Even more easy: Each time after editing and saving the changed source code you run this one-line-command in your terminal/bash:
plasmapkg -r steckdose-plasma/ && plasmapkg -i steckdose-plasma/ && plasmoidviewer steckdose-plasma/
- Close all instances of the plasmoid on the desktop and deinstall the plasmoid with "plasmapkg":
plasmapkg -r steckdose-plasma/
- Edit the source code and reinstall the plasmoid with "plasmapkg":
plasmapkg -i steckdose-plasma/
- Have a look at the plasmoid with "plasmoidviewer" instead of adding it to the desktop over and over again:
plasmoidviewer steckdose-plasma/
In addition you'll get if necessary all the error messages on the terminal. - Edit the source code and reinstall the plasmoid with "plasmapkg":
Even more easy: Each time after editing and saving the changed source code you run this one-line-command in your terminal/bash:
Useful internet addresses
About plasma and python: techbase.kde.org/Development/Tutorials/Plasma
This plasmoid revised and adapted for debian jessie from Rainer Dorsch in 2015: netcup.bokomoko.de/~rd/steckdose-plasma.tgz
This plasmoid revised and adapted for debian jessie from Rainer Dorsch in 2015: netcup.bokomoko.de/~rd/steckdose-plasma.tgz
Author
The script steckdosen.py was written by Annette Huck (annette at hopfenwiesen dot de).
The pictures lampen-on.png, lampen-off.png, glaskugel-on.png, glaskugel-off.png, salz-on.png, salz-off.png, klavier-on.png, klavier-off.png, update.png, update-jetzt.png were drawed by Annette Huck (annette at hopfenwiesen dot de) with Gimp 2.2/2.6.
This README was translated by Annette Huck.
License
Copyright 2011 Annette Huck.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.