Merged the ~raoul-snyman/openlp/dualdisplay changes into trunk.

bzr-revno: 437
This commit is contained in:
Raoul Snyman 2009-05-01 19:36:51 +02:00
commit 2d9cfa9f75
7 changed files with 70 additions and 36 deletions

View File

@ -52,9 +52,11 @@ class OpenLP(QtGui.QApplication):
self.processEvents() self.processEvents()
screens = [] screens = []
# Decide how many screens we have and their size # Decide how many screens we have and their size
for screen in xrange (0 , self.desktop().numScreens()): for screen in xrange(0, self.desktop().numScreens()):
screens.insert(screen, (screen+1, self.desktop().availableGeometry(screen+1))) screens.append({u'number': screen,
log.info(u'Screen %d found with resolution %s', screen+1, self.desktop().availableGeometry(screen+1)) u'size': self.desktop().availableGeometry(screen),
u'primary': (self.desktop().primaryScreen() == screen)})
log.info(u'Screen %d found with resolution %s', screen, self.desktop().availableGeometry(screen))
# start the main app window # start the main app window
self.main_window = MainWindow(screens) self.main_window = MainWindow(screens)
self.main_window.show() self.main_window.show()

View File

@ -38,9 +38,9 @@ class RenderManager:
self.screen_list = screen_list self.screen_list = screen_list
self.theme_manager = theme_manager self.theme_manager = theme_manager
self.displays = len(screen_list) self.displays = len(screen_list)
self.current_display = 1 self.current_display = 0
self.renderer = Renderer(None) self.renderer = Renderer(None)
self.calculate_default(self.screen_list[self.current_display-1][1]) self.calculate_default(self.screen_list[self.current_display]['size'])
self.frame = None self.frame = None
def set_override_theme(self, theme): def set_override_theme(self, theme):

View File

@ -33,26 +33,51 @@ class SettingsTab(QtGui.QWidget):
self.tabTitle = title self.tabTitle = title
self.setupUi() self.setupUi()
self.retranslateUi() self.retranslateUi()
self.initialise()
if title == None: if title == None:
self.config = PluginConfig(u"Main") self.config = PluginConfig(u'Main')
else: else:
self.config = PluginConfig(str(title)) self.config = PluginConfig(str(title))
self.load() self.load()
def setTitle(self, title): def setTitle(self, title):
"""
Set the title of the tab.
"""
self.tabTitle = title self.tabTitle = title
def title(self): def title(self):
"""
Get the title of the tab.
"""
return self.tabTitle return self.tabTitle
def setupUi(self): def setupUi(self):
"""
Setup the tab's interface.
"""
pass pass
def retranslateUi(self): def retranslateUi(self):
"""
Setup the interface translation strings.
"""
pass
def initialise(self):
"""
Do any extra initialisation here.
"""
pass pass
def load(self): def load(self):
"""
Load settings from disk.
"""
pass pass
def save(self): def save(self):
"""
Save settings to disk.
"""
pass pass

View File

