← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~tomasgroth/openlp/bugfixes2 into lp:openlp

 

Tomas Groth has proposed merging lp:~tomasgroth/openlp/bugfixes2 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1296574 in OpenLP: "Missing arguments in some event handler functions"
  https://bugs.launchpad.net/openlp/+bug/1296574

For more details, see:
https://code.launchpad.net/~tomasgroth/openlp/bugfixes2/+merge/239776

Various small bugfixes:
Fixes adding of images and media to the media manager. Copied from lp:~rafaellerm/openlp/media_import_fix
Fix for another occurrence of bug #1296574. Copied from lp:~erik-lundin/openlp/bug-1296574
Fixed a tiny glitch, remove author button became always disabled even if not needed to. Copied from lp:~mahfiaz/openlp/author-delete-button-not-active-in-edit-dialog
Remove prints in http_router
Change filename encoding in PptviewDocument to only apply to local variable, to avoid backtrace.

-- 
https://code.launchpad.net/~tomasgroth/openlp/bugfixes2/+merge/239776
Your team OpenLP Core is requested to review the proposed merge of lp:~tomasgroth/openlp/bugfixes2 into lp:openlp.
=== modified file 'openlp/core/lib/listwidgetwithdnd.py'
--- openlp/core/lib/listwidgetwithdnd.py	2014-03-17 19:05:55 +0000
+++ openlp/core/lib/listwidgetwithdnd.py	2014-10-27 21:49:44 +0000
@@ -109,6 +109,6 @@
                     listing = os.listdir(local_file)
                     for file in listing:
                         files.append(os.path.join(local_file, file))
-            Registry().execute('%s_dnd' % self.mime_data_text, files)
+            Registry().execute('%s_dnd' % self.mime_data_text, {'files': files, 'target': self.itemAt(event.pos())})
         else:
             event.ignore()

=== modified file 'openlp/core/lib/treewidgetwithdnd.py'
--- openlp/core/lib/treewidgetwithdnd.py	2014-03-17 19:05:55 +0000
+++ openlp/core/lib/treewidgetwithdnd.py	2014-10-27 21:49:44 +0000
@@ -127,7 +127,7 @@
                     listing = os.listdir(local_file)
                     for file_name in listing:
                         files.append(os.path.join(local_file, file_name))
-            Registry().execute('%s_dnd' % self.mime_Data_Text, {'files': files, 'target': self.itemAt(event.pos())})
+            Registry().execute('%s_dnd' % self.mime_data_text, {'files': files, 'target': self.itemAt(event.pos())})
         elif self.allow_internal_dnd:
             event.setDropAction(QtCore.Qt.CopyAction)
             event.accept()

=== modified file 'openlp/core/ui/media/mediacontroller.py'
--- openlp/core/ui/media/mediacontroller.py	2014-09-02 20:17:56 +0000
+++ openlp/core/ui/media/mediacontroller.py	2014-10-27 21:49:44 +0000
@@ -146,7 +146,7 @@
             if player.is_active:
                 for item in player.video_extensions_list:
                     if item not in self.video_extensions_list:
-                        self.video_extensions_list.extend(item)
+                        self.video_extensions_list.append(item)
                         suffix_list.append(item[2:])
         self.service_manager.supported_suffixes(suffix_list)
 

=== modified file 'openlp/core/ui/slidecontroller.py'
=== modified file 'openlp/plugins/presentations/lib/pptviewcontroller.py'
--- openlp/plugins/presentations/lib/pptviewcontroller.py	2014-09-08 21:08:49 +0000
+++ openlp/plugins/presentations/lib/pptviewcontroller.py	2014-10-27 21:49:44 +0000
@@ -135,11 +135,11 @@
         self.file_path = os.path.normpath(self.file_path)
         preview_path = os.path.join(temp_folder, 'slide')
         # Ensure that the paths are null terminated
-        self.file_path = self.file_path.encode('utf-16-le') + b'\0'
+        byte_file_path = self.file_path.encode('utf-16-le') + b'\0'
         preview_path = preview_path.encode('utf-16-le') + b'\0'
         if not os.path.isdir(temp_folder):
             os.makedirs(temp_folder)
-        self.ppt_id = self.controller.process.OpenPPT(self.file_path, None, rect, preview_path)
+        self.ppt_id = self.controller.process.OpenPPT(byte_file_path, None, rect, preview_path)
         if self.ppt_id >= 0:
             self.create_thumbnails()
             self.stop_presentation()

