Release 1.5.0

+ added music player support
+ added copyright
* edited README
This commit is contained in:
arcan1s 2013-11-06 01:33:21 +04:00
parent 7d5803fec8
commit 4a841766e8
18 changed files with 426 additions and 69 deletions

View File

@ -3,24 +3,27 @@
pkgname=kdeplasma-applets-pytextmonitor pkgname=kdeplasma-applets-pytextmonitor
_pkgname=py-text-monitor _pkgname=py-text-monitor
pkgver=1.4.0 pkgver=1.5.0
pkgrel=1 pkgrel=1
_dtengine=ext-sysmon _dtengine=ext-sysmon
_dtver=1.2 _dtver=1.3
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="https://github.com/arcan1s/pytextmonitor"
license=('GPL') license=('GPL')
depends=('kdebase-workspace' 'kdebindings-python2' 'lm_sensors' 'net-tools') depends=('kdebase-workspace' 'kdebindings-python2' 'lm_sensors' 'net-tools' 'sysstat')
optdepends=("hddtemp: for HDD temperature monitor" optdepends=("hddtemp: for HDD temperature monitor"
"catalyst: for GPU monitor" "catalyst: for GPU monitor"
"nvidia-utils: 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') 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=('67f3e3b55992048bd519867a9e94da37' md5sums=('df8e9f6df8e7b3caee3a502315756d81'
'3182acdadb3b498be929b3cadad92206') 'f7fce53d5f616891b30beac1afd99728')
build () build ()
{ {

36
README
View File

@ -1,36 +0,0 @@
py-text-monitor
=============
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)

89
README.md Normal file
View File

@ -0,0 +1,89 @@
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 "$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 "$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. $cpu will work only in cpu label.
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

6
TODO
View File

@ -1,6 +0,0 @@
1. Tooltip (graphical information):
a) cpu, %
b) cpuclock, mhz
c) memory, %
d) swap, %
e) network, %

BIN
ext-sysmon-1.3.zip Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,21 @@
# -*- coding: utf-8 -*- # -*- 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 * from util import *

View File

@ -1,5 +1,21 @@
# -*- coding: utf-8 -*- # -*- 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 PyQt4.QtGui import *
from PyKDE4.kdecore import * from PyKDE4.kdecore import *
from PyKDE4.kdeui import * from PyKDE4.kdeui import *
@ -117,8 +133,11 @@ class ConfigDefinition:
if (self.parent.batBool > 0): if (self.parent.batBool > 0):
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):
self.parent.label_player.setText('')
self.parent.layout.removeItem(self.parent.label_player)
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()))
@ -140,6 +159,9 @@ class ConfigDefinition:
elif (self.parent.dict_orders[label] == 'temp'): elif (self.parent.dict_orders[label] == 'temp'):
self.parent.tempdev = str(self.configpage.ui.comboBox_temp.currentText()) self.parent.tempdev = str(self.configpage.ui.comboBox_temp.currentText())
settings.set('temp_device', self.parent.tempdev) 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('-')) self.parent.label_order = ''.join(self.parent.label_order.split('-'))
settings.set('label_order', self.parent.label_order) settings.set('label_order', self.parent.label_order)
@ -186,6 +208,8 @@ class ConfigDefinition:
self.configpage.ui.comboBox_temp.addItem(tempdev) self.configpage.ui.comboBox_temp.addItem(tempdev)
except: except:
pass pass
elif (self.parent.dict_orders[label] == 'player'):
self.configpage.ui.comboBox_player.setCurrentIndex(int(settings.get('player_name', 0)))
# add config page # add config page
page = parent.addPage(self.configpage, i18n(self.parent.name())) page = parent.addPage(self.configpage, i18n(self.parent.name()))

View File

