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

Proposed by Tim Bentley
Status: Superseded
Proposed branch: lp:~trb143/openlp/bug-892571
Merge into: lp:openlp
Diff against target: 44 lines (+13/-5)
1 file modified
openlp/core/ui/slidecontroller.py (+13/-5)
To merge this branch: bzr merge lp:~trb143/openlp/bug-892571
Reviewer Review Type Date Requested Status
Andreas Preikschat (community) Needs Fixing
Review via email: mp+83116@code.launchpad.net

This proposal has been superseded by a proposal from 2011-11-27.

Description of the change

Stop keyboard floods getting the slide controller and service manager out of set.
Key presses are only accepted when the previous updates have happened.

To Test set preview next song to on.
Add 5 songs to service manager
Select the first one.
Press the right arrow key fast.

To post a comment you must log in.
Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote :

Now "right arrow", "right arrow" does not work (only the first "right arrow" is recognised). If I press the "right arrow" twice, I want to go to the song after the next one.

review: Needs Fixing
Revision history for this message
Tim Bentley (trb143) wrote :

Well If I use a mutex it locks up.
Without a major (2-3 month) re-write of the code path as it is very long and impacts plugins etc I am not sure what else to try.
The code
   looks up the current selected service item
   Selects the next one.
   Flushes the events to add a cursor
   Adds a service item
   This signals plugins twice to turn off and then hand new service item.
   selects the next service item to preview it.
   Flushes the events to remove the cursor

The Keyboard will start this flow BEFORE the previous has finished so you get a number of calling chains running at the same time.

Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote :

I just do not think this is the right attempt. I see that it is difficult (impossible ?) to fix this!?

lp:~trb143/openlp/bug-892571 updated
1802. By Tim Bentley

Move to reference counting

1803. By Tim Bentley

Implement a queue to process the requests

1804. By Tim Bentley

Fix double loop entry

Unmerged revisions

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-10-31 09:14:07 +0000
3+++ openlp/core/ui/slidecontroller.py 2011-11-27 16:12:24 +0000
4@@ -79,6 +79,7 @@
5 self.songEdit = False
6 self.selectedRow = 0
7 self.serviceItem = None
8+ self.keypress_count = 0
9 self.panel = QtGui.QWidget(parent.controlSplitter)
10 self.slideList = {}
11 # Layout for holding panel
12@@ -578,12 +579,19 @@
13 self.display.videoStop()
14
15 def servicePrevious(self):
16- time.sleep(0.1)
17- Receiver.send_message('servicemanager_previous_item')
18+ self.keypress_count += 1
19+ if self.keypress_count == 1:
20+ while self.keypress_count != 0:
21+ Receiver.send_message('servicemanager_previous_item')
22+ self.keypress_count -= 1
23
24 def serviceNext(self):
25- time.sleep(0.1)
26- Receiver.send_message('servicemanager_next_item')
27+ self.keypress_count += 1
28+ if self.keypress_count == 1:
29+ while self.keypress_count != 0:
30+ Receiver.send_message('servicemanager_next_item')
31+ self.keypress_count -= 1
32+
33
34 def screenSizeChanged(self):
35 """
36@@ -771,7 +779,7 @@
37 log.debug(u'processManagerItem live = %s' % self.isLive)
38 self.onStopLoop()
39 old_item = self.serviceItem
40- # take a copy not a link to the servicemeanager copy.
41+ # take a copy not a link to the servicemanager copy.
42 self.serviceItem = copy.copy(serviceItem)
43 if old_item and self.isLive and old_item.is_capable(
44 ItemCapabilities.ProvidesOwnDisplay):