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()
# 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)

View File

@ -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')

View File

@ -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'))

View File

@ -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())