Merge lp:~raoul-snyman/openlp/bug-1559336-2.4 into lp:openlp/2.4

Proposed by Raoul Snyman
Status: Merged
Approved by: Tim Bentley
Approved revision: 2630
Merged at revision: 2629
Proposed branch: lp:~raoul-snyman/openlp/bug-1559336-2.4
Merge into: lp:openlp/2.4
Diff against target: 56 lines (+33/-1)
2 files modified
openlp/plugins/songs/forms/editsongform.py (+16/-1)
tests/functional/openlp_core_ui/test_firsttimeform.py (+17/-0)
To merge this branch: bzr merge lp:~raoul-snyman/openlp/bug-1559336-2.4
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Review via email: mp+293453@code.launchpad.net

Description of the change

To post a comment you must log in.
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/plugins/songs/forms/editsongform.py'
2--- openlp/plugins/songs/forms/editsongform.py 2016-01-30 20:41:22 +0000
3+++ openlp/plugins/songs/forms/editsongform.py 2016-04-29 21:13:24 +0000
4@@ -1054,8 +1054,23 @@
5 filename = item.data(QtCore.Qt.UserRole)
6 if not filename.startswith(save_path):
7 old_file, filename = filename, os.path.join(save_path, os.path.split(filename)[1])
8- shutil.copyfile(old_file, filename)
9+ try:
10+ shutil.copyfile(old_file, filename)
11+ except FileNotFoundError:
12+ # show a dialog
13+ button = QtWidgets.QMessageBox.critical(
14+ self,
15+ translate('SongsPlugin.EditSongForm', 'File not found'),
16+ translate('SongsPlugin.EditSongForm', 'Unable to find the following file:\n' +
17+ '%s\nDo you want to remove the entry from the song?') % old_file,
18+ QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
19+ QtWidgets.QMessageBox.Yes
20+ )
21+ if button == QtWidgets.QMessageBox.Yes:
22+ # If they want the file removed, skip the rest and move onto the next file
23+ continue
24 files.append(filename)
25+ # Add the file to the media_file table
26 media_file = MediaFile()
27 media_file.file_name = filename
28 media_file.type = 'audio'
29
30=== modified file 'tests/functional/openlp_core_ui/test_firsttimeform.py'
31--- tests/functional/openlp_core_ui/test_firsttimeform.py 2015-12-31 22:46:06 +0000
32+++ tests/functional/openlp_core_ui/test_firsttimeform.py 2016-04-29 21:13:24 +0000
33@@ -78,6 +78,23 @@
34 if os.path.isfile(self.tempfile):
35 os.remove(self.tempfile)
36
37+ @patch('openlp.core.ui.firsttimewizard.is_macosx')
38+ def constructor_macosx_test(self, mocked_is_macosx):
39+ """
40+ Test that the form is resized correctly on OS X
41+ """
42+ # GIVEN: The platform is OS X
43+ mocked_is_macosx.return_value = True
44+
45+ # WHEN: The wizard is created
46+ frw = FirstTimeForm(None)
47+
48+ # THEN: The form should have been resized
49+ size = frw.size()
50+ self.assertEqual(634, size.width())
51+ self.assertEqual(386, size.height())
52+
53+
54 def initialise_test(self):
55 """
56 Test if we can intialise the FirstTimeForm

Subscribers

People subscribed via source and target branches

to all changes: