From a195e0524b83cae3612b36baeab2c2be42d2d41d Mon Sep 17 00:00:00 2001 From: arcan1s Date: Sun, 24 Feb 2013 06:04:34 +0400 Subject: [PATCH] Pre-release 1.1 + now you may set network device + now you may set to show network device + now you may set to show memory in Mb * widget consists of several labels * configuration interface - change order labels (I don't know how to do it) - some bugs Version 1.0 is now available in directory 'old_version' --- .../0.9}/contents/code/config.py | 0 .../0.9}/contents/code/configwindow.py | 0 .../0.9}/contents/code/main.py | 0 .../0.9}/contents/code/util.py | 0 .../0.9}/contents/ui/configwindow.ui | 0 .../0.9}/metadata.desktop | 0 old_versions/1.0/contents/code/config.py | 16 + .../1.0/contents/code/configwindow.py | 15 + old_versions/1.0/contents/code/main.py | 260 +++++++ old_versions/1.0/contents/code/util.py | 36 + old_versions/1.0/contents/ui/configwindow.ui | 710 ++++++++++++++++++ old_versions/1.0/metadata.desktop | 17 + .../pytextmonitor-1.0.plasmoid | Bin source/contents/code/configwindow.py | 47 +- source/contents/code/main.py | 365 ++++++--- source/contents/ui/configwindow.ui | 556 +++++++++++--- source/metadata.desktop | 2 +- 17 files changed, 1807 insertions(+), 217 deletions(-) rename {source_old => old_versions/0.9}/contents/code/config.py (100%) rename {source_old => old_versions/0.9}/contents/code/configwindow.py (100%) rename {source_old => old_versions/0.9}/contents/code/main.py (100%) rename {source_old => old_versions/0.9}/contents/code/util.py (100%) rename {source_old => old_versions/0.9}/contents/ui/configwindow.ui (100%) rename {source_old => old_versions/0.9}/metadata.desktop (100%) create mode 100644 old_versions/1.0/contents/code/config.py create mode 100644 old_versions/1.0/contents/code/configwindow.py create mode 100755 old_versions/1.0/contents/code/main.py create mode 100644 old_versions/1.0/contents/code/util.py create mode 100644 old_versions/1.0/contents/ui/configwindow.ui create mode 100644 old_versions/1.0/metadata.desktop rename pytextmonitor.plasmoid => old_versions/pytextmonitor-1.0.plasmoid (100%) diff --git a/source_old/contents/code/config.py b/old_versions/0.9/contents/code/config.py similarity index 100% rename from source_old/contents/code/config.py rename to old_versions/0.9/contents/code/config.py diff --git a/source_old/contents/code/configwindow.py b/old_versions/0.9/contents/code/configwindow.py similarity index 100% rename from source_old/contents/code/configwindow.py rename to old_versions/0.9/contents/code/configwindow.py diff --git a/source_old/contents/code/main.py b/old_versions/0.9/contents/code/main.py similarity index 100% rename from source_old/contents/code/main.py rename to old_versions/0.9/contents/code/main.py diff --git a/source_old/contents/code/util.py b/old_versions/0.9/contents/code/util.py similarity index 100% rename from source_old/contents/code/util.py rename to old_versions/0.9/contents/code/util.py diff --git a/source_old/contents/ui/configwindow.ui b/old_versions/0.9/contents/ui/configwindow.ui similarity index 100% rename from source_old/contents/ui/configwindow.ui rename to old_versions/0.9/contents/ui/configwindow.ui diff --git a/source_old/metadata.desktop b/old_versions/0.9/metadata.desktop similarity index 100% rename from source_old/metadata.desktop rename to old_versions/0.9/metadata.desktop diff --git a/old_versions/1.0/contents/code/config.py b/old_versions/1.0/contents/code/config.py new file mode 100644 index 0000000..3a4a6d3 --- /dev/null +++ b/old_versions/1.0/contents/code/config.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from util import * + + + +class Config(): + def __init__(self, applet): + self.applet = applet + self.config = self.applet.globalConfig() + + def get(self, key, default = ''): + return self.config.readEntry(key, default).toString() + + def set(self, key, value): + self.config.writeEntry(key, value) \ No newline at end of file diff --git a/old_versions/1.0/contents/code/configwindow.py b/old_versions/1.0/contents/code/configwindow.py new file mode 100644 index 0000000..c26a952 --- /dev/null +++ b/old_versions/1.0/contents/code/configwindow.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +from PyQt4.QtCore import * +from PyQt4.QtGui import * +from PyKDE4.plasma import * +from PyQt4 import uic +from PyKDE4 import plasmascript + + + +class ConfigWindow(QWidget): + def __init__(self, parent, settings): + QWidget.__init__(self) + self.ui = uic.loadUi(parent.package().filePath('ui', 'configwindow.ui'), self) + self.parent = parent \ No newline at end of file diff --git a/old_versions/1.0/contents/code/main.py b/old_versions/1.0/contents/code/main.py new file mode 100755 index 0000000..45b0b11 --- /dev/null +++ b/old_versions/1.0/contents/code/main.py @@ -0,0 +1,260 @@ +# -*- coding: utf-8 -*- + +from PyQt4.QtCore import * +from PyQt4.QtGui import * +from PyKDE4.kdecore import * +from PyKDE4.kdeui import * +from PyKDE4.kio import * +from PyKDE4.plasma import Plasma +from PyKDE4 import plasmascript +from PyQt4 import QtCore +from configwindow import * +from config import * +from util import * +import commands, os, time + + + +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()) + self.layout = QGraphicsLinearLayout(Qt.Horizontal, self.applet) + self.setHasConfigurationInterface(True) + + self.label = Plasma.Label(self.applet) + self.label.setText("N\A") + + self.layout.addItem(self.label) + self.applet.setLayout(self.layout) + + self.theme = Plasma.Svg(self) + self.theme.setImagePath("widgets/background") + self.setBackgroundHints(Plasma.Applet.DefaultBackground) + + #initial configuration + self.settings = Config(self) + self.format = str(self.settings.get('format', '[cpu: $cpu%][temp: $temp°C][mem: $mem%][swap: $swap%][net: $netKB/s][bat: $bat%]')) + self.interval = int(self.settings.get('interval', '2000')) + self.font_family = str(self.settings.get('font_family', 'Terminus')) + self.font_size = int(self.settings.get('font_size', 12)) + self.font_color = str(self.settings.get('font_color', '#000000')) + self.font_style = str(self.settings.get('font_style', 'normal')) + self.num_dev = int(self.settings.get('num_dev', 0)) + + self.setupNetdev() + self.setupTemp() + self.connectToEngine() + + self.cpuText = " 0.0" + self.up_speed = " 0" + self.down_speed = " 0" + self.mem_used = 0.0 + self.mem_free = 1.0 + self.mem_uf = 0.0 + self.swap_free = 1.0 + self.swap_used = 0.0 + self.tempText = " 0.0" + + self.resize(250,10) + + # start timer + self.timer = QtCore.QTimer() + self.timer.setInterval(self.interval) + self.startPolling() + + def configAccepted(self): + """function to accept settings""" + # update local variables + self.format = str(self.configpage.ui.lineEdit_format.text()) + self.interval = int(self.configpage.ui.spinBox_interval.value()) + self.font_family = str(self.configpage.ui.fontComboBox.currentFont().family()) + self.font_size = int(self.configpage.ui.spinBox_fontSize.value()) + self.font_color = str(self.configpage.ui.kcolorcombo.color().name()) + self.font_style = str(self.configpage.ui.lineEdit_style.text()) + self.num_dev = int(self.configpage.ui.comboBox_numNet.currentIndex()) + + # save config to settings + self.settings.set('format', self.format) + self.settings.set('interval', self.interval) + self.settings.set('font_family', self.font_family) + self.settings.set('font_size', self.font_size) + self.settings.set('font_color', self.font_color) + self.settings.set('font_style', self.font_style) + self.settings.set('num_dev', self.num_dev) + + # update timer + self.timer.setInterval(self.interval) + self.startPolling() + + def createConfigurationInterface(self, parent): + """function to setup configuration window""" + self.configpage = ConfigWindow(self, self.settings) + + font = QFont(str(self.settings.get('font_family', 'Terminus')), int(self.settings.get('font_size', 12)), int(int(self.settings.get('font_weight', 50)))) + self.configpage.ui.lineEdit_format.setText(str(self.settings.get('format', '[cpu: $cpu%][temp: $temp°C][mem: $mem%][swap: $swap%][net: $netKB/s][bat: $bat%]'))) + self.configpage.ui.spinBox_interval.setValue(int(self.settings.get('interval', '2000'))) + self.configpage.ui.fontComboBox.setCurrentFont(font) + self.configpage.ui.spinBox_fontSize.setValue(int(self.settings.get('font_size', 12))) + self.configpage.ui.kcolorcombo.setColor(QColor(str(self.settings.get('font_color', '#000000')))) + self.configpage.ui.lineEdit_style.setText(str(self.settings.get('font_style', 'normal'))) + self.configpage.ui.comboBox_numNet.setCurrentIndex(int(self.settings.get('num_dev', 0))) + + # add config page + page = parent.addPage(self.configpage, i18n(self.name())) + page.setIcon(KIcon(self.icon())) + + parent.okClicked.connect(self.configAccepted) + + def formating_line(self): + """function to set format line""" + output = self.format + + if (output.split("$cpu")[0] != output): + output = output.split("$cpu")[0] + self.cpuText + output.split("$cpu")[1] + if (output.split("$temp")[0] != output): + output = output.split("$temp")[0] + self.tempText + output.split("$temp")[1] + if (output.split("$mem")[0] != output): + output = output.split("$mem")[0] + self.memText() + output.split("$mem")[1] + if (output.split("$swap")[0] != output): + output = output.split("$swap")[0] + self.swapText() + output.split("$swap")[1] + if (output.split("$net")[0] != output): + output = output.split("$net")[0] + self.netText() + output.split("$net")[1] + if (output.split("$bat")[0] != output): + output = output.split("$bat")[0] + self.batText() + output.split("$bat")[1] + + return output + + def setupNetdev(self): + if (self.num_dev == 0): + for line in commands.getoutput("ifconfig -a").split("\n"): + if (line != ''): + if ((line[0] != ' ') and (line[0:3] != "lo:")): + self.netdev = line.split()[0][:-1] + else: + interfaces = [] + for line in commands.getoutput("ifconfig -a").split("\n"): + if (line != ''): + if ((line[0] != ' ') and (line[0:3] != "lo:")): + interfaces.append(line.split()[0][:-1]) + + command_line = "if ! (ifconfig "+ interfaces[1] + " | grep 'inet ' > /dev/null); then " + command_line = command_line + "if ! (ifconfig "+ interfaces[0] + " | grep 'inet ' > /dev/null); then echo lo; " + command_line = command_line + "else echo "+ interfaces[0] + "; fi; else echo "+ interfaces[1] + "; fi" + self.netdev = commands.getoutput(command_line) + + def setupTemp(self): + commandOut = commands.getoutput("sensors | grep Physical -B2") + self.tempdev = "lmsensors/"+commandOut.split("\n")[0]+"/"+'_'.join(commandOut.split("\n")[2].split(":")[0].split()) + + def showConfigurationInterface(self): + """function to show configuration window""" + plasmascript.Applet.showConfigurationInterface(self) + + def showTooltip(self, text): + """function to create and set tooltip""" + tooltip = Plasma.ToolTipContent() + tooltip.setImage(KIcon(self.icon())) + tooltip.setSubText(text) + tooltip.setAutohide(False) + Plasma.ToolTipManager.self().setContent(self.applet, tooltip) + Plasma.ToolTipManager.self().registerWidget(self.applet) + + def startPolling(self): + try: + self.timer.start() + QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.updateLabel) + + self.updateLabel() + self.showTooltip('') + except Exception as (strerror): + self.showTooltip(str(strerror)) + self.label.setText('ERROR') + return + + def updateLabel(self): + """function to update label""" + string = self.formating_line() + text = "" + text = text + "

"+string
+        text = text + "

" + self.label.setText(text) + + def batText(self): + """function to set battery text""" + commandOut = commands.getoutput("acpi") + bat = commandOut.split()[3][:-1] + output = "%3s" % (bat) + + return output + + def memText(self): + """function to set mem text""" + full = self.mem_uf + self.mem_free + mem = 100 * self.mem_used / full + output = "%5s" % (str(round(mem, 1))) + + return output + + def netText(self): + """function to set netspeed text""" + output = self.down_speed + "/" + self.up_speed + + return output + + def swapText(self): + """function to set swap text""" + full = self.swap_used + self.swap_free + mem = 100 * self.swap_used / full + output = "%5s" % (str(round(mem, 1))) + + return output + + def connectToEngine(self): + """function to initializate engine""" + self.systemmonitor = self.dataEngine("systemmonitor") + self.systemmonitor.connectSource("cpu/system/TotalLoad", self, 200) + self.systemmonitor.connectSource("network/interfaces/"+self.netdev+"/transmitter/data", self, 200) + self.systemmonitor.connectSource("network/interfaces/"+self.netdev+"/receiver/data", self, 200) + self.systemmonitor.connectSource(self.tempdev, self, 200) + self.systemmonitor.connectSource("mem/physical/free", self, 200) + self.systemmonitor.connectSource("mem/physical/used", self, 200) + self.systemmonitor.connectSource("mem/physical/application", self, 200) + self.systemmonitor.connectSource("mem/swap/free", self, 200) + self.systemmonitor.connectSource("mem/swap/used", self, 200) + + @pyqtSignature("dataUpdated(const QString &, const Plasma::DataEngine::Data &)") + def dataUpdated(self, sourceName, data): + """function to refresh data""" + if (sourceName == "cpu/system/TotalLoad"): + value = str(round(float(data[QString(u'value')]), 1)) + self.cpuText = "%5s" % (value) + elif (sourceName == "network/interfaces/"+self.netdev+"/transmitter/data"): + value = str(data[QString(u'value')]).split('.')[0] + self.up_speed = "%4s" % (value) + elif (sourceName == "network/interfaces/"+self.netdev+"/reciever/data"): + value = str(data[QString(u'value')]).split('.')[0] + self.down_speed = "%4s" % (value) + elif (sourceName == self.tempdev): + value = str(round(float(data[QString(u'value')]), 1)) + self.tempText = "%4s" % (value) + elif (sourceName == "mem/physical/free"): + self.mem_free = float(data[QString(u'value')]) + elif (sourceName == "mem/physical/used"): + self.mem_uf = float(data[QString(u'value')]) + elif (sourceName == "mem/physical/application"): + self.mem_used = float(data[QString(u'value')]) + elif (sourceName == "mem/swap/free"): + self.swap_free = float(data[QString(u'value')]) + elif (sourceName == "mem/swap/used"): + self.swap_used = float(data[QString(u'value')]) + + + +def CreateApplet(parent): + return pyTextWidget(parent) \ No newline at end of file diff --git a/old_versions/1.0/contents/code/util.py b/old_versions/1.0/contents/code/util.py new file mode 100644 index 0000000..32b87db --- /dev/null +++ b/old_versions/1.0/contents/code/util.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +import os +from shutil import copyfile +from PyKDE4.kdecore import * + + + +class Util(): + def __init__(self, applet): + self.applet = applet + + def createDirectory(self, name): + if not os.path.isdir(name): + try: + os.mkdir(name) + except: + print 'Failed to create directory: ' + name + + def kdeHome(self): + return unicode(KGlobal.dirs().localkdedir()) + + def createNotifyrc(self): + print '[%s] creating notifyrc' % (self.applet._name) + self.createDirectory(self.kdeHome() + 'share/apps/%s' % self.applet._name) + + source = self.applet.package().path() + 'contents/misc/%s.notifyrc' % self.applet._name + destination = self.kdeHome() + 'share/apps/%s/%s.notifyrc' % (self.applet._name, self.applet._name) + copyfile(source, destination) + + def createConfig(self): + self.createDirectory(self.kdeHome() + 'share/apps/%s' % self.applet._name) + + source = self.applet.package().path() + 'contents/misc/%s.ini' % self.applet._name + destination = self.kdeHome() + 'share/apps/%s/%s.ini' % (self.applet._name, self.applet._name) + copyfile(source, destination) \ No newline at end of file diff --git a/old_versions/1.0/contents/ui/configwindow.ui b/old_versions/1.0/contents/ui/configwindow.ui new file mode 100644 index 0000000..55f7c42 --- /dev/null +++ b/old_versions/1.0/contents/ui/configwindow.ui @@ -0,0 +1,710 @@ + + + ConfigWindow + + + + 0 + 0 + 302 + 247 + + + + + 0 + 0 + + + + + 0 + 247 + + + + + 16777215 + 16777215 + + + + Form + + + + + + + 0 + 0 + + + + + 0 + 242 + + + + + 16777215 + 16777215 + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + + + + 0 + 0 + + + + + 100 + 25 + + + + + 100 + 25 + + + + Output format + + + + + + + + 0 + 25 + + + + + 16777215 + 25 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + + + + 0 + 0 + + + + + 100 + 25 + + + + + 100 + 25 + + + + Time interval + + + + + + + Qt::Horizontal + + + + 40 + 19 + + + + + + + + + 0 + 0 + + + + + 150 + 25 + + + + + 150 + 25 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + 10000 + + + 2000 + + + + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + + + + 0 + 0 + + + + + 45 + 25 + + + + + 45 + 25 + + + + Font + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 150 + 25 + + + + + 150 + 25 + + + + QFontComboBox::AllFonts + + + + Terminus + 12 + true + + + + + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + + + + 0 + 0 + + + + + 100 + 25 + + + + + 100 + 25 + + + + Font size + + + + + + + Qt::Horizontal + + + + 40 + 19 + + + + + + + + + 0 + 0 + + + + + 150 + 25 + + + + + 150 + 25 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + 12 + + + + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + + + + 0 + 0 + + + + + 100 + 25 + + + + + 100 + 25 + + + + Font color + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 150 + 25 + + + + + 150 + 25 + + + + + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + + + + 0 + 0 + + + + + 100 + 25 + + + + + 100 + 25 + + + + Font style + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 150 + 25 + + + + + 150 + 25 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + + + + 0 + 0 + + + + + 170 + 25 + + + + + 170 + 25 + + + + Number of network devices + + + + + + + Qt::Horizontal + + + + 40 + 19 + + + + + + + + + 0 + 0 + + + + + 100 + 25 + + + + + 100 + 25 + + + + + 1 + + + + + 2 + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + widget + verticalSpacer + + + + KColorCombo + QComboBox +
kcolorcombo.h
+
+
+ + lineEdit_format + spinBox_interval + fontComboBox + spinBox_fontSize + kcolorcombo + lineEdit_style + comboBox_numNet + + + +
diff --git a/old_versions/1.0/metadata.desktop b/old_versions/1.0/metadata.desktop new file mode 100644 index 0000000..ca9e6c3 --- /dev/null +++ b/old_versions/1.0/metadata.desktop @@ -0,0 +1,17 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=Py Text Monitor +Type=Service +ServiceTypes=Plasma/Applet +Icon=utilities-system-monitor +X-Plasma-API=python +X-Plasma-MainScript=code/main.py +X-KDE-PluginInfo-Author=Evgeniy Alexeev aka arcanis +X-KDE-PluginInfo-Email=esalexeev@gmail.com +X-KDE-PluginInfo-Name=py-text-monitor +X-KDE-PluginInfo-Version=1.0 +X-KDE-PluginInfo-Website=http://kde-look.org/ +X-KDE-PluginInfo-Category=System Information +X-KDE-PluginInfo-Depends= +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-EnabledByDefault=true \ No newline at end of file diff --git a/pytextmonitor.plasmoid b/old_versions/pytextmonitor-1.0.plasmoid similarity index 100% rename from pytextmonitor.plasmoid rename to old_versions/pytextmonitor-1.0.plasmoid diff --git a/source/contents/code/configwindow.py b/source/contents/code/configwindow.py index c26a952..b1a75a8 100644 --- a/source/contents/code/configwindow.py +++ b/source/contents/code/configwindow.py @@ -12,4 +12,49 @@ class ConfigWindow(QWidget): def __init__(self, parent, settings): QWidget.__init__(self) self.ui = uic.loadUi(parent.package().filePath('ui', 'configwindow.ui'), self) - self.parent = parent \ No newline at end of file + self.parent = parent + + QObject.connect(self.ui.checkBox_bat, SIGNAL("stateChanged(int)"), self.batStatus) + QObject.connect(self.ui.checkBox_cpu, SIGNAL("stateChanged(int)"), self.cpuStatus) + QObject.connect(self.ui.checkBox_mem, SIGNAL("stateChanged(int)"), self.memStatus) + QObject.connect(self.ui.checkBox_net, SIGNAL("stateChanged(int)"), self.netStatus) + QObject.connect(self.ui.checkBox_swap, SIGNAL("stateChanged(int)"), self.swapStatus) + QObject.connect(self.ui.checkBox_temp, SIGNAL("stateChanged(int)"), self.tempStatus) + + def batStatus(self): + if (self.ui.checkBox_bat.checkState() == 2): + self.ui.lineEdit_bat.setEnabled(True) + else: + self.ui.lineEdit_bat.setDisabled(True) + + def cpuStatus(self): + if (self.ui.checkBox_cpu.checkState() == 2): + self.ui.lineEdit_cpu.setEnabled(True) + else: + self.ui.lineEdit_cpu.setDisabled(True) + + def memStatus(self): + if (self.ui.checkBox_mem.checkState() == 2): + self.ui.lineEdit_mem.setEnabled(True) + else: + self.ui.lineEdit_mem.setDisabled(True) + + def netStatus(self): + if (self.ui.checkBox_net.checkState() == 2): + self.ui.lineEdit_net.setEnabled(True) + self.ui.comboBox_numNet.setEnabled(True) + else: + self.ui.lineEdit_net.setDisabled(True) + self.ui.comboBox_numNet.setDisabled(True) + + def swapStatus(self): + if (self.ui.checkBox_swap.checkState() == 2): + self.ui.lineEdit_swap.setEnabled(True) + else: + self.ui.lineEdit_swap.setDisabled(True) + + def tempStatus(self): + if (self.ui.checkBox_temp.checkState() == 2): + self.ui.lineEdit_temp.setEnabled(True) + else: + self.ui.lineEdit_temp.setDisabled(True) \ No newline at end of file diff --git a/source/contents/code/main.py b/source/contents/code/main.py index e62c398..0a64bc2 100755 --- a/source/contents/code/main.py +++ b/source/contents/code/main.py @@ -25,43 +25,105 @@ class pyTextWidget(plasmascript.Applet): self._name = str(self.package().metadata().pluginName()) self.layout = QGraphicsLinearLayout(Qt.Horizontal, self.applet) self.setHasConfigurationInterface(True) + self.resize(10,10) - self.label = Plasma.Label(self.applet) - self.label.setText("N\A") - self.layout.addItem(self.label) - self.applet.setLayout(self.layout) - - self.theme = Plasma.Svg(self) - self.theme.setImagePath("widgets/background") - self.setBackgroundHints(Plasma.Applet.DefaultBackground) - - #initial configuration + # initial configuration self.settings = Config(self) - self.format = str(self.settings.get('format', '[cpu: $cpu%][temp: $temp°C][mem: $mem%][swap: $swap%][net: $netKB/s][bat: $bat%]')) self.interval = int(self.settings.get('interval', '2000')) self.font_family = str(self.settings.get('font_family', 'Terminus')) self.font_size = int(self.settings.get('font_size', 12)) self.font_color = str(self.settings.get('font_color', '#000000')) self.font_style = str(self.settings.get('font_style', 'normal')) - self.num_dev = int(self.settings.get('num_dev', 0)) + self.formatLine = "" + self.formatLine = self.formatLine + "

$LINE"
+        self.formatLine = self.formatLine + "

" - self.setupNetdev() - self.setupTemp() - self.connectToEngine() + self.cpuBool = self.settings.get('cpuBool', True) + if (self.cpuBool): + self.cpuFormat = str(self.settings.get('cpuFormat', '[cpu: $cpu%]')) + self.label_cpu = Plasma.Label(self.applet) + text = self.formatLine.split('$LINE')[0] + self.cpuFormat.split('$cpu')[0] + '-----' + self.cpuFormat.split('$cpu')[1] + self.formatLine.split('$LINE')[1] + self.label_cpu.setText(text) + self.layout.addItem(self.label_cpu) - self.cpuText = " 0.0" - self.up_speed = " 0" - self.down_speed = " 0" - self.mem_used = 0.0 - self.mem_free = 1.0 - self.mem_uf = 0.0 - self.swap_free = 1.0 - self.swap_used = 0.0 - self.tempText = " 0.0" + self.tempBool = self.settings.get('tempBool', True) + if (self.tempBool): + self.tempFormat = str(self.settings.get('tempFormat', '[temp: $temp°C]')) + self.setupTemp() + self.label_temp = Plasma.Label(self.applet) + text = self.formatLine.split('$LINE')[0] + self.tempFormat.split('$temp')[0] + '----' + self.tempFormat.split('$temp')[1] + self.formatLine.split('$LINE')[1] + self.label_temp.setText(text) + self.layout.addItem(self.label_temp) - self.resize(250,10) + self.memBool = self.settings.get('memBool', True) + if (self.memBool): + self.memFormat = str(self.settings.get('memFormat', '[mem: $mem%]')) + if (self.memFormat.split('$memmb')[0] != self.memFormat): + self.memInMb = True + text = self.formatLine.split('$LINE')[0] + self.memFormat.split('$memmb')[0] + '-----' + self.memFormat.split('$memmb')[1] + self.formatLine.split('$LINE')[1] + else: + self.memInMb = False + self.mem_used = 0.0 + self.mem_free = 1.0 + self.mem_uf = 0.0 + text = self.formatLine.split('$LINE')[0] + self.memFormat.split('$mem')[0] + '-----' + self.memFormat.split('$mem')[1] + self.formatLine.split('$LINE')[1] + self.label_mem = Plasma.Label(self.applet) + self.label_mem.setText(text) + self.layout.addItem(self.label_mem) + + self.swapBool = self.settings.get('swapBool', True) + if (self.swapBool): + self.swapFormat = str(self.settings.get('swapFormat', '[swap: $swap%]')) + if (self.swapFormat.split('$swapmb')[0] != self.swapFormat): + self.swapInMb = True + text = self.formatLine.split('$LINE')[0] + self.swapFormat.split('$swapmb')[0] + '-----' + self.swapFormat.split('$swapmb')[1] + self.formatLine.split('$LINE')[1] + else: + self.swapInMb = False + text = self.formatLine.split('$LINE')[0] + self.swapFormat.split('$swap')[0] + '-----' + self.swapFormat.split('$swap')[1] + self.formatLine.split('$LINE')[1] + self.swap_free = 1.0 + self.swap_used = 0.0 + self.label_swap = Plasma.Label(self.applet) + self.label_swap.setText(text) + self.layout.addItem(self.label_swap) + + self.netBool = self.settings.get('netBool', True) + if (self.netBool): + self.netNonFormat = str(self.settings.get('netNonFormat', '[net: $netKB/s]')) + if (self.netNonFormat.split('@@netdev=')[0] != self.netNonFormat): + self.netdev = self.netNonFormat.split('@@')[1].split('netdev=')[1] + self.netNonFormat = self.netNonFormat.split('@@')[0] + self.netNonFormat.split('@@')[2] + else: + self.num_dev = int(self.settings.get('num_dev', 0)) + self.setupNetdev() + if (self.netNonFormat.split('$netdev')[0] != self.netNonFormat): + self.netFormat = self.netNonFormat.split('$netdev')[0] + self.netdev + self.netNonFormat.split('$netdev')[1] + else: + self.netFormat = self.netNonFormat + self.label_netDown = Plasma.Label(self.applet) + text = self.formatLine.split('$LINE')[0] + self.netFormat.split('$net')[0] + '----' + self.formatLine.split('$LINE')[1] + self.label_netDown.setText(text) + self.layout.addItem(self.label_netDown) + self.label_netUp = Plasma.Label(self.applet) + text = self.formatLine.split('$LINE')[0] + '/----' + self.netFormat.split('$net')[1] + self.formatLine.split('$LINE')[1] + self.label_netUp.setText(text) + self.layout.addItem(self.label_netUp) + + self.batBool = self.settings.get('batBool', True) + if (self.batBool): + self.batFormat = str(self.settings.get('batFormat', '[bat: $bat%]')) + self.label_bat = Plasma.Label(self.applet) + text = self.formatLine.split('$LINE')[0] + self.batFormat.split('$bat')[0] + '---' + self.batFormat.split('$bat')[1] + self.formatLine.split('$LINE')[1] + self.label_bat.setText(text) + self.layout.addItem(self.label_bat) + + self.applet.setLayout(self.layout) + self.theme = Plasma.Svg(self) + self.theme.setImagePath("widgets/background") + self.setBackgroundHints(Plasma.Applet.DefaultBackground) # start timer + self.connectToEngine() self.timer = QtCore.QTimer() self.timer.setInterval(self.interval) self.startPolling() @@ -69,22 +131,70 @@ class pyTextWidget(plasmascript.Applet): def configAccepted(self): """function to accept settings""" # update local variables - self.format = str(self.configpage.ui.lineEdit_format.text()) self.interval = int(self.configpage.ui.spinBox_interval.value()) - self.font_family = str(self.configpage.ui.fontComboBox.currentFont().family()) - self.font_size = int(self.configpage.ui.spinBox_fontSize.value()) - self.font_color = str(self.configpage.ui.kcolorcombo.color().name()) - self.font_style = str(self.configpage.ui.lineEdit_style.text()) - self.num_dev = int(self.configpage.ui.comboBox_numNet.currentIndex()) - - # save config to settings - self.settings.set('format', self.format) self.settings.set('interval', self.interval) + self.font_family = str(self.configpage.ui.fontComboBox.currentFont().family()) self.settings.set('font_family', self.font_family) + self.font_size = int(self.configpage.ui.spinBox_fontSize.value()) self.settings.set('font_size', self.font_size) + self.font_color = str(self.configpage.ui.kcolorcombo.color().name()) self.settings.set('font_color', self.font_color) + self.font_style = str(self.configpage.ui.lineEdit_style.text()) self.settings.set('font_style', self.font_style) - self.settings.set('num_dev', self.num_dev) + self.formatLine = "" + self.formatLine = self.formatLine + "

$LINE"
+        self.formatLine = self.formatLine + "

" + + if (self.configpage.ui.checkBox_cpu.checkState() == 2): + self.cpuBool = True + self.cpuFormat = str(self.configpage.ui.lineEdit_cpu.text()) + self.settings.set('cpuFormat', self.cpuFormat) + else: + self.cpuBool = False + self.settings.set('cpuBool', self.cpuBool) + + if (self.configpage.ui.checkBox_temp.checkState() == 2): + self.tempBool = True + self.tempFormat = str(self.configpage.ui.lineEdit_temp.text()) + self.settings.set('tempFormat', self.tempFormat) + else: + self.tempBool = False + self.settings.set('tempBool', self.tempBool) + + if (self.configpage.ui.checkBox_mem.checkState() == 2): + self.memBool = True + self.memFormat = str(self.configpage.ui.lineEdit_mem.text()) + self.settings.set('memFormat', self.memFormat) + else: + self.memBool = False + self.settings.set('memBool', self.memBool) + + if (self.configpage.ui.checkBox_swap.checkState() == 2): + self.swapBool = True + self.swapFormat = str(self.configpage.ui.lineEdit_swap.text()) + self.settings.set('swapFormat', self.swapFormat) + else: + self.swapBool = False + self.settings.set('swapBool', self.swapBool) + + if (self.configpage.ui.checkBox_net.checkState() == 2): + self.netBool = True + self.netFormat = str(self.configpage.ui.lineEdit_net.text()) + self.num_dev = int(self.configpage.ui.comboBox_numNet.currentIndex()) + self.settings.set('netFormat', self.netFormat) + self.settings.set('num_dev', self.num_dev) + else: + self.netBool = False + self.settings.set('netBool', self.netBool) + + if (self.configpage.ui.checkBox_bat.checkState() == 2): + self.batBool = True + self.batFormat = str(self.configpage.ui.lineEdit_bat.text()) + self.settings.set('batFormat', self.batFormat) + else: + self.batBool = False + self.settings.set('batBool', self.batBool) # update timer self.timer.setInterval(self.interval) @@ -95,13 +205,62 @@ class pyTextWidget(plasmascript.Applet): self.configpage = ConfigWindow(self, self.settings) font = QFont(str(self.settings.get('font_family', 'Terminus')), int(self.settings.get('font_size', 12)), int(int(self.settings.get('font_weight', 50)))) - self.configpage.ui.lineEdit_format.setText(str(self.settings.get('format', '[cpu: $cpu%][temp: $temp°C][mem: $mem%][swap: $swap%][net: $netKB/s][bat: $bat%]'))) self.configpage.ui.spinBox_interval.setValue(int(self.settings.get('interval', '2000'))) self.configpage.ui.fontComboBox.setCurrentFont(font) self.configpage.ui.spinBox_fontSize.setValue(int(self.settings.get('font_size', 12))) self.configpage.ui.kcolorcombo.setColor(QColor(str(self.settings.get('font_color', '#000000')))) self.configpage.ui.lineEdit_style.setText(str(self.settings.get('font_style', 'normal'))) - self.configpage.ui.comboBox_numNet.setCurrentIndex(int(self.settings.get('num_dev', 0))) + + if (self.cpuBool): + self.configpage.ui.checkBox_cpu.setCheckState(2) + self.configpage.ui.lineEdit_cpu.setEnabled(True) + self.configpage.ui.lineEdit_cpu.setText(str(self.settings.get('cpuFormat', '[cpu: $cpu%]'))) + else: + self.configpage.ui.checkBox_cpu.setCheckState(0) + self.configpage.ui.lineEdit_cpu.setDisabled(True) + + if (self.tempBool): + self.configpage.ui.checkBox_temp.setCheckState(2) + self.configpage.ui.lineEdit_temp.setEnabled(True) + self.configpage.ui.lineEdit_temp.setText(str(self.settings.get('tempFormat', '[temp: $temp°C]'))) + else: + self.configpage.ui.checkBox_temp.setCheckState(0) + self.configpage.ui.lineEdit_temp.setDisabled(True) + + if (self.memBool): + self.configpage.ui.checkBox_mem.setCheckState(2) + self.configpage.ui.lineEdit_mem.setEnabled(True) + self.configpage.ui.lineEdit_mem.setText(str(self.settings.get('memFormat', '[mem: $mem%]'))) + else: + self.configpage.ui.checkBox_mem.setCheckState(0) + self.configpage.ui.lineEdit_mem.setDisabled(True) + + if (self.swapBool): + self.configpage.ui.checkBox_swap.setCheckState(2) + self.configpage.ui.lineEdit_swap.setEnabled(True) + self.configpage.ui.lineEdit_swap.setText(str(self.settings.get('swapFormat', '[swap: $swap%]'))) + else: + self.configpage.ui.checkBox_swap.setCheckState(0) + self.configpage.ui.lineEdit_swap.setDisabled(True) + + if (self.netBool): + self.configpage.ui.checkBox_net.setCheckState(2) + self.configpage.ui.lineEdit_net.setEnabled(True) + self.configpage.ui.comboBox_numNet.setEnabled(True) + self.configpage.ui.comboBox_numNet.setCurrentIndex(int(self.settings.get('num_dev', 0))) + self.configpage.ui.lineEdit_net.setText(str(self.settings.get('netNonFormat', '[net: $net%]'))) + else: + self.configpage.ui.checkBox_swap.setCheckState(0) + self.configpage.ui.comboBox_numNet.setDisabled(True) + self.configpage.ui.lineEdit_swap.setDisabled(True) + + if (self.batBool): + self.configpage.ui.checkBox_bat.setCheckState(2) + self.configpage.ui.lineEdit_bat.setEnabled(True) + self.configpage.ui.lineEdit_bat.setText(str(self.settings.get('batFormat', '[bat: $bat%]'))) + else: + self.configpage.ui.checkBox_bat.setCheckState(0) + self.configpage.ui.lineEdit_bat.setDisabled(True) # add config page page = parent.addPage(self.configpage, i18n(self.name())) @@ -109,27 +268,8 @@ class pyTextWidget(plasmascript.Applet): parent.okClicked.connect(self.configAccepted) - def formating_line(self): - """function to set format line""" - output = self.format - - if (output.split("$cpu")[0] != output): - output = output.split("$cpu")[0] + self.cpuText + output.split("$cpu")[1] - if (output.split("$temp")[0] != output): - output = output.split("$temp")[0] + self.tempText + output.split("$temp")[1] - if (output.split("$mem")[0] != output): - output = output.split("$mem")[0] + self.memText() + output.split("$mem")[1] - if (output.split("$swap")[0] != output): - output = output.split("$swap")[0] + self.swapText() + output.split("$swap")[1] - if (output.split("$net")[0] != output): - output = output.split("$net")[0] + self.netText() + output.split("$net")[1] - print output - if (output.split("$bat")[0] != output): - output = output.split("$bat")[0] + self.batText() + output.split("$bat")[1] - - return output - def setupNetdev(self): + """function to setup network device""" if (self.num_dev == 0): for line in commands.getoutput("ifconfig -a").split("\n"): if (line != ''): @@ -148,6 +288,7 @@ class pyTextWidget(plasmascript.Applet): self.netdev = commands.getoutput(command_line) def setupTemp(self): + """function to setup temp device""" commandOut = commands.getoutput("sensors | grep Physical -B2") self.tempdev = "lmsensors/"+commandOut.split("\n")[0]+"/"+'_'.join(commandOut.split("\n")[2].split(":")[0].split()) @@ -178,82 +319,114 @@ class pyTextWidget(plasmascript.Applet): def updateLabel(self): """function to update label""" - string = self.formating_line() - #string = self.cpuText - text = "" - text = text + "

"+string
-        text = text + "

" - self.label.setText(text) + if ((self.memBool) and (self.memInMb == False)): + self.memText() + if ((self.swapBool) and (self.swapInMb == False)): + self.swapText() + if (self.batBool): + self.batText() def batText(self): """function to set battery text""" commandOut = commands.getoutput("acpi") - bat = commandOut.split()[3][:-1] - output = "%3s" % (bat) - - return output + bat = "%3s" % (commandOut.split()[3].split("%")[0]) + line = self.batFormat.split('$bat')[0] + bat + self.batFormat.split('$bat')[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 mem = 100 * self.mem_used / full - output = "%5s" % (str(round(mem, 1))) - - return output - - def netText(self): - """function to set netspeed text""" - output = self.down_speed + "/" + self.up_speed - - return output + mem = "%5s" % (str(round(mem, 1))) + line = self.memFormat.split('$mem')[0] + mem + self.memFormat.split('$mem')[1] + 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 mem = 100 * self.swap_used / full - output = "%5s" % (str(round(mem, 1))) - - return output + mem = "%5s" % (str(round(mem, 1))) + line = self.swapFormat.split('$swap')[0] + mem + self.swapFormat.split('$swap')[1] + text = self.formatLine.split('$LINE')[0] + line + self.formatLine.split('$LINE')[1] + self.label_swap.setText(text) def connectToEngine(self): """function to initializate engine""" self.systemmonitor = self.dataEngine("systemmonitor") - self.systemmonitor.connectSource("cpu/system/TotalLoad", self, 200) - self.systemmonitor.connectSource("network/interfaces/"+self.netdev+"/transmitter/data", self, 200) - self.systemmonitor.connectSource("network/interfaces/"+self.netdev+"/receiver/data", self, 200) - self.systemmonitor.connectSource(self.tempdev, self, 200) - self.systemmonitor.connectSource("mem/physical/free", self, 200) - self.systemmonitor.connectSource("mem/physical/used", self, 200) - self.systemmonitor.connectSource("mem/physical/application", self, 200) - self.systemmonitor.connectSource("mem/swap/free", self, 200) - self.systemmonitor.connectSource("mem/swap/used", self, 200) + if (self.cpuBool): + self.systemmonitor.connectSource("cpu/system/TotalLoad", self, self.interval) + if (self.netBool): + self.systemmonitor.connectSource("network/interfaces/"+self.netdev+"/transmitter/data", self, self.interval) + self.systemmonitor.connectSource("network/interfaces/"+self.netdev+"/receiver/data", self, self.interval) + if (self.tempBool): + self.systemmonitor.connectSource(self.tempdev, self, self.interval) + if (self.memBool): + if (self.memInMb): + self.systemmonitor.connectSource("mem/physical/application", self, self.interval) + else: + self.systemmonitor.connectSource("mem/physical/free", self, 200) + self.systemmonitor.connectSource("mem/physical/used", self, 200) + self.systemmonitor.connectSource("mem/physical/application", self, 200) + if (self.swapBool): + if (self.swapInMb): + self.systemmonitor.connectSource("mem/swap/used", self, self.interval) + else: + self.systemmonitor.connectSource("mem/swap/free", self, 200) + self.systemmonitor.connectSource("mem/swap/used", self, 200) @pyqtSignature("dataUpdated(const QString &, const Plasma::DataEngine::Data &)") def dataUpdated(self, sourceName, data): """function to refresh data""" if (sourceName == "cpu/system/TotalLoad"): value = str(round(float(data[QString(u'value')]), 1)) - self.cpuText = "%5s" % (value) + cpuText = "%5s" % (value) + line = self.cpuFormat.split('$cpu')[0] + cpuText + self.cpuFormat.split('$cpu')[1] + text = self.formatLine.split('$LINE')[0] + line + self.formatLine.split('$LINE')[1] + self.label_cpu.setText(text) elif (sourceName == "network/interfaces/"+self.netdev+"/transmitter/data"): value = str(data[QString(u'value')]).split('.')[0] - self.up_speed = "%4s" % (value) - elif (sourceName == "network/interfaces/"+self.netdev+"/reciever/data"): + up_speed = "%4s" % (value) + line = '/' + up_speed + self.netFormat.split('$net')[1] + text = self.formatLine.split('$LINE')[0] + line + self.formatLine.split('$LINE')[1] + self.label_netUp.setText(text) + elif (sourceName == "network/interfaces/"+self.netdev+"/receiver/data"): value = str(data[QString(u'value')]).split('.')[0] - self.down_speed = "%4s" % (value) + down_speed = "%4s" % (value) + line = self.netFormat.split('$net')[0] + down_speed + text = self.formatLine.split('$LINE')[0] + line + self.formatLine.split('$LINE')[1] + self.label_netDown.setText(text) elif (sourceName == self.tempdev): value = str(round(float(data[QString(u'value')]), 1)) - self.tempText = "%4s" % (value) + tempText = "%4s" % (value) + line = self.tempFormat.split('$temp')[0] + tempText + self.tempFormat.split('$temp')[1] + text = self.formatLine.split('$LINE')[0] + line + self.formatLine.split('$LINE')[1] + self.label_temp.setText(text) elif (sourceName == "mem/physical/free"): self.mem_free = float(data[QString(u'value')]) elif (sourceName == "mem/physical/used"): self.mem_uf = float(data[QString(u'value')]) elif (sourceName == "mem/physical/application"): - self.mem_used = float(data[QString(u'value')]) + if (self.memInMb): + mem = str(round(float(data[QString(u'value')]) / 1024, 0)).split('.')[0] + mem = "%5s" % (mem) + line = self.memFormat.split('$memmb')[0] + mem + self.memFormat.split('$memmb')[1] + text = self.formatLine.split('$LINE')[0] + line + self.formatLine.split('$LINE')[1] + self.label_mem.setText(text) + else: + self.mem_used = float(data[QString(u'value')]) elif (sourceName == "mem/swap/free"): self.swap_free = float(data[QString(u'value')]) elif (sourceName == "mem/swap/used"): - self.swap_used = float(data[QString(u'value')]) + if (self.swapInMb): + mem = str(round(float(data[QString(u'value')]) / 1024, 0)).split('.')[0] + mem = "%5s" % (mem) + line = self.swapFormat.split('$swapmb')[0] + mem + self.swapFormat.split('$swapmb')[1] + text = self.formatLine.split('$LINE')[0] + line + self.formatLine.split('$LINE')[1] + self.label_swap.setText(text) + else: + self.swap_used = float(data[QString(u'value')]) diff --git a/source/contents/ui/configwindow.ui b/source/contents/ui/configwindow.ui index 55f7c42..39fda4f 100644 --- a/source/contents/ui/configwindow.ui +++ b/source/contents/ui/configwindow.ui @@ -6,8 +6,8 @@ 0 0 - 302 - 247 + 372 + 382 @@ -18,8 +18,8 @@ - 0 - 247 + 372 + 382 @@ -31,8 +31,8 @@ Form - - + + @@ -42,19 +42,19 @@ - 0 - 242 + 364 + 378 16777215 - 16777215 + 378 - - - + + + 0 @@ -75,7 +75,7 @@ - + 0 @@ -84,23 +84,26 @@ - 100 + 111 25 - 100 + 111 25 - Output format + CPU + + + true - + 0 @@ -121,7 +124,394 @@ - + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + + + + 0 + 0 + + + + + 111 + 25 + + + + + 111 + 25 + + + + Temperature + + + true + + + + + + + + 0 + 25 + + + + + 16777215 + 25 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + + + + 0 + 0 + + + + + 111 + 25 + + + + + 111 + 25 + + + + Memory + + + true + + + + + + + + 0 + 25 + + + + + 16777215 + 25 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + + + + 0 + 0 + + + + + 111 + 25 + + + + + 111 + 25 + + + + Swap + + + true + + + + + + + + 0 + 25 + + + + + 16777215 + 25 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + + + + 0 + 0 + + + + + 111 + 25 + + + + + 111 + 25 + + + + Network + + + true + + + + + + + + 0 + 0 + + + + + 100 + 25 + + + + + 100 + 25 + + + + + One device + + + + + Two devices + + + + + + + + + 0 + 25 + + + + + 16777215 + 25 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + + + + 0 + 0 + + + + + 111 + 25 + + + + + 111 + 25 + + + + Battery + + + true + + + + + + + + 0 + 25 + + + + + 16777215 + 25 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + @@ -217,7 +607,7 @@ - + @@ -311,7 +701,7 @@ - + @@ -404,7 +794,7 @@ - + @@ -488,7 +878,7 @@ - + @@ -575,104 +965,21 @@ - - - - - 0 - 0 - - - - - 0 - 30 - - - - - 16777215 - 30 - - - - - - - - 0 - 0 - - - - - 170 - 25 - - - - - 170 - 25 - - - - Number of network devices - - - - - - - Qt::Horizontal - - - - 40 - 19 - - - - - - - - - 0 - 0 - - - - - 100 - 25 - - - - - 100 - 25 - - - - - 1 - - - - - 2 - - - - - - - + widget_cpu + widget_interval + widget_font + widget_fontSize + widget_color + widget_style + widget_temp + widget_mem + widget_swap + widget_net + widget_bat - + Qt::Vertical @@ -697,13 +1004,24 @@ - lineEdit_format + checkBox_cpu + lineEdit_cpu + checkBox_temp + lineEdit_temp + checkBox_mem + lineEdit_mem + checkBox_swap + lineEdit_swap + checkBox_net + comboBox_numNet + lineEdit_net + checkBox_bat + lineEdit_bat spinBox_interval fontComboBox spinBox_fontSize kcolorcombo lineEdit_style - comboBox_numNet diff --git a/source/metadata.desktop b/source/metadata.desktop index ca9e6c3..e48b628 100644 --- a/source/metadata.desktop +++ b/source/metadata.desktop @@ -9,7 +9,7 @@ X-Plasma-MainScript=code/main.py X-KDE-PluginInfo-Author=Evgeniy Alexeev aka arcanis X-KDE-PluginInfo-Email=esalexeev@gmail.com X-KDE-PluginInfo-Name=py-text-monitor -X-KDE-PluginInfo-Version=1.0 +X-KDE-PluginInfo-Version=1.1 X-KDE-PluginInfo-Website=http://kde-look.org/ X-KDE-PluginInfo-Category=System Information X-KDE-PluginInfo-Depends=