Merge lp:~milleja46/openlp/milleja46 into lp:openlp

Proposed by Joshua Miller
Status: Merged
Approved by: Jonathan Corwin
Approved revision: no longer in the source branch.
Merged at revision: 1575
Proposed branch: lp:~milleja46/openlp/milleja46
Merge into: lp:openlp
Diff against target: 103 lines (+16/-19)
2 files modified
openlp/core/ui/generaltab.py (+9/-0)
openlp/core/ui/slidecontroller.py (+7/-19)
To merge this branch: bzr merge lp:~milleja46/openlp/milleja46
Reviewer Review Type Date Requested Status
Jonathan Corwin (community) Approve
Tim Bentley Approve
Review via email: mp+62460@code.launchpad.net

This proposal supersedes a proposal from 2011-05-26.

Description of the change

Adds in looping of slides based on a checkbox in the general settings. Fully functional now, and corrections as noted, and extra blank deletion. changes can_loop to the setting directly

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) wrote : Posted in a previous version of this proposal

line 80 longer than 80 bytes

lines 85 and 88 not needed.

QtCore.QSettings().value(self.parent.generalSettingsSection + u'/enable slide loop'
should be
QtCore.QSettings().value(u'general/enable slide loop'

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

> QtCore.QSettings().value(self.parent.generalSettingsSection + u'/enable slide
> loop'
> should be
> QtCore.QSettings().value(u'general/enable slide loop'

Tim, what Joshua has is consistent with the rest of slidecontroller.py, and we've just spent the last few days telling him to replace the 'general' with the self.parent.generalSettingsSection!

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

@Joshua just a small thing, rename your "enable_loop" variable to "can_loop" as it makes a little more sense when you read the "if" statement.

  if can_loop:

Just makes the code a little more readable.

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

Delete line 45

Line 88, shouldn't be pass, but:
    row = self.previewListWidget.rowCount() - 1
Otherwise row will be one greater than the highest index in the controller.

Leave the self.parent.generalSettingsSection until Tim has chance to respond to my earlier comment and I find out why he wants it changed. But it still needs splitting so it doesn't go over 80 characters.

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

Accept that SlideController does it that way with Qsettings BUT the reset of the code ThemeManager which I have written does it the other way.

self.parent.generalSettingsSection + u'/enable slide is less readable than u'general/enable slide.
This is a different debate for later so ignore that comment. The rest still stand.

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

Looks good but can_loop can be removed and the IF test applied against the QSettings directly.

This is in both situations

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

Hope you are sitting down !

review: Approve
lp:~milleja46/openlp/milleja46 updated
1574. By Tim Bentley

More busy and sort changes

Revision history for this message
Jonathan Corwin (j-corwin) wrote :

Well done, we got there in the end! :)

review: Approve
lp:~milleja46/openlp/milleja46 updated
1575. By Joshua Miller

Enable or disable looping of slides based on a checkbox in the general settings

Revision history for this message
Joshua Miller (milleja46) wrote :

Glad it finally got approved and merged(glad Raoul finally made the connection to me about signals and slots to events and event methods) at least now we're somewhat closer to having the next version ready

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/ui/generaltab.py'
2--- openlp/core/ui/generaltab.py 2011-05-24 20:47:05 +0000
3+++ openlp/core/ui/generaltab.py 2011-05-26 11:02:52 +0000
4@@ -97,6 +97,9 @@
5 self.autoPreviewCheckBox = QtGui.QCheckBox(self.settingsGroupBox)
6 self.autoPreviewCheckBox.setObjectName(u'autoPreviewCheckBox')
7 self.settingsLayout.addRow(self.autoPreviewCheckBox)
8+ self.enableLoopCheckBox = QtGui.QCheckBox(self.settingsGroupBox)
9+ self.enableLoopCheckBox.setObjectName(u'enableLoopCheckBox')
10+ self.settingsLayout.addRow(self.enableLoopCheckBox)
11 # Moved here from image tab
12 self.timeoutLabel = QtGui.QLabel(self.settingsGroupBox)
13 self.timeoutLabel.setObjectName(u'timeoutLabel')
14@@ -219,6 +222,8 @@
15 'Unblank display when adding new live item'))
16 self.autoPreviewCheckBox.setText(translate('OpenLP.GeneralTab',
17 'Automatically preview next item in service'))
18+ self.enableLoopCheckBox.setText(translate('OpenLP.GeneralTab',
19+ 'Enable slide loop'))
20 self.timeoutLabel.setText(translate('OpenLP.GeneralTab',
21 'Slide loop delay:'))
22 self.timeoutSpinBox.setSuffix(translate('OpenLP.GeneralTab', ' sec'))
23@@ -271,6 +276,8 @@
24 QtCore.QVariant(True)).toBool())
25 self.autoPreviewCheckBox.setChecked(settings.value(u'auto preview',
26 QtCore.QVariant(False)).toBool())
27+ self.enableLoopCheckBox.setChecked(settings.value(u'enable slide loop',
28+ QtCore.QVariant(True)).toBool())
29 self.timeoutSpinBox.setValue(settings.value(u'loop delay',
30 QtCore.QVariant(5)).toInt()[0])
31 self.overrideCheckBox.setChecked(settings.value(u'override position',
32@@ -314,6 +321,8 @@
33 QtCore.QVariant(self.autoUnblankCheckBox.isChecked()))
34 settings.setValue(u'auto preview',
35 QtCore.QVariant(self.autoPreviewCheckBox.isChecked()))
36+ settings.setValue(u'enable slide loop',
37+ QtCore.QVariant(self.enableLoopCheckBox.isChecked()))
38 settings.setValue(u'loop delay',
39 QtCore.QVariant(self.timeoutSpinBox.value()))
40 settings.setValue(u'ccli number',
41
42=== modified file 'openlp/core/ui/slidecontroller.py'
43--- openlp/core/ui/slidecontroller.py 2011-05-25 09:10:57 +0000
44+++ openlp/core/ui/slidecontroller.py 2011-05-26 11:02:52 +0000
45@@ -349,13 +349,6 @@
46 QtCore.SIGNAL(u'slidecontroller_%s_previous' % self.typePrefix),
47 self.onSlideSelectedPrevious)
48 QtCore.QObject.connect(Receiver.get_receiver(),
49- QtCore.SIGNAL(u'slidecontroller_%s_next_noloop' % self.typePrefix),
50- self.onSlideSelectedNextNoloop)
51- QtCore.QObject.connect(Receiver.get_receiver(),
52- QtCore.SIGNAL(u'slidecontroller_%s_previous_noloop' %
53- self.typePrefix),
54- self.onSlideSelectedPreviousNoloop)
55- QtCore.QObject.connect(Receiver.get_receiver(),
56 QtCore.SIGNAL(u'slidecontroller_%s_last' % self.typePrefix),
57 self.onSlideSelectedLast)
58 QtCore.QObject.connect(Receiver.get_receiver(),
59@@ -940,10 +933,7 @@
60 rect.y(), rect.width(), rect.height())
61 self.slidePreview.setPixmap(winimg)
62
63- def onSlideSelectedNextNoloop(self):
64- self.onSlideSelectedNext(False)
65-
66- def onSlideSelectedNext(self, loop=True):
67+ def onSlideSelectedNext(self):
68 """
69 Go to the next slide.
70 """
71@@ -956,18 +946,15 @@
72 else:
73 row = self.previewListWidget.currentRow() + 1
74 if row == self.previewListWidget.rowCount():
75- if loop:
76+ if QtCore.QSettings().value(self.parent.generalSettingsSection +
77+ u'/enable slide loop', QtCore.QVariant(True)).toBool():
78 row = 0
79 else:
80- Receiver.send_message('servicemanager_next_item')
81- return
82+ row = self.previewListWidget.rowCount() - 1
83 self.__checkUpdateSelectedSlide(row)
84 self.slideSelected()
85
86- def onSlideSelectedPreviousNoloop(self):
87- self.onSlideSelectedPrevious(False)
88-
89- def onSlideSelectedPrevious(self, loop=True):
90+ def onSlideSelectedPrevious(self):
91 """
92 Go to the previous slide.
93 """
94@@ -980,7 +967,8 @@
95 else:
96 row = self.previewListWidget.currentRow() - 1
97 if row == -1:
98- if loop:
99+ if QtCore.QSettings().value(self.parent.generalSettingsSection +
100+ u'/enable slide loop', QtCore.QVariant(True)).toBool():
101 row = self.previewListWidget.rowCount() - 1
102 else:
103 row = 0