moved player settings from plasmoid to dataengine

try to fix creating a lot of zombies
This commit is contained in:
arcan1s
2014-05-27 09:11:53 +04:00
parent 926c283338
commit 6ba1288c50
15 changed files with 135 additions and 156 deletions

View File

@ -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():

View File

@ -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'] = {}

View File

@ -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'] = ["<pre><p align=\"center\"><span style=\" font-family:'" + str(settings.get('font_family', 'Terminus')) +\