Permalink
Browse files

Merge branch 'outputs'

Conflicts:
	qygmy/translations/qygmy_pl.ts
  • Loading branch information...
tsufeki committed Jul 18, 2013
2 parents 412d2b5 + 4558091 commit fbc6a181825e9c96cd826422ebe1535e8cc21786
Showing with 140 additions and 132 deletions.
  1. +11 −1 qygmy/qygmy.py
  2. +14 −0 qygmy/server.py
  3. +106 −131 qygmy/translations/qygmy_pl.ts
  4. +9 −0 qygmy/ui/main.ui
View
@@ -217,7 +217,7 @@ def on_state_changed(self, state):
'add', 'clear', 'repeat', 'shuffle', 'single', 'consume',
'updatedb', 'save', 'randomize', 'details', 'statistics',
'louder', 'quieter', 'reverse',
- 'playback_menu', 'volume_menu', 'playlist_menu'):
+ 'playback_menu', 'volume_menu', 'playlist_menu', 'outputs_menu'):
getattr(self.ui, e).setEnabled(c)
self.on_queue_selection_changed()
@@ -228,6 +228,16 @@ def on_updating_db_changed(self, updating):
else:
self.ui.settings.setIcon(self.ui.settings_icon)
+ @Slot()
+ def on_outputs_menu_aboutToShow(self):
+ self.ui.outputs_menu.clear()
+ for name, oid, enabled in self.srv.outputs():
+ a = QAction(name, self.ui.outputs_menu)
+ a.setCheckable(True)
+ a.setChecked(enabled)
+ a.triggered[bool].connect(lambda enable, oid=oid: self.srv.enable_output(oid, enable))
+ self.ui.outputs_menu.addAction(a)
+
@Slot()
def on_queue_selection_changed(self):
self.ui.remove.setEnabled(self.srv.state.value != 'disconnect' and
View
@@ -92,3 +92,17 @@ def statistics(self):
stats['mpdversion'] = self.conn.mpd_version
return stats
+ @mpd_cmd(fallback=[])
+ def outputs(self):
+ return sorted((
+ i.get('outputname', i['outputid']),
+ int(i['outputid']),
+ i['outputenabled'] == '1') for i in self.conn.outputs())
+
+ @mpd_cmd
+ def enable_output(self, outputid, enable=True):
+ if enable:
+ self.conn.enableoutput(outputid)
+ else:
+ self.conn.disableoutput(outputid)
+
Oops, something went wrong.

0 comments on commit fbc6a18

Please sign in to comment.