From 2de09cec3286fdb3de2b2078fded79e70b8f1a98 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Tue, 20 May 2014 10:07:01 +0400 Subject: [PATCH] prepare to release 1.9.0 + added support of several custom commands * fix parsing pkg label --- CHANGELOG | 5 +++-- CHANGELOG-RU | 5 +++-- PKGBUILD | 2 +- sources/ptm/contents/code/configdef.py | 6 +++--- sources/ptm/contents/code/dataengine.py | 5 +++-- sources/ptm/contents/code/main.py | 19 ++++++++++++++----- 6 files changed, 27 insertions(+), 15 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f5054f4..ea5be51 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,8 @@ Ver.1.9.0: -+ added support of several custom commands -+ added hdd speed label ++ added support of several custom commands ($customN) ++ added hdd speed label ($hddrN, $hddwN) + added actions to context menu (open readme and run ksysguard) +* fix parsing pkg label - removed doubleclick event Ver.1.8.3: diff --git a/CHANGELOG-RU b/CHANGELOG-RU index 76b7998..4327fe5 100644 --- a/CHANGELOG-RU +++ b/CHANGELOG-RU @@ -1,7 +1,8 @@ Вер.1.9.0: -+ добавлена поддержка нескольких кастомных команд -+ добавлено поле скорости hdd ++ добавлена поддержка нескольких кастомных команд ($customN) ++ добавлено поле скорости hdd ($hddrN, $hddwN) + добавлены действия в контекстное меню (открыть readme и запустить ksysguard) +* исправлен парсинг поля pkg - убрано событие по двойному клику Вер.1.8.3: diff --git a/PKGBUILD b/PKGBUILD index 36800b8..287fda8 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -20,7 +20,7 @@ optdepends=("amarok: for music player monitor" makedepends=('automoc4' 'cmake') source=(https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz) install=${pkgname}.install -md5sums=('9cd2ebf4f2afa80c2bd1330c06c86d17') +md5sums=('3b65c259a8042b8555ff689a68dfe247') backup=('usr/share/config/extsysmon.conf') prepare() { diff --git a/sources/ptm/contents/code/configdef.py b/sources/ptm/contents/code/configdef.py index ebda8cb..dbb199f 100644 --- a/sources/ptm/contents/code/configdef.py +++ b/sources/ptm/contents/code/configdef.py @@ -80,10 +80,10 @@ class ConfigDefinition: dataengineConfig = unicode(KGlobal.dirs().localkdedir()) + "/share/config/extsysmon.conf" try: - item = QStringList() - for i in range(self.configpage.ui.listWidget_customCommand.count()): - item.append(self.configpage.ui.listWidget_customCommand.item(i).text()) with open(dataengineConfig, 'w') as deConfigFile: + item = QStringList() + for i in range(self.configpage.ui.listWidget_customCommand.count()): + item.append(self.configpage.ui.listWidget_customCommand.item(i).text()) deConfigFile.write("CUSTOM=" + str(item.join(QString('@@'))) + "\n") deConfigFile.write("GPUDEV=" + str(self.configpage.ui.comboBox_gpudev.currentText()) + "\n") deConfigFile.write("HDDDEV=" + str(self.configpage.ui.comboBox_hdddev.currentText()) + "\n") diff --git a/sources/ptm/contents/code/dataengine.py b/sources/ptm/contents/code/dataengine.py index 3c257c0..5ffae3b 100644 --- a/sources/ptm/contents/code/dataengine.py +++ b/sources/ptm/contents/code/dataengine.py @@ -118,8 +118,9 @@ class DataEngine: updatedData['value'] = value elif (sourceName == "custom"): updatedData['name'] = "custom" - value = str(data[QString(u'custom')].toUtf8()).decode("utf-8") - updatedData['value'] = value + updatedData['value'] = {} + for singleData in data.keys(): + updatedData['value'][str(singleData.toLower())] = str(data[singleData].toUtf8()).decode("utf-8") elif ((sourceName[:4] == "disk") and (sourceName[-4:] == "rblk")): updatedData['name'] = "disk-r" updatedData['type'] = '/'.join(str(sourceName).split('/')[0:2]) diff --git a/sources/ptm/contents/code/main.py b/sources/ptm/contents/code/main.py index 15e06c4..cd5fc7c 100644 --- a/sources/ptm/contents/code/main.py +++ b/sources/ptm/contents/code/main.py @@ -623,8 +623,13 @@ class pyTextWidget(plasmascript.Applet): """function to prepare text""" line = self.ptm['vars']['formats'][name] if (name == "custom"): - if (line.split('$custom')[0] != line): - line = line.split('$custom')[0] + text + line.split('$custom')[1] + cmds = range(len(text.keys())) + cmds.reverse() + for i in cmds: + if (line.split('$custom' + str(i))[0] != line): + line = line.split('$custom' + str(i))[0] + \ + text['custom'+str(i)] + \ + line.split('$custom' + str(i))[1] elif (name == "gpu"): if (line.split('$gpu')[0] != line): line = line.split('$gpu')[0] + text + line.split('$gpu')[1] @@ -632,9 +637,13 @@ class pyTextWidget(plasmascript.Applet): if (line.split('$gputemp')[0] != line): line = line.split('$gputemp')[0] + getTemp(text, self.ptm['vars']['adv']['tempUnits']) + line.split('$gputemp')[1] elif (name == "pkg"): - for item in text.keys(): - if (line.split('$' + item)[0] != line): - line = line.split('$' + item)[0] + text[item] + line.split('$' + item)[1] + pkgs = range(len(text.keys())) + pkgs.reverse() + for i in pkgs: + if (line.split('$pkgcount' + str(i))[0] != line): + line = line.split('$pkgcount' + str(i))[0] + \ + text['pkgcount'+str(i)] + \ + line.split('$pkgcount' + str(i))[1] elif (name == "player"): if (line.split('$album')[0] != line): line = line.split('$album')[0] + text['album'] + line.split('$album')[1]