Compare commits

...

8 Commits

Author SHA1 Message Date
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
14 changed files with 144 additions and 37 deletions

View File

@ -3,10 +3,10 @@
pkgname=kdeplasma-applets-pytextmonitor
_pkgname=py-text-monitor
pkgver=1.5.1
pkgrel=1
pkgver=1.5.2
pkgrel=2
_dtengine=ext-sysmon
_dtver=1.3
_dtver=1.5
pkgdesc="Minimalistic Plasmoid script written on Python2. It looks like widgets in awesome-wm"
arch=('i686' 'x86_64')
url="https://github.com/arcan1s/pytextmonitor"
@ -22,8 +22,9 @@ 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=('3ef9536493e48cd460ee3f37faa8cf58'
'f7fce53d5f616891b30beac1afd99728')
md5sums=('62a83e665d5a60e40891357a237cea1c'
'e8c0e40298facf6f515f3c72c66b2aa0')
backup=('usr/share/config/extsysmon.conf')
build ()
{

View File

@ -8,7 +8,10 @@ PyTextMonitor is a minimalistic Plasmoid script written on Python2. It looks lik
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 `$time` - time in default format. For example, `fri Nov 6 04:48:01 2013`
* label `$isotime` - time in iso format
* 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>
@ -34,6 +37,10 @@ Label order will changed if you change slider position. HTML tags in label work
**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
----------------
Tooltip (graphical information):

Binary file not shown.

BIN
ext-sysmon-1.5.zip Normal file

Binary file not shown.

View File

@ -14,11 +14,13 @@ include_directories (${CMAKE_SOURCE_DIR}
set (PLUGIN_NAME ${PROJECT_NAME})
file (GLOB PROJECT_DESKTOP *.desktop)
file (GLOB PROJECT_SRCS *.cpp)
file (GLOB PROJECT_CONF *.conf)
# make
kde4_add_plugin (${PLUGIN_NAME} ${PROJECT_SRCS})
target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS})
# install
install(TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES ${PROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_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.5)
# 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

@ -20,8 +20,10 @@
#include "extsysmon.h"
#include <Plasma/DataContainer>
#include <QFile>
#include <stdio.h>
#include <stdlib.h>
ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
@ -30,29 +32,7 @@ ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
Q_UNUSED(args)
setMinimumPollingInterval(333);
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);
readConfiguration();
}
QStringList ExtendedSysMon::sources() const
@ -65,6 +45,90 @@ QStringList ExtendedSysMon::sources() const
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 (confFile.atEnd())
break;
else 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];
}
}
}
confFile.close();
return true;
}
bool ExtendedSysMon::sourceRequestEvent(const QString &name)
{
return updateSourceEvent(name);
@ -235,7 +299,10 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
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");
char commandStr[512];
sprintf (commandStr, "echo 'currentsong\nclose' | curl --connect-timeout 1 -fsm 3 telnet://%s:%s 2> /dev/null", \
mpdAddress.toUtf8().data(), mpdPort.toUtf8().data());
f_out = popen(commandStr, "r");
while (true)
{
fgets(output, 256, f_out);

View File

@ -32,9 +32,14 @@ public:
protected:
bool sourceRequestEvent(const QString &name);
bool updateSourceEvent(const QString &source);
bool readConfiguration();
QStringList sources() const;
// main configuration
QStringList hdddev;
QString gpudev;
QStringList sources() const;
// configuration
QString mpdAddress;
QString mpdPort;
};
#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-Email=esalexeev@gmail.com
X-KDE-PluginInfo-Name=ext-sysmon
X-KDE-PluginInfo-Version=1.3
X-KDE-PluginInfo-Version=1.5
X-KDE-PluginInfo-Category=System Information
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL

Binary file not shown.

View File

@ -275,9 +275,18 @@ class DataEngine:
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):
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]

View File

@ -63,7 +63,10 @@
<item>
<widget class="QLineEdit" name="lineEdit_time">
<property name="toolTip">
<string notr="true">$time - time</string>
<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>

View File

@ -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.5.1
X-KDE-PluginInfo-Version=1.5.2
X-KDE-PluginInfo-Website=http://kde-look.org/
X-KDE-PluginInfo-Category=System Information
X-KDE-PluginInfo-Depends=