From 43f99b81ebf41b2f19ef82c2fcb7b65ad7013e8e Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Tue, 22 Oct 2013 17:37:56 +0200 Subject: [PATCH 1/4] This variable has been renamed. --- openlp/plugins/presentations/lib/messagelistener.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index 6ab723c9e..259e65281 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -281,7 +281,7 @@ class Controller(object): class MessageListener(object): """ - This is the Presentation listener who acts on events from the slide controller and passes the messages on the the + This is the Presentation listener who acts on events from the slide controller and passes the messages on the correct presentation handlers """ log.info('Message Listener loaded') @@ -316,7 +316,7 @@ class MessageListener(object): hide_mode = message[2] file = item.get_frame_path() self.handler = item.processor - if self.handler == self.media_item.Automatic: + if self.handler == self.media_item.automatic: self.handler = self.media_item.findControllerByType(file) if not self.handler: return From abdc3937ef60298d73a55dc389d856ef728a2b79 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Sun, 27 Oct 2013 13:39:13 +0100 Subject: [PATCH 2/4] Small test for PresentationController Constructor --- .../lib/presentationcontroller.py | 7 ++- .../test_presentationcontroller.py | 48 +++++++++++++++++++ 2 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 tests/functional/openlp_plugins/presentations/test_presentationcontroller.py diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index 0a70b174a..e137dc39c 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -292,8 +292,8 @@ class PresentationDocument(object): class PresentationController(object): """ - This class is used to control interactions with presentation applications by creating a runtime environment. This is - a base class for presentation controllers to inherit from. + This class is used to control interactions with presentation applications by creating a runtime environment. + This is a base class for presentation controllers to inherit from. To create a new controller, take a copy of this file and name it so it ends with ``controller.py``, i.e. ``foobarcontroller.py``. Make sure it inherits @@ -341,8 +341,7 @@ class PresentationController(object): """ log.info('PresentationController loaded') - def __init__(self, plugin=None, name='PresentationController', - document_class=PresentationDocument): + def __init__(self, plugin=None, name='PresentationController', document_class=PresentationDocument): """ This is the constructor for the presentationcontroller object. This provides an easy way for descendent plugins to populate common data. This method *must* be overridden, like so:: diff --git a/tests/functional/openlp_plugins/presentations/test_presentationcontroller.py b/tests/functional/openlp_plugins/presentations/test_presentationcontroller.py new file mode 100644 index 000000000..97d34f4f1 --- /dev/null +++ b/tests/functional/openlp_plugins/presentations/test_presentationcontroller.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2013 Raoul Snyman # +# Portions copyright (c) 2008-2013 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 # +############################################################################### +""" +This module contains tests for the Presentation Controller. +""" +from unittest import TestCase + +from openlp.plugins.presentations.lib.presentationcontroller import PresentationController +from tests.functional import MagicMock + +class TestPresentationController(TestCase): + """ + Test the mediaitem methods. + """ + def setUp(self): + """ + Set up the components need for all tests. + """ + self.pres_controller = PresentationController(plugin=MagicMock()) + + def constructor_test(self): + assert(self.pres_controller.name == "PresentationController") From 0ed0b2148e1bf84d99b03824cf5f150694150fb8 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Sun, 27 Oct 2013 21:33:58 +0100 Subject: [PATCH 3/4] Small changes to the test --- .../test_presentationcontroller.py | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tests/functional/openlp_plugins/presentations/test_presentationcontroller.py b/tests/functional/openlp_plugins/presentations/test_presentationcontroller.py index 97d34f4f1..61d62b473 100644 --- a/tests/functional/openlp_plugins/presentations/test_presentationcontroller.py +++ b/tests/functional/openlp_plugins/presentations/test_presentationcontroller.py @@ -36,13 +36,18 @@ from tests.functional import MagicMock class TestPresentationController(TestCase): """ - Test the mediaitem methods. + Test the PresentationController. """ - def setUp(self): - """ - Set up the components need for all tests. - """ - self.pres_controller = PresentationController(plugin=MagicMock()) - def constructor_test(self): - assert(self.pres_controller.name == "PresentationController") + """ + Test the Constructor + """ + # GIVEN: No presentation controller + controller = None + + # WHEN: The presentation controller object is created + controller = PresentationController(plugin=MagicMock()) + + # THEN: The name of the presentation controller should be correct + self.assertEqual('PresentationController', controller.name, + 'The name of the presentation controller should be correct') From 2a262e4ef68e3bda5bff2ed716008b41057bf016 Mon Sep 17 00:00:00 2001 From: Jonathan Springer Date: Sun, 8 Dec 2013 21:05:52 -0500 Subject: [PATCH 4/4] pass all keyboard events to shortcut dialog --- openlp/core/ui/shortcutlistform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/shortcutlistform.py b/openlp/core/ui/shortcutlistform.py index efe876e3e..fb459824d 100644 --- a/openlp/core/ui/shortcutlistform.py +++ b/openlp/core/ui/shortcutlistform.py @@ -74,7 +74,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog): if event.key() == QtCore.Qt.Key_Space: self.keyReleaseEvent(event) elif self.primaryPushButton.isChecked() or self.alternatePushButton.isChecked(): - event.ignore() + self.keyReleaseEvent(event) elif event.key() == QtCore.Qt.Key_Escape: event.accept() self.close()