Merge lp:~phill-ridout/openlp/bug-1011286 into lp:openlp

Proposed by Phill
Status: Merged
Approved by: Raoul Snyman
Approved revision: 1994
Merged at revision: 2047
Proposed branch: lp:~phill-ridout/openlp/bug-1011286
Merge into: lp:openlp
Diff against target: 69 lines (+4/-24)
4 files modified
openlp/core/lib/renderer.py (+1/-2)
openlp/plugins/songs/forms/editsongform.py (+2/-2)
openlp/plugins/songs/forms/editversedialog.py (+1/-1)
openlp/plugins/songs/forms/editverseform.py (+0/-19)
To merge this branch: bzr merge lp:~phill-ridout/openlp/bug-1011286
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Raoul Snyman Approve
Andreas Preikschat Pending
Jonathan Corwin Pending
Review via email: mp+119419@code.launchpad.net

This proposal supersedes a proposal from 2012-07-22.

Description of the change

I have actually fixed the entering of verses with no text! I would appreciate extended testing on this, as I have made a change in the renderer code. As far as my testing goes, I have not broken any thing. But you guys have a knack of finding flaws ;-)

The validation is no longer needed, as it was just checking that each verse had some text.

Changed the save button to OK as per the reasons in my email.

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

Do we need the log.debug?

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

You should be able to close the dialog via OK without any text in the dialog. No text is also valid.

review: Needs Fixing
Revision history for this message
Phill (phill-ridout) wrote : Posted in a previous version of this proposal

On Jun 12, 2012 8:06 PM, "Raoul Snyman" <
<email address hidden>> wrote:
>
> Review: Needs Fixing

Can you clarify what you want? The current behaviour is:

Click Add/Edit verse try to close the dialog box by clicking save, to save
with out any text and there is a message box telling the user that there
needs to be text.

Click edit all, and leave it blank a stack trace occurs. Add only one line
and the stack trace occurs.

Save the song with no verses, and a message appears telling you that you
can't do that.

> You should be able to close the dialog via OK without any text in the
dialog. No text is also valid.

My fix fixes the edit all version of the dialog box. The edit (single
verse) is not affected.

If you were to remove all text, then this would delete all verses. And you
wouldn't be able to save the song.

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

Looks OK but we are in a string freeze so this cannot be merge.

review: Needs Fixing
Revision history for this message
Phill (phill-ridout) wrote : Posted in a previous version of this proposal

On Jun 16, 2012 9:42 AM, "Tim Bentley" <email address hidden> wrote:
>
> Review: Needs Fixing
>
> Looks OK but we are in a string freeze so this cannot be merge.

I have not changed any strings. One has moved up a couple of lines but I
thought that was neither here nor there.

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

Needs to put his glasses on!

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

If I now Edit All, remove all the text from just one of the verses:
---[Verse:1]---
---[Verse:2]---
blah blah blah

I now don't get the error dialog, but verse 1 also completely disappears when I save it.

We still need that warning for the edit all scenario. We just don't want it to crash if all the text is removed.

review: Needs Fixing
Revision history for this message
Phill (phill-ridout) wrote : Posted in a previous version of this proposal

On 16 June 2012 13:59, Jonathan Corwin <email address hidden> wrote:
> I now don't get the error dialog, but verse 1 also completely disappears when I save it.

> We still need that warning for the edit all scenario. We just don't want it to crash if all the text is removed.

So its ok that V1 disappears if we still should have a dialogue box?

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

So, apparently what I want is a change in functionality.

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

The existing code was preventing empty verses.
---[Verse:1]---
---[Verse:2]---

We still need the code that was preventing it. So V1 won't disappear because the dialog box will prevent the above from being saved.

We don't need a dialog if there is no text at all in the edit all verses window. The user can just save that, and we'll not worry about what strange thing they are up to.

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

(Needs Fixing still applies)

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

I think line 21 should now be the following to replicate previous behaviour?

if not value[1]:

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

Sorry but the saving has become a mess.
Add a song
---[Verse:1]---
---[Verse:2]---

does not allow the song to be saved.

---[Verse:1]---

---[Verse:2]---

with a space in each verse allows the song to be saved but verse 2 disappears.

The loss of verse 2 even with a space in it is not correct as this is how I would add a blank verse are the end of the song.

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

Tim, I just tried your second example, and verse 2 doesn't disappear for me. I don't see how Phill's changes could affect this behaviour.

Revision history for this message
Phill (phill-ridout) wrote : Posted in a previous version of this proposal

Hrm, It removes the last verse if there is only one char after the new
line. It can be any char it appears!

Although, technically this has nothing to do with my code, my code is
doing what it should do. This is caused by the code that creates the
list items. I had a look at it, but its too far over my head.

I'm not sure what you want to do, but really this is a separate bug.

Phill

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

All verses must have 1 character in them
The last verse must have 2 characters in it to be preserved.

This is strange behaviour but if this is an existing bug then that needs to be looked at under a new bug.

review: Approve
Revision history for this message
Phill (phill-ridout) wrote : Posted in a previous version of this proposal