@ -1,5 +1,21 @@
# -*- coding: utf-8 -*- # -*- 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.QtCore import *
from PyQt4.QtGui import * from PyQt4.QtGui import *
from PyKDE4.plasma import * from PyKDE4.plasma import *
@ -19,19 +35,22 @@ class ConfigWindow(QWidget):
'gputemp':self.ui.checkBox_gpuTemp, 'hdd':self.ui.checkBox_hdd, 'gputemp':self.ui.checkBox_gpuTemp, 'hdd':self.ui.checkBox_hdd,
'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}
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}
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}
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)
@ -51,6 +70,8 @@ class ConfigWindow(QWidget):
self.ui.lineEdit_batdev.setEnabled(True) self.ui.lineEdit_batdev.setEnabled(True)
elif (label == 'temp'): elif (label == 'temp'):
self.ui.comboBox_temp.setEnabled(True) self.ui.comboBox_temp.setEnabled(True)
elif (label == 'player'):
self.ui.comboBox_player.setEnabled(True)
slider_label = 0 slider_label = 0
for slider in self.sliders.values(): for slider in self.sliders.values():
if (slider.isEnabled() == True): if (slider.isEnabled() == True):
@ -69,6 +90,8 @@ class ConfigWindow(QWidget):
self.ui.lineEdit_batdev.setDisabled(True) self.ui.lineEdit_batdev.setDisabled(True)
elif (label == 'temp'): elif (label == 'temp'):
self.ui.comboBox_temp.setDisabled(True) self.ui.comboBox_temp.setDisabled(True)
elif (label == 'player'):
self.ui.comboBox_player.setDisabled(True)
for slider in self.sliders.values(): for slider in self.sliders.values():
if ((slider.value() == slider.maximum()) and (slider != self.sliders[label])): if ((slider.value() == slider.maximum()) and (slider != self.sliders[label])):
slider.setValue(self.sliders[label].value()) slider.setValue(self.sliders[label].value())

View File

@ -1,5 +1,21 @@
# -*- coding: utf-8 -*- # -*- 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.QtCore import *
from PyQt4.QtGui import * from PyQt4.QtGui import *
from PyKDE4.plasma import Plasma from PyKDE4.plasma import Plasma
@ -16,7 +32,7 @@ class DataEngine:
def connectToEngine(self): def connectToEngine(self):
"""function to initializate engine""" """function to initializate engine"""
self.parent.systemmonitor = self.parent.dataEngine("systemmonitor") self.parent.systemmonitor = self.parent.dataEngine("systemmonitor")
if ((self.parent.gputempBool > 0) or (self.parent.gpuBool > 0) or (self.parent.hddtempBool > 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.uptimeBool > 0): if (self.parent.uptimeBool > 0):
@ -59,6 +75,8 @@ class DataEngine:
self.parent.updateNetdev = 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+"/transmitter/data", self.parent, self.parent.interval)
self.parent.systemmonitor.connectSource("network/interfaces/"+self.parent.netdev+"/receiver/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): def dataUpdated(self, sourceName, data):
"""function to update data""" """function to update data"""
@ -231,6 +249,28 @@ class DataEngine:
line = self.parent.hddtempFormat line = self.parent.hddtempFormat
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_hddtemp.setText(text) 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)
self.parent.update() self.parent.update()
except: except:

View File

@ -1,5 +1,21 @@
# -*- coding: utf-8 -*- # -*- 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.QtCore import *
from PyQt4.QtGui import * from PyQt4.QtGui import *
from PyKDE4.kdecore import * from PyKDE4.kdecore import *
@ -103,13 +119,15 @@ class pyTextWidget(plasmascript.Applet):
# 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'}
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]'}
def showConfigurationInterface(self): def showConfigurationInterface(self):
"""function to show configuration window""" """function to show configuration window"""

View File

@ -42,3 +42,8 @@ Action=Popup
Name=Graphical Information Name=Graphical Information
Comment=Graphical Information Comment=Graphical Information
Action=Popup Action=Popup
[Event/musicplayer]
Name=Now playing
Comment=Now playing
Action=Popup

View File

