From cd99f059ffeb607924b8842496073e9a126e2ef8 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Mon, 7 Apr 2014 21:19:32 +0400 Subject: [PATCH] added tags $hddmb, $hddgb --- CHANGELOG | 1 + CHANGELOG-RU | 1 + README.md | 1 - sources/ptm/contents/code/dataengine.py | 11 +++++++++-- sources/ptm/contents/code/main.py | 16 +++++++++++++++- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 16e3ff9..5ca7280 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Ver.1.7.5: + added scrollbar to configuration interface + added AC lines configuration ++ added $hddmbN, %hddgbN tags Ver.1.7.4: + added support more than 10 tags in cpu, cpuclock, hdd, hddtemp, temp labels diff --git a/CHANGELOG-RU b/CHANGELOG-RU index ad409d1..9df3b47 100644 --- a/CHANGELOG-RU +++ b/CHANGELOG-RU @@ -1,6 +1,7 @@ Вер.1.7.5: + добавлены скроллбары в конфигурационный интерфейс + добавлена настройка значений AC ++ добавлены теги $hddmbN, $hddgbN Вер.1.7.4: + добавлена поддержка более чем 10 тэгов в полях cpu, cpuclock, hdd, hddtemp, temp diff --git a/README.md b/README.md index f3756de..73cf772 100644 --- a/README.md +++ b/README.md @@ -186,7 +186,6 @@ TODO (wish list) ---------------- * data labels on tooltip * package manager support -* hddmb support * ps count and ps support Links diff --git a/sources/ptm/contents/code/dataengine.py b/sources/ptm/contents/code/dataengine.py index f0f4fdf..2f688f2 100644 --- a/sources/ptm/contents/code/dataengine.py +++ b/sources/ptm/contents/code/dataengine.py @@ -53,6 +53,7 @@ class DataEngine: if (bools['hdd'] > 0): for item in names['hdd']: dataEngines['system'].connectSource("partitions" + item + "/filllevel", self.parent, interval) + dataEngines['system'].connectSource("partitions" + item + "/usedspace", self.parent, interval) if (bools['hddtemp'] > 0): dataEngines['ext'].connectSource("hddtemp", self.parent, interval) if (bools['mem'] > 0): @@ -118,11 +119,16 @@ class DataEngine: updatedData['name'] = "gputemp" value = round(data[QString(u'GPUTemp')].toFloat()[0], 1) updatedData['value'] = "%4.1f" % (value) - elif (sourceName.split('/')[0] == "partitions"): + elif (sourceName.split('/')[0] == "partitions") and (sourceName.split('/')[-1] == "filllevel"): updatedData['name'] = "hdd" updatedData['type'] = '/' + '/'.join(sourceName.split('/')[1:-1]) value = round(data[QString(u'value')].toFloat()[0], 1) - updatedData['value'] = "%5.1f" % (value) + updatedData['value'] = value + elif (sourceName.split('/')[0] == "partitions") and (sourceName.split('/')[-1] == "usedspace"): + updatedData['name'] = "hddmb" + updatedData['type'] = '/' + '/'.join(sourceName.split('/')[1:-1]) + value = data[QString(u'value')].toFloat()[0] + updatedData['value'] = value elif (sourceName == "hddtemp"): updatedData['name'] = "hddtemp" updatedData['value'] = {} @@ -267,6 +273,7 @@ class DataEngine: elif (name == "hdd"): for item in keys['hdd']: dataEngines['system'].disconnectSource("partitions" + item + "/filllevel", self.parent) + dataEngines['system'].disconnectSource("partitions" + item + "/usedspace", self.parent) elif (name == "hddtemp"): dataEngines['ext'].disconnectSource("hddtemp", self.parent) elif (name == "mem"): diff --git a/sources/ptm/contents/code/main.py b/sources/ptm/contents/code/main.py index f4159c5..91f44f6 100644 --- a/sources/ptm/contents/code/main.py +++ b/sources/ptm/contents/code/main.py @@ -180,6 +180,7 @@ class pyTextWidget(plasmascript.Applet): self.ptm['values']['cpu'][i] = 0.0 self.ptm['values']['cpuclock'][i] = 0.0 self.ptm['values']['hdd'] = {} + self.ptm['values']['hddmb'] = {} self.ptm['values']['hddtemp'] = {} self.ptm['values']['mem'] = {'app':0.0, 'used':0.0, 'free':1.0} self.ptm['values']['net'] = {"up":0.0, "down":0.0} @@ -348,9 +349,20 @@ class pyTextWidget(plasmascript.Applet): devices.reverse() for i in devices: if (line.split('$hdd' + str(i))[0] != line): + hdd = "%4.1f" % (self.ptm['values']['hdd'][self.ptm['names']['hdd'][i]]) line = line.split('$hdd' + str(i))[0] +\ - str(self.ptm['values']['hdd'][self.ptm['names']['hdd'][i]]) +\ + hdd +\ line.split('$hdd' + str(i))[1] + if (line.split('$hddmb' + str(i))[0] != line): + hdd = "%i" % (self.ptm['values']['hddmb'][self.ptm['names']['hdd'][i]] / 1024.0) + line = line.split('$hddmb' + str(i))[0] +\ + str(int(self.ptm['values']['hddmb'][self.ptm['names']['hdd'][i]] / 1024.0)) +\ + line.split('$hddmb' + str(i))[1] + if (line.split('$hddgb' + str(i))[0] != line): + hdd = "%4.1f" % (self.ptm['values']['hddmb'][self.ptm['names']['hdd'][i]] / (1024.0 * 1024.0)) + line = line.split('$hddgb' + str(i))[0] +\ + hdd +\ + line.split('$hddgb' + str(i))[1] text = self.ptm['vars']['app']['format'][0] + line + self.ptm['vars']['app']['format'][1] self.setText("hdd", text) @@ -457,6 +469,8 @@ class pyTextWidget(plasmascript.Applet): for item in ['hdd', 'hddtemp', 'temp']: for value in self.ptm['names'][item]: self.ptm['values'][item][value] = 0.0 + if (item == "hdd"): + self.ptm['values']['hddmb'][value] = 0.0 def connectToEngine(self):