add mpris support

This commit is contained in:
arcan1s
2014-08-02 11:54:57 +04:00
parent edf3a72564
commit 5ea8c97094
5 changed files with 203 additions and 108 deletions

View File

@ -104,6 +104,7 @@ class ConfigDefinition:
deConfigFile.write("HDDTEMPCMD=" + str(self.configpage['dataengine'].ui.lineEdit_hddtempCmd.text()) + "\n")
deConfigFile.write("MPDADDRESS=" + str(self.configpage['dataengine'].ui.lineEdit_mpdaddress.text()) + "\n")
deConfigFile.write("MPDPORT=" + str(self.configpage['dataengine'].ui.spinBox_mpdport.value()) + "\n")
deConfigFile.write("MPRIS=" + str(self.configpage['dataengine'].ui.comboBox_mpris.currentText()) + "\n")
item = QStringList()
for i in range(self.configpage['dataengine'].ui.listWidget_pkgCommand.count()):
item.append(self.configpage['dataengine'].ui.listWidget_pkgCommand.item(i).text())
@ -125,7 +126,7 @@ class ConfigDefinition:
# disconnecting from source and clear layout
self.parent.disconnectFromSource()
labelOrder = "----------------"
labelOrder = "--------------------"
for label in self.defaults['order'].keys():
if (self.configpage['widget'].checkboxes[self.defaults['order'][label]].checkState() > 0):
pos = self.configpage['widget'].sliders[self.defaults['order'][label]].value() - 1
@ -224,7 +225,7 @@ class ConfigDefinition:
deSettings = {'CUSTOM':'wget -qO- http://ifconfig.me/ip', 'DESKTOPCMD':'qdbus org.kde.kwin /KWin currentDesktop',
'GPUDEV':'auto', 'HDDDEV':'all', 'HDDTEMPCMD':'sudo hddtemp', 'MPDADDRESS':'localhost',
'MPDPORT':'6600', 'PKGCMD':'pacman -Qu', 'PKGNULL':'0', 'PLAYER':'amarok'}
'MPDPORT':'6600', 'MPRIS':'auto', 'PKGCMD':'pacman -Qu', 'PKGNULL':'0', 'PLAYER':'mpris'}
dataengineConfig = unicode(KGlobal.dirs().localkdedir()) + "/share/config/extsysmon.conf"
try:
with open(dataengineConfig, 'r') as deConfigFile:
@ -252,6 +253,8 @@ class ConfigDefinition:
self.configpage['dataengine'].ui.lineEdit_mpdaddress.setText(deSettings['MPDADDRESS'])
self.configpage['dataengine'].ui.spinBox_mpdport.setValue(int(deSettings['MPDPORT']))
self.configpage['dataengine'].ui.spinBox_mpdport.setValue(int(deSettings['MPDPORT']))
index = self.configpage['dataengine'].ui.comboBox_mpris.findText(deSettings['MPRIS'])
self.configpage['dataengine'].ui.comboBox_mpris.setCurrentIndex(index)
self.configpage['dataengine'].ui.listWidget_pkgCommand.clear()
for i in range(len(deSettings['PKGCMD'].split(','))):
try:

View File

@ -288,7 +288,7 @@ del - remove item</string>
</item>
</layout>
</item>
<item row="7" column="0">
<item row="8" column="0">
<layout class="QVBoxLayout" name="layout_pkgCommand">
<item>
<layout class="QHBoxLayout" name="layout_pkgCommandSelect">
@ -403,7 +403,7 @@ del - remove item</string>
</item>
</layout>
</item>
<item row="8" column="0">
<item row="9" column="0">
<layout class="QHBoxLayout" name="layout_playerSelect">
<item>
<widget class="QLabel" name="label_playerSelect">
@ -434,12 +434,7 @@ del - remove item</string>
</property>
<item>
<property name="text">
<string notr="true">amarok</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">clementine</string>
<string notr="true">mpris</string>
</property>
</item>
<item>
@ -447,16 +442,11 @@ del - remove item</string>
<string notr="true">mpd</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">qmmp</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="9" column="0">
<item row="10" column="0">
<spacer name="spacer_dataengine">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -493,6 +483,96 @@ del - remove item</string>
</item>
</layout>
</item>
<item row="7" column="0">
<layout class="QVBoxLayout" name="layout_mpris">
<item>
<widget class="QLabel" name="label_mprisInfo">
<property name="text">
<string>&lt;b&gt;NOTE:&lt;/b&gt; Player DBus interface should be an active</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="layout_mprisSelect">
<item>
<widget class="QLabel" name="label_mpris">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>MPRIS player name</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_mpris">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="editable">
<bool>true</bool>
</property>
<item>
<property name="text">
<string notr="true">auto</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">amarok</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">audacious</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">clementine</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">deadbeef</string>
</property>
</item>
<item>
<property name="text">
<string>vlc</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">qmmp</string>
</property>
</item>
<item>
<property name="text">
<string>xmms2</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
@ -510,6 +590,7 @@ del - remove item</string>
<tabstop>lineEdit_hddtempCmd</tabstop>
<tabstop>lineEdit_mpdaddress</tabstop>
<tabstop>spinBox_mpdport</tabstop>
<tabstop>comboBox_mpris</tabstop>
<tabstop>comboBox_pkgCommand</tabstop>
<tabstop>spinBox_pkgCommandNum</tabstop>
<tabstop>pushButton_pkgCommand</tabstop>