diff --git a/PKGBUILD b/PKGBUILD
index 4f21d3e..efcefb8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@
pkgname=kdeplasma-applets-pytextmonitor
_pkgname=py-text-monitor
-pkgver=1.3.6
+pkgver=1.4.0
pkgrel=1
_dtengine=ext-sysmon
_dtver=1.2
@@ -19,8 +19,8 @@ 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=('de54ece6545d28888a60d33f09ce69a1'
- '775bc3a6057f2dc1696f09b8d315a3e9')
+md5sums=('988704016573b215bb36b62762075fee'
+ '3182acdadb3b498be929b3cadad92206')
build ()
{
@@ -42,6 +42,8 @@ package()
make DESTDIR="${pkgdir}" install
# install plasmoid
+ install -D -m644 "${srcdir}/contents/code/plasma_applet_pytextmonitor.notifyrc" \
+ "${pkgdir}/`kde4-config --prefix`/share/apps/plasma_applet_pytextmonitor/plasma_applet_pytextmonitor.notifyrc"
install -D -m644 "${srcdir}/metadata.desktop" \
"${pkgdir}/`kde4-config --prefix`/share/kde4/services/${_pkgname}.desktop"
install -D -m644 "${srcdir}/metadata.desktop" \
diff --git a/TODO b/TODO
index 19d4a8c..f46f42f 100644
--- a/TODO
+++ b/TODO
@@ -3,4 +3,4 @@
b) cpuclock, mhz
c) memory, %
d) swap, %
- f) network, %
+ e) network, %
diff --git a/create_archive.sh b/create_archive.sh
index f3c1450..b4ad3dd 100755
--- a/create_archive.sh
+++ b/create_archive.sh
@@ -15,7 +15,7 @@ sed -i "s/_dtver=[0-9.]*/_dtver=${VERSION}/" PKGBUILD
# build widget
cd sources
-FILES="contents metadata.desktop"
+FILES="contents metadata.desktop plasma_applet_pytextmonitor"
ARCHIVE="py-text-monitor"
VERSION=`grep Version metadata.desktop | awk -F "=" '{print $2}'`
# create archive
diff --git a/ext-sysmon-1.2.zip b/ext-sysmon-1.2.zip
index efeb97b..bd3d302 100644
Binary files a/ext-sysmon-1.2.zip and b/ext-sysmon-1.2.zip differ
diff --git a/kdeplasma-applets-pytextmonitor.install b/kdeplasma-applets-pytextmonitor.install
index 7fa6471..2336774 100644
--- a/kdeplasma-applets-pytextmonitor.install
+++ b/kdeplasma-applets-pytextmonitor.install
@@ -1,9 +1,14 @@
-post_install()
+func_update()
{
cat << EOF
Update plasmoids...
EOF
kbuildsycoca4 > /dev/null 2>&1
+}
+
+post_install()
+{
+ func_update
cat << EOF
Make sure that \`hddtemp\` can be run as non-root
EOF
@@ -11,10 +16,10 @@ EOF
post_upgrade()
{
- post_install
+ func_update
}
post_remove()
{
- post_install
+ func_update
}
diff --git a/py-text-monitor-1.3.6.plasmoid b/old_versions/py-text-monitor-1.3.6.plasmoid
similarity index 100%
rename from py-text-monitor-1.3.6.plasmoid
rename to old_versions/py-text-monitor-1.3.6.plasmoid
diff --git a/py-text-monitor-1.4.0.plasmoid b/py-text-monitor-1.4.0.plasmoid
new file mode 100644
index 0000000..d9d5851
Binary files /dev/null and b/py-text-monitor-1.4.0.plasmoid differ
diff --git a/sources/contents/code/main.py b/sources/contents/code/main.py
index cc23366..d330e5d 100644
--- a/sources/contents/code/main.py
+++ b/sources/contents/code/main.py
@@ -7,7 +7,7 @@ from PyKDE4.kdeui import *
from PyKDE4.kio import *
from PyKDE4 import plasmascript
from PyKDE4.plasma import Plasma
-import commands, os, time
+import commands, os, shutil, time
import configdef
import configwindow
@@ -21,8 +21,8 @@ class pyTextWidget(plasmascript.Applet):
def __init__(self, parent, args=None):
"""widget definition"""
plasmascript.Applet.__init__(self, parent)
-
-
+
+
def init(self):
"""function to initializate widget"""
self._name = str(self.package().metadata().pluginName())
@@ -39,6 +39,11 @@ class pyTextWidget(plasmascript.Applet):
self.reinit.reinit(confAccept=False)
self.setHasConfigurationInterface(True)
+ # Create notifyrc file if required
+ kdehome = unicode(KGlobal.dirs().localkdedir())
+ if ((not os.path.exists(kdehome + "/share/apps/plasma_applet_pytextmonitor/plasma_applet_pytextmonitor.notifyrc")) or
+ (not os.path.exists("/usr" + "/share/apps/plasma_applet_pytextmonitor/plasma_applet_pytextmonitor.notifyrc"))):
+ self.createNotifyrc(kdehome)
def createConfigurationInterface(self, parent):
@@ -48,6 +53,14 @@ class pyTextWidget(plasmascript.Applet):
self.configdef.createConfigurationInterface(parent)
+ def createNotifyrc(self, kdehome):
+ """function to create *.notifyrc"""
+ if (not os.path.isdir(kdehome + "/share/apps/plasma_applet_pytextmonitor")):
+ os.mkdir(kdehome + "/share/apps/plasma_applet_pytextmonitor")
+ shutil.copy(kdehome + "/share/apps/plasma/plasmoids/py-text-monitor/contents/code/plasma_applet_pytextmonitor.notifyrc",
+ kdehome + "/share/apps/plasma_applet_pytextmonitor/")
+
+
def initTooltip(self):
"""function to create tooltip"""
self.tooltip = Plasma.ToolTipContent()
@@ -57,12 +70,12 @@ class pyTextWidget(plasmascript.Applet):
# show tooltip
#Plasma.ToolTipManager.self().setContent(self.applet, self.tooltip)
-
+
def mouseDoubleClickEvent(self, event):
"""function to doubleclick event"""
os.system("ksysguard &")
-
+
def setupNetdev(self):
"""function to setup network device"""
netdev = "lo"
@@ -79,8 +92,8 @@ class pyTextWidget(plasmascript.Applet):
except:
pass
return netdev
-
-
+
+
def setupVar(self):
"""function to setup variables"""
self.netdev = ''
@@ -101,8 +114,8 @@ class pyTextWidget(plasmascript.Applet):
def showConfigurationInterface(self):
"""function to show configuration window"""
plasmascript.Applet.showConfigurationInterface(self)
-
-
+
+
def startPolling(self):
try:
self.timer.start()
@@ -114,7 +127,7 @@ class pyTextWidget(plasmascript.Applet):
self.label_error.setText('ERROR')
self.layout.addItem(self.label_error)
return
-
+
def updateLabel(self):
"""function to update label"""
if ((self.memBool > 0) and (self.memInMb == False)):
@@ -123,8 +136,8 @@ class pyTextWidget(plasmascript.Applet):
self.swapText()
if (self.batBool > 0):
self.batText()
-
-
+
+
def batText(self):
"""function to set battery text"""
line = self.batFormat
@@ -150,8 +163,8 @@ class pyTextWidget(plasmascript.Applet):
line = line.split('$ac')[0] + bat + line.split('$ac')[1]
text = self.formatLine.split('$LINE')[0] + line + self.formatLine.split('$LINE')[1]
self.label_bat.setText(text)
-
-
+
+
def memText(self):
"""function to set mem text"""
full = self.mem_uf + self.mem_free
@@ -163,8 +176,8 @@ class pyTextWidget(plasmascript.Applet):
line = self.memFormat
text = self.formatLine.split('$LINE')[0] + line + self.formatLine.split('$LINE')[1]
self.label_mem.setText(text)
-
-
+
+
def swapText(self):
"""function to set swap text"""
full = self.swap_used + self.swap_free
@@ -186,4 +199,4 @@ class pyTextWidget(plasmascript.Applet):
def CreateApplet(parent):
- return pyTextWidget(parent)
+ return pyTextWidget(parent)
diff --git a/sources/contents/code/plasma_applet_pytextmonitor.notifyrc b/sources/contents/code/plasma_applet_pytextmonitor.notifyrc
index c1d6188..a6530d8 100644
--- a/sources/contents/code/plasma_applet_pytextmonitor.notifyrc
+++ b/sources/contents/code/plasma_applet_pytextmonitor.notifyrc
@@ -37,3 +37,8 @@ Action=Popup
Name=Battery information
Comment=Battery information
Action=Popup
+
+[Event/graphinfo]
+Name=Graphical Information
+Comment=Graphical Information
+Action=Popup
diff --git a/sources/contents/code/ptmnotify.py b/sources/contents/code/ptmnotify.py
index 4cf7d6e..9f02df1 100644
--- a/sources/contents/code/ptmnotify.py
+++ b/sources/contents/code/ptmnotify.py
@@ -37,12 +37,13 @@ class PTMNotify:
text = text + "Whoami: %s\n" %(commands.getoutput("whoami"))
text = text + "Uptime: %s\n" %(commands.getoutput("uptime"))
except:
- pass
+ text = "Something wrong"
elif (type == "processor"):
try:
output = commands.getoutput("grep 'model name' /proc/cpuinfo | head -1")
text = text + "Model: %s\n" %(' '.join(output.split()[3:]))
output = commands.getoutput("sar -u | tail -1")
+ print "1"
text = text + "CPU Usage: %s%%\n" %(str(100-float(output.split()[-1])))
output = commands.getoutput("grep MHz /proc/cpuinfo | head -1")
text = text + "CPU Freq: %s MHz\n" %(str(int(float(output.split()[-1]))))
@@ -52,7 +53,7 @@ class PTMNotify:
if (line.find("_input") > -1):
text = text + " %s\xb0C" %(str(round(float(line.split()[-1]), 0)))
except:
- pass
+ text = "Something wrong"
elif (type == "graphical"):
try:
output = commands.getoutput("lspci -m | grep 'VGA\|3D'")
@@ -93,7 +94,7 @@ class PTMNotify:
value = " N\A"
text = text + "Temp: %s\xb0C\n" %(value)
except:
- pass
+ text = "Something wrong"
elif (type == "memory"):
try:
output = commands.getoutput("free -m -o").split("\n")
@@ -103,14 +104,14 @@ class PTMNotify:
output = commands.getoutput("swapon --show").split("\n")
text = text + "Swap Device: %s (%s)" %(output[1].split()[0], output[1].split()[1])
except:
- pass
+ text = "Something wrong"
elif (type == "disk"):
try:
output = commands.getoutput("df -h --output='source,target,used,size,pcent' --exclude-type=fuseblk --exclude-type=tmpfs --exclude-type=devtmpfs").split("\n")[1:]
for line in output:
text = text + "%s (to %s): %s of %s (%s)\n" %(line.split()[0], line.split()[1], line.split()[2], line.split()[3], line.split()[4])
except:
- pass
+ text = "Something wrong"
elif (type == "network"):
try:
output = commands.getoutput("ifconfig -a -s").split("\n")[1:]
@@ -126,12 +127,12 @@ class PTMNotify:
output = commands.getoutput("wget http://checkip.dyndns.org/ -q -O - | awk '{print $6}' | sed 's/<.*>//g'")
text = text + "External IP: %s" %(output[:-1])
except:
- pass
+ text = "Something wrong"
elif (type == "battery"):
try:
text = text + "%s" %(commands.getoutput("acpi -abi"))
except:
- pass
+ text = "Something wrong"
content = [type, text]
return content
diff --git a/sources/contents/code/reinit.py b/sources/contents/code/reinit.py
index 050851e..49bf25c 100644
--- a/sources/contents/code/reinit.py
+++ b/sources/contents/code/reinit.py
@@ -16,7 +16,7 @@ class NewPlasmaLabel(Plasma.Label):
self.parent = parent
self.notify = ptmnotify.PTMNotify(self)
-
+
def mousePressEvent(self, event):
"""mouse click event"""
if (event.button() == Qt.LeftButton):
@@ -49,6 +49,7 @@ class Reinit():
else:
exec ('self.parent.' + label + 'Bool = int(settings.get("' + label + 'Bool", 0))')
+ # labels
for order in self.parent.label_order:
if (order == "1"):
if (self.parent.cpuBool > 0):
@@ -101,7 +102,7 @@ class Reinit():
self.parent.memFormat = str(settings.get('memFormat', '[mem: $mem%]'))
if (self.parent.memFormat.split('$memmb')[0] != self.parent.memFormat):
self.parent.memInMb = True
- text = self.parent.formatLine.split('$LINE')[0] + self.parent.memFormat.split('$memmb')[0] + '-----' + self.parent.memFormat.split('$memmb')[1] + self.parent.formatLine.split('$LINE')[1]
+ line = self.parent.memFormat.split('$memmb')[0] + '-----' + self.parent.memFormat.split('$memmb')[1]
elif (self.parent.memFormat.split('$mem')[0] != self.parent.memFormat):
self.parent.memInMb = False
self.parent.mem_used = 0.0
@@ -119,7 +120,7 @@ class Reinit():
self.parent.swapFormat = str(settings.get('swapFormat', '[swap: $swap%]'))
if (self.parent.swapFormat.split('$swapmb')[0] != self.parent.swapFormat):
self.parent.swapInMb = True
- text = self.parent.formatLine.split('$LINE')[0] + self.parent.swapFormat.split('$swapmb')[0] + '-----' + self.parent.swapFormat.split('$swapmb')[1] + self.parent.formatLine.split('$LINE')[1]
+ line = self.parent.swapFormat.split('$swapmb')[0] + '-----' + self.parent.swapFormat.split('$swapmb')[1]
elif (self.parent.swapFormat.split('$swap')[0] != self.parent.swapFormat):
self.parent.swapInMb = False
self.parent.swap_free = 1.0
@@ -281,7 +282,7 @@ class Reinit():
self.parent.theme = Plasma.Svg(self.parent)
self.parent.theme.setImagePath("widgets/background")
self.parent.setBackgroundHints(Plasma.Applet.DefaultBackground)
- self.parent.resize(10,10)
+ self.parent.resize(10, 10)
# create dataengines
self.parent.thread().wait(60000)
diff --git a/sources/contents/ui/configwindow.ui b/sources/contents/ui/configwindow.ui
index f633e52..968161b 100644
--- a/sources/contents/ui/configwindow.ui
+++ b/sources/contents/ui/configwindow.ui
@@ -65,6 +65,9 @@
$uptime - uptime
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
-
@@ -118,6 +121,9 @@
$cpu - total load CPU, %
$ccpu - load CPU for each core, %
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
-
@@ -174,6 +180,9 @@ $ccpu - load CPU for each core, %
$cpucl - average CPU clock, MHz
$ccpucl - CPU clock for each core, MHz
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
-
@@ -242,6 +251,9 @@ $ccpucl - CPU clock for each core, MHz
$temp - physical temperature on CPU
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
-
@@ -297,6 +309,9 @@ $ccpucl - CPU clock for each core, MHz
$gpu - gpu usage, %
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
-
@@ -352,6 +367,9 @@ $ccpucl - CPU clock for each core, MHz
$gputemp - physical temperature on GPU
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
-
@@ -408,6 +426,9 @@ $ccpucl - CPU clock for each core, MHz
$mem - RAM usage, %
$memmb - RAM usage, MB
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
-
@@ -464,6 +485,9 @@ $memmb - RAM usage, MB
$swap - swap usage, %
$swapmb - swap usage, MB
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
-
@@ -519,6 +543,9 @@ $swapmb - swap usage, MB
@@/;@@ - mount point usage, %
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
-
@@ -574,6 +601,9 @@ $swapmb - swap usage, MB
@@/dev/sda@@ - physical temperature on /dev/sda
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
-
@@ -631,6 +661,9 @@ $swapmb - swap usage, MB
$netdev - current network device
@@eth0@@ - disable auto select device and set specified device
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
-
@@ -687,6 +720,9 @@ $netdev - current network device
$bat - battery charge, %
$ac - AC status
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
-
@@ -755,6 +791,9 @@ $ac - AC status
"/sys/class/power_supply/BAT0/capacity" by default
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
@@ -795,6 +834,9 @@ $ac - AC status
"/sys/class/power_supply/AC/online" by default
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
diff --git a/sources/metadata.desktop b/sources/metadata.desktop
index beb5f2a..6b64ef9 100644
--- a/sources/metadata.desktop
+++ b/sources/metadata.desktop
@@ -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=2.0.0
+X-KDE-PluginInfo-Version=1.4.0
X-KDE-PluginInfo-Website=http://kde-look.org/
X-KDE-PluginInfo-Category=System Information
X-KDE-PluginInfo-Depends=