openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #19402
[Merge] lp:~googol/openlp/screen into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/screen into lp:openlp.
Requested reviews:
Raoul Snyman (raoul-snyman)
For more details, see:
https://code.launchpad.net/~googol/openlp/screen/+merge/148871
Hello,
- use own ScreenList() call instead of using parents to access it
[andreas@andylaptop screen]$ nosetests2 tests/functional/
.......................................
----------------------------------------------------------------------
Ran 39 tests in 0.219s
OK
--
https://code.launchpad.net/~googol/openlp/screen/+merge/148871
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/presentations/lib/impresscontroller.py'
--- openlp/plugins/presentations/lib/impresscontroller.py 2013-02-04 21:26:27 +0000
+++ openlp/plugins/presentations/lib/impresscontroller.py 2013-02-16 12:44:20 +0000
@@ -58,6 +58,7 @@
from PyQt4 import QtCore
+from openlp.core.lib import ScreenList
from openlp.core.utils import delete_file, get_uno_command, get_uno_instance
from presentationcontroller import PresentationController, PresentationDocument
@@ -254,7 +255,7 @@
window = self.document.getCurrentController().getFrame().getContainerWindow()
window.setVisible(False)
self.presentation = self.document.getPresentation()
- self.presentation.Display = self.controller.plugin.renderer.screens.current[u'number'] + 1
+ self.presentation.Display = ScreenList().current[u'number'] + 1
self.control = None
self.create_thumbnails()
return True
=== modified file 'openlp/plugins/presentations/lib/powerpointcontroller.py'
--- openlp/plugins/presentations/lib/powerpointcontroller.py 2013-01-05 22:17:30 +0000
+++ openlp/plugins/presentations/lib/powerpointcontroller.py 2013-02-16 12:44:20 +0000
@@ -36,6 +36,7 @@
import win32ui
import pywintypes
+from openlp.core.lib import ScreenList
from presentationcontroller import PresentationController, PresentationDocument
log = logging.getLogger(__name__)
@@ -252,8 +253,7 @@
dpi = win32ui.GetForegroundWindow().GetDC().GetDeviceCaps(88)
except win32ui.error:
dpi = 96
- renderer = self.controller.plugin.renderer
- rect = renderer.screens.current[u'size']
+ rect = ScreenList().current[u'size']
ppt_window = self.presentation.SlideShowSettings.Run()
if not ppt_window:
return
=== modified file 'openlp/plugins/presentations/lib/pptviewcontroller.py'
--- openlp/plugins/presentations/lib/pptviewcontroller.py 2013-02-02 14:09:22 +0000
+++ openlp/plugins/presentations/lib/pptviewcontroller.py 2013-02-16 12:44:20 +0000
@@ -34,6 +34,7 @@
from ctypes import cdll
from ctypes.wintypes import RECT
+from openlp.core.lib import ScreenList
from presentationcontroller import PresentationController, PresentationDocument
log = logging.getLogger(__name__)
@@ -120,8 +121,7 @@
PptView task started earlier.
"""
log.debug(u'LoadPresentation')
- renderer = self.controller.plugin.renderer
- rect = renderer.screens.current[u'size']
+ rect = ScreenList().current[u'size']
rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom())
filepath = str(self.filepath.replace(u'/', u'\\'))
if not os.path.isdir(self.get_temp_folder()):
=== modified file 'tests/functional/openlp_core_lib/test_image_manager.py'
--- tests/functional/openlp_core_lib/test_image_manager.py 2013-02-16 10:15:49 +0000
+++ tests/functional/openlp_core_lib/test_image_manager.py 2013-02-16 12:44:20 +0000
@@ -24,12 +24,6 @@
ScreenList.create(self.app.desktop())
self.image_manager = ImageManager()
- def tearDown(self):
- """
- Delete all the C++ objects at the end so that we don't have a segfault
- """
- del self.app
-
def basic_image_manager_test(self):
"""
Test the Image Manager setup basic functionality
=== added file 'tests/functional/openlp_core_lib/test_screen.py'
--- tests/functional/openlp_core_lib/test_screen.py 1970-01-01 00:00:00 +0000
+++ tests/functional/openlp_core_lib/test_screen.py 2013-02-16 12:44:20 +0000
@@ -0,0 +1,48 @@
+"""
+Package to test the openlp.core.lib.screenlist package.
+"""
+import copy
+from unittest import TestCase
+
+from mock import MagicMock
+from PyQt4 import QtGui, QtCore
+
+from openlp.core.lib import ScreenList
+
+
+class TestScreenList(TestCase):
+
+ def setUp(self):
+ """
+ Set up the components need for all tests.
+ """
+ self.application = QtGui.QApplication.instance()
+ self.screens = ScreenList.create(self.application.desktop())
+
+ def add_desktop_test(self):
+ """
+ Test to check if new monitors are detected by OpenLP (= plugged in while OpenLP is running).
+ """
+ # GIVEN: The screen list.
+ old_screens = copy.deepcopy(self.screens.screen_list)
+
+ screen = {
+ u'primary': False,
+ u'number': 1,
+ u'size': QtCore.QRect(0, 0, 1024, 768)
+ }
+ # Mock the attributes.
+ self.screens.desktop.primaryScreen = MagicMock(return_value=screen[u'primary'])
+ self.screens.desktop.screenCount = MagicMock(return_value=screen[u'number'] + 1)
+ self.screens.desktop.screenGeometry = MagicMock(return_value=screen[u'size'])
+
+ # WHEN: Add a new screen.
+ self.screens.screen_count_changed(len(old_screens))
+
+ # THEN: The screen should have been added.
+ new_screens = self.screens.screen_list
+ assert len(old_screens) + 1 == len(new_screens), u'The new_screens list should be bigger.'
+
+ # THEN: The screens should be identically.
+ assert screen == new_screens.pop(), u'The new screen should be identically to the screen defined above.'
+
Follow ups