@ -1,5 +1,21 @@
# -*- coding: utf-8 -*- # -*- 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.kdecore import KComponentData
from PyKDE4.kdeui import KNotification from PyKDE4.kdeui import KNotification
import commands import commands
@ -132,6 +148,31 @@ class PTMNotify:
text = text + "%s" %(commands.getoutput("acpi -abi")) text = text + "%s" %(commands.getoutput("acpi -abi"))
except: except:
text = "Something wrong" 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] content = [type, text]
return content return content
@ -211,3 +252,9 @@ class PTMNotify:
return content return content
except: except:
pass pass
try:
if (sender == self.parent.parent.label_player):
content = self.createText("musicplayer")
return content
except:
pass

View File

@ -1,5 +1,21 @@
# -*- coding: utf-8 -*- # -*- 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.QtCore import *
from PyQt4.QtGui import * from PyQt4.QtGui import *
from PyKDE4.plasma import Plasma from PyKDE4.plasma import Plasma
@ -277,6 +293,20 @@ class Reinit():
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_hddtemp.setText(text) self.parent.label_hddtemp.setText(text)
self.parent.layout.addItem(self.parent.label_hddtemp) self.parent.layout.addItem(self.parent.label_hddtemp)
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)
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

@ -1,5 +1,21 @@
# -*- coding: utf-8 -*- # -*- 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 shutil import copyfile
from PyKDE4.kdecore import * from PyKDE4.kdecore import *
import os import os

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>500</height> <height>530</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -82,7 +82,7 @@
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>12</number> <number>13</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
@ -138,7 +138,7 @@ $ccpu - load CPU for each core, %</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>12</number> <number>13</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
@ -197,7 +197,7 @@ $ccpucl - CPU clock for each core, MHz</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>12</number> <number>13</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
@ -268,7 +268,7 @@ $ccpucl - CPU clock for each core, MHz</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>12</number> <number>13</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
@ -326,7 +326,7 @@ $ccpucl - CPU clock for each core, MHz</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>12</number> <number>13</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
@ -384,7 +384,7 @@ $ccpucl - CPU clock for each core, MHz</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>12</number> <number>13</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
@ -443,7 +443,7 @@ $memmb - RAM usage, MB</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>12</number> <number>13</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
@ -502,7 +502,7 @@ $swapmb - swap usage, MB</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>12</number> <number>13</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
@ -560,7 +560,7 @@ $swapmb - swap usage, MB</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>12</number> <number>13</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
@ -618,7 +618,7 @@ $swapmb - swap usage, MB</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>12</number> <number>13</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
@ -678,7 +678,7 @@ $netdev - current network device
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>12</number> <number>13</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
@ -737,7 +737,7 @@ $ac - AC status</string>
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>12</number> <number>13</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
@ -841,6 +841,90 @@ $ac - AC status</string>
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="layout_player">
<item>
<widget class="QCheckBox" name="checkBox_player">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string notr="true">Music player</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_player">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<item>
<property name="text">
<string>amarok</string>
</property>
</item>
<item>
<property name="text">
<string>mpd</string>
</property>
</item>
<item>
<property name="text">
<string>qmmp</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_player">
<property name="toolTip">
<string notr="true">$title - song title
$artist - song artist</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="slider_player">
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>13</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>13</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksAbove</enum>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<spacer name="spacer_elements"> <spacer name="spacer_elements">
<property name="orientation"> <property name="orientation">
@ -1223,6 +1307,10 @@ $ac - AC status</string>
<tabstop>slider_bat</tabstop> <tabstop>slider_bat</tabstop>
<tabstop>lineEdit_batdev</tabstop> <tabstop>lineEdit_batdev</tabstop>
<tabstop>lineEdit_acdev</tabstop> <tabstop>lineEdit_acdev</tabstop>
<tabstop>checkBox_player</tabstop>
<tabstop>comboBox_player</tabstop>
<tabstop>lineEdit_player</tabstop>
<tabstop>slider_player</tabstop>
<tabstop>spinBox_interval</tabstop> <tabstop>spinBox_interval</tabstop>
<tabstop>fontComboBox</tabstop> <tabstop>fontComboBox</tabstop>
<tabstop>spinBox_fontSize</tabstop> <tabstop>spinBox_fontSize</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.4.0 X-KDE-PluginInfo-Version=1.5.0
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=