mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
Release 1.4.0
+ added notification * small refactoring
This commit is contained in:
parent
d55d478243
commit
6c9a167aa2
8
PKGBUILD
8
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" \
|
||||
|
2
TODO
2
TODO
@ -3,4 +3,4 @@
|
||||
b) cpuclock, mhz
|
||||
c) memory, %
|
||||
d) swap, %
|
||||
f) network, %
|
||||
e) network, %
|
||||
|
@ -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
|
||||
|
Binary file not shown.
@ -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
|
||||
}
|
||||
|
BIN
py-text-monitor-1.4.0.plasmoid
Normal file
BIN
py-text-monitor-1.4.0.plasmoid
Normal file
Binary file not shown.
@ -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
|
||||
@ -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()
|
||||
@ -186,4 +199,4 @@ class pyTextWidget(plasmascript.Applet):
|
||||
|
||||
|
||||
def CreateApplet(parent):
|
||||
return pyTextWidget(parent)
|
||||
return pyTextWidget(parent)
|
||||
|
@ -37,3 +37,8 @@ Action=Popup
|
||||
Name=Battery information
|
||||
Comment=Battery information
|
||||
Action=Popup
|
||||
|
||||
[Event/graphinfo]
|
||||
Name=Graphical Information
|
||||
Comment=Graphical Information
|
||||
Action=Popup
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -65,6 +65,9 @@
|
||||
<property name="toolTip">
|
||||
<string notr="true">$uptime - uptime</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -118,6 +121,9 @@
|
||||
<string notr="true">$cpu - total load CPU, %
|
||||
$ccpu - load CPU for each core, %</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -174,6 +180,9 @@ $ccpu - load CPU for each core, %</string>
|
||||
<string notr="true">$cpucl - average CPU clock, MHz
|
||||
$ccpucl - CPU clock for each core, MHz</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -242,6 +251,9 @@ $ccpucl - CPU clock for each core, MHz</string>
|
||||
<property name="toolTip">
|
||||
<string notr="true">$temp - physical temperature on CPU</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -297,6 +309,9 @@ $ccpucl - CPU clock for each core, MHz</string>
|
||||
<property name="toolTip">
|
||||
<string notr="true">$gpu - gpu usage, %</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -352,6 +367,9 @@ $ccpucl - CPU clock for each core, MHz</string>
|
||||
<property name="toolTip">
|
||||
<string notr="true">$gputemp - physical temperature on GPU</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -408,6 +426,9 @@ $ccpucl - CPU clock for each core, MHz</string>
|
||||
<string notr="true">$mem - RAM usage, %
|
||||
$memmb - RAM usage, MB</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -464,6 +485,9 @@ $memmb - RAM usage, MB</string>
|
||||
<string notr="true">$swap - swap usage, %
|
||||
$swapmb - swap usage, MB</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -519,6 +543,9 @@ $swapmb - swap usage, MB</string>
|
||||
<property name="toolTip">
|
||||
<string notr="true">@@/;@@ - mount point usage, %</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -574,6 +601,9 @@ $swapmb - swap usage, MB</string>
|
||||
<property name="toolTip">
|
||||
<string notr="true">@@/dev/sda@@ - physical temperature on /dev/sda</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -631,6 +661,9 @@ $swapmb - swap usage, MB</string>
|
||||
$netdev - current network device
|
||||
@@eth0@@ - disable auto select device and set specified device</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -687,6 +720,9 @@ $netdev - current network device
|
||||
<string notr="true">$bat - battery charge, %
|
||||
$ac - AC status</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -755,6 +791,9 @@ $ac - AC status</string>
|
||||
<property name="toolTip">
|
||||
<string notr="true">"/sys/class/power_supply/BAT0/capacity" by default</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -795,6 +834,9 @@ $ac - AC status</string>
|
||||
<property name="toolTip">
|
||||
<string notr="true">"/sys/class/power_supply/AC/online" by default</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -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=
|
||||
|
Loading…
Reference in New Issue
Block a user