=== modified file 'openlp/plugins/remotes/lib/httprouter.py'
--- openlp/plugins/remotes/lib/httprouter.py	2014-09-24 08:09:11 +0000
+++ openlp/plugins/remotes/lib/httprouter.py	2014-10-27 21:49:44 +0000
@@ -526,7 +526,6 @@
                             Settings().value('remotes/thumbnails'):
                         # If the file is under our app directory tree send the portion after the match
                         data_path = AppLocation.get_data_path()
-                        print(frame)
                         if frame['image'][0:len(data_path)] == data_path:
                             item['img'] = urllib.request.pathname2url(frame['image'][len(data_path):])
                     item['text'] = str(frame['title'])
@@ -534,7 +533,6 @@
                 item['selected'] = (self.live_controller.selected_row == index)
                 if current_item.notes:
                     item['notes'] = item.get('notes', '') + '\n' + current_item.notes
-                print(item)
                 data.append(item)
         json_data = {'results': {'slides': data}}
         if current_item:

=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py	2014-07-14 16:25:59 +0000
+++ openlp/plugins/songs/forms/editsongform.py	2014-10-27 21:49:44 +0000
@@ -625,7 +625,8 @@
         """
         Remove the author from the list when the delete button is clicked.
         """
-        self.author_remove_button.setEnabled(False)
+        if self.authors_list_view.count() <= 2:
+            self.author_remove_button.setEnabled(False)
         item = self.authors_list_view.currentItem()
         row = self.authors_list_view.row(item)
         self.authors_list_view.takeItem(row)

=== modified file 'tests/functional/openlp_core_ui/__init__.py'
--- tests/functional/openlp_core_ui/__init__.py	2013-01-21 07:26:36 +0000
+++ tests/functional/openlp_core_ui/__init__.py	2014-10-27 21:49:44 +0000
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
+"""
+Package to test the openlp.core.ui package.
+"""

=== added directory 'tests/functional/openlp_core_ui_media'
=== added file 'tests/functional/openlp_core_ui_media/__init__.py'
--- tests/functional/openlp_core_ui_media/__init__.py	1970-01-01 00:00:00 +0000
+++ tests/functional/openlp_core_ui_media/__init__.py	2014-10-27 21:49:44 +0000
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
+"""
+Package to test the openlp.core.ui.media package.
+"""

=== added file 'tests/functional/openlp_core_ui_media/test_mediacontroller.py'
--- tests/functional/openlp_core_ui_media/test_mediacontroller.py	1970-01-01 00:00:00 +0000
+++ tests/functional/openlp_core_ui_media/test_mediacontroller.py	2014-10-27 21:49:44 +0000
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection                                      #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman                                        #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan      #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub,      #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer.   #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru,          #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith,             #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock,              #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann                         #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it     #
+# under the terms of the GNU General Public License as published by the Free  #
+# Software Foundation; version 2 of the License.                              #
+#                                                                             #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or       #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for    #
+# more details.                                                               #
+#                                                                             #
+# You should have received a copy of the GNU General Public License along     #
+# with this program; if not, write to the Free Software Foundation, Inc., 59  #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
+###############################################################################
+"""
+Package to test the openlp.core.ui.media package.
+"""
+from unittest import TestCase
+
+from openlp.core.ui.media.mediacontroller import MediaController
+from openlp.core.ui.media.mediaplayer import MediaPlayer
+from openlp.core.common import Registry
+
+from tests.functional import MagicMock
+from tests.helpers.testmixin import TestMixin
+
+
+class TestMediaController(TestCase, TestMixin):
+
+    def setUp(self):
+        Registry.create()
+        Registry().register('service_manager', MagicMock())
+
+    def generate_extensions_lists_test(self):
+        """
+        Test that the extensions are create correctly
+        """
+        # GIVEN: A MediaController and an active player with audio and video extensions
+        media_controller = MediaController()
+        media_player = MediaPlayer(None)
+        media_player.is_active = True
+        media_player.audio_extensions_list = ['*.mp3', '*.wav', '*.wma', '*.ogg']
+        media_player.video_extensions_list = ['*.mp4', '*.mov', '*.avi', '*.ogm']
+        media_controller.register_players(media_player)
+
+        # WHEN: calling _generate_extensions_lists
+        media_controller._generate_extensions_lists()
+
+        # THEN: extensions list should have been copied from the player to the mediacontroller
+        self.assertListEqual(media_player.video_extensions_list, media_controller.video_extensions_list,
+                             'Video extensions should be the same')
+        self.assertListEqual(media_player.audio_extensions_list, media_controller.audio_extensions_list,
+                             'Audio extensions should be the same')


References