Generate Array of Screens and their sizes and pass through components.

This commit is contained in:
Tim Bentley 2009-04-09 19:50:20 +01:00
parent 1fb2b366b2
commit 8ea6f35f1f
4 changed files with 14 additions and 8 deletions

View File

@ -47,8 +47,12 @@ class OpenLP(QtGui.QApplication):
self.splash.show() self.splash.show()
# make sure Qt really display the splash screen # make sure Qt really display the splash screen
self.processEvents() self.processEvents()
# start tha main app window screens = []
self.main_window = MainWindow() # 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() self.main_window.show()
# now kill the splashscreen # now kill the splashscreen
self.splash.finish(self.main_window.main_window) self.splash.finish(self.main_window.main_window)

View File

@ -28,8 +28,9 @@ class GeneralTab(SettingsTab):
""" """
GeneralTab is the general settings tab in the settings dialog. 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')) SettingsTab.__init__(self, translate(u'GeneralTab', u'General'))
self.screen_list = screen_list
def setupUi(self): def setupUi(self):
self.setObjectName(u'GeneralTab') self.setObjectName(u'GeneralTab')

View File

@ -37,12 +37,13 @@ class MainWindow(object):
log=logging.getLogger(u'MainWindow') log=logging.getLogger(u'MainWindow')
log.info(u'MainWindow loaded') log.info(u'MainWindow loaded')
def __init__(self): def __init__(self, screens):
self.main_window = QtGui.QMainWindow() self.main_window = QtGui.QMainWindow()
self.screen_list = screens
self.EventManager = EventManager() self.EventManager = EventManager()
self.alert_form = AlertForm() self.alert_form = AlertForm()
self.about_form = AboutForm() 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.split(os.path.abspath(__file__))[0]
pluginpath = os.path.abspath(os.path.join(pluginpath, '..', '..','plugins')) pluginpath = os.path.abspath(os.path.join(pluginpath, '..', '..','plugins'))

View File

@ -31,18 +31,18 @@ log = logging.getLogger('SettingsForm')
class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
def __init__(self, parent=None): def __init__(self, screen_list, parent=None):
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
self.setupUi(self) self.setupUi(self)
# General tab # General tab
self.GeneralTab = GeneralTab() self.GeneralTab = GeneralTab(screen_list)
self.addTab(self.GeneralTab) self.addTab(self.GeneralTab)
# Themes tab # Themes tab
self.ThemesTab = ThemesTab() self.ThemesTab = ThemesTab()
self.addTab(self.ThemesTab) self.addTab(self.ThemesTab)
# Alert tab # Alert tab
self.AlertsTab = AlertsTab() self.AlertsTab = AlertsTab()
self.addTab(self.AlertsTab) self.addTab(self.AlertsTab)
def addTab(self, tab): def addTab(self, tab):
log.info(u'Inserting %s' % tab.title()) log.info(u'Inserting %s' % tab.title())