Compare commits

...

14 Commits

Author SHA1 Message Date
1b5e2c7fea edited readme 2014-03-27 20:10:59 +04:00
a3a5ebf2af release 1.5.3 2014-03-27 20:09:46 +04:00
0d3aacdec7 Fixed zero swap and memory 2013-11-19 18:17:59 +04:00
5bcf76a136 Fixed pkgrel 2013-11-18 21:20:40 +04:00
29da9b43f3 Edited README 2013-11-18 21:09:03 +04:00
e2e511f083 Release pytextmonitor 1.5.2
+ added time formats
* fixed definition of conf file for dataengine
2013-11-18 21:02:55 +04:00
ccaca2a725 Edited for 1.5 ext-sysmon 2013-11-18 19:51:57 +04:00
916c32589f Release ext-sysmon 1.5
+ added configuration file
2013-11-18 19:16:38 +04:00
24325e2d3a Edited archives 2013-11-11 09:50:23 +04:00
9569400757 Edited for #6 2013-11-11 09:47:48 +04:00
4d4317150a Edited pkgbuild 2013-11-07 01:45:55 +04:00
946c0ea874 Release ext-sysmon 1.4
* fix #4
2013-11-07 01:38:32 +04:00
ebb828dd4c Edited readme 2013-11-06 04:48:28 +04:00
f5fa6af1bc Release 1.5.1
+ added date andtime support
2013-11-06 04:45:58 +04:00
22 changed files with 455 additions and 196 deletions

View File

