From 6ba1288c50a304fd5efd9b4380ececaeb327e865 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Tue, 27 May 2014 09:11:53 +0400 Subject: [PATCH] moved player settings from plasmoid to dataengine try to fix creating a lot of zombies --- CHANGELOG | 1 + CHANGELOG-RU | 1 + PKGBUILD | 2 +- README.md | 7 +- md_readme/en.md | 11 ++- md_readme/ru.md | 8 +- readme_diff.patch | 27 +++++- sources/ext-sysmon/extsysmon.conf | 5 +- sources/ext-sysmon/extsysmon.cpp | 50 ++-------- sources/ptm/contents/code/configdef.py | 8 +- sources/ptm/contents/code/dataengine.py | 29 +----- sources/ptm/contents/code/reinit.py | 1 - sources/ptm/contents/ui/configwindow.ui | 117 ++++++++++++------------ sources/readme/en.html | 12 ++- sources/readme/ru.html | 12 ++- 15 files changed, 135 insertions(+), 156 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 42949bc..f13556c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,7 @@ Ver.1.9.1: + added tags $memtotmb, $memtotgb, $swaptotmb, $swaptotgb + added Brazillian Portuguese translation (@underr) + added Ukrainian translation (Виктор Слободян) +* player settings was moved from plasmoid to dataengine * edited readme call * changed readme from md to html diff --git a/CHANGELOG-RU b/CHANGELOG-RU index e3805f8..eea8b81 100644 --- a/CHANGELOG-RU +++ b/CHANGELOG-RU @@ -5,6 +5,7 @@ + добавлены теги $memtotmb, $memtotgb, $swaptotmb, $swaptotgb + добавлен перевод Brazillian Portuguese (@underr) + добавлена украинская локализация (Виктор Слободян) +* настройки плеера были перенесены из виджета в dataengine * исправлен вызов readme под четырехсимвольное обозначение * перенос readme с md на html diff --git a/PKGBUILD b/PKGBUILD index c2b9f4c..3e12f83 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=('9338f4db03d1b0d7ab540fd5be69ef89') +md5sums=('eb49cc4c68b161500ba103bd00090b65') backup=('usr/share/config/extsysmon.conf') prepare() { diff --git a/README.md b/README.md index 542860a..7caa72f 100644 --- a/README.md +++ b/README.md @@ -135,10 +135,6 @@ Line which will be shown when AC is offline. File with AC information. File (`/sys/class/power_supply/AC/online` by default) must contain `1` if AC is online. -**Music player** - -Select one of supported music playes for player label. - Tooltip settings ---------------- Since version 1.7.0 CPU, CPU clock, memory, swap and network labels support graphical tooltip. To enable them just make the needed checkboxes a fully checked. The number of stored values can be set in the tab. Colors of graphs are configurable too. @@ -181,6 +177,9 @@ List of commands, which will be run. Number of null lines is a number of unneede * *FreeBSD*: `PKGCMD=pkg_version -I -l '<'`, `PKGNULL=0` * *Mandriva*: `PKGCMD=urpmq --auto-select`, `PKGNULL=0` +**Music player** + +Select one of supported music playes for player label. DataEngine configuration ------------------------ diff --git a/md_readme/en.md b/md_readme/en.md index d593fe9..7caa72f 100644 --- a/md_readme/en.md +++ b/md_readme/en.md @@ -28,9 +28,13 @@ For edited output you must open Settings window and setup output format in lines * tag `$mem` - usage memory, *%* * tag `$memmb` - usage memory, *MB* * tag `$memgb` - usage memory, *GB* +* tag `$memtotmb` - total RAM, *MB* +* tag `$memtotgb` - total RAM, *GB* * tag `$swap` - swap, *%* * tag `$swapmb` - swap, *MB* * tag `$swapgb` - swap, *GB* +* tag `$swaptotmb` - total swap, *MB* +* tag `$swaptotgb` - total swap, *GB* * tag `$hddN` - usage for mount point N, *%*. For example, `$hdd0` * tag `$hddmbN` - usage for mount point N, *MB*. For example, `$hddmb0` * tag `$hddgbN` - usage for mount point N, *GB*. For example, `$hddgb0` @@ -131,10 +135,6 @@ Line which will be shown when AC is offline. File with AC information. File (`/sys/class/power_supply/AC/online` by default) must contain `1` if AC is online. -**Music player** - -Select one of supported music playes for player label. - Tooltip settings ---------------- Since version 1.7.0 CPU, CPU clock, memory, swap and network labels support graphical tooltip. To enable them just make the needed checkboxes a fully checked. The number of stored values can be set in the tab. Colors of graphs are configurable too. @@ -177,6 +177,9 @@ List of commands, which will be run. Number of null lines is a number of unneede * *FreeBSD*: `PKGCMD=pkg_version -I -l '<'`, `PKGNULL=0` * *Mandriva*: `PKGCMD=urpmq --auto-select`, `PKGNULL=0` +**Music player** + +Select one of supported music playes for player label. DataEngine configuration ------------------------ diff --git a/md_readme/ru.md b/md_readme/ru.md index 4592a2a..2034474 100644 --- a/md_readme/ru.md +++ b/md_readme/ru.md @@ -135,10 +135,6 @@ PyTextMonitor - минималистичный плазмоид, написан Файл с информацией об адапторе питания. Данный файл (`/sys/class/power_supply/AC/online` по умолчанию) должен содержать `1`, если адаптор подключен. -**Музыкальные плеер** - -Выберете один из поддерживаемых музыкальных плееров. - Настройки тултипа ----------------- Начиная с версии 1.7.0 поля CPU, частота CPU, память, swap и сеть поддерживают графический тултип. Чтобы включить их, просто сделайте требуемые чекбоксы полностью чекнутыми. Число хранимых значений может быть выставленно в данной вкладке. Цвета графиков также настраиваются. @@ -181,6 +177,10 @@ PyTextMonitor - минималистичный плазмоид, написан * *FreeBSD*: `PKGCMD=pkg_version -I -l '<'`, `PKGNULL=0` * *Mandriva*: `PKGCMD=urpmq --auto-select`, `PKGNULL=0` +**Музыкальные плеер** + +Выберете один из поддерживаемых музыкальных плееров. + Настройка DataEngine -------------------- Вы можете отредактировать настройки DataEngine вручную. Откройте файл `/usr/share/config/extsysmon.conf` или `$HOME/.kde4/share/config/extsysmon.conf`, в зависимости от типа установки. Раскомментируйте требуемые строки и отредактируйте их. diff --git a/readme_diff.patch b/readme_diff.patch index fafb552..7fc9be7 100644 --- a/readme_diff.patch +++ b/readme_diff.patch @@ -1,5 +1,5 @@ --- README.md.orig 2014-05-21 19:56:55.000000000 +0400 -+++ README.md 2014-05-27 01:20:30.845903666 +0400 ++++ README.md 2014-05-27 09:07:25.548819808 +0400 @@ -10,6 +10,7 @@ Configuration ------------- @@ -22,7 +22,18 @@ * tag `$hddN` - usage for mount point N, *%*. For example, `$hdd0` * tag `$hddmbN` - usage for mount point N, *MB*. For example, `$hddmb0` * tag `$hddgbN` - usage for mount point N, *GB*. For example, `$hddgb0` -@@ -154,6 +159,10 @@ +@@ -130,10 +135,6 @@ + + File with AC information. File (`/sys/class/power_supply/AC/online` by default) must contain `1` if AC is online. + +-**Music player** +- +-Select one of supported music playes for player label. +- + Tooltip settings + ---------------- + Since version 1.7.0 CPU, CPU clock, memory, swap and network labels support graphical tooltip. To enable them just make the needed checkboxes a fully checked. The number of stored values can be set in the tab. Colors of graphs are configurable too. +@@ -154,6 +155,10 @@ Select one of HDDs for HDD temperature monitor. `all` will enable monitor for all devices. Default is `all`. @@ -33,7 +44,17 @@ **MPD address** Address of MPD server. Default is `localhost`. -@@ -191,7 +200,7 @@ +@@ -172,6 +177,9 @@ + * *FreeBSD*: `PKGCMD=pkg_version -I -l '<'`, `PKGNULL=0` + * *Mandriva*: `PKGCMD=urpmq --auto-select`, `PKGNULL=0` + ++**Music player** ++ ++Select one of supported music playes for player label. + + DataEngine configuration + ------------------------ +@@ -191,7 +199,7 @@ --------------------- * proprietary video driver * hddtemp (make sure that it may be run with `sudo` without password. Just add following line to `/etc/sudoers`: `$USERNAME ALL=NOPASSWD: /usr/bin/hddtemp`) diff --git a/sources/ext-sysmon/extsysmon.conf b/sources/ext-sysmon/extsysmon.conf index fb0bff3..a178f25 100644 --- a/sources/ext-sysmon/extsysmon.conf +++ b/sources/ext-sysmon/extsysmon.conf @@ -1,7 +1,7 @@ # Configuration file for Extended Systemmonitor DataEngine # Uncomment needed lines -# Custom command +# Custom command, separator is '@@' #CUSTOM=wget -qO- http://ifconfig.me/ip # Set GPU device @@ -27,3 +27,6 @@ #PKGCMD=pacman -Qu # Number of null lines for commands, comma separated #PKGNULL=0 + +# Player name. Supported players are amarok, clementine, mpd, qmmp +#PLAYER=amarok diff --git a/sources/ext-sysmon/extsysmon.cpp b/sources/ext-sysmon/extsysmon.cpp index 048425a..8cc4037 100644 --- a/sources/ext-sysmon/extsysmon.cpp +++ b/sources/ext-sysmon/extsysmon.cpp @@ -95,6 +95,7 @@ void ExtendedSysMon::readConfiguration() rawConfig[QString("MPDPORT")] = QString("6600"); rawConfig[QString("PKGCMD")] = QString("pacman -Qu"); rawConfig[QString("PKGNULL")] = QString("0"); + rawConfig[QString("PLAYER")] = QString("amarok"); QString fileName = KGlobal::dirs()->findResource("config", "extsysmon.conf"); QFile confFile(fileName); @@ -456,55 +457,18 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source) } else if (source == QString("player")) { QStringList value; - // amarok - value = getPlayerInfo(QString("amarok")); - key = QString("amarok_album"); - setData(source, key, value[0]); - key = QString("amarok_artist"); - setData(source, key, value[1]); - key = QString("amarok_progress"); - setData(source, key, value[2]); - key = QString("amarok_duration"); - setData(source, key, value[3]); - key = QString("amarok_title"); - setData(source, key, value[4]); - // clementine - value = getPlayerInfo(QString("clementine")); - key = QString("clementine_album"); - setData(source, key, value[0]); - key = QString("clementine_artist"); - setData(source, key, value[1]); - key = QString("clementine_progress"); - setData(source, key, value[2]); - key = QString("clementine_duration"); - setData(source, key, value[3]); - key = QString("clementine_title"); - setData(source, key, value[4]); - // mpd - value = getPlayerInfo(QString("mpd"), + value = getPlayerInfo(configuration[QString("PLAYER")], configuration[QString("MPDADDRESS")], configuration[QString("MPDPORT")]); - key = QString("mpd_album"); + key = QString("album"); setData(source, key, value[0]); - key = QString("mpd_artist"); + key = QString("artist"); setData(source, key, value[1]); - key = QString("mpd_progress"); + key = QString("progress"); setData(source, key, value[2]); - key = QString("mpd_duration"); + key = QString("duration"); setData(source, key, value[3]); - key = QString("mpd_title"); - setData(source, key, value[4]); - // qmmp - value = getPlayerInfo(QString("qmmp")); - key = QString("qmmp_album"); - setData(source, key, value[0]); - key = QString("qmmp_artist"); - setData(source, key, value[1]); - key = QString("qmmp_progress"); - setData(source, key, value[2]); - key = QString("qmmp_duration"); - setData(source, key, value[3]); - key = QString("qmmp_title"); + key = QString("title"); setData(source, key, value[4]); } else if (source == QString("ps")) { diff --git a/sources/ptm/contents/code/configdef.py b/sources/ptm/contents/code/configdef.py index c2b099f..5cc5f59 100644 --- a/sources/ptm/contents/code/configdef.py +++ b/sources/ptm/contents/code/configdef.py @@ -72,7 +72,6 @@ class ConfigDefinition: settings.set('ac_device', str(self.configpage.ui.lineEdit_acdev.text())) settings.set('ac_online', str(self.configpage.ui.lineEdit_acOnline.text())) settings.set('ac_offline', str(self.configpage.ui.lineEdit_acOffline.text())) - settings.set('player_name', str(self.configpage.ui.comboBox_playerSelect.currentText())) settings.set('tooltip_num', self.configpage.ui.spinBox_tooltipNum.value()) for label in ['cpu', 'cpuclock', 'mem', 'swap', 'down', 'up']: @@ -104,6 +103,7 @@ class ConfigDefinition: pkgNull.append("0") deConfigFile.write("PKGCMD=" + ','.join(pkgCmd) + "\n") deConfigFile.write("PKGNULL=" + ','.join(pkgNull) + "\n") + deConfigFile.write("PLAYER=" + str(self.configpage.ui.comboBox_playerSelect.currentText()) + "\n") except: pass @@ -192,8 +192,6 @@ class ConfigDefinition: self.configpage.ui.lineEdit_acdev.setText(str(settings.get('ac_device', '/sys/class/power_supply/AC/online'))) self.configpage.ui.lineEdit_acOnline.setText(str(settings.get('ac_online', '(*)'))) self.configpage.ui.lineEdit_acOffline.setText(str(settings.get('ac_offline', '( )'))) - index = self.configpage.ui.comboBox_playerSelect.findText(str(settings.get('player_name', "amarok"))) - self.configpage.ui.comboBox_playerSelect.setCurrentIndex(index) self.configpage.ui.spinBox_tooltipNum.setValue(settings.get('tooltip_num', 100).toInt()[0]) self.configpage.ui.kcolorcombo_cpu.setColor(QColor(str(settings.get('cpu_color', '#ff0000')))) @@ -205,7 +203,7 @@ class ConfigDefinition: deSettings = {'CUSTOM':'wget -qO- http://ifconfig.me/ip', 'GPUDEV':'auto', 'HDDDEV':'all', 'HDDTEMPCMD':'sudo hddtemp', 'MPDADDRESS':'localhost', 'MPDPORT':'6600', 'PKGCMD':'pacman -Qu', - 'PKGNULL':'0'} + 'PKGNULL':'0', 'PLAYER':'amarok'} dataengineConfig = unicode(KGlobal.dirs().localkdedir()) + "/share/config/extsysmon.conf" try: with open(dataengineConfig, 'r') as deConfigFile: @@ -238,6 +236,8 @@ class ConfigDefinition: except: num = "0" self.configpage.ui.listWidget_pkgCommand.addItem(deSettings['PKGCMD'].split(',')[i] + ':' + num) + index = self.configpage.ui.comboBox_playerSelect.findText(deSettings['PLAYER']) + self.configpage.ui.comboBox_playerSelect.setCurrentIndex(index) labelOrder = str(settings.get('label_order', '1345')) for label in self.defaults['order'].keys(): diff --git a/sources/ptm/contents/code/dataengine.py b/sources/ptm/contents/code/dataengine.py index b99dd0c..4d557de 100644 --- a/sources/ptm/contents/code/dataengine.py +++ b/sources/ptm/contents/code/dataengine.py @@ -198,30 +198,11 @@ class DataEngine: elif (sourceName == "player"): updatedData['name'] = "player" updatedData['value'] = {} - if (adv['player'] == "amarok"): - updatedData['value']['album'] = str(data[QString(u'amarok_album')].toUtf8()).decode("utf-8") - updatedData['value']['artist'] = str(data[QString(u'amarok_artist')].toUtf8()).decode("utf-8") - updatedData['value']['progress'] = str(data[QString(u'amarok_progress')].toUtf8()).decode("utf-8") - updatedData['value']['time'] = str(data[QString(u'amarok_duration')].toUtf8()).decode("utf-8") - updatedData['value']['title'] = str(data[QString(u'amarok_title')].toUtf8()).decode("utf-8") - elif (adv['player'] == "clementine"): - updatedData['value']['album'] = str(data[QString(u'clementine_album')].toUtf8()).decode("utf-8") - updatedData['value']['artist'] = str(data[QString(u'clementine_artist')].toUtf8()).decode("utf-8") - updatedData['value']['progress'] = str(data[QString(u'clementine_progress')].toUtf8()).decode("utf-8") - updatedData['value']['time'] = str(data[QString(u'clementine_duration')].toUtf8()).decode("utf-8") - updatedData['value']['title'] = str(data[QString(u'clementine_title')].toUtf8()).decode("utf-8") - elif (adv['player'] == "mpd"): - updatedData['value']['album'] = str(data[QString(u'mpd_album')].toUtf8()).decode("utf-8") - updatedData['value']['artist'] = str(data[QString(u'mpd_artist')].toUtf8()).decode("utf-8") - updatedData['value']['progress'] = str(data[QString(u'mpd_progress')].toUtf8()).decode("utf-8") - updatedData['value']['time'] = str(data[QString(u'mpd_duration')].toUtf8()).decode("utf-8") - updatedData['value']['title'] = str(data[QString(u'mpd_title')].toUtf8()).decode("utf-8") - elif (adv['player'] == "qmmp"): - updatedData['value']['album'] = str(data[QString(u'qmmp_album')].toUtf8()).decode("utf-8") - updatedData['value']['artist'] = str(data[QString(u'qmmp_artist')].toUtf8()).decode("utf-8") - updatedData['value']['progress'] = str(data[QString(u'qmmp_progress')].toUtf8()).decode("utf-8") - updatedData['value']['time'] = str(data[QString(u'qmmp_duration')].toUtf8()).decode("utf-8") - updatedData['value']['title'] = str(data[QString(u'qmmp_title')].toUtf8()).decode("utf-8") + updatedData['value']['album'] = str(data[QString(u'album')].toUtf8()).decode("utf-8") + updatedData['value']['artist'] = str(data[QString(u'artist')].toUtf8()).decode("utf-8") + updatedData['value']['progress'] = str(data[QString(u'progress')].toUtf8()).decode("utf-8") + updatedData['value']['time'] = str(data[QString(u'duration')].toUtf8()).decode("utf-8") + updatedData['value']['title'] = str(data[QString(u'title')].toUtf8()).decode("utf-8") elif (sourceName == "ps"): updatedData['name'] = "ps" updatedData['value'] = {} diff --git a/sources/ptm/contents/code/reinit.py b/sources/ptm/contents/code/reinit.py index a87f602..a46a8ba 100644 --- a/sources/ptm/contents/code/reinit.py +++ b/sources/ptm/contents/code/reinit.py @@ -47,7 +47,6 @@ class Reinit(): ptmVars['adv']['netdevBool'] = settings.get('netdevBool', 0).toInt()[0] ptmVars['adv']['netdev'] = str(settings.get('custom_netdev', 'lo')) ptmVars['adv']['netDir'] = str(settings.get('netdir', '/sys/class/net')) - ptmVars['adv']['player'] = str(settings.get('player_name', "amarok")) ptmVars['app'] = {} ptmVars['app']['format'] = ["

0 - 0 - 328 - 754 + -183 + 526 + 723 @@ -1717,59 +1717,6 @@ del - remove item - - - - - - - 120 - 0 - - - - Music player - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - amarok - - - - - clementine - - - - - mpd - - - - - qmmp - - - - - - @@ -2485,8 +2432,8 @@ del - remove item 0 0 - 326 - 414 + 544 + 540 @@ -2841,6 +2788,59 @@ del - remove item + + + + + + + 120 + 0 + + + + Music player + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + amarok + + + + + clementine + + + + + mpd + + + + + qmmp + + + + + + @@ -2951,7 +2951,6 @@ del - remove item lineEdit_acOnline lineEdit_acOffline lineEdit_acdev - comboBox_playerSelect scrollArea_tooltip spinBox_tooltipNum kcolorcombo_cpuclock diff --git a/sources/readme/en.html b/sources/readme/en.html index 63185da..df38a83 100644 --- a/sources/readme/en.html +++ b/sources/readme/en.html @@ -28,9 +28,13 @@

  • tag $mem - usage memory, %
  • tag $memmb - usage memory, MB
  • tag $memgb - usage memory, GB
  • +
  • tag $memtotmb - total RAM, MB
  • +
  • tag $memtotgb - total RAM, GB
  • tag $swap - swap, %
  • tag $swapmb - swap, MB
  • tag $swapgb - swap, GB
  • +
  • tag $swaptotmb - total swap, MB
  • +
  • tag $swaptotgb - total swap, GB
  • tag $hddN - usage for mount point N, %. For example, $hdd0
  • tag $hddmbN - usage for mount point N, MB. For example, $hddmb0
  • tag $hddgbN - usage for mount point N, GB. For example, $hddgb0
  • @@ -136,10 +140,6 @@

    File with AC information. File (/sys/class/power_supply/AC/online by default) must contain 1 if AC is online.

    -

    Music player

    - -

    Select one of supported music playes for player label.

    -

    Tooltip settings

    Since version 1.7.0 CPU, CPU clock, memory, swap and network labels support graphical tooltip. To enable them just make the needed checkboxes a fully checked. The number of stored values can be set in the tab. Colors of graphs are configurable too.

    @@ -182,6 +182,10 @@ * FreeBSD: PKGCMD=pkg_version -I -l '<', PKGNULL=0 * Mandriva: PKGCMD=urpmq --auto-select, PKGNULL=0

    +

    Music player

    + +

    Select one of supported music playes for player label.

    +

    DataEngine configuration

    You may edit DataEngine configuration. It is /usr/share/config/extsysmon.conf or $HOME/share/config/extsysmon.conf depending on the type of installation. Uncomment needed line and edit it.

    diff --git a/sources/readme/ru.html b/sources/readme/ru.html index 91a04ff..c20a931 100644 --- a/sources/readme/ru.html +++ b/sources/readme/ru.html @@ -26,9 +26,13 @@ * тег $mem - использование RAM, % * тег $memmb - использование RAM, MB * тег $memgb - использование RAM, GB +* тег $memtotmb - RAM, MB +* тег $memtotgb - RAM, GB * тег $swap - swap, % * тег $swapmb - swap, MB * тег $swapgb - swap, GB +* тег $swaptotmb - размер swap, MB +* тег $swaptotgb - размер swap, GB * тег $hddN - использование точки монтирования N, %. Например, $hdd0 * тег $hddmbN - использование точки монтирования N, KB/s. Например, $hddmb0 * тег $hddgbN - использование точки монтирования N, KB/s. Например, $hddgb0 @@ -133,10 +137,6 @@

    Файл с информацией об адапторе питания. Данный файл (/sys/class/power_supply/AC/online по умолчанию) должен содержать 1, если адаптор подключен.

    -

    Музыкальные плеер

    - -

    Выберете один из поддерживаемых музыкальных плееров.

    -

    Настройки тултипа

    Начиная с версии 1.7.0 поля CPU, частота CPU, память, swap и сеть поддерживают графический тултип. Чтобы включить их, просто сделайте требуемые чекбоксы полностью чекнутыми. Число хранимых значений может быть выставленно в данной вкладке. Цвета графиков также настраиваются.

    @@ -179,6 +179,10 @@ * FreeBSD: PKGCMD=pkg_version -I -l '<', PKGNULL=0 * Mandriva: PKGCMD=urpmq --auto-select, PKGNULL=0

    +

    Музыкальные плеер

    + +

    Выберете один из поддерживаемых музыкальных плееров.

    +

    Настройка DataEngine

    Вы можете отредактировать настройки DataEngine вручную. Откройте файл /usr/share/config/extsysmon.conf или $HOME/.kde4/share/config/extsysmon.conf, в зависимости от типа установки. Раскомментируйте требуемые строки и отредактируйте их.