From 8ea6f35f1f2ad7e963062cd5616dc0b34d4bddea Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 9 Apr 2009 19:50:20 +0100 Subject: [PATCH] Generate Array of Screens and their sizes and pass through components. --- openlp.pyw | 8 ++++++-- openlp/core/ui/generaltab.py | 3 ++- openlp/core/ui/mainwindow.py | 5 +++-- openlp/core/ui/settingsform.py | 6 +++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 2040b9c70..387f96eb2 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -47,8 +47,12 @@ class OpenLP(QtGui.QApplication): self.splash.show() # make sure Qt really display the splash screen self.processEvents() - # start tha main app window - self.main_window = MainWindow() + screens = [] + # Decide how many screens we have and their size + for i in range (0 , self.desktop().numScreens()): + screens.insert(i, (i+1, self.desktop().availableGeometry(i+1))) + # start the main app window + self.main_window = MainWindow(screens) self.main_window.show() # now kill the splashscreen self.splash.finish(self.main_window.main_window) diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 6f8e62739..9e6bad4ac 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -28,8 +28,9 @@ class GeneralTab(SettingsTab): """ GeneralTab is the general settings tab in the settings dialog. """ - def __init__(self): + def __init__(self, screen_list): SettingsTab.__init__(self, translate(u'GeneralTab', u'General')) + self.screen_list = screen_list def setupUi(self): self.setObjectName(u'GeneralTab') diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index a23f02886..40cc153a7 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -37,12 +37,13 @@ class MainWindow(object): log=logging.getLogger(u'MainWindow') log.info(u'MainWindow loaded') - def __init__(self): + def __init__(self, screens): self.main_window = QtGui.QMainWindow() + self.screen_list = screens self.EventManager = EventManager() self.alert_form = AlertForm() self.about_form = AboutForm() - self.settings_form = SettingsForm() + self.settings_form = SettingsForm(self.screen_list) pluginpath = os.path.split(os.path.abspath(__file__))[0] pluginpath = os.path.abspath(os.path.join(pluginpath, '..', '..','plugins')) diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index 20fb8ed20..70cdb8d93 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -31,18 +31,18 @@ log = logging.getLogger('SettingsForm') class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): - def __init__(self, parent=None): + def __init__(self, screen_list, parent=None): QtGui.QDialog.__init__(self, parent) self.setupUi(self) # General tab - self.GeneralTab = GeneralTab() + self.GeneralTab = GeneralTab(screen_list) self.addTab(self.GeneralTab) # Themes tab self.ThemesTab = ThemesTab() self.addTab(self.ThemesTab) # Alert tab self.AlertsTab = AlertsTab() - self.addTab(self.AlertsTab) + self.addTab(self.AlertsTab) def addTab(self, tab): log.info(u'Inserting %s' % tab.title())