@ -3,13 +3,13 @@
pkgname=kdeplasma-applets-pytextmonitor pkgname=kdeplasma-applets-pytextmonitor
_pkgname=py-text-monitor _pkgname=py-text-monitor
pkgver=1.5.0 pkgver=1.5.3
pkgrel=1 pkgrel=1
_dtengine=ext-sysmon _dtengine=ext-sysmon
_dtver=1.3 _dtver=1.6
pkgdesc="Minimalistic Plasmoid script written on Python2. It looks like widgets in awesome-wm" pkgdesc="Minimalistic Plasmoid script written on Python2. It looks like widgets in awesome-wm"
arch=('i686' 'x86_64') arch=('i686' 'x86_64')
url="https://github.com/arcan1s/pytextmonitor" url="http://arcanis.name/projects/pytextmonitor"
license=('GPL') license=('GPL')
depends=('kdebase-workspace' 'kdebindings-python2' 'lm_sensors' 'net-tools' 'sysstat') depends=('kdebase-workspace' 'kdebindings-python2' 'lm_sensors' 'net-tools' 'sysstat')
optdepends=("hddtemp: for HDD temperature monitor" optdepends=("hddtemp: for HDD temperature monitor"
@ -22,24 +22,24 @@ makedepends=('automoc4' 'cmake')
source=(https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_pkgname}-${pkgver}.plasmoid 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) https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_dtengine}-${_dtver}.zip)
install=${pkgname}.install install=${pkgname}.install
md5sums=('df8e9f6df8e7b3caee3a502315756d81' md5sums=('7fef048a8e000ccf9a1e5f0924f59cc2'
'f7fce53d5f616891b30beac1afd99728') '74f42444a2bddce898d462045c3dbd44')
backup=('usr/share/config/extsysmon.conf')
build () build () {
{
# build dataengine # build dataengine
if [[ -d ${srcdir}/${_dtengine}/build ]]; then if [[ -d ${srcdir}/${_dtengine}/build ]]; then
rm -rf "${srcdir}/${_dtengine}/build" rm -rf "${srcdir}/${_dtengine}/build"
fi fi
mkdir "${srcdir}/${_dtengine}/build"; cd "${srcdir}/${_dtengine}/build" mkdir "${srcdir}/${_dtengine}/build"
cd "${srcdir}/${_dtengine}/build"
cmake -DCMAKE_BUILD_TYPE=Release \ cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` \ -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` \
../ ../
make make
} }
package() package() {
{
# install dataengine # install dataengine
cd "${srcdir}/${_dtengine}/build" cd "${srcdir}/${_dtengine}/build"
make DESTDIR="${pkgdir}" install make DESTDIR="${pkgdir}" install

View File

@ -8,9 +8,13 @@ PyTextMonitor is a minimalistic Plasmoid script written on Python2. It looks lik
Configuration Configuration
------------- -------------
For edited output you must open Settings window and setup output format in lines: For edited output you must open Settings window and setup output format in lines:
* label `$uptime` means uptime, <i>---d--h--m</i> * label `$time` - time in default format. For example, `fri Nov 6 04:48:01 2013`
* label `$cpu` means total load cpu, <i>%</i> * label `$isotime` - time in iso format
* label `$ccpu` means load CPU for each core, <i>%</i> * label `$shorttime` - time in short locale format
* label `$longtime` - time in long locale format
* 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 `$cpucl` - average cpu clock, <i>MHz</i>
* label `$ccpucl` - cpu clock for each core, <i>MHz</i> * label `$ccpucl` - cpu clock for each core, <i>MHz</i>
* label `$temp` - average temperature in system * label `$temp` - average temperature in system
@ -27,12 +31,19 @@ For edited output you must open Settings window and setup output format in lines
* 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 `$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 `$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 `$artist` - current song artist. One of supported music players must be installed
* label `$album` - current song album. One of supported music players must be installed
* label `$progress` - current song progress. One of supported music players must be installed (mpd does not support yet)
* label `$time` - current song duration. One of supported music players must be installed
* label `$title` - current song title. 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. 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>. **NOTE** you don't may set to show $cpu in swap label for example. <b>$cpu will work only in cpu label</b>.
DataEngine configuration
------------------------
You may edit DataEngine configuration. It is `/usr/share/config/extsysmon.conf` or `$HOME/share/config/extsysmon.conf` depending on the type of installation. Uncomment needed line and edit it.
TODO (wish) list TODO (wish) list
---------------- ----------------
Tooltip (graphical information): Tooltip (graphical information):

Binary file not shown.

BIN
ext-sysmon-1.6.zip Normal file

Binary file not shown.

View File

@ -14,11 +14,13 @@ include_directories (${CMAKE_SOURCE_DIR}
set (PLUGIN_NAME ${PROJECT_NAME}) set (PLUGIN_NAME ${PROJECT_NAME})
file (GLOB PROJECT_DESKTOP *.desktop) file (GLOB PROJECT_DESKTOP *.desktop)
file (GLOB PROJECT_SRCS *.cpp) file (GLOB PROJECT_SRCS *.cpp)
file (GLOB PROJECT_CONF *.conf)
# make # make
kde4_add_plugin (${PLUGIN_NAME} ${PROJECT_SRCS}) kde4_add_plugin (${PLUGIN_NAME} ${PROJECT_SRCS})
target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS}) target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS})
# install # install
install(TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES ${PROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR}) install (FILES ${PROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
install (FILES ${PROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})

13
ext-sysmon/extsysmon.conf Normal file
View File

@ -0,0 +1,13 @@
# Configuration file for Extended Systemmonitor DataEngine (v.1.6)
# Uncomment needed lines
# Set GPU device
# May be 'nvidia' (for nvidia), 'ati' (for ATI RADEON), 'ignore' or 'auto'
#GPUDEV=auto
# Set block device for hddtemp comma separated or use 'all'
#HDDDEV=all
# Set MPD settings
#MPDADDRESS=localhost
#MPDPORT=6600

View File

@ -1,27 +1,30 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2013 by Evgeniy Alekseev <esalekseev@gmail.com> * * Copyright (C) 2013 by Evgeniy Alekseev <esalekseev@gmail.com> *
* * * *
* This program is free software; you can redistribute it and/or modify * * 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 * * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
* This program is distributed in the hope that it will be useful, * * This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. * * GNU General Public License for more details. *
* * * *
* You should have received a copy of the GNU General Public License * * You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the * * along with this program; if not, write to the *
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/ ***************************************************************************/
#include "extsysmon.h" #include "extsysmon.h"
#include <Plasma/DataContainer> #include <Plasma/DataContainer>
#include <QFile>
#include <QProcess>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args) ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
@ -30,29 +33,7 @@ ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
Q_UNUSED(args) Q_UNUSED(args)
setMinimumPollingInterval(333); setMinimumPollingInterval(333);
readConfiguration();
FILE *f_out;
f_out = popen("lspci 2>&1", "r");
char device[256];
QString dev;
while (fgets(device, 256, f_out) != NULL)
{
dev = QString(device);
if (dev.toLower().contains("nvidia"))
gpudev = QString("nvidia");
else if (dev.toLower().contains("radeon"))
gpudev = QString("ati");
}
pclose(f_out);
f_out = popen("ls -1 /dev/sd[a-z] && ls -1 /dev/hd[a-z] 2>&1", "r");
while (fgets(device, 256, f_out) != NULL)
{
dev = QString(device);
if (dev[0] == '/')
hdddev.append(dev);
}
pclose(f_out);
} }
QStringList ExtendedSysMon::sources() const QStringList ExtendedSysMon::sources() const
@ -65,6 +46,81 @@ QStringList ExtendedSysMon::sources() const
return source; return source;
} }
bool ExtendedSysMon::readConfiguration()
{
// pre-setup
FILE *f_out;
f_out = popen("lspci 2> /dev/null", "r");
char device[256];
QString dev;
while (fgets(device, 256, f_out) != NULL) {
dev = QString(device);
if (dev.toLower().contains("nvidia"))
gpuDev = QString("nvidia");
else if (dev.toLower().contains("radeon"))
gpuDev = QString("ati");
}
pclose(f_out);
f_out = popen("ls -1 /dev/sd[a-z] 2> /dev/null ; ls -1 /dev/hd[a-z] 2> /dev/null", "r");
while (fgets(device, 256, f_out) != NULL) {
dev = QString(device).split("\n")[0];
if (dev[0] == '/')
hddDev.append(dev);
}
pclose(f_out);
mpdAddress = QString("localhost");
mpdPort = QString("6600");
QString fileStr;
// FIXME: define configuration file
QString confFileName = QString(getenv("HOME")) + QString("/.kde4/share/config/extsysmon.conf");
QFile confFile(confFileName);
bool exists = confFile.open(QIODevice::ReadOnly);
if (!exists) {
confFileName = QString("/usr/share/config/extsysmon.conf");
confFile.setFileName(confFileName);
exists = confFile.open(QIODevice::ReadOnly);
if (!exists)
return false;
}
while (true) {
fileStr = QString(confFile.readLine());
if (fileStr[0] != '#') {
if (fileStr.split(QString("="), QString::SkipEmptyParts).count() == 2) {
if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("GPUDEV")) {
if (fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0] == QString("ati"))
gpuDev = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0] == QString("nvidia"))
gpuDev = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0] != QString("auto"))
gpuDev = QString("ignore");
}
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("HDDDEV")) {
if (fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0] != QString("all")) {
hddDev.clear();
for (int i=0; i<fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), \
QString::SkipEmptyParts)[0].split(QString(","), QString::SkipEmptyParts).count(); i++)
hddDev.append(fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), \
QString::SkipEmptyParts)[0].split(QString(","), QString::SkipEmptyParts)[i]);
}
}
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("MPDADDRESS"))
mpdAddress = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (fileStr.split(QString("="), QString::SkipEmptyParts)[0] == QString("MPDPORT"))
mpdPort = fileStr.split(QString("="), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
}
}
if (confFile.atEnd())
break;
}
confFile.close();
return true;
}
bool ExtendedSysMon::sourceRequestEvent(const QString &name) bool ExtendedSysMon::sourceRequestEvent(const QString &name)
{ {
return updateSourceEvent(name); return updateSourceEvent(name);
@ -76,41 +132,35 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
QString key, out, tmp_out, value; QString key, out, tmp_out, value;
bool ok = false; bool ok = false;
char output[256], val[5]; char output[256], val[5];
if (source == QString("gpu")) if (source == QString("gpu")) {
{
key = QString("GPU"); key = QString("GPU");
if (gpudev == QString("nvidia")) if (gpuDev == QString("nvidia")) {
{
f_out = popen("nvidia-smi -q -d UTILIZATION 2> /dev/null | grep Gpu | tail -n1", "r"); f_out = popen("nvidia-smi -q -d UTILIZATION 2> /dev/null | grep Gpu | tail -n1", "r");
fgets (output, 256, f_out); fgets (output, 256, f_out);
if ((output[0] == '\0') || if ((output[0] == '\0') ||
(QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 2)) (QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 2))
value = QString(" N\\A"); value = QString(" N\\A");
else else {
{
out = QString(output).split(QString(" "), QString::SkipEmptyParts)[2]; out = QString(output).split(QString(" "), QString::SkipEmptyParts)[2];
sprintf (val, "%5.1f", out.left(out.count()-2).toFloat(&ok)); sprintf (val, "%5.1f", out.left(out.count()-2).toFloat(&ok));
value = QString(val); value = QString(val);
} }
pclose(f_out); pclose(f_out);
} }
else if (gpudev == QString("ati")) else if (gpuDev == QString("ati")) {
{
f_out = popen("aticonfig --od-getclocks 2> /dev/null | grep load | tail -n1", "r"); f_out = popen("aticonfig --od-getclocks 2> /dev/null | grep load | tail -n1", "r");
fgets (output, 256, f_out); fgets (output, 256, f_out);
if ((output[0] == '\0') || if ((output[0] == '\0') ||
(QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 3)) (QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 3))
value = QString(" N\\A"); value = QString(" N\\A");
else else {
{
out = QString(output).split(QString(" "), QString::SkipEmptyParts)[3]; out = QString(output).split(QString(" "), QString::SkipEmptyParts)[3];
sprintf (val, "%5.1f", out.left(out.count()-2).toFloat(&ok)); sprintf (val, "%5.1f", out.left(out.count()-2).toFloat(&ok));
value = QString(val); value = QString(val);
} }
pclose(f_out); pclose(f_out);
} }
else else {
{
value = QString(" N\\A"); value = QString(" N\\A");
} }
if (ok == false) if (ok == false)
@ -118,41 +168,35 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
value = value.split(QString(","), QString::SkipEmptyParts).join(QString(".")); value = value.split(QString(","), QString::SkipEmptyParts).join(QString("."));
setData(source, key, value); setData(source, key, value);
} }
else if (source == QString("gputemp")) else if (source == QString("gputemp")) {
{
key = QString("GPUTemp"); key = QString("GPUTemp");
if (gpudev == QString("nvidia")) if (gpuDev == QString("nvidia")) {
{
f_out = popen("nvidia-smi -q -d TEMPERATURE 2> /dev/null | grep Gpu | tail -n1", "r"); f_out = popen("nvidia-smi -q -d TEMPERATURE 2> /dev/null | grep Gpu | tail -n1", "r");
fgets (output, 256, f_out); fgets (output, 256, f_out);
if ((output[0] == '\0') || if ((output[0] == '\0') ||
(QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 2)) (QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 2))
value = QString(" N\\A"); value = QString(" N\\A");
else else {
{
out = QString(output).split(QString(" "), QString::SkipEmptyParts)[2]; out = QString(output).split(QString(" "), QString::SkipEmptyParts)[2];
sprintf (val, "%4.1f", out.toFloat(&ok)); sprintf (val, "%4.1f", out.toFloat(&ok));
value = QString(val); value = QString(val);
} }
pclose(f_out); pclose(f_out);
} }
else if (gpudev == QString("ati")) else if (gpuDev == QString("ati")) {
{
f_out = popen("aticonfig --od-gettemperature 2> /dev/null | grep Temperature | tail -n1", "r"); f_out = popen("aticonfig --od-gettemperature 2> /dev/null | grep Temperature | tail -n1", "r");
fgets (output, 256, f_out); fgets (output, 256, f_out);
if ((output[0] == '\0') || if ((output[0] == '\0') ||
(QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 4)) (QString(output).split(QString(" "), QString::SkipEmptyParts).count() < 4))
value = QString(" N\\A"); value = QString(" N\\A");
else else {
{
out = QString(output).split(QString(" "), QString::SkipEmptyParts)[4]; out = QString(output).split(QString(" "), QString::SkipEmptyParts)[4];
sprintf (val, "%4.1f", out.toFloat(&ok)); sprintf (val, "%4.1f", out.toFloat(&ok));
value = QString(val); value = QString(val);
} }
pclose(f_out); pclose(f_out);
} }
else else {
{
value = QString(" N\\A"); value = QString(" N\\A");
} }
if (ok == false) if (ok == false)
@ -160,22 +204,19 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
value = value.split(QString(","), QString::SkipEmptyParts).join(QString(".")); value = value.split(QString(","), QString::SkipEmptyParts).join(QString("."));
setData(source, key, value); setData(source, key, value);
} }
else if (source == QString("hddtemp")) else if (source == QString("hddtemp")) {
{
char command[256], *dev; char command[256], *dev;
QByteArray qb; QByteArray qb;
for (int i=0; i<hdddev.count(); i++) for (int i=0; i<hddDev.count(); i++) {
{ qb = hddDev[i].toUtf8();
qb = hdddev[i].toUtf8();
dev = qb.data(); dev = qb.data();
sprintf(command, "hddtemp %s 2> /dev/null", dev); sprintf(command, "sudo hddtemp %s 2> /dev/null", dev);
f_out = popen(command, "r"); f_out = popen(command, "r");
fgets(output, 256, f_out); fgets(output, 256, f_out);
if ((output[0] == '\0') || if ((output[0] == '\0') ||
(QString(output).split(QString(":"), QString::SkipEmptyParts).count() < 3)) (QString(output).split(QString(":"), QString::SkipEmptyParts).count() < 3))
value = QString(" N\\A"); value = QString(" N\\A");
else else {
{
out = QString(output).split(QString(":"), QString::SkipEmptyParts)[2]; out = QString(output).split(QString(":"), QString::SkipEmptyParts)[2];
sprintf (val, "%4.1f", out.left(out.count()-4).toFloat(&ok)); sprintf (val, "%4.1f", out.left(out.count()-4).toFloat(&ok));
value = QString(val); value = QString(val);
@ -184,71 +225,120 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
if (ok == false) if (ok == false)
value = QString(" N\\A"); value = QString(" N\\A");
value = value.split(QString(","), QString::SkipEmptyParts).join(QString(".")); value = value.split(QString(","), QString::SkipEmptyParts).join(QString("."));
setData(source, hdddev[i], value); setData(source, hddDev[i], value);
} }
} }
else if (source == QString("player")) else if (source == QString("player")) {
{ QProcess player;
QString qoutput;
QString value_album, value_artist, value_progress, value_duration, qstr;
// qmmp // qmmp
output[0] = '\0'; qoutput = QString("");
value = QString("N\\A");
value_album = QString("N\\A");
value_artist = QString("N\\A");
value_progress = QString("0");
value_duration = QString("0");
player.start("qmmp --status");
player.waitForFinished(-1);
qoutput = player.readAllStandardOutput();
for (int i=0; i<qoutput.split(QString("\n"), QString::SkipEmptyParts).count(); i++) {
qstr = qoutput.split(QString("\n"), QString::SkipEmptyParts)[i];
if (qstr.split(QString(" = "), QString::SkipEmptyParts)[0] == QString("ALBUM"))
value_album = qstr.split(QString(" = "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (qstr.split(QString(" = "), QString::SkipEmptyParts)[0] == QString("ARTIST"))
value_artist = qstr.split(QString(" = "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (qstr.at(0) == QChar('[')) {
QString time = qstr.split(QString(" "), QString::SkipEmptyParts)[2].split(QString("\n"), QString::SkipEmptyParts)[0];
value_progress = QString::number(time.split(QString("/"), QString::SkipEmptyParts)[0].split(QString(":"), QString::SkipEmptyParts)[0].toInt() * 60 +
time.split(QString("/"), QString::SkipEmptyParts)[0].split(QString(":"), QString::SkipEmptyParts)[1].toInt());
value_duration = QString::number(time.split(QString("/"), QString::SkipEmptyParts)[1].split(QString(":"), QString::SkipEmptyParts)[0].toInt() * 60 +
time.split(QString("/"), QString::SkipEmptyParts)[1].split(QString(":"), QString::SkipEmptyParts)[1].toInt());
}
else if (qstr.split(QString(" = "), QString::SkipEmptyParts)[0] == QString("TITLE"))
value = qstr.split(QString(" = "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
}
key = QString("qmmp_album");
setData(source, key, value_album);
key = QString("qmmp_artist"); key = QString("qmmp_artist");
f_out = popen("qmmp --nowplaying '%if(%p,%p,Unknown)' 2> /dev/null", "r"); setData(source, key, value_artist);
fgets(output, 256, f_out); key = QString("qmmp_progress");
if (output[0] == '\0') setData(source, key, value_progress);
value = QString("N\\A"); key = QString("qmmp_duration");
else setData(source, key, value_duration);
value = QString(output).split(QString("\n"), QString::SkipEmptyParts)[0];
pclose(f_out);
setData(source, key, value);
output[0] = '\0';
key = QString("qmmp_title"); 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); setData(source, key, value);
// amarok // amarok
output[0] = '\0'; qoutput = QString("");
value = QString("N\\A");
value_album = QString("N\\A");
value_artist = QString("N\\A");
value_progress = QString("0");
value_duration = QString("0");
player.start("qdbus org.kde.amarok /Player GetMetadata");
player.waitForFinished(-1);
qoutput = player.readAllStandardOutput();
for (int i=0; i<qoutput.split(QString("\n"), QString::SkipEmptyParts).count(); i++) {
qstr = qoutput.split(QString("\n"), QString::SkipEmptyParts)[i];
if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("album"))
value_album = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("artist"))
value_artist = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("time"))
value_duration = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("title"))
value = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
}
player.start("qdbus org.kde.amarok /Player PositionGet");
player.waitForFinished(-1);
qoutput = player.readAllStandardOutput();
for (int i=0; i<qoutput.split(QString("\n"), QString::SkipEmptyParts).count(); i++) {
qstr = qoutput.split(QString("\n"), QString::SkipEmptyParts)[i];
int time = qstr.toInt() / 1000;
value_progress = QString::number(time);
}
key = QString("amarok_album");
setData(source, key, value_album);
key = QString("amarok_artist"); key = QString("amarok_artist");
f_out = popen("qdbus org.kde.amarok /Player GetMetadata 2> /dev/null | grep albumartist: | cut -c14-", "r"); setData(source, key, value_artist);
fgets(output, 256, f_out); key = QString("amarok_progress");
if (output[0] == '\0') setData(source, key, value_progress);
value = QString("N\\A"); key = QString("amarok_duration");
else setData(source, key, value_duration);
value = QString(output).split(QString("\n"), QString::SkipEmptyParts)[0];
pclose(f_out);
setData(source, key, value);
output[0] = '\0';
key = QString("amarok_title"); 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); setData(source, key, value);
// mpd // mpd
QString value_artist;
value = QString("N\\A"); value = QString("N\\A");
value_album = QString("N\\A");
value_artist = 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"); value_progress = QString("0");
while (true) value_duration = QString("0");
{ char commandStr[512];
fgets(output, 256, f_out); sprintf (commandStr, "echo 'currentsong\nclose' | curl --connect-timeout 1 -fsm 3 telnet://%s:%s 2> /dev/null", \
if (feof (f_out)) mpdAddress.toUtf8().data(), mpdPort.toUtf8().data());
break; qoutput = QString("");
if (QString(output).split(QString(": "), QString::SkipEmptyParts)[0] == QString("Artist")) player.start(QString(commandStr));
value_artist = QString(output).split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0]; player.waitForFinished(-1);
else if (QString(output).split(QString(": "), QString::SkipEmptyParts)[0] == QString("Title")) qoutput = player.readAllStandardOutput();
value = QString(output).split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0]; for (int i=0; i<qoutput.split(QString("\n"), QString::SkipEmptyParts).count(); i++) {
qstr = qoutput.split(QString("\n"), QString::SkipEmptyParts)[i];
if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Album"))
value_album = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Artist"))
value_artist = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Time"))
value_duration = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Title"))
value = qstr.split(QString(": "), QString::SkipEmptyParts)[1].split(QString("\n"), QString::SkipEmptyParts)[0];
} }
pclose(f_out); key = QString("mpd_album");
setData(source, key, value_album);
key = QString("mpd_artist"); key = QString("mpd_artist");
setData(source, key, value_artist); setData(source, key, value_artist);
key = QString("mpd_progress");
setData(source, key, value_progress);
key = QString("mpd_duration");
setData(source, key, value_duration);
key = QString("mpd_title"); key = QString("mpd_title");
setData(source, key, value); setData(source, key, value);
} }

View File

@ -32,9 +32,14 @@ public:
protected: protected:
bool sourceRequestEvent(const QString &name); bool sourceRequestEvent(const QString &name);
bool updateSourceEvent(const QString &source); bool updateSourceEvent(const QString &source);
QStringList hdddev; bool readConfiguration();
QString gpudev;
QStringList sources() const; QStringList sources() const;
// main configuration
QStringList hddDev;
QString gpuDev;
// configuration
QString mpdAddress;
QString mpdPort;
}; };
#endif // EXTSYSMON_H #endif // EXTSYSMON_H

