Merge lp:~trb143/openlp/bug-850254 into lp:openlp

Proposed by Tim Bentley
Status: Merged
Merged at revision: 1841
Proposed branch: lp:~trb143/openlp/bug-850254
Merge into: lp:openlp
Diff against target: 112 lines (+33/-10)
2 files modified
openlp/core/ui/slidecontroller.py (+24/-6)
openlp/plugins/remotes/lib/httpserver.py (+9/-4)
To merge this branch: bzr merge lp:~trb143/openlp/bug-850254
Reviewer Review Type Date Requested Status
Raoul Snyman Approve
Review via email: mp+85934@code.launchpad.net

This proposal supersedes a proposal from 2011-12-15.

Description of the change

This is the core changes to handle the remote events for hiding and showing screens

To post a comment you must log in.
Revision history for this message
Jonathan Corwin (j-corwin) wrote : Posted in a previous version of this proposal

Too many blank lines 56-58
There is an elif on 53 but an if on 55.

I'm not sure about the term "status" in httpserver, it doesn't seem descriptive enough to me, as lots of things could have a status. Perhaps displaystatus or something?

review: Needs Fixing
Revision history for this message
Jonathan Corwin (j-corwin) wrote : Posted in a previous version of this proposal

Oh, and you seem to be sneaking a feature in along with the fix...

Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

81 + (r'^/api/status$', self.status),
82 + (r'^/api/changeStatus/(blank|theme|desktop)$', self.changeStatus),

As Jonathan said, "status" is a little too generic...

(r'^/api/display-status$', self.displayStatus),
(r'^/api/display-status/(blank|theme|desktop)$', self.changeDisplayStatus),

That should work.

review: Needs Fixing
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

Can you also change the method names to make them a little more descriptive please? Like...

  def displayStatus(self):
      """
      Obtain the display status of system.
      """

  def changeDisplayStatus(self, action):
      """
      Toggle the display of the system including the status button.
      """

review: Needs Fixing
Revision history for this message
Jonathan Corwin (j-corwin) wrote : Posted in a previous version of this proposal

Just looking at httpserver.py, we already have a method /api/display
It currently only supports hide or show.
Can't we just extend it to support 'theme' and 'desktop' too?

I'm also not convinced about just toggling it, this could just cause chaos if both the PC user and remote user do it at the same time as it could just result in a flicker. I think the user should tell the app what he wants to do, and then the app does it, even if the end result is to do nothing.

Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

Will fix up the comments.

The API needs changing but if we change it when have to update the clients at the same time which will be a problem. The old API should be deprecated and removed in March.

The current situation is worse as the when and android can set the screen to blank but then have no view of what it is and the display is just changed without the button being set.
This change will make it possible to make the button states consistent across all clients.

Revision history for this message
Jonathan Corwin (j-corwin) wrote : Posted in a previous version of this proposal

But if I write a client that wants to blank the screen, then I want to be able to tell OpenLP to blank the screen. Changing it to a 'toggle' means that I press the button, and the application has no clue as to what OpenLP will do.

I have no issue with a method to get the current display status and for this to then update the ui afterwards with the state, or even poll regularly. But the remote app needs to be able to tell OpenLP exactly what they want to do.

99% of the time the operator will be able to look up at the projector screen and see what the current state of play is if they really badly want to know.

Revision history for this message
Jonathan Corwin (j-corwin) wrote : Posted in a previous version of this proposal

In fact we could just change the existing 'poll' call to get the display status

Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

I agree with Jonathan, I think we should probably move away from a "toggle" mentality, and move to a "hide|theme|desktop|show" idea - then we can keep the API the same, just adding new items, keeping the API backwards compatible.

Then we can show 4 buttons in the toolbar, and using the poll event, indicate which button is active.

