Fix remote hiding of screen and updating UI buttons

bzr-revno: 1841
This commit is contained in:
Tim Bentley 2011-12-16 15:06:14 +00:00
commit 0a9ea54bf8
2 changed files with 33 additions and 10 deletions

View File

@ -412,6 +412,9 @@ class SlideController(Controller):
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_live_spin_delay'), QtCore.SIGNAL(u'slidecontroller_live_spin_delay'),
self.receiveSpinDelay) self.receiveSpinDelay)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_toggle_display'),
self.toggleDisplay)
self.toolbar.makeWidgetsInvisible(self.loopList) self.toolbar.makeWidgetsInvisible(self.loopList)
else: else:
QtCore.QObject.connect(self.previewListWidget, QtCore.QObject.connect(self.previewListWidget,
@ -570,6 +573,21 @@ class SlideController(Controller):
self.display.setVisible(False) self.display.setVisible(False)
self.mediaController.video_stop([self]) self.mediaController.video_stop([self])
def toggleDisplay(self, action):
"""
Toggle the display settings triggered from remote messages.
"""
if action == u'blank' or action == u'hide':
self.onBlankDisplay(True)
elif action == u'theme':
self.onThemeDisplay(True)
elif action == u'desktop':
self.onHideDisplay(True)
elif action == u'show':
self.onBlankDisplay(False)
self.onThemeDisplay(False)
self.onHideDisplay(False)
def servicePrevious(self): def servicePrevious(self):
""" """
Live event to select the previous service item from the service manager. Live event to select the previous service item from the service manager.

View File

@ -249,7 +249,7 @@ class HttpConnection(object):
(r'^/api/poll$', self.poll), (r'^/api/poll$', self.poll),
(r'^/api/controller/(live|preview)/(.*)$', self.controller), (r'^/api/controller/(live|preview)/(.*)$', self.controller),
(r'^/api/service/(.*)$', self.service), (r'^/api/service/(.*)$', self.service),
(r'^/api/display/(hide|show)$', self.display), (r'^/api/display/(hide|show|blank|theme|desktop)$', self.display),
(r'^/api/alert$', self.alert), (r'^/api/alert$', self.alert),
(r'^/api/plugin/(search)$', self.pluginInfo), (r'^/api/plugin/(search)$', self.pluginInfo),
(r'^/api/(.*)/search$', self.search), (r'^/api/(.*)/search$', self.search),
@ -401,7 +401,13 @@ class HttpConnection(object):
u'item': self.parent.current_item._uuid \ u'item': self.parent.current_item._uuid \
if self.parent.current_item else u'', if self.parent.current_item else u'',
u'twelve':QtCore.QSettings().value( u'twelve':QtCore.QSettings().value(
u'remotes/twelve hour', QtCore.QVariant(True)).toBool() u'remotes/twelve hour', QtCore.QVariant(True)).toBool(),
u'blank': self.parent.plugin.liveController.blankScreen.\
isChecked(),
u'theme': self.parent.plugin.liveController.themeScreen.\
isChecked(),
u'display': self.parent.plugin.liveController.desktopScreen.\
isChecked()
} }
return HttpResponse(json.dumps({u'results': result}), return HttpResponse(json.dumps({u'results': result}),
{u'Content-Type': u'application/json'}) {u'Content-Type': u'application/json'})
@ -413,8 +419,7 @@ class HttpConnection(object):
``action`` ``action``
This is the action, either ``hide`` or ``show``. This is the action, either ``hide`` or ``show``.
""" """
event = u'live_display_%s' % action Receiver.send_message(u'slidecontroller_toggle_display', action)
Receiver.send_message(event, HideMode.Blank)
return HttpResponse(json.dumps({u'results': {u'success': True}}), return HttpResponse(json.dumps({u'results': {u'success': True}}),
{u'Content-Type': u'application/json'}) {u'Content-Type': u'application/json'})