View File

@ -13,7 +13,7 @@ X-Plasma-EngineName=ext-sysmon
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
X-KDE-PluginInfo-Email=esalexeev@gmail.com X-KDE-PluginInfo-Email=esalexeev@gmail.com
X-KDE-PluginInfo-Name=ext-sysmon X-KDE-PluginInfo-Name=ext-sysmon
X-KDE-PluginInfo-Version=1.3 X-KDE-PluginInfo-Version=1.6
X-KDE-PluginInfo-Category=System Information X-KDE-PluginInfo-Category=System Information
X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-License=GPL

View File

@ -10,13 +10,16 @@ post_install()
{ {
func_update func_update
cat << EOF cat << EOF
Make sure that \`hddtemp\` can be run as non-root Make sure that \`hddtemp\` can be run with sudo without password
EOF EOF
} }
post_upgrade() post_upgrade()
{ {
func_update func_update
cat << EOF
Make sure that \`hddtemp\` can be run with sudo without password
EOF
} }
post_remove() post_remove()

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

After

Width:  |  Height:  |  Size: 175 KiB

View File

@ -134,10 +134,15 @@ class ConfigDefinition:
self.parent.label_bat.setText('') self.parent.label_bat.setText('')
self.parent.layout.removeItem(self.parent.label_bat) self.parent.layout.removeItem(self.parent.label_bat)
if (self.parent.playerBool > 0): if (self.parent.playerBool > 0):
self.parent.extsysmon.disconnectSource("player", self.parent)
self.parent.label_player.setText('') self.parent.label_player.setText('')
self.parent.layout.removeItem(self.parent.label_player) 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(): for label in self.parent.dict_orders.keys():
exec ('self.parent.' + self.parent.dict_orders[label] + 'Bool = ' + str(self.configpage.checkboxes[self.parent.dict_orders[label]].checkState())) exec ('self.parent.' + self.parent.dict_orders[label] + 'Bool = ' + str(self.configpage.checkboxes[self.parent.dict_orders[label]].checkState()))

View File

@ -36,21 +36,21 @@ class ConfigWindow(QWidget):
'hddtemp':self.ui.checkBox_hddTemp, 'mem':self.ui.checkBox_mem, 'hddtemp':self.ui.checkBox_hddTemp, 'mem':self.ui.checkBox_mem,
'net':self.ui.checkBox_net, 'swap':self.ui.checkBox_swap, '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} 'player':self.ui.checkBox_player, 'time':self.ui.checkBox_time}
self.sliders = {'bat':self.ui.slider_bat, 'cpu':self.ui.slider_cpu, self.sliders = {'bat':self.ui.slider_bat, 'cpu':self.ui.slider_cpu,
'cpuclock':self.ui.slider_cpuclock, 'gpu':self.ui.slider_gpu, 'cpuclock':self.ui.slider_cpuclock, 'gpu':self.ui.slider_gpu,
'gputemp':self.ui.slider_gpuTemp, 'hdd':self.ui.slider_hdd, 'gputemp':self.ui.slider_gpuTemp, 'hdd':self.ui.slider_hdd,
'hddtemp':self.ui.slider_hddTemp, 'mem':self.ui.slider_mem, 'hddtemp':self.ui.slider_hddTemp, 'mem':self.ui.slider_mem,
'net':self.ui.slider_net, 'swap':self.ui.slider_swap, '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} 'player':self.ui.slider_player, 'time':self.ui.slider_time}
self.lineedits = {'bat':self.ui.lineEdit_bat, 'cpu':self.ui.lineEdit_cpu, self.lineedits = {'bat':self.ui.lineEdit_bat, 'cpu':self.ui.lineEdit_cpu,
'cpuclock':self.ui.lineEdit_cpuclock, 'gpu':self.ui.lineEdit_gpu, 'cpuclock':self.ui.lineEdit_cpuclock, 'gpu':self.ui.lineEdit_gpu,
'gputemp':self.ui.lineEdit_gpuTemp, 'hdd':self.ui.lineEdit_hdd, 'gputemp':self.ui.lineEdit_gpuTemp, 'hdd':self.ui.lineEdit_hdd,
'hddtemp':self.ui.lineEdit_hddTemp, 'mem':self.ui.lineEdit_mem, 'hddtemp':self.ui.lineEdit_hddTemp, 'mem':self.ui.lineEdit_mem,
'net':self.ui.lineEdit_net, 'swap':self.ui.lineEdit_swap, '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} 'player':self.ui.lineEdit_player, 'time':self.ui.lineEdit_time}
for item in self.checkboxes.values(): for item in self.checkboxes.values():
QObject.connect(item, SIGNAL("stateChanged(int)"), self.setStatus) QObject.connect(item, SIGNAL("stateChanged(int)"), self.setStatus)

View File

@ -21,6 +21,7 @@ from PyQt4.QtGui import *
from PyKDE4.plasma import Plasma from PyKDE4.plasma import Plasma
from PyKDE4 import plasmascript from PyKDE4 import plasmascript
import datetime
class DataEngine: class DataEngine:
@ -35,6 +36,10 @@ class DataEngine:
if ((self.parent.gputempBool > 0) or (self.parent.gpuBool > 0) or (self.parent.hddtempBool > 0) or (self.parent.playerBool > 0)): 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") self.parent.extsysmon = self.parent.dataEngine("ext-sysmon")
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): if (self.parent.uptimeBool > 0):
self.parent.systemmonitor.connectSource("system/uptime", self.parent, self.parent.interval) self.parent.systemmonitor.connectSource("system/uptime", self.parent, self.parent.interval)
if (self.parent.cpuBool > 0): if (self.parent.cpuBool > 0):
@ -251,27 +256,56 @@ class DataEngine:
self.parent.label_hddtemp.setText(text) self.parent.label_hddtemp.setText(text)
elif (sourceName == "player"): elif (sourceName == "player"):
if (self.parent.player_name == 0): if (self.parent.player_name == 0):
title = str(data[QString(u'amarok_title')]) album = str(data[QString(u'amarok_album')])
artist = str(data[QString(u'amarok_artist')]) artist = str(data[QString(u'amarok_artist')])
progress = str(data[QString(u'amarok_progress')])
time = str(data[QString(u'amarok_duration')])
title = str(data[QString(u'amarok_title')])
elif (self.parent.player_name == 1): elif (self.parent.player_name == 1):
title = str(data[QString(u'mpd_title')]) album = str(data[QString(u'mpd_album')])
artist = str(data[QString(u'mpd_artist')]) artist = str(data[QString(u'mpd_artist')])
progress = str(data[QString(u'mpd_progress')])
time = str(data[QString(u'mpd_duration')])
title = str(data[QString(u'mpd_title')])
elif (self.parent.player_name == 2): elif (self.parent.player_name == 2):
title = str(data[QString(u'qmmp_title')]) album = str(data[QString(u'qmmp_album')])
artist = str(data[QString(u'qmmp_artist')]) artist = str(data[QString(u'qmmp_artist')])
if (self.parent.playerFormat.split('$artist')[0] != self.parent.playerFormat): progress = str(data[QString(u'qmmp_progress')])
if ((len(artist) + len(title)) > 10): time = str(data[QString(u'qmmp_duration')])
line = self.parent.playerFormat.split('$artist')[0] + artist[:5] + u"" + self.parent.playerFormat.split('$artist')[1] title = str(data[QString(u'qmmp_title')])
else: line = self.parent.playerFormat
line = self.parent.playerFormat.split('$artist')[0] + artist + self.parent.playerFormat.split('$artist')[1] if (line.split('$album')[0] != line):
else: line = line.split('$album')[0] + album + line.split('$album')[1]
line = self.parent.playerFormat if (line.split('$artist')[0] != line):
line = line.split('$artist')[0] + artist + line.split('$artist')[1]
if (line.split('$progress')[0] != line):
timeText = '%02i:%02i' % (int(time)/60, int(time)%60)
line = line.split('$progress')[0] + timeText + line.split('$progress')[1]
if (line.split('$time')[0] != line):
timeText = '%02i:%02i' % (int(time)/60, int(time)%60)
line = line.split('$time')[0] + timeText + line.split('$time')[1]
if (line.split('$title') != line): if (line.split('$title') != line):
line = line.split('$title')[0] + title + line.split('$title')[1] line = line.split('$title')[0] + title + line.split('$title')[1]
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1] text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
self.parent.label_player.setText(text) self.parent.label_player.setText(text)
elif (sourceName == "Local"):
if (self.parent.timeFormat.split('$time')[0] != self.parent.timeFormat):
value = str(data[QString(u'DateTime')].toString(Qt.TextDate).toUtf8())
line = self.parent.timeFormat.split('$time')[0] + value.decode("utf-8") + self.parent.timeFormat.split('$time')[1]
elif (self.parent.timeFormat.split('$isotime')[0] != self.parent.timeFormat):
value = str(data[QString(u'DateTime')].toString(Qt.ISODate).toUtf8())
line = self.parent.timeFormat.split('$isotime')[0] + value.decode("utf-8") + self.parent.timeFormat.split('$isotime')[1]
elif (self.parent.timeFormat.split('$shorttime')[0] != self.parent.timeFormat):
value = str(data[QString(u'DateTime')].toString(Qt.SystemLocaleShortDate).toUtf8())
line = self.parent.timeFormat.split('$shorttime')[0] + value.decode("utf-8") + self.parent.timeFormat.split('$shorttime')[1]
elif (self.parent.timeFormat.split('$longtime')[0] != self.parent.timeFormat):
value = str(data[QString(u'DateTime')].toString(Qt.SystemLocaleLongDate).toUtf8())
line = self.parent.timeFormat.split('$longtime')[0] + value.decode("utf-8") + self.parent.timeFormat.split('$longtime')[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() self.parent.update()
except: except:
pass pass

View File

@ -116,18 +116,19 @@ class pyTextWidget(plasmascript.Applet):
# setup number of cores # setup number of cores
commandOut = commands.getoutput("grep -c '^processor' /proc/cpuinfo") commandOut = commands.getoutput("grep -c '^processor' /proc/cpuinfo")
self.numCores = int(commandOut) self.numCores = int(commandOut)
self.tempdev = "tempdevice"
# create dictionaries # create dictionaries
self.dict_orders = {'6':'bat', '1':'cpu', '7':'cpuclock', '9':'gpu', 'a':'gputemp', 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'} 'd':'player', 'e':'time'}
self.dict_defFormat = {'bat':'[bat: $bat%$ac]', 'cpu':'[cpu: $cpu%]', self.dict_defFormat = {'bat':'[bat: $bat%$ac]', 'cpu':'[cpu: $cpu%]',
'cpuclock':'[mhz: $cpucl]', 'gpu':'[gpu: $gpu%]', 'cpuclock':'[mhz: $cpucl]', 'gpu':'[gpu: $gpu%]',
'gputemp':'[gpu temp: $gputemp&deg;C]', 'hdd':'[hdd: @@/@@%]', 'gputemp':'[gpu temp: $gputemp&deg;C]', 'hdd':'[hdd: @@/@@%]',
'hddtemp':'[hdd temp: @@/dev/sda@@&deg;C]', 'mem':'[mem: $mem%]', 'hddtemp':'[hdd temp: @@/dev/sda@@&deg;C]', 'mem':'[mem: $mem%]',
'net':'[$netdev: $netKB/s]', 'swap':'[swap: $swap%]', 'net':'[$netdev: $netKB/s]', 'swap':'[swap: $swap%]',
'temp':'[temp: $temp&deg;C]', 'uptime':'[uptime: $uptime]', 'temp':'[temp: $temp&deg;C]', 'uptime':'[uptime: $uptime]',
'player':'[$artist - $title]'} 'player':'[$artist - $title]', 'time':'[$time]'}
def showConfigurationInterface(self): def showConfigurationInterface(self):
"""function to show configuration window""" """function to show configuration window"""
@ -186,8 +187,11 @@ class pyTextWidget(plasmascript.Applet):
def memText(self): def memText(self):
"""function to set mem text""" """function to set mem text"""
full = self.mem_uf + self.mem_free full = self.mem_uf + self.mem_free
mem = 100 * self.mem_used / full try:
mem = "%5s" % (str(round(mem, 1))) mem = 100 * self.mem_used / full
mem = "%5s" % (str(round(mem, 1)))
except:
mem = " N\\A"
if (self.memFormat.split('$mem')[0] != self.memFormat): if (self.memFormat.split('$mem')[0] != self.memFormat):
line = self.memFormat.split('$mem')[0] + mem + self.memFormat.split('$mem')[1] line = self.memFormat.split('$mem')[0] + mem + self.memFormat.split('$mem')[1]
else: else:
@ -199,8 +203,11 @@ class pyTextWidget(plasmascript.Applet):
def swapText(self): def swapText(self):
"""function to set swap text""" """function to set swap text"""
full = self.swap_used + self.swap_free full = self.swap_used + self.swap_free
mem = 100 * self.swap_used / full try:
mem = "%5s" % (str(round(mem, 1))) mem = 100 * self.swap_used / full
mem = "%5s" % (str(round(mem, 1)))
except:
mem = " N\\A"
if (self.swapFormat.split('$swap')[0] != self.swapFormat): if (self.swapFormat.split('$swap')[0] != self.swapFormat):
line = self.swapFormat.split('$swap')[0] + mem + self.swapFormat.split('$swap')[1] line = self.swapFormat.split('$swap')[0] + mem + self.swapFormat.split('$swap')[1]
else: else:

View File

@ -180,6 +180,12 @@ class PTMNotify:
def initText(self, sender): def initText(self, sender):
"""function to send text""" """function to send text"""
try:
if (sender == self.parent.parent.label_time):
content = self.createText("system")
return content
except:
pass
try: try:
if (sender == self.parent.parent.label_uptime): if (sender == self.parent.parent.label_uptime):
content = self.createText("system") content = self.createText("system")

View File

@ -298,15 +298,31 @@ class Reinit():
self.parent.playerFormat = str(settings.get('playerFormat', '[$artist - $title]')) self.parent.playerFormat = str(settings.get('playerFormat', '[$artist - $title]'))
self.parent.player_name = settings.get('player_name', 0).toInt()[0] self.parent.player_name = settings.get('player_name', 0).toInt()[0]
self.parent.label_player = NewPlasmaLabel(self.parent.applet, self.parent) self.parent.label_player = NewPlasmaLabel(self.parent.applet, self.parent)
if (self.parent.playerFormat.split('$artist')[0] != self.parent.playerFormat): line = self.parent.playerFormat
line = self.parent.playerFormat.split('$artist')[0] + '----------' + self.parent.playerFormat.split('$artist')[1] if (line.split('$album')[0] != line):
else: line = line.split('$album')[0] + 'N\\A' + line.split('$album')[1]
line = self.parent.playerFormat if (line.split('$artist')[0] != line):
line = line.split('$artist')[0] + 'N\\A' + line.split('$artist')[1]
if (line.split('$progress')[0] != line):
line = line.split('$progress')[0] + '00:00' + line.split('$progress')[1]
if (line.split('$title') != line): if (line.split('$title') != line):
line = line.split('$title')[0] + '----------' + line.split('$title')[1] line = line.split('$title')[0] + 'N\\A' + line.split('$title')[1]
if (line.split('$time') != line):
line = line.split('$time')[0] + '00:00' + line.split('$time')[1]
text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1] text = self.parent.formatLine.split('$LINE')[0] + line + self.parent.formatLine.split('$LINE')[1]
self.parent.label_player.setText(text) self.parent.label_player.setText(text)
self.parent.layout.addItem(self.parent.label_player) 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: if not confAccept:
self.parent.applet.setLayout(self.parent.layout) self.parent.applet.setLayout(self.parent.layout)
self.parent.theme = Plasma.Svg(self.parent) self.parent.theme = Plasma.Svg(self.parent)

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>575</width> <width>575</width>
<height>530</height> <height>561</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -42,6 +42,64 @@
<string>Widget settings</string> <string>Widget settings</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="layout_time">
<item>
<widget class="QCheckBox" name="checkBox_time">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string notr="true">Time</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_time">
<property name="toolTip">
<string notr="true">$time - time in default format
$isotime - time in ISO format
$shorttime - time in short format
$longtime - time in log format</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="slider_time">
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>14</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksAbove</enum>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<layout class="QHBoxLayout" name="layout_uptime"> <layout class="QHBoxLayout" name="layout_uptime">
<item> <item>
@ -82,11 +140,14 @@
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>13</number> <number>14</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
</property> </property>
<property name="value">
<number>2</number>
</property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -138,13 +199,13 @@ $ccpu - load CPU for each core, %</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>13</number> <number>14</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
</property> </property>
<property name="value"> <property name="value">
<number>2</number> <number>3</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -197,13 +258,13 @@ $ccpucl - CPU clock for each core, MHz</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>13</number> <number>14</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
</property> </property>
<property name="value"> <property name="value">
<number>3</number> <number>4</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -268,13 +329,13 @@ $ccpucl - CPU clock for each core, MHz</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>13</number> <number>14</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
</property> </property>
<property name="value"> <property name="value">
<number>4</number> <number>5</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -326,13 +387,13 @@ $ccpucl - CPU clock for each core, MHz</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>13</number> <number>14</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
</property> </property>
<property name="value"> <property name="value">
<number>5</number> <number>6</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -384,13 +445,13 @@ $ccpucl - CPU clock for each core, MHz</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>13</number> <number>14</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
</property> </property>
<property name="value"> <property name="value">
<number>6</number> <number>7</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -443,13 +504,13 @@ $memmb - RAM usage, MB</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>13</number> <number>14</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
</property> </property>
<property name="value"> <property name="value">
<number>7</number> <number>8</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -502,13 +563,13 @@ $swapmb - swap usage, MB</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>13</number> <number>14</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
</property> </property>
<property name="value"> <property name="value">
<number>8</number> <number>9</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -560,13 +621,13 @@ $swapmb - swap usage, MB</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>13</number> <number>14</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
</property> </property>
<property name="value"> <property name="value">
<number>9</number> <number>10</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -618,13 +679,13 @@ $swapmb - swap usage, MB</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>13</number> <number>14</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
</property> </property>
<property name="value"> <property name="value">
<number>10</number> <number>11</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -678,13 +739,13 @@ $netdev - current network device
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>13</number> <number>14</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
</property> </property>
<property name="value"> <property name="value">
<number>11</number> <number>12</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -737,13 +798,13 @@ $ac - AC status</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>13</number> <number>14</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
</property> </property>
<property name="value"> <property name="value">
<number>12</number> <number>13</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -887,8 +948,11 @@ $ac - AC status</string>
<item> <item>
<widget class="QLineEdit" name="lineEdit_player"> <widget class="QLineEdit" name="lineEdit_player">
<property name="toolTip"> <property name="toolTip">
<string notr="true">$title - song title <string notr="true">$album - song album
$artist - song artist</string> $artist - song artist
$progress - song progress
$time - song duration
$title - song title</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -907,13 +971,13 @@ $artist - song artist</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>13</number> <number>14</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
</property> </property>
<property name="value"> <property name="value">
<number>13</number> <number>14</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -1268,6 +1332,9 @@ $artist - song artist</string>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>tabWidget</tabstop> <tabstop>tabWidget</tabstop>
<tabstop>checkBox_time</tabstop>
<tabstop>lineEdit_time</tabstop>
<tabstop>slider_time</tabstop>
<tabstop>checkBox_uptime</tabstop> <tabstop>checkBox_uptime</tabstop>
<tabstop>lineEdit_uptime</tabstop> <tabstop>lineEdit_uptime</tabstop>
<tabstop>slider_uptime</tabstop> <tabstop>slider_uptime</tabstop>

View File

@ -12,7 +12,7 @@ X-Plasma-RequiredExtensions=LaunchApp,LocalIO,FileDialog
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
X-KDE-PluginInfo-Email=esalexeev@gmail.com X-KDE-PluginInfo-Email=esalexeev@gmail.com
X-KDE-PluginInfo-Name=py-text-monitor X-KDE-PluginInfo-Name=py-text-monitor
X-KDE-PluginInfo-Version=1.5.0 X-KDE-PluginInfo-Version=1.5.3
X-KDE-PluginInfo-Website=http://kde-look.org/ X-KDE-PluginInfo-Website=http://kde-look.org/
X-KDE-PluginInfo-Category=System Information X-KDE-PluginInfo-Category=System Information
X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-Depends=