mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-06-29 23:15:54 +00:00
Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
ebb828dd4c | |||
f5fa6af1bc | |||
ddf1de6f8e | |||
4689a9054d | |||
4a841766e8 | |||
7d5803fec8 | |||
60f1cd8c58 | |||
b7f4b80c7e | |||
6c9a167aa2 | |||
d55d478243 | |||
1dd3d4090c | |||
d5a91f566e | |||
3994652562 | |||
c729d6573d | |||
7aabdf9485 | |||
d8a9ca1fe6 | |||
ff874f0b5e | |||
c3d953b99e | |||
e7babdfde4 | |||
013cf8d335 | |||
3db0f5f126 |
49
PKGBUILD
49
PKGBUILD
@ -3,32 +3,35 @@
|
||||
|
||||
pkgname=kdeplasma-applets-pytextmonitor
|
||||
_pkgname=py-text-monitor
|
||||
pkgver=1.3.5
|
||||
pkgver=1.5.1
|
||||
pkgrel=1
|
||||
_dtengine=ext-sysmon
|
||||
_dtver=1.2
|
||||
_dtver=1.3
|
||||
pkgdesc="Minimalistic Plasmoid script written on Python2. It looks like widgets in awesome-wm"
|
||||
arch=('i686' 'x86_64')
|
||||
url="https://github.com/arcan1s/pytextmonitor"
|
||||
license=('GPL')
|
||||
depends=('kdebase-workspace' 'kdebindings-python2' 'lm_sensors' 'net-tools')
|
||||
optdepends=('hddtemp: for HDD temperature monitor'
|
||||
'775bc3a6057f2dc1696f09b8d315a3e9'
|
||||
'775bc3a6057f2dc1696f09b8d315a3e9')
|
||||
depends=('kdebase-workspace' 'kdebindings-python2' 'lm_sensors' 'net-tools' 'sysstat')
|
||||
optdepends=("hddtemp: for HDD temperature monitor"
|
||||
"catalyst: for GPU monitor"
|
||||
"nvidia-utils: for GPU monitor"
|
||||
"amarok: for music player monitor"
|
||||
"mpd: for music player monitor"
|
||||
"qmmp: for music player monitor")
|
||||
makedepends=('automoc4' 'cmake')
|
||||
source=(https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_pkgname}-${pkgver}.plasmoid
|
||||
https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_dtengine}-${_dtver}.zip)
|
||||
install=${pkgname}.install
|
||||
md5sums=('d99c8a152693b6b10ebe8fb1a076a333'
|
||||
'775bc3a6057f2dc1696f09b8d315a3e9')
|
||||
md5sums=('3ef9536493e48cd460ee3f37faa8cf58'
|
||||
'f7fce53d5f616891b30beac1afd99728')
|
||||
|
||||
build ()
|
||||
{
|
||||
# build dataengine
|
||||
if [ -d ${srcdir}/${_dtengine}/build ]; then
|
||||
rm -r ${srcdir}/${_dtengine}/build
|
||||
if [[ -d ${srcdir}/${_dtengine}/build ]]; then
|
||||
rm -rf "${srcdir}/${_dtengine}/build"
|
||||
fi
|
||||
mkdir ${srcdir}/${_dtengine}/build && cd ${srcdir}/${_dtengine}/build
|
||||
mkdir "${srcdir}/${_dtengine}/build"; cd "${srcdir}/${_dtengine}/build"
|
||||
cmake -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` \
|
||||
../
|
||||
@ -38,17 +41,19 @@ build ()
|
||||
package()
|
||||
{
|
||||
# install dataengine
|
||||
cd ${srcdir}/${_dtengine}/build
|
||||
make DESTDIR=${pkgdir} install
|
||||
cd "${srcdir}/${_dtengine}/build"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
|
||||
# install plasmoid
|
||||
install -D -m644 ${srcdir}/metadata.desktop \
|
||||
${pkgdir}/`kde4-config --prefix`/share/kde4/services/${_pkgname}.desktop
|
||||
install -D -m644 ${srcdir}/metadata.desktop \
|
||||
${pkgdir}/`kde4-config --prefix`/share/apps/plasma/plasmoids/${_pkgname}/metadata.desktop
|
||||
mkdir -p ${pkgdir}/`kde4-config --prefix`/share/apps/plasma/plasmoids/${_pkgname}/contents/{code,ui}
|
||||
install -m644 ${srcdir}/contents/code/* \
|
||||
-t ${pkgdir}/`kde4-config --prefix`/share/apps/plasma/plasmoids/${_pkgname}/contents/code
|
||||
install -m644 ${srcdir}/contents/ui/* \
|
||||
-t ${pkgdir}/`kde4-config --prefix`/share/apps/plasma/plasmoids/${_pkgname}/contents/ui
|
||||
install -D -m644 "${srcdir}/contents/code/plasma_applet_pytextmonitor.notifyrc" \
|
||||
"${pkgdir}/`kde4-config --prefix`/share/apps/plasma_applet_pytextmonitor/plasma_applet_pytextmonitor.notifyrc"
|
||||
install -D -m644 "${srcdir}/metadata.desktop" \
|
||||
"${pkgdir}/`kde4-config --prefix`/share/kde4/services/${_pkgname}.desktop"
|
||||
install -D -m644 "${srcdir}/metadata.desktop" \
|
||||
"${pkgdir}/`kde4-config --prefix`/share/apps/plasma/plasmoids/${_pkgname}/metadata.desktop"
|
||||
mkdir -p "${pkgdir}/`kde4-config --prefix`/share/apps/plasma/plasmoids/${_pkgname}/contents/"{code,ui}
|
||||
install -m644 "${srcdir}/contents/code/"* \
|
||||
-t "${pkgdir}/`kde4-config --prefix`/share/apps/plasma/plasmoids/${_pkgname}/contents/code"
|
||||
install -m644 "${srcdir}/contents/ui/"* \
|
||||
-t "${pkgdir}/`kde4-config --prefix`/share/apps/plasma/plasmoids/${_pkgname}/contents/ui"
|
||||
}
|
||||
|
36
README
36
README
@ -1,36 +0,0 @@
|
||||
pytextmonitor
|
||||
=============
|
||||
|
||||
PyTextMonitor is a minimalistic Plasmoid script written on Python2. It looks like widgets in awesome-wm.
|
||||
|
||||
HOWTO
|
||||
For edited output you must open Settings window and setup output format in lines:
|
||||
label "$uptime" means uptime, ---d--h--m
|
||||
label "$cpu" means total load cpu, %
|
||||
label "$ccpu" means load CPU for each core, %
|
||||
label "$cpucl" - average cpu clock, MHz
|
||||
label "$ccpucl" - cpu clock for each core, MHz
|
||||
label "$temp" - average temperature in system
|
||||
label "$gpu" - GPU usage, %. `aticonfig` or `nvidia-smi` must be installed
|
||||
label "$gputemp" - GPU temperature. `aticonfig` or `nvidia-smi` must be installed
|
||||
label "$mem" - usage memory, %
|
||||
label "$memmb" - usage memory, MB
|
||||
label "$swap" - swap, %
|
||||
label "$swapmb" - swap, MB
|
||||
label "@@/@@" (in hdd label) - mount point ('/' in example) usage, %. Separator for mount points list is ';', for example "@@/;/home;/mnt/global@@". `hddtemp` must be installed
|
||||
label "@@/dev/sda@@" (in hddtemp label) - HDD ('/dev/sda' in example) temperature
|
||||
label "$net" - download and upload speed, KB/s. You may specify network device: something like @@eth0@@
|
||||
label "$netdev" - current network device
|
||||
label "$bat" - battery charge, %. Battery device may be set below. File ("/sys/class/power_supply/BAT0/capacity" by default) must contain only battery charge in percent
|
||||
label "$ac" - status AC device. Return (*) if AC device is online or ( ) if offline. AC device may be set below. FIle ("/sys/class/power_supply/AC/online" by default) must contain '1' if AC is online
|
||||
|
||||
Label order will changed if you change slider position. HTML tags in label work normally.
|
||||
Attention: you don't may set to show $cpu in swap label for example. $cpu will work only in cpu label.
|
||||
|
||||
|
||||
Dependencies:
|
||||
kdebindings-python2
|
||||
|
||||
ext-sysmon (for GPU, GPU temp and HDD temp labels)
|
||||
lm_sensors (for definition temperature device)
|
||||
net-tools (for definition network device)
|
98
README.md
Normal file
98
README.md
Normal file
@ -0,0 +1,98 @@
|
||||
py-text-monitor
|
||||
=============
|
||||
|
||||
Information
|
||||
-----------
|
||||
PyTextMonitor is a minimalistic Plasmoid script written on Python2. It looks like widgets in awesome-wm.
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
For edited output you must open Settings window and setup output format in lines:
|
||||
* label `$time` - time in long format. For example, `fri Nov 6 04:48:01 2013`
|
||||
* label `$uptime` - uptime, <i>---d--h--m</i>
|
||||
* label `$cpu` - total load cpu, <i>%</i>
|
||||
* label `$ccpu` - load CPU for each core, <i>%</i>
|
||||
* label `$cpucl` - average cpu clock, <i>MHz</i>
|
||||
* label `$ccpucl` - cpu clock for each core, <i>MHz</i>
|
||||
* label `$temp` - average temperature in system
|
||||
* label `$gpu` - GPU usage, <i>%</i>. `aticonfig` or `nvidia-smi` must be installed
|
||||
* label `$gputemp` - GPU temperature. `aticonfig` or `nvidia-smi` must be installed
|
||||
* label `$mem` - usage memory, <i>%</i>
|
||||
* label `$memmb` - usage memory, <i>MB</i>
|
||||
* label `$swap` - swap, <i>%</i>
|
||||
* label `$swapmb` - swap, <i>MB</i>
|
||||
* label `@@/@@` (in hdd label) - mount point (`/` in example) usage, <i>%</i>. Separator for mount points list is `;`, for example `@@/;/home;/mnt/global@@`
|
||||
* label `@@/dev/sda@@` (in hddtemp label) - HDD (`/dev/sda` in example) temperature. `hddtemp` must be installed
|
||||
* label `$net` - download and upload speed, <i>KB/s</i>. You may specify network device: something like `@@eth0@@`
|
||||
* label `$netdev` - current network device
|
||||
* label `$bat` - battery charge, <i>%</i>. Battery device may be set below. File (`/sys/class/power_supply/BAT0/capacity` by default) must contain only battery charge in percent
|
||||
* label `$ac` - status AC device. Return <i>(*)</i> if AC device is online or <i>( )</i> if offline. AC device may be set below. FIle (`/sys/class/power_supply/AC/online` by default) must contain `1` if AC is online
|
||||
* label `$artist` - current song artist. One of supported music players must be installed
|
||||
* label `$title` - current song title. One of supported music players must be installed
|
||||
|
||||
Label order will changed if you change slider position. HTML tags in label work normally.
|
||||
|
||||
**NOTE** you don't may set to show $cpu in swap label for example. <b>$cpu will work only in cpu label</b>.
|
||||
|
||||
TODO (wish) list
|
||||
----------------
|
||||
Tooltip (graphical information):
|
||||
* cpu, %
|
||||
* cpuclock, mhz
|
||||
* memory, %
|
||||
* swap, %
|
||||
* network, %
|
||||
|
||||
Instruction
|
||||
===========
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
* kdebase-workspace
|
||||
* kdebindings-python2
|
||||
* lm_sensors (for definition temperature device)
|
||||
* net-tools (for definition network device)
|
||||
* sysstat (for notification)
|
||||
|
||||
Optional dependencies
|
||||
---------------------
|
||||
ext-sysmon (for GPU, GPU temp, HDD temp and player labels):
|
||||
* proprietary video driver
|
||||
* hddtemp
|
||||
* music player (amarok, mpd or qmmp)
|
||||
|
||||
Make dependencies
|
||||
-----------------
|
||||
* automoc4
|
||||
* cmake
|
||||
|
||||
Installation
|
||||
------------
|
||||
* download sources
|
||||
* install dataengine
|
||||
|
||||
mkdir build && cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --localprefix` ../
|
||||
make && make install
|
||||
|
||||
Also you may install it to "/":
|
||||
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ../
|
||||
make && sudo make install
|
||||
|
||||
* install plasmoid
|
||||
|
||||
plasmapkg -i py-text-monitor-1.5.0.plasmoid
|
||||
|
||||
Also you may install it to "/" too:
|
||||
|
||||
plasmapkg -g -i py-text-monitor-1.5.0.plasmoid
|
||||
|
||||
Additional information
|
||||
======================
|
||||
|
||||
Links
|
||||
-----
|
||||
* Plasmoid on [kde-look](http://kde-look.org/content/show.php/Py+Text+Monitor?content=157124)
|
||||
* DataEngine on [kde-look](http://kde-look.org/content/show.php/Extended+Systemmonitor+DataEngine?content=158773)
|
||||
* Archlinux [AUR](https://aur.archlinux.org/packages/kdeplasma-applets-pytextmonitor/) package
|
@ -15,7 +15,7 @@ sed -i "s/_dtver=[0-9.]*/_dtver=${VERSION}/" PKGBUILD
|
||||
|
||||
# build widget
|
||||
cd sources
|
||||
FILES="contents metadata.desktop"
|
||||
FILES="contents metadata.desktop plasma_applet_pytextmonitor"
|
||||
ARCHIVE="py-text-monitor"
|
||||
VERSION=`grep Version metadata.desktop | awk -F "=" '{print $2}'`
|
||||
# create archive
|
||||
|
BIN
ext-sysmon-1.3.zip
Normal file
BIN
ext-sysmon-1.3.zip
Normal file
Binary file not shown.
@ -1,9 +1,29 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2013 by Evgeniy Alekseev <esalekseev@gmail.com> *
|
||||
* *
|
||||
* 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 2 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, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
||||
***************************************************************************/
|
||||
|
||||
#include "extsysmon.h"
|
||||
|
||||
#include <Plasma/DataContainer>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
|
||||
: Plasma::DataEngine(parent, args)
|
||||
{
|
||||
@ -41,6 +61,7 @@ QStringList ExtendedSysMon::sources() const
|
||||
source.append(QString("gpu"));
|
||||
source.append(QString("gputemp"));
|
||||
source.append(QString("hddtemp"));
|
||||
source.append(QString("player"));
|
||||
return source;
|
||||
}
|
||||
|
||||
@ -60,7 +81,7 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
||||
key = QString("GPU");
|
||||
if (gpudev == QString("nvidia"))
|
||||
{
|
||||
f_out = popen("nvidia-smi -q -d UTILIZATION | grep Gpu | tail -n1 2>&1", "r");
|
||||
f_out = popen("nvidia-smi -q -d UTILIZATION 2> /dev/null | grep Gpu | tail -n1", "r");
|
||||
fgets (output, 256, f_out);
|
||||
if ((output[0] == '\0') ||
|
||||
(QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 2))
|
||||
@ -75,7 +96,7 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
||||
}
|
||||
else if (gpudev == QString("ati"))
|
||||
{
|
||||
f_out = popen("aticonfig --od-getclocks | grep load | tail -n1 2>&1", "r");
|
||||
f_out = popen("aticonfig --od-getclocks 2> /dev/null | grep load | tail -n1", "r");
|
||||
fgets (output, 256, f_out);
|
||||
if ((output[0] == '\0') ||
|
||||
(QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 3))
|
||||
@ -102,7 +123,7 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
||||
key = QString("GPUTemp");
|
||||
if (gpudev == QString("nvidia"))
|
||||
{
|
||||
f_out = popen("nvidia-smi -q -d TEMPERATURE | grep Gpu | tail -n1 2>&1", "r");
|
||||
f_out = popen("nvidia-smi -q -d TEMPERATURE 2> /dev/null | grep Gpu | tail -n1", "r");
|
||||
fgets (output, 256, f_out);
|
||||
if ((output[0] == '\0') ||
|
||||
(QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 2))
|
||||
@ -117,7 +138,7 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
||||
}
|
||||
else if (gpudev == QString("ati"))
|
||||
{
|
||||
f_out = popen("aticonfig --od-gettemperature | grep Temperature | tail -n1 2>&1", "r");
|
||||
f_out = popen("aticonfig --od-gettemperature 2> /dev/null | grep Temperature | tail -n1", "r");
|
||||
fgets (output, 256, f_out);
|
||||
if ((output[0] == '\0') ||
|
||||
(QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 4))
|
||||
@ -147,7 +168,7 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
||||
{
|
||||
qb = hdddev[i].toUtf8();
|
||||
dev = qb.data();
|
||||
sprintf(command, "hddtemp %s", dev);
|
||||
sprintf(command, "hddtemp %s 2> /dev/null", dev);
|
||||
f_out = popen(command, "r");
|
||||
fgets(output, 256, f_out);
|
||||
if ((output[0] == '\0') ||
|
||||
@ -166,10 +187,75 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
||||
setData(source, hdddev[i], value);
|
||||
}
|
||||
}
|
||||
else if (source == QString("player"))
|
||||
{
|
||||
// qmmp
|
||||
output[0] = '\0';
|
||||
key = QString("qmmp_artist");
|
||||
f_out = popen("qmmp --nowplaying '%if(%p,%p,Unknown)' 2> /dev/null", "r");
|
||||
fgets(output, 256, f_out);
|
||||
if (output[0] == '\0')
|
||||
value = QString("N\\A");
|
||||
else
|
||||
value = QString(output).split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
pclose(f_out);
|
||||
setData(source, key, value);
|
||||
output[0] = '\0';
|
||||
key = QString("qmmp_title");
|
||||
f_out = popen("qmmp --nowplaying '%if(%t,%t,Unknown)' 2> /dev/null", "r");
|
||||
fgets(output, 256, f_out);
|
||||
if (output[0] == '\0')
|
||||
value = QString("N\\A");
|
||||
else
|
||||
value = QString(output).split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
pclose(f_out);
|
||||
setData(source, key, value);
|
||||
// amarok
|
||||
output[0] = '\0';
|
||||
key = QString("amarok_artist");
|
||||
f_out = popen("qdbus org.kde.amarok /Player GetMetadata 2> /dev/null | grep albumartist: | cut -c14-", "r");
|
||||
fgets(output, 256, f_out);
|
||||
if (output[0] == '\0')
|
||||
value = QString("N\\A");
|
||||
else
|
||||
value = QString(output).split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
pclose(f_out);
|
||||
setData(source, key, value);
|
||||
output[0] = '\0';
|
||||
key = QString("amarok_title");
|
||||
f_out = popen("qdbus org.kde.amarok /Player GetMetadata 2> /dev/null | grep title: | cut -c8-", "r");
|
||||
fgets(output, 256, f_out);
|
||||
if (output[0] == '\0')
|
||||
value = QString("N\\A");
|
||||
else
|
||||
value = QString(output).split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
pclose(f_out);
|
||||
setData(source, key, value);
|
||||
// mpd
|
||||
QString value_artist;
|
||||
value = QString("N\\A");
|
||||
value_artist = QString("N\\A");
|
||||
f_out = popen("echo 'currentsong\nclose' | curl --connect-timeout 1 -fsm 3 telnet://localhost:6600 2> /dev/null", "r");
|
||||
while (true)
|
||||
{
|
||||
fgets(output, 256, f_out);
|
||||
if (feof (f_out))
|
||||
break;
|
||||
if (QString(output).split(QString(": "), QString::SkipEmptyParts)[0] == QString("Artist"))
|
||||
value_artist = QString(output).split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
else if (QString(output).split(QString(": "), QString::SkipEmptyParts)[0] == QString("Title"))
|
||||
value = QString(output).split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
|
||||
}
|
||||
pclose(f_out);
|
||||
key = QString("mpd_artist");
|
||||
setData(source, key, value_artist);
|
||||
key = QString("mpd_title");
|
||||
setData(source, key, value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
K_EXPORT_PLASMA_DATAENGINE(extsysmon, ExtendedSysMon)
|
||||
|
||||
#include "extsysmon.moc"
|
||||
#include "extsysmon.moc"
|
||||
|
@ -1,3 +1,22 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2013 by Evgeniy Alekseev <esalekseev@gmail.com> *
|
||||
* *
|
||||
* 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 2 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, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef EXTSYSMON_H
|
||||
#define EXTSYSMON_H
|
||||
|
||||
|
@ -13,7 +13,7 @@ X-Plasma-EngineName=ext-sysmon
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||
X-KDE-PluginInfo-Name=ext-sysmon
|
||||
X-KDE-PluginInfo-Version=1.2
|
||||
X-KDE-PluginInfo-Version=1.3
|
||||
X-KDE-PluginInfo-Category=System Information
|
||||
X-KDE-PluginInfo-Depends=
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
|
@ -1,9 +1,14 @@
|
||||
post_install()
|
||||
func_update()
|
||||
{
|
||||
cat << EOF
|
||||
Update plasmoids...
|
||||
EOF
|
||||
kbuildsycoca4 > /dev/null 2>&1
|
||||
}
|
||||
|
||||
post_install()
|
||||
{
|
||||
func_update
|
||||
cat << EOF
|
||||
Make sure that \`hddtemp\` can be run as non-root
|
||||
EOF
|
||||
@ -11,10 +16,10 @@ EOF
|
||||
|
||||
post_upgrade()
|
||||
{
|
||||
post_install
|
||||
func_update
|
||||
}
|
||||
|
||||
post_remove()
|
||||
{
|
||||
post_install
|
||||
func_update
|
||||
}
|
||||
|
Binary file not shown.
BIN
old_versions/py-text-monitor-1.3.6.plasmoid
Normal file
BIN
old_versions/py-text-monitor-1.3.6.plasmoid
Normal file
Binary file not shown.
BIN
old_versions/py-text-monitor-1.4.0.plasmoid
Normal file
BIN
old_versions/py-text-monitor-1.4.0.plasmoid
Normal file
Binary file not shown.
Binary file not shown.
BIN
py-text-monitor-1.5.1.plasmoid
Normal file
BIN
py-text-monitor-1.5.1.plasmoid
Normal file
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 205 KiB After Width: | Height: | Size: 175 KiB |
@ -1,5 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2012 Alex Oleshkevich <alex.oleshkevich@gmail.com>
|
||||
#
|
||||
# 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 2 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, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
from util import *
|
||||
|
||||
|
||||
|
@ -1,5 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2013 Evgeniy Alekseev <esalexeev@gmail.com>
|
||||
#
|
||||
# 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 2 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, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyKDE4.kdecore import *
|
||||
from PyKDE4.kdeui import *
|
||||
@ -37,15 +53,15 @@ class ConfigDefinition:
|
||||
settings.set('font_weight', self.parent.font_weight)
|
||||
|
||||
# disconnecting from source and clear layout
|
||||
if (self.parent.uptimeBool == 1):
|
||||
if (self.parent.uptimeBool > 0):
|
||||
self.parent.systemmonitor.disconnectSource("system/uptime", self.parent)
|
||||
self.parent.label_uptime.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_uptime)
|
||||
if (self.parent.cpuBool == 1):
|
||||
if (self.parent.cpuBool > 0):
|
||||
self.parent.systemmonitor.disconnectSource("cpu/system/TotalLoad", self.parent)
|
||||
if (self.parent.cpuFormat.split('$ccpu')[0] != self.parent.cpuFormat):
|
||||
self.parent.label_cpu0.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_cpu0)
|
||||
self.parent.label_cpu.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_cpu)
|
||||
self.parent.label_cpu1.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_cpu1)
|
||||
for core in range(self.parent.numCores):
|
||||
@ -55,11 +71,11 @@ class ConfigDefinition:
|
||||
else:
|
||||
self.parent.label_cpu.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_cpu)
|
||||
if (self.parent.cpuclockBool == 1):
|
||||
if (self.parent.cpuclockBool > 0):
|
||||
self.parent.systemmonitor.disconnectSource("cpu/system/AverageClock", self.parent)
|
||||
if (self.parent.cpuclockFormat.split('$ccpu')[0] != self.parent.cpuclockFormat):
|
||||
self.parent.label_cpuclock0.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_cpuclock0)
|
||||
self.parent.label_cpuclock.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_cpuclock)
|
||||
self.parent.label_cpuclock1.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_cpuclock1)
|
||||
for core in range(self.parent.numCores):
|
||||
@ -69,32 +85,32 @@ class ConfigDefinition:
|
||||
else:
|
||||
self.parent.label_cpuclock.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_cpuclock)
|
||||
if (self.parent.tempBool == 1):
|
||||
if (self.parent.tempBool > 0):
|
||||
self.parent.systemmonitor.disconnectSource(self.parent.tempdev, self.parent)
|
||||
self.parent.label_temp.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_temp)
|
||||
if (self.parent.gpuBool == 1):
|
||||
if (self.parent.gpuBool > 0):
|
||||
self.parent.extsysmon.disconnectSource("gpu", self.parent)
|
||||
self.parent.label_gpu.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_gpu)
|
||||
if (self.parent.gputempBool == 1):
|
||||
if (self.parent.gputempBool > 0):
|
||||
self.parent.extsysmon.disconnectSource("gputemp", self.parent)
|
||||
self.parent.label_gputemp.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_gputemp)
|
||||
if (self.parent.memBool == 1):
|
||||
if (self.parent.memBool > 0):
|
||||
self.parent.systemmonitor.disconnectSource("mem/physical/application", self.parent)
|
||||
if (self.parent.memInMb == False):
|
||||
self.parent.systemmonitor.disconnectSource("mem/physical/free", self.parent)
|
||||
self.parent.systemmonitor.disconnectSource("mem/physical/used", self.parent)
|
||||
self.parent.label_mem.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_mem)
|
||||
if (self.parent.swapBool == 1):
|
||||
if (self.parent.swapBool > 0):
|
||||
self.parent.systemmonitor.disconnectSource("mem/swap/used", self.parent)
|
||||
if (self.parent.swapInMb == False):
|
||||
self.parent.systemmonitor.disconnectSource("mem/swap/free", self.parent)
|
||||
self.parent.label_swap.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_swap)
|
||||
if (self.parent.hddBool == 1):
|
||||
if (self.parent.hddBool > 0):
|
||||
for mount in self.parent.mountPoints:
|
||||
self.parent.systemmonitor.disconnectSource("partitions" + mount + "/filllevel", self.parent)
|
||||
exec ('self.parent.label_hdd_' + ''.join(mount.split('/')) + '.setText("")')
|
||||
@ -103,30 +119,36 @@ class ConfigDefinition:
|
||||
self.parent.label_hdd1.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_hdd0)
|
||||
self.parent.layout.removeItem(self.parent.label_hdd1)
|
||||
if (self.parent.hddtempBool == 1):
|
||||
if (self.parent.hddtempBool > 0):
|
||||
self.parent.extsysmon.disconnectSource("hddtemp", self.parent)
|
||||
self.parent.label_hddtemp.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_hddtemp)
|
||||
if (self.parent.netBool == 1):
|
||||
if (self.parent.netBool > 0):
|
||||
self.parent.systemmonitor.disconnectSource("network/interfaces/"+self.parent.netdev+"/transmitter/data", self.parent)
|
||||
self.parent.systemmonitor.disconnectSource("network/interfaces/"+self.parent.netdev+"/receiver/data", self.parent)
|
||||
self.parent.label_netDown.setText('')
|
||||
self.parent.label_netUp.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_netUp)
|
||||
self.parent.layout.removeItem(self.parent.label_netDown)
|
||||
if (self.parent.batBool == 1):
|
||||
if (self.parent.batBool > 0):
|
||||
self.parent.label_bat.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_bat)
|
||||
if (self.parent.playerBool > 0):
|
||||
self.parent.extsysmon.disconnectSource("player", self.parent)
|
||||
self.parent.label_player.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_player)
|
||||
if (self.parent.timeBool > 0):
|
||||
self.parent.timemon.disconnectSource("Local", self.parent)
|
||||
self.parent.label_time.setText('')
|
||||
self.parent.layout.removeItem(self.parent.label_time)
|
||||
|
||||
self.parent.label_order = "------------"
|
||||
self.parent.label_order = "--------------"
|
||||
|
||||
for label in self.parent.dict_orders.keys():
|
||||
if (self.configpage.checkboxes[self.parent.dict_orders[label]].checkState() == 2):
|
||||
exec ('self.parent.' + self.parent.dict_orders[label] + 'Bool = 1')
|
||||
exec ('self.parent.' + self.parent.dict_orders[label] + 'Bool = ' + str(self.configpage.checkboxes[self.parent.dict_orders[label]].checkState()))
|
||||
if (self.configpage.checkboxes[self.parent.dict_orders[label]].checkState() > 0):
|
||||
pos = self.configpage.sliders[self.parent.dict_orders[label]].value() - 1
|
||||
self.parent.label_order = self.parent.label_order[:pos] + label + self.parent.label_order[pos+1:]
|
||||
else:
|
||||
exec ('self.parent.' + self.parent.dict_orders[label] + 'Bool = 0')
|
||||
if (self.parent.dict_orders[label] == 'net'):
|
||||
exec ('self.parent.' + self.parent.dict_orders[label] + 'NonFormat = str(self.configpage.lineedits[self.parent.dict_orders[label]].text())')
|
||||
exec ('settings.set("' + self.parent.dict_orders[label] + 'NonFormat", self.parent.' + self.parent.dict_orders[label] + 'NonFormat)')
|
||||
@ -142,12 +164,15 @@ class ConfigDefinition:
|
||||
elif (self.parent.dict_orders[label] == 'temp'):
|
||||
self.parent.tempdev = str(self.configpage.ui.comboBox_temp.currentText())
|
||||
settings.set('temp_device', self.parent.tempdev)
|
||||
elif (self.parent.dict_orders[label] == 'player'):
|
||||
self.parent.player_name = self.configpage.ui.comboBox_player.currentIndex()
|
||||
settings.set('player_name', self.parent.player_name)
|
||||
|
||||
self.parent.label_order = ''.join(self.parent.label_order.split('-'))
|
||||
settings.set('label_order', self.parent.label_order)
|
||||
|
||||
# reinitializate
|
||||
self.parent.reinit.reinit()
|
||||
self.parent.reinit.reinit(confAccept=True)
|
||||
|
||||
|
||||
def createConfigurationInterface(self, parent):
|
||||
@ -167,11 +192,9 @@ class ConfigDefinition:
|
||||
self.configpage.ui.spinBox_weight.setValue(settings.get('font_weight', 400).toInt()[0])
|
||||
for label in self.parent.dict_orders.keys():
|
||||
exec ('bool = self.parent.' + self.parent.dict_orders[label] + 'Bool')
|
||||
if (bool == 1):
|
||||
self.configpage.checkboxes[self.parent.dict_orders[label]].setCheckState(2)
|
||||
self.configpage.checkboxes[self.parent.dict_orders[label]].setCheckState(bool)
|
||||
if (bool > 0):
|
||||
self.configpage.sliders[self.parent.dict_orders[label]].setValue(self.parent.label_order.find(label)+1)
|
||||
else:
|
||||
self.configpage.checkboxes[self.parent.dict_orders[label]].setCheckState(0)
|
||||
if (self.parent.dict_orders[label] == 'net'):
|
||||
self.configpage.lineedits[self.parent.dict_orders[label]].setText(str(settings.get(self.parent.dict_orders[label] + 'NonFormat', self.parent.dict_defFormat[self.parent.dict_orders[label]])))
|
||||
else:
|
||||
@ -190,6 +213,8 @@ class ConfigDefinition:
|
||||
self.configpage.ui.comboBox_temp.addItem(tempdev)
|
||||
except:
|
||||
pass
|
||||
elif (self.parent.dict_orders[label] == 'player'):
|
||||
self.configpage.ui.comboBox_player.setCurrentIndex(int(settings.get('player_name', 0)))
|
||||
|
||||
# add config page
|
||||
page = parent.addPage(self.configpage, i18n(self.parent.name()))
|
||||
|
@ -1,5 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2013 Evgeniy Alekseev <esalexeev@gmail.com>
|
||||
#
|
||||
# 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 2 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, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from PyKDE4.plasma import *
|
||||
@ -19,19 +35,22 @@ class ConfigWindow(QWidget):
|
||||
'gputemp':self.ui.checkBox_gpuTemp, 'hdd':self.ui.checkBox_hdd,
|
||||
'hddtemp':self.ui.checkBox_hddTemp, 'mem':self.ui.checkBox_mem,
|
||||
'net':self.ui.checkBox_net, 'swap':self.ui.checkBox_swap,
|
||||
'temp':self.ui.checkBox_temp, 'uptime':self.ui.checkBox_uptime}
|
||||
'temp':self.ui.checkBox_temp, 'uptime':self.ui.checkBox_uptime,
|
||||
'player':self.ui.checkBox_player, 'time':self.ui.checkBox_time}
|
||||
self.sliders = {'bat':self.ui.slider_bat, 'cpu':self.ui.slider_cpu,
|
||||
'cpuclock':self.ui.slider_cpuclock, 'gpu':self.ui.slider_gpu,
|
||||
'gputemp':self.ui.slider_gpuTemp, 'hdd':self.ui.slider_hdd,
|
||||
'hddtemp':self.ui.slider_hddTemp, 'mem':self.ui.slider_mem,
|
||||
'net':self.ui.slider_net, 'swap':self.ui.slider_swap,
|
||||
'temp':self.ui.slider_temp, 'uptime':self.ui.slider_uptime}
|
||||
'temp':self.ui.slider_temp, 'uptime':self.ui.slider_uptime,
|
||||
'player':self.ui.slider_player, 'time':self.ui.slider_time}
|
||||
self.lineedits = {'bat':self.ui.lineEdit_bat, 'cpu':self.ui.lineEdit_cpu,
|
||||
'cpuclock':self.ui.lineEdit_cpuclock, 'gpu':self.ui.lineEdit_gpu,
|
||||
'gputemp':self.ui.lineEdit_gpuTemp, 'hdd':self.ui.lineEdit_hdd,
|
||||
'hddtemp':self.ui.lineEdit_hddTemp, 'mem':self.ui.lineEdit_mem,
|
||||
'net':self.ui.lineEdit_net, 'swap':self.ui.lineEdit_swap,
|
||||
'temp':self.ui.lineEdit_temp, 'uptime':self.ui.lineEdit_uptime}
|
||||
'temp':self.ui.lineEdit_temp, 'uptime':self.ui.lineEdit_uptime,
|
||||
'player':self.ui.lineEdit_player, 'time':self.ui.lineEdit_time}
|
||||
|
||||
for item in self.checkboxes.values():
|
||||
QObject.connect(item, SIGNAL("stateChanged(int)"), self.setStatus)
|
||||
@ -43,7 +62,7 @@ class ConfigWindow(QWidget):
|
||||
"""function to enable label"""
|
||||
count = self.sliders['bat'].maximum()
|
||||
for label in self.checkboxes.keys():
|
||||
if ((self.checkboxes[label].checkState() == 2) and (self.sliders[label].isEnabled() == False)):
|
||||
if ((self.checkboxes[label].checkState() > 0) and (self.sliders[label].isEnabled() == False)):
|
||||
self.lineedits[label].setEnabled(True)
|
||||
self.sliders[label].setEnabled(True)
|
||||
if (label == 'bat'):
|
||||
@ -51,6 +70,8 @@ class ConfigWindow(QWidget):
|
||||
self.ui.lineEdit_batdev.setEnabled(True)
|
||||
elif (label == 'temp'):
|
||||
self.ui.comboBox_temp.setEnabled(True)
|
||||
elif (label == 'player'):
|
||||
self.ui.comboBox_player.setEnabled(True)
|
||||
slider_label = 0
|
||||
for slider in self.sliders.values():
|
||||
if (slider.isEnabled() == True):
|
||||
@ -69,6 +90,8 @@ class ConfigWindow(QWidget):
|
||||
self.ui.lineEdit_batdev.setDisabled(True)
|
||||
elif (label == 'temp'):
|
||||
self.ui.comboBox_temp.setDisabled(True)
|
||||
elif (label == 'player'):
|
||||
self.ui.comboBox_player.setDisabled(True)
|
||||
for slider in self.sliders.values():
|
||||
if ((slider.value() == slider.maximum()) and (slider != self.sliders[label])):
|
||||
slider.setValue(self.sliders[label].value())
|
||||
|
@ -1,5 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2013 Evgeniy Alekseev <esalexeev@gmail.com>
|
||||
#
|
||||
# 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 2 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, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from PyKDE4.plasma import Plasma
|
||||
@ -16,49 +32,55 @@ class DataEngine:
|
||||
def connectToEngine(self):
|
||||
"""function to initializate engine"""
|
||||
self.parent.systemmonitor = self.parent.dataEngine("systemmonitor")
|
||||
if ((self.parent.gputempBool == 1) or (self.parent.gpuBool == 1) or (self.parent.hddtempBool == 1)):
|
||||
if ((self.parent.gputempBool > 0) or (self.parent.gpuBool > 0) or (self.parent.hddtempBool > 0) or (self.parent.playerBool > 0)):
|
||||
self.parent.extsysmon = self.parent.dataEngine("ext-sysmon")
|
||||
|
||||
if (self.parent.uptimeBool == 1):
|
||||
if (self.parent.timeBool > 0):
|
||||
self.parent.timemon = self.parent.dataEngine("time")
|
||||
self.parent.timemon.connectSource("Local", self.parent, 1000)
|
||||
|
||||
if (self.parent.uptimeBool > 0):
|
||||
self.parent.systemmonitor.connectSource("system/uptime", self.parent, self.parent.interval)
|
||||
if (self.parent.cpuBool == 1):
|
||||
if (self.parent.cpuBool > 0):
|
||||
self.parent.systemmonitor.connectSource("cpu/system/TotalLoad", self.parent, self.parent.interval)
|
||||
if (self.parent.cpuFormat.split('$ccpu')[0] != self.parent.cpuFormat):
|
||||
for core in range(self.parent.numCores):
|
||||
self.parent.systemmonitor.connectSource("cpu/cpu"+str(core)+"/TotalLoad", self.parent, self.parent.interval)
|
||||
if (self.parent.cpuclockBool == 1):
|
||||
if (self.parent.cpuclockBool > 0):
|
||||
self.parent.systemmonitor.connectSource("cpu/system/AverageClock", self.parent, self.parent.interval)
|
||||
if (self.parent.cpuclockFormat.split('$ccpucl')[0] != self.parent.cpuclockFormat):
|
||||
for core in range(self.parent.numCores):
|
||||
self.parent.systemmonitor.connectSource("cpu/cpu"+str(core)+"/clock", self.parent, self.parent.interval)
|
||||
if (self.parent.tempBool == 1):
|
||||
if (self.parent.tempBool > 0):
|
||||
self.parent.systemmonitor.connectSource(self.parent.tempdev, self.parent, self.parent.interval)
|
||||
if (self.parent.gpuBool == 1):
|
||||
if (self.parent.gpuBool > 0):
|
||||
self.parent.extsysmon.connectSource("gpu", self.parent, self.parent.interval)
|
||||
if (self.parent.gputempBool == 1):
|
||||
if (self.parent.gputempBool > 0):
|
||||
self.parent.extsysmon.connectSource("gputemp", self.parent, self.parent.interval)
|
||||
if (self.parent.memBool == 1):
|
||||
if (self.parent.memBool > 0):
|
||||
if (self.parent.memInMb):
|
||||
self.parent.systemmonitor.connectSource("mem/physical/application", self.parent, self.parent.interval)
|
||||
else:
|
||||
self.parent.systemmonitor.connectSource("mem/physical/free", self.parent, int(self.parent.interval*0.5))
|
||||
self.parent.systemmonitor.connectSource("mem/physical/used", self.parent, int(self.parent.interval*0.5))
|
||||
self.parent.systemmonitor.connectSource("mem/physical/application", self.parent, int(self.parent.interval*0.5))
|
||||
if (self.parent.swapBool == 1):
|
||||
if (self.parent.swapBool > 0):
|
||||
if (self.parent.swapInMb):
|
||||
self.parent.systemmonitor.connectSource("mem/swap/used", self.parent, self.parent.interval)
|
||||
else:
|
||||
self.parent.systemmonitor.connectSource("mem/swap/free", self.parent, int(self.parent.interval*0.5))
|
||||
self.parent.systemmonitor.connectSource("mem/swap/used", self.parent, int(self.parent.interval*0.5))
|
||||
if (self.parent.hddBool == 1):
|
||||
if (self.parent.hddBool > 0):
|
||||
for mount in self.parent.mountPoints:
|
||||
self.parent.systemmonitor.connectSource("partitions" + mount + "/filllevel", self.parent, self.parent.interval)
|
||||
if (self.parent.hddtempBool == 1):
|
||||
if (self.parent.hddtempBool > 0):
|
||||
self.parent.extsysmon.connectSource("hddtemp", self.parent, self.parent.interval)
|
||||
if (self.parent.netBool == 1):
|
||||
if (self.parent.netBool > 0):
|
||||
self.parent.updateNetdev = 0
|
||||
self.parent.systemmonitor.connectSource("network/interfaces/"+self.parent.netdev+"/transmitter/data", self.parent, self.parent.interval)
|
||||
self.parent.systemmonitor.connectSource("network/interfaces/"+self.parent.netdev+"/receiver/data", self.parent, self.parent.interval)
|
||||
if (self.parent.playerBool > 0):
|
||||
self.parent.extsysmon.connectSource("player", self.parent, self.parent.interval)
|
||||
|
||||
def dataUpdated(self, sourceName, data):
|
||||
"""function to update data"""
|
||||
@ -81,7 +103,7 @@ class DataEngine:
|
||||
else:
|
||||
line = self.parent.cpuFormat.split('$ccpu')[0]
|
||||
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
|
||||
self.parent.label_cpu0.setText(text)
|
||||
self.parent.label_cpu.setText(text)
|
||||
if (self.parent.cpuFormat.split('$ccpu')[1].split('$cpu')[0] != self.parent.cpuFormat.split('$ccpu')[1]):
|
||||
line = self.parent.cpuFormat.split('$ccpu')[1].split('$cpu')[0] + cpuText + self.parent.cpuFormat.split('$ccpu')[1].split('$cpu')[1]
|
||||
else:
|
||||
@ -109,7 +131,7 @@ class DataEngine:
|
||||
else:
|
||||
line = self.parent.cpuclockFormat.split('$ccpucl')[0]
|
||||
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
|
||||
self.parent.label_cpuclock0.setText(text)
|
||||
self.parent.label_cpuclock.setText(text)
|
||||
if (self.parent.cpuclockFormat.split('$ccpucl')[1].split('$cpucl')[0] != self.parent.cpuclockFormat.split('$ccpucl')[1]):
|
||||
line = self.parent.cpuclockFormat.split('$ccpucl')[1].split('$cpucl')[0] + cpuclockText + self.parent.cpuclockFormat.split('$ccpucl')[1].split('$cpucl')[1]
|
||||
else:
|
||||
@ -153,7 +175,7 @@ class DataEngine:
|
||||
if (self.parent.netNonFormat.split('@@')[0] == self.parent.netNonFormat):
|
||||
self.parent.systemmonitor.disconnectSource("network/interfaces/"+self.parent.netdev+"/transmitter/data", self.parent)
|
||||
self.parent.systemmonitor.disconnectSource("network/interfaces/"+self.parent.netdev+"/receiver/data", self.parent)
|
||||
self.parent.setupNetdev()
|
||||
self.parent.netdev = self.parent.setupNetdev()
|
||||
self.parent.systemmonitor.connectSource("network/interfaces/"+self.parent.netdev+"/transmitter/data", self.parent, self.parent.interval)
|
||||
self.parent.systemmonitor.connectSource("network/interfaces/"+self.parent.netdev+"/receiver/data", self.parent, self.parent.interval)
|
||||
if (self.parent.netNonFormat.split('$netdev')[0] != self.parent.netNonFormat):
|
||||
@ -231,7 +253,36 @@ class DataEngine:
|
||||
line = self.parent.hddtempFormat
|
||||
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
|
||||
self.parent.label_hddtemp.setText(text)
|
||||
|
||||
elif (sourceName == "player"):
|
||||
if (self.parent.player_name == 0):
|
||||
title = str(data[QString(u'amarok_title')])
|
||||
artist = str(data[QString(u'amarok_artist')])
|
||||
elif (self.parent.player_name == 1):
|
||||
title = str(data[QString(u'mpd_title')])
|
||||
artist = str(data[QString(u'mpd_artist')])
|
||||
elif (self.parent.player_name == 2):
|
||||
title = str(data[QString(u'qmmp_title')])
|
||||
artist = str(data[QString(u'qmmp_artist')])
|
||||
if (self.parent.playerFormat.split('$artist')[0] != self.parent.playerFormat):
|
||||
if ((len(artist) + len(title)) > 10):
|
||||
line = self.parent.playerFormat.split('$artist')[0] + artist[:5] + u"…" + self.parent.playerFormat.split('$artist')[1]
|
||||
else:
|
||||
line = self.parent.playerFormat.split('$artist')[0] + artist + self.parent.playerFormat.split('$artist')[1]
|
||||
else:
|
||||
line = self.parent.playerFormat
|
||||
if (line.split('$title') != line):
|
||||
line = line.split('$title')[0] + title + line.split('$title')[1]
|
||||
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
|
||||
self.parent.label_player.setText(text)
|
||||
elif (sourceName == "Local"):
|
||||
value = str(data[QString(u'DateTime')].toString().toUtf8())
|
||||
if (self.parent.timeFormat.split('$time')[0] != self.parent.timeFormat):
|
||||
line = self.parent.timeFormat.split('$time')[0] + value.decode("utf-8") + self.parent.timeFormat.split('$time')[1]
|
||||
else:
|
||||
line = self.parent.timeFormat
|
||||
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
|
||||
self.parent.label_time.setText(text)
|
||||
|
||||
self.parent.update()
|
||||
except:
|
||||
pass
|
||||
|
@ -1,5 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2013 Evgeniy Alekseev <esalexeev@gmail.com>
|
||||
#
|
||||
# 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 2 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, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from PyKDE4.kdecore import *
|
||||
@ -7,7 +23,7 @@ from PyKDE4.kdeui import *
|
||||
from PyKDE4.kio import *
|
||||
from PyKDE4 import plasmascript
|
||||
from PyKDE4.plasma import Plasma
|
||||
import commands, os, time
|
||||
import commands, os, shutil, time
|
||||
|
||||
import configdef
|
||||
import configwindow
|
||||
@ -21,8 +37,8 @@ class pyTextWidget(plasmascript.Applet):
|
||||
def __init__(self, parent, args=None):
|
||||
"""widget definition"""
|
||||
plasmascript.Applet.__init__(self, parent)
|
||||
|
||||
|
||||
|
||||
|
||||
def init(self):
|
||||
"""function to initializate widget"""
|
||||
self._name = str(self.package().metadata().pluginName())
|
||||
@ -36,9 +52,14 @@ class pyTextWidget(plasmascript.Applet):
|
||||
QObject.connect(self.timer, SIGNAL("timeout()"), self.updateLabel)
|
||||
|
||||
self.setupVar()
|
||||
self.reinit.reinit()
|
||||
self.reinit.reinit(confAccept=False)
|
||||
|
||||
self.setHasConfigurationInterface(True)
|
||||
# Create notifyrc file if required
|
||||
kdehome = unicode(KGlobal.dirs().localkdedir())
|
||||
if ((not os.path.exists(kdehome + "/share/apps/plasma_applet_pytextmonitor/plasma_applet_pytextmonitor.notifyrc")) and
|
||||
(not os.path.exists("/usr" + "/share/apps/plasma_applet_pytextmonitor/plasma_applet_pytextmonitor.notifyrc"))):
|
||||
self.createNotifyrc(kdehome)
|
||||
|
||||
|
||||
def createConfigurationInterface(self, parent):
|
||||
@ -48,6 +69,14 @@ class pyTextWidget(plasmascript.Applet):
|
||||
self.configdef.createConfigurationInterface(parent)
|
||||
|
||||
|
||||
def createNotifyrc(self, kdehome):
|
||||
"""function to create *.notifyrc"""
|
||||
if (not os.path.isdir(kdehome + "/share/apps/plasma_applet_pytextmonitor")):
|
||||
os.mkdir(kdehome + "/share/apps/plasma_applet_pytextmonitor")
|
||||
shutil.copy(kdehome + "/share/apps/plasma/plasmoids/py-text-monitor/contents/code/plasma_applet_pytextmonitor.notifyrc",
|
||||
kdehome + "/share/apps/plasma_applet_pytextmonitor/")
|
||||
|
||||
|
||||
def initTooltip(self):
|
||||
"""function to create tooltip"""
|
||||
self.tooltip = Plasma.ToolTipContent()
|
||||
@ -57,29 +86,30 @@ class pyTextWidget(plasmascript.Applet):
|
||||
# show tooltip
|
||||
#Plasma.ToolTipManager.self().setContent(self.applet, self.tooltip)
|
||||
|
||||
|
||||
|
||||
def mouseDoubleClickEvent(self, event):
|
||||
"""function to doubleclick event"""
|
||||
os.system("ksysguard")
|
||||
os.system("ksysguard &")
|
||||
|
||||
|
||||
|
||||
def setupNetdev(self):
|
||||
"""function to setup network device"""
|
||||
self.netdev = "lo"
|
||||
netdev = "lo"
|
||||
try:
|
||||
interfaces = []
|
||||
for line in commands.getoutput("ifconfig -a").split("\n"):
|
||||
if ((line != '') and (line[0] != ' ') and (line.split(":")[0].split()[0] != 'lo')):
|
||||
interfaces.append(line.split(":")[0].split()[0])
|
||||
for line in commands.getoutput("ifconfig -a -s").split("\n"):
|
||||
if ((line.split()[0] != 'Iface') and (line.split()[0] != 'lo')):
|
||||
interfaces.append(line.split()[0])
|
||||
|
||||
for device in interfaces:
|
||||
if (commands.getoutput("ifconfig " + device + " | grep 'inet '") != ''):
|
||||
self.netdev = device
|
||||
netdev = device
|
||||
break
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
return netdev
|
||||
|
||||
|
||||
def setupVar(self):
|
||||
"""function to setup variables"""
|
||||
self.netdev = ''
|
||||
@ -89,19 +119,21 @@ class pyTextWidget(plasmascript.Applet):
|
||||
|
||||
# create dictionaries
|
||||
self.dict_orders = {'6':'bat', '1':'cpu', '7':'cpuclock', '9':'gpu', 'a':'gputemp',
|
||||
'b':'hdd', 'c':'hddtemp', '3':'mem', '5':'net', '4':'swap', '2':'temp', '8':'uptime'}
|
||||
'b':'hdd', 'c':'hddtemp', '3':'mem', '5':'net', '4':'swap', '2':'temp', '8':'uptime',
|
||||
'd':'player', 'e':'time'}
|
||||
self.dict_defFormat = {'bat':'[bat: $bat%$ac]', 'cpu':'[cpu: $cpu%]',
|
||||
'cpuclock':'[mhz: $cpucl]', 'gpu':'[gpu: $gpu%]',
|
||||
'gputemp':'[gpu temp: $gputemp°C]', 'hdd':'[hdd: @@/@@%]',
|
||||
'hddtemp':'[hdd temp: @@/dev/sda@@°C]', 'mem':'[mem: $mem%]',
|
||||
'net':'[$netdev: $netKB/s]', 'swap':'[swap: $swap%]',
|
||||
'temp':'[temp: $temp°C]', 'uptime':'[uptime: $uptime]'}
|
||||
'temp':'[temp: $temp°C]', 'uptime':'[uptime: $uptime]',
|
||||
'player':'[$artist - $title]', 'time':'[$time]'}
|
||||
|
||||
def showConfigurationInterface(self):
|
||||
"""function to show configuration window"""
|
||||
plasmascript.Applet.showConfigurationInterface(self)
|
||||
|
||||
|
||||
|
||||
|
||||
def startPolling(self):
|
||||
try:
|
||||
self.timer.start()
|
||||
@ -113,17 +145,17 @@ class pyTextWidget(plasmascript.Applet):
|
||||
self.label_error.setText('<font color="red">ERROR</font>')
|
||||
self.layout.addItem(self.label_error)
|
||||
return
|
||||
|
||||
|
||||
def updateLabel(self):
|
||||
"""function to update label"""
|
||||
if ((self.memBool == 1) and (self.memInMb == False)):
|
||||
if ((self.memBool > 0) and (self.memInMb == False)):
|
||||
self.memText()
|
||||
if ((self.swapBool == 1) and (self.swapInMb == False)):
|
||||
if ((self.swapBool > 0) and (self.swapInMb == False)):
|
||||
self.swapText()
|
||||
if (self.batBool == 1):
|
||||
if (self.batBool > 0):
|
||||
self.batText()
|
||||
|
||||
|
||||
|
||||
|
||||
def batText(self):
|
||||
"""function to set battery text"""
|
||||
line = self.batFormat
|
||||
@ -149,8 +181,8 @@ class pyTextWidget(plasmascript.Applet):
|
||||
line = line.split('$ac')[0] + bat + line.split('$ac')[1]
|
||||
text = self.formatLine.split('$LINE')[0] + line + self.formatLine.split('$LINE')[1]
|
||||
self.label_bat.setText(text)
|
||||
|
||||
|
||||
|
||||
|
||||
def memText(self):
|
||||
"""function to set mem text"""
|
||||
full = self.mem_uf + self.mem_free
|
||||
@ -162,8 +194,8 @@ class pyTextWidget(plasmascript.Applet):
|
||||
line = self.memFormat
|
||||
text = self.formatLine.split('$LINE')[0] + line + self.formatLine.split('$LINE')[1]
|
||||
self.label_mem.setText(text)
|
||||
|
||||
|
||||
|
||||
|
||||
def swapText(self):
|
||||
"""function to set swap text"""
|
||||
full = self.swap_used + self.swap_free
|
||||
@ -185,4 +217,4 @@ class pyTextWidget(plasmascript.Applet):
|
||||
|
||||
|
||||
def CreateApplet(parent):
|
||||
return pyTextWidget(parent)
|
||||
return pyTextWidget(parent)
|
||||
|
49
sources/contents/code/plasma_applet_pytextmonitor.notifyrc
Normal file
49
sources/contents/code/plasma_applet_pytextmonitor.notifyrc
Normal file
@ -0,0 +1,49 @@
|
||||
[Global]
|
||||
IconName=system
|
||||
Name=PyTextMonitor
|
||||
Comment=PyTextMonitor information
|
||||
|
||||
[Event/system]
|
||||
Name=System information
|
||||
Comment=System information
|
||||
Action=Popup
|
||||
|
||||
[Event/processor]
|
||||
Name=Processor information
|
||||
Comment=Processor information
|
||||
Action=Popup
|
||||
|
||||
[Event/graphical]
|
||||
Name=GPU information
|
||||
Comment=GPU information
|
||||
Action=Popup
|
||||
|
||||
[Event/memory]
|
||||
Name=Memory information
|
||||
Comment=Memory information
|
||||
Action=Popup
|
||||
|
||||
[Event/disk]
|
||||
Name=Disk information
|
||||
Comment=Disk information
|
||||
Action=Popup
|
||||
|
||||
[Event/network]
|
||||
Name=Network information
|
||||
Comment=Network information
|
||||
Action=Popup
|
||||
|
||||
[Event/battery]
|
||||
Name=Battery information
|
||||
Comment=Battery information
|
||||
Action=Popup
|
||||
|
||||
[Event/graphinfo]
|
||||
Name=Graphical Information
|
||||
Comment=Graphical Information
|
||||
Action=Popup
|
||||
|
||||
[Event/musicplayer]
|
||||
Name=Now playing
|
||||
Comment=Now playing
|
||||
Action=Popup
|
266
sources/contents/code/ptmnotify.py
Normal file
266
sources/contents/code/ptmnotify.py
Normal file
@ -0,0 +1,266 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2013 Evgeniy Alekseev <esalexeev@gmail.com>
|
||||
#
|
||||
# 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 2 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, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
from PyKDE4.kdecore import KComponentData
|
||||
from PyKDE4.kdeui import KNotification
|
||||
import commands
|
||||
|
||||
|
||||
|
||||
class PTMNotify:
|
||||
def __init__(self, parent):
|
||||
"""class definition"""
|
||||
self.parent = parent
|
||||
|
||||
|
||||
def init(self):
|
||||
"""function to init notification"""
|
||||
content = self.initText(self.parent)
|
||||
self.createNotify(content)
|
||||
|
||||
|
||||
def createNotify(self, content):
|
||||
"""function to create notification for label"""
|
||||
notification = KNotification(content[0])
|
||||
notification.setComponentData(KComponentData("plasma_applet_pytextmonitor"))
|
||||
notification.setTitle("PyTextMonitor info ::: " + content[0]);
|
||||
notification.setText(content[1]);
|
||||
notification.sendEvent();
|
||||
|
||||
|
||||
def createText(self, type):
|
||||
"""function to create text"""
|
||||
text = ""
|
||||
if (type == "system"):
|
||||
try:
|
||||
text = text + "Kernel: %s\n" %(commands.getoutput("uname -rsm"))
|
||||
text = text + "Hostname: %s\n" %(commands.getoutput("uname -n"))
|
||||
text = text + "Whoami: %s\n" %(commands.getoutput("whoami"))
|
||||
text = text + "Uptime: %s\n" %(commands.getoutput("uptime"))
|
||||
except:
|
||||
text = "Something wrong"
|
||||
elif (type == "processor"):
|
||||
try:
|
||||
output = commands.getoutput("grep 'model name' /proc/cpuinfo | head -1")
|
||||
text = text + "Model: %s\n" %(' '.join(output.split()[3:]))
|
||||
output = commands.getoutput("sar -u | tail -1")
|
||||
text = text + "CPU Usage: %s%%\n" %(str(100-float(output.split()[-1])))
|
||||
output = commands.getoutput("grep MHz /proc/cpuinfo | head -1")
|
||||
text = text + "CPU Freq: %s MHz\n" %(str(int(float(output.split()[-1]))))
|
||||
output = commands.getoutput("sensors -u")
|
||||
text = text + "Temps:"
|
||||
for line in output.split("\n"):
|
||||
if (line.find("_input") > -1):
|
||||
text = text + " %s\xb0C" %(str(round(float(line.split()[-1]), 0)))
|
||||
except:
|
||||
text = "Something wrong"
|
||||
elif (type == "graphical"):
|
||||
try:
|
||||
output = commands.getoutput("lspci -m | grep 'VGA\|3D'")
|
||||
if (output.lower().find('nvidia') > -1):
|
||||
gpudev = "nvidia"
|
||||
elif (output.lower().find('radeon') > -1):
|
||||
gpudev = "ati"
|
||||
for line in output.split("\n"):
|
||||
text = text + "%s %s\n" %(line.split('"')[0], line.split('"')[5])
|
||||
if (gpudev == 'nvidia'):
|
||||
output = commands.getoutput("nvidia-smi -q -d UTILIZATION | grep Gpu | tail -n1")
|
||||
try:
|
||||
value = "%5s" % (str(round(float(output.split()[2][:-1]), 1)))
|
||||
except:
|
||||
value = " N\A"
|
||||
elif (gpudev == 'ati'):
|
||||
output = commands.getoutput("aticonfig --od-getclocks | grep load | tail -n1")
|
||||
try:
|
||||
value = "%5s" % (str(round(float(output.split()[3][:-1]), 1)))
|
||||
except:
|
||||
value = " N\A"
|
||||
else:
|
||||
value = " N\A"
|
||||
text = text + "Load: %s%%\n" %(value)
|
||||
if (gpudev == 'nvidia'):
|
||||
output = commands.getoutput("nvidia-smi -q -d TEMPERATURE | grep Gpu | tail -n1")
|
||||
try:
|
||||
value = "%5s" % (str(round(float(output.split()[2][:-1]), 1)))
|
||||
except:
|
||||
value = " N\A"
|
||||
elif (gpudev == 'ati'):
|
||||
output = commands.getoutput("aticonfig --od-gettemperature | grep Temperature | tail -n1")
|
||||
try:
|
||||
value = "%5s" % (str(round(float(output.split()[3][:-1]), 1)))
|
||||
except:
|
||||
value = " N\A"
|
||||
else:
|
||||
value = " N\A"
|
||||
text = text + "Temp: %s\xb0C\n" %(value)
|
||||
except:
|
||||
text = "Something wrong"
|
||||
elif (type == "memory"):
|
||||
try:
|
||||
output = commands.getoutput("free -m -o").split("\n")
|
||||
memusage = int(output[1].split()[1]) - (int(output[1].split()[3]) + int(output[1].split()[5]) + int(output[1].split()[6]))
|
||||
text = text + "Memory: %s of %s (%s%%)\n" %(str(memusage), output[1].split()[1], str(int(100*memusage/int(output[1].split()[1]))))
|
||||
text = text + "Swap: %s of %s (%s%%)\n" %(output[2].split()[2], output[2].split()[1], str(int(100*int(output[2].split()[2])/int(output[2].split()[1]))))
|
||||
output = commands.getoutput("swapon --show").split("\n")
|
||||
text = text + "Swap Device: %s (%s)" %(output[1].split()[0], output[1].split()[1])
|
||||
except:
|
||||
text = "Something wrong"
|
||||
elif (type == "disk"):
|
||||
try:
|
||||
output = commands.getoutput("df -h --output='source,target,used,size,pcent' --exclude-type=fuseblk --exclude-type=tmpfs --exclude-type=devtmpfs").split("\n")[1:]
|
||||
for line in output:
|
||||
text = text + "%s (to %s): %s of %s (%s)\n" %(line.split()[0], line.split()[1], line.split()[2], line.split()[3], line.split()[4])
|
||||
except:
|
||||
text = "Something wrong"
|
||||
elif (type == "network"):
|
||||
try:
|
||||
output = commands.getoutput("ifconfig -a -s").split("\n")[1:]
|
||||
text = text + "Devices:"
|
||||
for line in output:
|
||||
text = text + " %s" %(line.split()[0])
|
||||
output = commands.getoutput("ifconfig -a -s " + self.parent.parent.netdev + " && sleep 0.2 && ifconfig -a -s " + self.parent.parent.netdev).split("\n")
|
||||
download = int((int(output[3].split()[2]) - int(output[1].split()[2])) / (0.2 * 1024))
|
||||
upload = int((int(output[3].split()[6]) - int(output[1].split()[6])) / (0.2 * 1024))
|
||||
text = text + "\n%s: %s/%s KB/s\n" %(self.parent.parent.netdev, download, upload)
|
||||
output = commands.getoutput("ifconfig " + self.parent.parent.netdev + " | grep 'inet '").split()[1]
|
||||
text = text + "IP: %s\n" %(output[:-1])
|
||||
output = commands.getoutput("wget http://checkip.dyndns.org/ -q -O - | awk '{print $6}' | sed 's/<.*>//g'")
|
||||
text = text + "External IP: %s" %(output[:-1])
|
||||
except:
|
||||
text = "Something wrong"
|
||||
elif (type == "battery"):
|
||||
try:
|
||||
text = text + "%s" %(commands.getoutput("acpi -abi"))
|
||||
except:
|
||||
text = "Something wrong"
|
||||
elif (type == "musicplayer"):
|
||||
try:
|
||||
artist = "N\\A"
|
||||
album = "N\\A"
|
||||
title = "N\\A"
|
||||
if (self.parent.parent.player_name == 0):
|
||||
artist = commands.getoutput("qdbus org.kde.amarok /Player GetMetadata 2> /dev/null | grep albumartist: | cut -c14-")
|
||||
album = commands.getoutput("qdbus org.kde.amarok /Player GetMetadata 2> /dev/null | grep album: | cut -c8-")
|
||||
title = commands.getoutput("qdbus org.kde.amarok /Player GetMetadata 2> /dev/null | grep title: | cut -c8-")
|
||||
elif (self.parent.parent.player_name == 1):
|
||||
output = commands.getoutput("echo 'currentsong\nclose' | curl --connect-timeout 1 -fsm 3 telnet://localhost:6600 2> /dev/null")
|
||||
for line in output.split("\n"):
|
||||
if (line.split(": ")[0] == "Artist"):
|
||||
artist = line.split(": ")[1]
|
||||
elif (line.split(": ")[0] == "Album"):
|
||||
album = line.split(": ")[1]
|
||||
elif (line.split(": ")[0] == "Title"):
|
||||
title = line.split(": ")[1]
|
||||
elif (self.parent.parent.player_name == 2):
|
||||
artist = commands.getoutput("qmmp --nowplaying '%if(%p,%p,Unknown)' 2> /dev/null")
|
||||
album = commands.getoutput("qmmp --nowplaying '%if(%a,%a,Unknown)' 2> /dev/null")
|
||||
title = commands.getoutput("qmmp --nowplaying '%if(%t,%t,Unknown)' 2> /dev/null")
|
||||
text = text + "Artist: %s\nAlbum: %s\nTitle: %s" %(artist, album, title)
|
||||
except:
|
||||
text = "Something wrong"
|
||||
|
||||
content = [type, text]
|
||||
return content
|
||||
|
||||
|
||||
def initText(self, sender):
|
||||
"""function to send text"""
|
||||
try:
|
||||
if (sender == self.parent.parent.label_time):
|
||||
content = self.createText("system")
|
||||
return content
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if (sender == self.parent.parent.label_uptime):
|
||||
content = self.createText("system")
|
||||
return content
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if (sender == self.parent.parent.label_cpu):
|
||||
content = self.createText("processor")
|
||||
return content
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if (sender == self.parent.parent.label_cpuclock):
|
||||
content = self.createText("processor")
|
||||
return content
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if (sender == self.parent.parent.label_temp):
|
||||
content = self.createText("processor")
|
||||
return content
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if (sender == self.parent.parent.label_gpu):
|
||||
content = self.createText("graphical")
|
||||
return content
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if (sender == self.parent.parent.label_gputemp):
|
||||
content = self.createText("graphical")
|
||||
return content
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if (sender == self.parent.parent.label_mem):
|
||||
content = self.createText("memory")
|
||||
return content
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if (sender == self.parent.parent.label_swap):
|
||||
content = self.createText("memory")
|
||||
return content
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if (sender == self.parent.parent.label_hdd0):
|
||||
content = self.createText("disk")
|
||||
return content
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if (sender == self.parent.parent.label_hddtemp):
|
||||
content = self.createText("disk")
|
||||
return content
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if (sender == self.parent.parent.label_netDown):
|
||||
content = self.createText("network")
|
||||
return content
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if (sender == self.parent.parent.label_bat):
|
||||
content = self.createText("battery")
|
||||
return content
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if (sender == self.parent.parent.label_player):
|
||||
content = self.createText("musicplayer")
|
||||
return content
|
||||
except:
|
||||
pass
|
@ -1,8 +1,42 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2013 Evgeniy Alekseev <esalexeev@gmail.com>
|
||||
#
|
||||
# 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 2 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, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from PyKDE4.plasma import Plasma
|
||||
import config
|
||||
import ptmnotify
|
||||
|
||||
|
||||
|
||||
class NewPlasmaLabel(Plasma.Label):
|
||||
"""new Label with defined clicked() event"""
|
||||
def __init__(self, applet, parent):
|
||||
"""class definition"""
|
||||
Plasma.Label.__init__(self, applet)
|
||||
self.parent = parent
|
||||
self.notify = ptmnotify.PTMNotify(self)
|
||||
|
||||
|
||||
def mousePressEvent(self, event):
|
||||
"""mouse click event"""
|
||||
if (event.button() == Qt.LeftButton):
|
||||
self.notify.init()
|
||||
|
||||
|
||||
|
||||
@ -10,8 +44,9 @@ class Reinit():
|
||||
def __init__(self, parent):
|
||||
"""class definition"""
|
||||
self.parent = parent
|
||||
|
||||
def reinit(self):
|
||||
|
||||
|
||||
def reinit(self, confAccept=False):
|
||||
"""function to reinitializate widget"""
|
||||
settings = config.Config(self.parent)
|
||||
self.parent.interval = settings.get('interval', 2000).toInt()[0]
|
||||
@ -26,37 +61,25 @@ class Reinit():
|
||||
self.parent.label_order = str(settings.get('label_order', '1345'))
|
||||
for label in self.parent.dict_orders.values():
|
||||
if ((label == 'cpu') or (label == 'mem') or (label == 'swap') or (label == 'net')):
|
||||
exec ('self.parent.' + label + 'Bool = int(settings.get("' + label + 'Bool", 1))')
|
||||
exec ('self.parent.' + label + 'Bool = int(settings.get("' + label + 'Bool", 2))')
|
||||
else:
|
||||
exec ('self.parent.' + label + 'Bool = int(settings.get("' + label + 'Bool", 0))')
|
||||
# small function for update if errors exist
|
||||
summ = 0
|
||||
for label in self.parent.dict_orders.values():
|
||||
exec ('summ += self.parent.' + label + 'Bool')
|
||||
if (len(self.parent.label_order) != summ):
|
||||
for label in self.parent.dict_orders.values():
|
||||
if ((label == 'cpu') or (label == 'mem') or (label == 'swap') or (label == 'net')):
|
||||
exec ('self.parent.' + label + 'Bool = 1')
|
||||
else:
|
||||
exec ('self.parent.' + label + 'Bool = 0')
|
||||
exec ('settings.set("' + label + 'Bool", self.parent.' + label + 'Bool)')
|
||||
self.parent.label_order = '1345'
|
||||
settings.set('label_order', self.parent.label_order)
|
||||
|
||||
# labels
|
||||
for order in self.parent.label_order:
|
||||
if (order == "1"):
|
||||
if (self.parent.cpuBool == 1):
|
||||
if (self.parent.cpuBool > 0):
|
||||
self.parent.cpuFormat = str(settings.get('cpuFormat', '[cpu: $cpu%]'))
|
||||
if (self.parent.cpuFormat.split('$ccpu')[0] != self.parent.cpuFormat):
|
||||
self.parent.label_cpu0 = Plasma.Label(self.parent.applet)
|
||||
self.parent.label_cpu = NewPlasmaLabel(self.parent.applet, self.parent)
|
||||
self.parent.label_cpu1 = Plasma.Label(self.parent.applet)
|
||||
if (self.parent.cpuFormat.split('$ccpu')[0].split('$cpu')[0] != self.parent.cpuFormat.split('$ccpu')[0]):
|
||||
line = self.parent.cpuFormat.split('$ccpu')[0].split('$cpu')[0] + '-----' + self.parent.cpuFormat.split('$ccpu')[0].split('$cpu')[1]
|
||||
else:
|
||||
line = self.parent.cpuFormat.split('$ccpu')[0]
|
||||
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
|
||||
self.parent.label_cpu0.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_cpu0)
|
||||
self.parent.label_cpu.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_cpu)
|
||||
text = self.parent.formatLine.split('$LINE')[0] + "-----" + self.parent.formatLine.split('$LINE')[1]
|
||||
for core in range(self.parent.numCores):
|
||||
exec ('self.parent.label_coreCpu' + str(core) + ' = Plasma.Label(self.parent.applet)')
|
||||
@ -70,7 +93,7 @@ class Reinit():
|
||||
self.parent.label_cpu1.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_cpu1)
|
||||
else:
|
||||
self.parent.label_cpu = Plasma.Label(self.parent.applet)
|
||||
self.parent.label_cpu = NewPlasmaLabel(self.parent.applet, self.parent)
|
||||
if (self.parent.cpuFormat.split('$cpu')[0] != self.parent.cpuFormat):
|
||||
line = self.parent.cpuFormat.split('$cpu')[0] + '-----' + self.parent.cpuFormat.split('$cpu')[1]
|
||||
else:
|
||||
@ -79,10 +102,10 @@ class Reinit():
|
||||
self.parent.label_cpu.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_cpu)
|
||||
elif (order == "2"):
|
||||
if (self.parent.tempBool == 1):
|
||||
if (self.parent.tempBool > 0):
|
||||
self.parent.tempdev = str(settings.get('temp_device', '<select device>'))
|
||||
self.parent.tempFormat = str(settings.get('tempFormat', '[temp: $temp°C]'))
|
||||
self.parent.label_temp = Plasma.Label(self.parent.applet)
|
||||
self.parent.label_temp = NewPlasmaLabel(self.parent.applet, self.parent)
|
||||
if (self.parent.tempFormat.split('$temp')[0] != self.parent.tempFormat):
|
||||
line = self.parent.tempFormat.split('$temp')[0] + '----' + self.parent.tempFormat.split('$temp')[1]
|
||||
else:
|
||||
@ -91,11 +114,11 @@ class Reinit():
|
||||
self.parent.label_temp.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_temp)
|
||||
elif (order == "3"):
|
||||
if (self.parent.memBool == 1):
|
||||
if (self.parent.memBool > 0):
|
||||
self.parent.memFormat = str(settings.get('memFormat', '[mem: $mem%]'))
|
||||
if (self.parent.memFormat.split('$memmb')[0] != self.parent.memFormat):
|
||||
self.parent.memInMb = True
|
||||
text = self.parent.formatLine.split('$LINE')[0] + self.parent.memFormat.split('$memmb')[0] + '-----' + self.parent.memFormat.split('$memmb')[1] + self.parent.formatLine.split('$LINE')[1]
|
||||
line = self.parent.memFormat.split('$memmb')[0] + '-----' + self.parent.memFormat.split('$memmb')[1]
|
||||
elif (self.parent.memFormat.split('$mem')[0] != self.parent.memFormat):
|
||||
self.parent.memInMb = False
|
||||
self.parent.mem_used = 0.0
|
||||
@ -105,15 +128,15 @@ class Reinit():
|
||||
else:
|
||||
line = self.parent.memFormat
|
||||
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
|
||||
self.parent.label_mem = Plasma.Label(self.parent.applet)
|
||||
self.parent.label_mem = NewPlasmaLabel(self.parent.applet, self.parent)
|
||||
self.parent.label_mem.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_mem)
|
||||
elif (order == "4"):
|
||||
if (self.parent.swapBool == 1):
|
||||
if (self.parent.swapBool > 0):
|
||||
self.parent.swapFormat = str(settings.get('swapFormat', '[swap: $swap%]'))
|
||||
if (self.parent.swapFormat.split('$swapmb')[0] != self.parent.swapFormat):
|
||||
self.parent.swapInMb = True
|
||||
text = self.parent.formatLine.split('$LINE')[0] + self.parent.swapFormat.split('$swapmb')[0] + '-----' + self.parent.swapFormat.split('$swapmb')[1] + self.parent.formatLine.split('$LINE')[1]
|
||||
line = self.parent.swapFormat.split('$swapmb')[0] + '-----' + self.parent.swapFormat.split('$swapmb')[1]
|
||||
elif (self.parent.swapFormat.split('$swap')[0] != self.parent.swapFormat):
|
||||
self.parent.swapInMb = False
|
||||
self.parent.swap_free = 1.0
|
||||
@ -122,22 +145,22 @@ class Reinit():
|
||||
else:
|
||||
line = self.parent.swapFormat
|
||||
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
|
||||
self.parent.label_swap = Plasma.Label(self.parent.applet)
|
||||
self.parent.label_swap = NewPlasmaLabel(self.parent.applet, self.parent)
|
||||
self.parent.label_swap.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_swap)
|
||||
elif (order == "5"):
|
||||
if (self.parent.netBool == 1):
|
||||
if (self.parent.netBool > 0):
|
||||
self.parent.netNonFormat = str(settings.get('netNonFormat', '[net: $netKB/s]'))
|
||||
if (self.parent.netNonFormat.split('@@')[0] != self.parent.netNonFormat):
|
||||
self.parent.netdev = self.parent.netNonFormat.split('@@')[1]
|
||||
self.parent.netNonFormat = self.parent.netNonFormat.split('@@')[0] + self.parent.netNonFormat.split('@@')[2]
|
||||
else:
|
||||
self.parent.setupNetdev()
|
||||
self.parent.netdev = self.parent.setupNetdev()
|
||||
if (self.parent.netNonFormat.split('$netdev')[0] != self.parent.netNonFormat):
|
||||
self.parent.netFormat = self.parent.netNonFormat.split('$netdev')[0] + self.parent.netdev + self.parent.netNonFormat.split('$netdev')[1]
|
||||
else:
|
||||
self.parent.netFormat = self.parent.netNonFormat
|
||||
self.parent.label_netDown = Plasma.Label(self.parent.applet)
|
||||
self.parent.label_netDown = NewPlasmaLabel(self.parent.applet, self.parent)
|
||||
if (self.parent.netFormat.split('$net')[0] != self.parent.netFormat):
|
||||
line = self.parent.netFormat.split('$net')[0] + '----'
|
||||
else:
|
||||
@ -154,11 +177,11 @@ class Reinit():
|
||||
self.parent.label_netUp.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_netUp)
|
||||
elif (order == "6"):
|
||||
if (self.parent.batBool == 1):
|
||||
if (self.parent.batBool > 0):
|
||||
self.parent.batFormat = str(settings.get('batFormat', '[bat: $bat%$ac]'))
|
||||
self.parent.battery_device= str(settings.get('battery_device', '/sys/class/power_supply/BAT0/capacity'))
|
||||
self.parent.ac_device = str(settings.get('ac_device', '/sys/class/power_supply/AC/online'))
|
||||
self.parent.label_bat = Plasma.Label(self.parent.applet)
|
||||
self.parent.label_bat = NewPlasmaLabel(self.parent.applet, self.parent)
|
||||
line = self.parent.batFormat
|
||||
if (line.split('$ac')[0] != line):
|
||||
line = line.split('$ac')[0] + '(-)' + line.split('$ac')[1]
|
||||
@ -168,18 +191,18 @@ class Reinit():
|
||||
self.parent.label_bat.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_bat)
|
||||
elif (order == "7"):
|
||||
if (self.parent.cpuclockBool == 1):
|
||||
if (self.parent.cpuclockBool > 0):
|
||||
self.parent.cpuclockFormat = str(settings.get('cpuclockFormat', '[mhz: $cpucl]'))
|
||||
if (self.parent.cpuclockFormat.split('$ccpucl')[0] != self.parent.cpuclockFormat):
|
||||
self.parent.label_cpuclock0 = Plasma.Label(self.parent.applet)
|
||||
self.parent.label_cpuclock = NewPlasmaLabel(self.parent.applet, self.parent)
|
||||
self.parent.label_cpuclock1 = Plasma.Label(self.parent.applet)
|
||||
if (self.parent.cpuclockFormat.split('$ccpucl')[0].split('$cpucl')[0] != self.parent.cpuclockFormat.split('$ccpucl')[0]):
|
||||
line = self.parent.cpuclockFormat.split('$ccpucl')[0].split('$cpucl')[0] + '----' + self.parent.cpuclockFormat.split('$ccpucl')[0].split('$cpucl')[1]
|
||||
else:
|
||||
line = self.parent.cpuclockFormat.split('$ccpucl')[0]
|
||||
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
|
||||
self.parent.label_cpuclock0.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_cpuclock0)
|
||||
self.parent.label_cpuclock.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_cpuclock)
|
||||
text = self.parent.formatLine.split('$LINE')[0] + "----" + self.parent.formatLine.split('$LINE')[1]
|
||||
for core in range(self.parent.numCores):
|
||||
exec ('self.parent.label_coreCpuclock' + str(core) + ' = Plasma.Label(self.parent.applet)')
|
||||
@ -193,7 +216,7 @@ class Reinit():
|
||||
self.parent.label_cpuclock1.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_cpuclock1)
|
||||
else:
|
||||
self.parent.label_cpuclock = Plasma.Label(self.parent.applet)
|
||||
self.parent.label_cpuclock = NewPlasmaLabel(self.parent.applet, self.parent)
|
||||
if (self.parent.cpuclockFormat.split('$cpucl')[0] != self.parent.cpuclockFormat):
|
||||
line = self.parent.cpuclockFormat.split('$cpucl')[0] + '----' + self.parent.cpuclockFormat.split('$cpucl')[1]
|
||||
else:
|
||||
@ -202,9 +225,9 @@ class Reinit():
|
||||
self.parent.label_cpuclock.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_cpuclock)
|
||||
elif (order == "8"):
|
||||
if (self.parent.uptimeBool == 1):
|
||||
if (self.parent.uptimeBool > 0):
|
||||
self.parent.uptimeFormat = str(settings.get('uptimeFormat', '[uptime: $uptime]'))
|
||||
self.parent.label_uptime = Plasma.Label(self.parent.applet)
|
||||
self.parent.label_uptime = NewPlasmaLabel(self.parent.applet, self.parent)
|
||||
if (self.parent.uptimeFormat.split('$uptime')[0] != self.parent.uptimeFormat):
|
||||
line = self.parent.uptimeFormat.split('$uptime')[0] + '---d--h--m' + self.parent.uptimeFormat.split('$uptime')[1]
|
||||
else:
|
||||
@ -213,9 +236,9 @@ class Reinit():
|
||||
self.parent.label_uptime.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_uptime)
|
||||
elif (order == "9"):
|
||||
if (self.parent.gpuBool == 1):
|
||||
if (self.parent.gpuBool > 0):
|
||||
self.parent.gpuFormat = str(settings.get('gpuFormat', '[gpu: $gpu%]'))
|
||||
self.parent.label_gpu = Plasma.Label(self.parent.applet)
|
||||
self.parent.label_gpu = NewPlasmaLabel(self.parent.applet, self.parent)
|
||||
if (self.parent.gpuFormat.split('$gpu')[0] != self.parent.gpuFormat):
|
||||
line = self.parent.gpuFormat.split('$gpu')[0] + '-----' + self.parent.gpuFormat.split('$gpu')[1]
|
||||
else:
|
||||
@ -224,9 +247,9 @@ class Reinit():
|
||||
self.parent.label_gpu.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_gpu)
|
||||
elif (order == "a"):
|
||||
if (self.parent.gputempBool == 1):
|
||||
if (self.parent.gputempBool > 0):
|
||||
self.parent.gputempFormat = str(settings.get('gputempFormat', '[gpu temp: $gputemp°C]'))
|
||||
self.parent.label_gputemp = Plasma.Label(self.parent.applet)
|
||||
self.parent.label_gputemp = NewPlasmaLabel(self.parent.applet, self.parent)
|
||||
if (self.parent.gputempFormat.split('$gputemp')[0] != self.parent.gputempFormat):
|
||||
line = self.parent.gputempFormat.split('$gputemp')[0] + '----' + self.parent.gputempFormat.split('$gputemp')[1]
|
||||
else:
|
||||
@ -235,13 +258,13 @@ class Reinit():
|
||||
self.parent.label_gputemp.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_gputemp)
|
||||
elif (order == "b"):
|
||||
if (self.parent.hddBool == 1):
|
||||
if (self.parent.hddBool > 0):
|
||||
self.parent.hddFormat = str(settings.get('hddFormat', '[hdd: @@/@@%]'))
|
||||
if (self.parent.hddFormat.split('@@')[0] != self.parent.hddFormat):
|
||||
self.parent.mountPoints = self.parent.hddFormat.split('@@')[1].split(';')
|
||||
line = self.parent.hddFormat.split('@@')[0]
|
||||
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
|
||||
self.parent.label_hdd0 = Plasma.Label(self.parent.applet)
|
||||
self.parent.label_hdd0 = NewPlasmaLabel(self.parent.applet, self.parent)
|
||||
self.parent.label_hdd0.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_hdd0)
|
||||
text = self.parent.formatLine.split('$LINE')[0] + "-----" + self.parent.formatLine.split('$LINE')[1]
|
||||
@ -260,9 +283,9 @@ class Reinit():
|
||||
self.parent.label_hdd0.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_hdd0)
|
||||
elif (order == "c"):
|
||||
if (self.parent.hddtempBool == 1):
|
||||
if (self.parent.hddtempBool > 0):
|
||||
self.parent.hddtempFormat = str(settings.get('hddtempFormat', '[hdd temp: @@/dev/sda@@°C]'))
|
||||
self.parent.label_hddtemp = Plasma.Label(self.parent.applet)
|
||||
self.parent.label_hddtemp = NewPlasmaLabel(self.parent.applet, self.parent)
|
||||
if (self.parent.hddtempFormat.split('@@')[0] != self.parent.hddtempFormat):
|
||||
line = self.parent.hddtempFormat.split('@@')[0] + '----' + self.parent.hddtempFormat.split('@@')[2]
|
||||
else:
|
||||
@ -270,11 +293,37 @@ class Reinit():
|
||||
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
|
||||
self.parent.label_hddtemp.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_hddtemp)
|
||||
self.parent.applet.setLayout(self.parent.layout)
|
||||
self.parent.theme = Plasma.Svg(self.parent)
|
||||
self.parent.theme.setImagePath("widgets/background")
|
||||
self.parent.setBackgroundHints(Plasma.Applet.DefaultBackground)
|
||||
self.parent.resize(10,10)
|
||||
elif (order == "d"):
|
||||
if (self.parent.playerBool > 0):
|
||||
self.parent.playerFormat = str(settings.get('playerFormat', '[$artist - $title]'))
|
||||
self.parent.player_name = settings.get('player_name', 0).toInt()[0]
|
||||
self.parent.label_player = NewPlasmaLabel(self.parent.applet, self.parent)
|
||||
if (self.parent.playerFormat.split('$artist')[0] != self.parent.playerFormat):
|
||||
line = self.parent.playerFormat.split('$artist')[0] + '----------' + self.parent.playerFormat.split('$artist')[1]
|
||||
else:
|
||||
line = self.parent.playerFormat
|
||||
if (line.split('$title') != line):
|
||||
line = line.split('$title')[0] + '----------' + line.split('$title')[1]
|
||||
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
|
||||
self.parent.label_player.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_player)
|
||||
elif (order == "e"):
|
||||
if (self.parent.timeBool > 0):
|
||||
self.parent.timeFormat = str(settings.get('timeFormat', '[$time]'))
|
||||
self.parent.label_time = NewPlasmaLabel(self.parent.applet, self.parent)
|
||||
if (self.parent.timeFormat.split('$time')[0] != self.parent.timeFormat):
|
||||
line = self.parent.timeFormat.split('$time')[0] + '----------------------' + self.parent.timeFormat.split('$time')[1]
|
||||
else:
|
||||
line = self.parent.timeFormat
|
||||
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
|
||||
self.parent.label_time.setText(text)
|
||||
self.parent.layout.addItem(self.parent.label_time)
|
||||
if not confAccept:
|
||||
self.parent.applet.setLayout(self.parent.layout)
|
||||
self.parent.theme = Plasma.Svg(self.parent)
|
||||
self.parent.theme.setImagePath("widgets/background")
|
||||
self.parent.setBackgroundHints(Plasma.Applet.DefaultBackground)
|
||||
self.parent.resize(10, 10)
|
||||
|
||||
# create dataengines
|
||||
self.parent.thread().wait(60000)
|
||||
|
@ -1,5 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2012 Alex Oleshkevich <alex.oleshkevich@gmail.com>
|
||||
#
|
||||
# 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 2 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, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
from shutil import copyfile
|
||||
from PyKDE4.kdecore import *
|
||||
import os
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,7 @@ X-Plasma-RequiredExtensions=LaunchApp,LocalIO,FileDialog
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||
X-KDE-PluginInfo-Name=py-text-monitor
|
||||
X-KDE-PluginInfo-Version=1.3.5
|
||||
X-KDE-PluginInfo-Version=1.5.1
|
||||
X-KDE-PluginInfo-Website=http://kde-look.org/
|
||||
X-KDE-PluginInfo-Category=System Information
|
||||
X-KDE-PluginInfo-Depends=
|
||||
|
Reference in New Issue
Block a user