Further thoughts/ideas/comments/etc ?

Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/ui/slidecontroller.py'
2--- openlp/core/ui/slidecontroller.py 2011-12-09 12:35:18 +0000
3+++ openlp/core/ui/slidecontroller.py 2011-12-15 19:01:50 +0000
4@@ -95,7 +95,7 @@
5 u'Edit Song',
6 ]
7 self.nextPreviousList = [
8- u'Previous Slide',
9+ u'Previous Slide',
10 u'Next Slide'
11 ]
12 self.timer_id = 0
13@@ -114,8 +114,8 @@
14 self.typeLabel.setText(UiStrings().Live)
15 self.split = 1
16 self.typePrefix = u'live'
17- self.keypress_queue = deque()
18- self.keypress_loop = False
19+ self.keypress_queue = deque()
20+ self.keypress_loop = False
21 else:
22 self.typeLabel.setText(UiStrings().Preview)
23 self.split = 0
24@@ -187,7 +187,7 @@
25 translate('OpenLP.SlideController', 'Hide'), self.toolbar))
26 self.blankScreen = shortcut_action(self.hideMenu, u'blankScreen',
27 [QtCore.Qt.Key_Period], self.onBlankDisplay,
28- u':/slides/slide_blank.png', False,
29+ u':/slides/slide_blank.png', False,
30 unicode(UiStrings().LiveToolbar))
31 self.blankScreen.setText(
32 translate('OpenLP.SlideController', 'Blank Screen'))
33@@ -412,6 +412,9 @@
34 QtCore.QObject.connect(Receiver.get_receiver(),
35 QtCore.SIGNAL(u'slidecontroller_live_spin_delay'),
36 self.receiveSpinDelay)
37+ QtCore.QObject.connect(Receiver.get_receiver(),
38+ QtCore.SIGNAL(u'slidecontroller_toggle_display'),
39+ self.toggleDisplay)
40 self.toolbar.makeWidgetsInvisible(self.loopList)
41 else:
42 QtCore.QObject.connect(self.previewListWidget,
43@@ -570,6 +573,21 @@
44 self.display.setVisible(False)
45 self.mediaController.video_stop([self])
46
47+ def toggleDisplay(self, action):
48+ """
49+ Toggle the display settings triggered from remote messages.
50+ """
51+ if action == u'blank' or action == u'hide':
52+ self.onBlankDisplay(True)
53+ elif action == u'theme':
54+ self.onThemeDisplay(True)
55+ elif action == u'desktop':
56+ self.onHideDisplay(True)
57+ elif action == u'show':
58+ self.onBlankDisplay(False)
59+ self.onThemeDisplay(False)
60+ self.onHideDisplay(False)
61+
62 def servicePrevious(self):
63 """
64 Live event to select the previous service item from the service manager.
65@@ -618,8 +636,8 @@
66 self.previewSizeChanged()
67 self.previewDisplay.setup()
68 serviceItem = ServiceItem()
69- self.previewDisplay.webView.setHtml(build_html(serviceItem,
70- self.previewDisplay.screen, None, self.isLive, None,
71+ self.previewDisplay.webView.setHtml(build_html(serviceItem,
72+ self.previewDisplay.screen, None, self.isLive, None,
73 plugins=PluginManager.get_instance().plugins))
74 self.mediaController.setup_display(self.previewDisplay)
75 if self.serviceItem:
76
77=== modified file 'openlp/plugins/remotes/lib/httpserver.py'
78--- openlp/plugins/remotes/lib/httpserver.py 2011-12-14 22:39:52 +0000
79+++ openlp/plugins/remotes/lib/httpserver.py 2011-12-15 19:01:50 +0000
80@@ -249,7 +249,7 @@
81 (r'^/api/poll$', self.poll),
82 (r'^/api/controller/(live|preview)/(.*)$', self.controller),
83 (r'^/api/service/(.*)$', self.service),
84- (r'^/api/display/(hide|show)$', self.display),
85+ (r'^/api/display/(hide|show|blank|theme|desktop)$', self.display),
86 (r'^/api/alert$', self.alert),
87 (r'^/api/plugin/(search)$', self.pluginInfo),
88 (r'^/api/(.*)/search$', self.search),
89@@ -401,7 +401,13 @@
90 u'item': self.parent.current_item._uuid \
91 if self.parent.current_item else u'',
92 u'twelve':QtCore.QSettings().value(
93- u'remotes/twelve hour', QtCore.QVariant(True)).toBool()
94+ u'remotes/twelve hour', QtCore.QVariant(True)).toBool(),
95+ u'blank': self.parent.plugin.liveController.blankScreen.\
96+ isChecked(),
97+ u'theme': self.parent.plugin.liveController.themeScreen.\
98+ isChecked(),
99+ u'display': self.parent.plugin.liveController.desktopScreen.\
100+ isChecked()
101 }
102 return HttpResponse(json.dumps({u'results': result}),
103 {u'Content-Type': u'application/json'})
104@@ -413,8 +419,7 @@
105 ``action``
106 This is the action, either ``hide`` or ``show``.
107 """
108- event = u'live_display_%s' % action
109- Receiver.send_message(event, HideMode.Blank)
110+ Receiver.send_message(u'slidecontroller_toggle_display', action)
111 return HttpResponse(json.dumps({u'results': {u'success': True}}),
112 {u'Content-Type': u'application/json'})
113