> All verses must have 1 character in them
> The last verse must have 2 characters in it to be preserved.
>
> This is strange behaviour but if this is an existing bug then that needs to be looked at under a new bug.

Both these issues have now been fixed in my latest resubmit

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

Line 9, change to:
   if previous_raw is not None:

Line 22:
   Rather than have a if count == 0 /and/ len(... just move the len() part of the test into the if on line 24. Also we can't have negative lengths, so change the len() test to == 0, not <= 0.

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

I just want to check, is this proposal waiting for post-RC2?

Revision history for this message
Phill (phill-ridout) wrote : Posted in a previous version of this proposal

No, not if you are happy with it.
On Jul 27, 2012 12:10 AM, "Raoul Snyman" <
<email address hidden>> wrote:

> I just want to check, is this proposal waiting for post-RC2?
> --
> https://code.launchpad.net/~phill-ridout/openlp/bug-1011286/+merge/116168
> You are the owner of lp:~phill-ridout/openlp/bug-1011286.
>

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

I have not had time this week to review this due to pressure.
It is too late to get this in and tested before the freeze.
This needs to be reviewed and signed off by two Core's !

Revision history for this message
Phill (phill-ridout) wrote : Posted in a previous version of this proposal

> I have not had time this week to review this due to pressure.
> It is too late to get this in and tested before the freeze.
> This needs to be reviewed and signed off by two Core's !

Thats fine, although I've done my testing, I would rather it was thourghly
tested. Due to the change to the render it has the potential to screw the
main display up.

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

Yes, let's play it safe.

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

I am happy with this, let's get it in.

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

looks fine to me to.

review: Approve
Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote : Posted in a previous version of this proposal

I am not sure about line 9. I do not see a place where previous_raw becomes None.

My question: Why did you change the line? In what circumstances does this fix or prevent something?

Currently I believe that this check is not needed any longer (because it is always true). Just check the code yourself: previous_raw is set to u'' or is build from strings, but never set to None.

review: Needs Information
Revision history for this message
Phill (phill-ridout) wrote :

Any chance of getting this in before the next freeze?

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/lib/renderer.py'
2--- openlp/core/lib/renderer.py 2012-07-02 18:45:03 +0000
3+++ openlp/core/lib/renderer.py 2012-08-13 19:34:21 +0000
4@@ -450,8 +450,7 @@
5 previous_html, previous_raw, html_lines, lines, separator, u'')
6 else:
7 previous_raw = separator.join(lines)
8- if previous_raw:
9- formatted.append(previous_raw)
10+ formatted.append(previous_raw)
11 log.debug(u'_paginate_slide - End')
12 return formatted
13
14
15=== modified file 'openlp/plugins/songs/forms/editsongform.py'
16--- openlp/plugins/songs/forms/editsongform.py 2012-07-07 14:54:14 +0000
17+++ openlp/plugins/songs/forms/editsongform.py 2012-08-13 19:34:21 +0000
18@@ -528,9 +528,9 @@
19 for row in self.findVerseSplit.split(verse_list):
20 for match in row.split(u'---['):
21 for count, parts in enumerate(match.split(u']---\n')):
22- if len(parts) <= 1:
23- continue
24 if count == 0:
25+ if len(parts) == 0:
26+ continue
27 # handling carefully user inputted versetags
28 separator = parts.find(u':')
29 if separator >= 0:
30
31=== modified file 'openlp/plugins/songs/forms/editversedialog.py'
32--- openlp/plugins/songs/forms/editversedialog.py 2012-06-22 14:14:53 +0000
33+++ openlp/plugins/songs/forms/editversedialog.py 2012-08-13 19:34:21 +0000
34@@ -67,7 +67,7 @@
35 self.verseTypeLayout.addStretch()
36 self.dialogLayout.addLayout(self.verseTypeLayout)
37 self.buttonBox = create_button_box(editVerseDialog, u'buttonBox',
38- [u'cancel', u'save'])
39+ [u'cancel', u'ok'])
40 self.dialogLayout.addWidget(self.buttonBox)
41 self.retranslateUi(editVerseDialog)
42
43
44=== modified file 'openlp/plugins/songs/forms/editverseform.py'
45--- openlp/plugins/songs/forms/editverseform.py 2012-06-22 14:14:53 +0000
46+++ openlp/plugins/songs/forms/editverseform.py 2012-08-13 19:34:21 +0000
47@@ -185,22 +185,3 @@
48 text = u'---[%s:1]---\n%s' % \
49 (VerseType.TranslatedNames[VerseType.Verse], text)
50 return text
51-
52- def accept(self):
53- if self.hasSingleVerse:
54- value = unicode(self.getVerse()[0])
55- else:
56- log.debug(unicode(self.getVerse()[0]).split(u'\n'))
57- value = unicode(self.getVerse()[0]).split(u'\n')[1]
58- if not value:
59- lines = unicode(self.getVerse()[0]).split(u'\n')
60- index = 2
61- while index < len(lines) and not value:
62- value = lines[index]
63- index += 1
64- if not value:
65- critical_error_message_box(
66- message=translate('SongsPlugin.EditSongForm',
67- 'You need to type some text in to the verse.'))
68- return False
69- QtGui.QDialog.accept(self)