From 69490c8f2ca0c9b24fece64045330e9f298f670d Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Thu, 22 Dec 2011 20:11:52 +0000 Subject: [PATCH 1/4] Ensure visible flags correct, and display if single screen works on Windows --- openlp/core/ui/maindisplay.py | 10 ++++++++++ openlp/core/ui/slidecontroller.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 03b5da7e6..2abfac841 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -405,6 +405,11 @@ class MainDisplay(Display): Store the images so they can be replaced when required """ log.debug(u'hideDisplay mode = %d', mode) + if self.screens.display_count == 1: + # Only make visible if setting enabled + if not QtCore.QSettings().value(u'general/display on monitor', + QtCore.QVariant(True)).toBool(): + return if mode == HideMode.Screen: self.frame.evaluateJavaScript(u'show_blank("desktop");') self.setVisible(False) @@ -425,6 +430,11 @@ class MainDisplay(Display): Make the stored images None to release memory. """ log.debug(u'showDisplay') + if self.screens.display_count == 1: + # Only make visible if setting enabled + if not QtCore.QSettings().value(u'general/display on monitor', + QtCore.QVariant(True)).toBool(): + return self.frame.evaluateJavaScript('show_blank("show");') if self.isHidden(): self.setVisible(True) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index b6e18c32a..c11aa79e4 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -967,7 +967,7 @@ class SlideController(Controller): else: Receiver.send_message(u'live_display_show') else: - Receiver.send_message(u'live_display_hide', HideMode.Screen) + self.liveEscape() def onSlideBlank(self): """ From 3a5723cbaa649280fda73a850ee92f593f8615d1 Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Fri, 23 Dec 2011 14:38:02 +0000 Subject: [PATCH 2/4] Don't show initial display window if on same screen as application window, override or not. --- openlp/core/ui/screen.py | 14 ++++++++++++++ openlp/core/ui/slidecontroller.py | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/screen.py b/openlp/core/ui/screen.py index 5b81c8be8..fab2e0f35 100644 --- a/openlp/core/ui/screen.py +++ b/openlp/core/ui/screen.py @@ -222,6 +222,20 @@ class ScreenList(object): log.debug(u'reset_current_display') self.set_current_display(self.current[u'number']) + def which_screen(self, window): + """ + Return the Screen number that the centre of the passed window is in + Window is a QWidget + """ + x = window.x() + (window.width() / 2) + y = window.y() + (window.height() / 2) + for screen in self.screen_list: + size = screen[u'size'] + if x >= size.x() and x <= (size.x() + size.width()) \ + and y >= size.y() and y <= (size.y() + size.height()): + return screen[u'number'] + return None + def _load_screen_settings(self): """ Loads the screen size and the monitor number from the settings. diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index c11aa79e4..ae46d9e95 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -956,7 +956,8 @@ class SlideController(Controller): display_type = QtCore.QSettings().value( self.parent().generalSettingsSection + u'/screen blank', QtCore.QVariant(u'')).toString() - if not self.display.primary: + if self.screens.which_screen(self.window()) != \ + self.screens.which_screen(self.display): # Order done to handle initial conversion if display_type == u'themed': self.onThemeDisplay(True) From ec035d6d379269c1bb947687303a53f6ac3afce6 Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Fri, 23 Dec 2011 17:25:05 +0000 Subject: [PATCH 3/4] Set correct monitor in wizard --- openlp/core/ui/firsttimeform.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 9a5a2ea9d..e7f516980 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -421,6 +421,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if self.displayComboBox.currentIndex() != -1: QtCore.QSettings().setValue(u'General/monitor', QtCore.QVariant(self.displayComboBox.currentIndex())) + self.screens.set_current_display( + self.displayComboBox.currentIndex()) # Set Global Theme if self.themeComboBox.currentIndex() != -1: QtCore.QSettings().setValue(u'themes/global theme', From 2b9f09b32ad688b48df5171fcf47c8c55856f6a6 Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Fri, 23 Dec 2011 21:52:54 +0000 Subject: [PATCH 4/4] Minor fixes --- openlp/core/ui/screen.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/screen.py b/openlp/core/ui/screen.py index fab2e0f35..1f3a1e7f8 100644 --- a/openlp/core/ui/screen.py +++ b/openlp/core/ui/screen.py @@ -224,8 +224,10 @@ class ScreenList(object): def which_screen(self, window): """ - Return the Screen number that the centre of the passed window is in - Window is a QWidget + Return the screen number that the centre of the passed window is in. + + ``window`` + A QWidget we are finding the location of. """ x = window.x() + (window.width() / 2) y = window.y() + (window.height() / 2) @@ -234,7 +236,6 @@ class ScreenList(object): if x >= size.x() and x <= (size.x() + size.width()) \ and y >= size.y() and y <= (size.y() + size.height()): return screen[u'number'] - return None def _load_screen_settings(self): """