@ -29,8 +29,8 @@ 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, screen_list): def __init__(self, screen_list):
SettingsTab.__init__(self, translate(u'GeneralTab', u'General'))
self.screen_list = screen_list self.screen_list = screen_list
SettingsTab.__init__(self, translate(u'GeneralTab', u'General'))
def setupUi(self): def setupUi(self):
self.setObjectName(u'GeneralTab') self.setObjectName(u'GeneralTab')
@ -55,8 +55,6 @@ class GeneralTab(SettingsTab):
self.MonitorLayout.addWidget(self.MonitorLabel) self.MonitorLayout.addWidget(self.MonitorLabel)
self.MonitorComboBox = QtGui.QComboBox(self.MonitorGroupBox) self.MonitorComboBox = QtGui.QComboBox(self.MonitorGroupBox)
self.MonitorComboBox.setObjectName(u'MonitorComboBox') self.MonitorComboBox.setObjectName(u'MonitorComboBox')
self.MonitorComboBox.addItem(QtCore.QString())
self.MonitorComboBox.addItem(QtCore.QString())
self.MonitorLayout.addWidget(self.MonitorComboBox) self.MonitorLayout.addWidget(self.MonitorComboBox)
self.GeneralLeftLayout.addWidget(self.MonitorGroupBox) self.GeneralLeftLayout.addWidget(self.MonitorGroupBox)
self.BlankScreenGroupBox = QtGui.QGroupBox(self.GeneralLeftWidget) self.BlankScreenGroupBox = QtGui.QGroupBox(self.GeneralLeftWidget)
@ -121,8 +119,6 @@ class GeneralTab(SettingsTab):
def retranslateUi(self): def retranslateUi(self):
self.MonitorGroupBox.setTitle(translate(u'GeneralTab', u'Monitors')) self.MonitorGroupBox.setTitle(translate(u'GeneralTab', u'Monitors'))
self.MonitorLabel.setText(translate(u'GeneralTab', u'Select monitor for output display:')) self.MonitorLabel.setText(translate(u'GeneralTab', u'Select monitor for output display:'))
self.MonitorComboBox.setItemText(0, translate(u'GeneralTab', u'Monitor 1 on X11 Windowing System'))
self.MonitorComboBox.setItemText(1, translate(u'GeneralTab', u'Monitor 2 on X11 Windowing System'))
self.BlankScreenGroupBox.setTitle(translate(u'GeneralTab', u'Blank Screen')) self.BlankScreenGroupBox.setTitle(translate(u'GeneralTab', u'Blank Screen'))
self.WarningCheckBox.setText(translate(u'GeneralTab', u'Show warning on startup')) self.WarningCheckBox.setText(translate(u'GeneralTab', u'Show warning on startup'))
self.AutoOpenGroupBox.setTitle(translate(u'GeneralTab', u'Auto Open Last Service')) self.AutoOpenGroupBox.setTitle(translate(u'GeneralTab', u'Auto Open Last Service'))
@ -132,3 +128,11 @@ class GeneralTab(SettingsTab):
self.UsernameLabel.setText(translate(u'GeneralTab', u'SongSelect Username:')) self.UsernameLabel.setText(translate(u'GeneralTab', u'SongSelect Username:'))
self.PasswordLabel.setText(translate(u'GeneralTab', u'SongSelect Password:')) self.PasswordLabel.setText(translate(u'GeneralTab', u'SongSelect Password:'))
def initialise(self):
for screen in self.screen_list:
screen_name = translate(u'GeneralTab', u'Screen') + u' ' + \
str(screen['number'] + 1)
if screen['primary']:
screen_name = screen_name + u' (' + \
translate(u'GeneralTab', u'primary') + u')'
self.MonitorComboBox.addItem(screen_name)

View File

@ -24,25 +24,31 @@ from openlp.core import translate
class MainDisplay(QtGui.QWidget): class MainDisplay(QtGui.QWidget):
def __init__(self, screens, parent=None): def __init__(self, parent, screens):
QtGui.QWidget.__init__(self, parent) QtGui.QWidget.__init__(self, parent)
self.setWindowTitle(u'OpenLP Display') self.setWindowTitle(u'OpenLP Display')
self.screens = screens self.screens = screens
self.imagesize = screens[0][1]
self.display = QtGui.QLabel(self) self.display = QtGui.QLabel(self)
#self.showMinimized()
def initialView(self): def setup(self, screenNumber):
self.display.setGeometry((self.imagesize.width()-429)/2, (self.imagesize.height()-429)/2, 429, 429) """
self.display.setPixmap(QtGui.QPixmap("openlp2.png")) Sets up the screen on a particular screen.
self.showMaximized() @param (integer) screen This is the screen number.
print len(self.screens) """
print self.isEnabled() screen = self.screens[screenNumber]
print self.isVisible() if screen['number'] != screenNumber:
print self.geometry() # We will most probably never actually hit this bit, but just in
#if len(self.screens) > 0: # case the index in the list doesn't match the screen number, we
# search for it.
for scrn in self.screens:
if scrn['number'] == screenNumber:
screen = scrn
break
self.setGeometry(screen['size'])
if not screen['primary']:
self.showFullScreen() self.showFullScreen()
self.show() else:
self.hide()
def frameView(self, frame): def frameView(self, frame):
self.display.setGeometry(0, 0, imagesize.width(), imagesize.height()) self.display.setGeometry(0, 0, imagesize.width(), imagesize.height())
@ -50,6 +56,3 @@ class MainDisplay(QtGui.QWidget):
def kill(self): def kill(self):
pass pass

View File

@ -37,7 +37,7 @@ class MainWindow(object):
def __init__(self, screens): def __init__(self, screens):
self.main_window = QtGui.QMainWindow() self.main_window = QtGui.QMainWindow()
self.main_display = MainDisplay(screens, self.main_window) self.main_display = MainDisplay(None, screens)
self.screen_list = screens self.screen_list = screens
self.EventManager = EventManager() self.EventManager = EventManager()
self.alert_form = AlertForm() self.alert_form = AlertForm()
@ -421,7 +421,7 @@ class MainWindow(object):
def show(self): def show(self):
self.main_window.showMaximized() self.main_window.showMaximized()
self.main_display.initialView() self.main_display.setup(0)
self.main_display.show() self.main_display.show()
def onHelpAboutItemClicked(self): def onHelpAboutItemClicked(self):