forked from openlp/openlp
- (re)moved obsolete code from SettingsManager
- removed redundant code from ScreenList - removed redundant code form MainDisplay - made the start up logic easier - fixed use of negative x and y values - fixed ratio of images (in the small preview frame) after changing the screen ratio bzr-revno: 1533
This commit is contained in:
commit
7b12c9ef88
@ -115,8 +115,7 @@ class OpenLP(QtGui.QApplication):
|
|||||||
# make sure Qt really display the splash screen
|
# make sure Qt really display the splash screen
|
||||||
self.processEvents()
|
self.processEvents()
|
||||||
# start the main app window
|
# start the main app window
|
||||||
self.mainWindow = MainWindow(screens, self.clipboard(),
|
self.mainWindow = MainWindow(self.clipboard(), self.arguments())
|
||||||
self.arguments())
|
|
||||||
self.mainWindow.show()
|
self.mainWindow.show()
|
||||||
if show_splash:
|
if show_splash:
|
||||||
# now kill the splashscreen
|
# now kill the splashscreen
|
||||||
|
@ -299,7 +299,6 @@ from listwidgetwithdnd import ListWidgetWithDnD
|
|||||||
from displaytags import DisplayTags
|
from displaytags import DisplayTags
|
||||||
from eventreceiver import Receiver
|
from eventreceiver import Receiver
|
||||||
from spelltextedit import SpellTextEdit
|
from spelltextedit import SpellTextEdit
|
||||||
from imagemanager import ImageManager
|
|
||||||
from settingsmanager import SettingsManager
|
from settingsmanager import SettingsManager
|
||||||
from plugin import PluginStatus, StringContent, Plugin
|
from plugin import PluginStatus, StringContent, Plugin
|
||||||
from pluginmanager import PluginManager
|
from pluginmanager import PluginManager
|
||||||
@ -311,6 +310,7 @@ from htmlbuilder import build_html, build_lyrics_format_css, \
|
|||||||
build_lyrics_outline_css
|
build_lyrics_outline_css
|
||||||
from toolbar import OpenLPToolbar
|
from toolbar import OpenLPToolbar
|
||||||
from dockwidget import OpenLPDockWidget
|
from dockwidget import OpenLPDockWidget
|
||||||
|
from imagemanager import ImageManager
|
||||||
from renderer import Renderer
|
from renderer import Renderer
|
||||||
from mediamanageritem import MediaManagerItem
|
from mediamanageritem import MediaManagerItem
|
||||||
from openlp.core.utils.actions import ActionList
|
from openlp.core.utils.actions import ActionList
|
||||||
|
@ -32,6 +32,7 @@ import logging
|
|||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon
|
from openlp.core.lib import build_icon
|
||||||
|
from openlp.core.ui import ScreenList
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -50,3 +51,11 @@ class OpenLPDockWidget(QtGui.QDockWidget):
|
|||||||
self.setObjectName(name)
|
self.setObjectName(name)
|
||||||
if icon:
|
if icon:
|
||||||
self.setWindowIcon(build_icon(icon))
|
self.setWindowIcon(build_icon(icon))
|
||||||
|
# Sort out the minimum width.
|
||||||
|
screens = ScreenList.get_instance()
|
||||||
|
screen_width = screens.current[u'size'].width()
|
||||||
|
mainwindow_docbars = screen_width / 5
|
||||||
|
if mainwindow_docbars > 300:
|
||||||
|
self.setMinimumWidth(300)
|
||||||
|
else:
|
||||||
|
self.setMinimumWidth(mainwindow_docbars)
|
||||||
|
@ -324,17 +324,22 @@ def build_html(item, screen, alert, islive, background, image=None):
|
|||||||
"""
|
"""
|
||||||
Build the full web paged structure for display
|
Build the full web paged structure for display
|
||||||
|
|
||||||
`item`
|
``item``
|
||||||
Service Item to be displayed
|
Service Item to be displayed
|
||||||
`screen`
|
|
||||||
|
``screen``
|
||||||
Current display information
|
Current display information
|
||||||
`alert`
|
|
||||||
|
``alert``
|
||||||
Alert display display information
|
Alert display display information
|
||||||
`islive`
|
|
||||||
|
``islive``
|
||||||
Item is going live, rather than preview/theme building
|
Item is going live, rather than preview/theme building
|
||||||
`background`
|
|
||||||
|
``background``
|
||||||
Theme background image - bytes
|
Theme background image - bytes
|
||||||
`image`
|
|
||||||
|
``image``
|
||||||
Image media item - bytes
|
Image media item - bytes
|
||||||
"""
|
"""
|
||||||
width = screen[u'size'].width()
|
width = screen[u'size'].width()
|
||||||
@ -379,7 +384,7 @@ def build_background_css(item, width, height):
|
|||||||
"""
|
"""
|
||||||
Build the background css
|
Build the background css
|
||||||
|
|
||||||
`item`
|
``item``
|
||||||
Service Item containing theme and location information
|
Service Item containing theme and location information
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -432,10 +437,10 @@ def build_lyrics_css(item, webkitvers):
|
|||||||
"""
|
"""
|
||||||
Build the lyrics display css
|
Build the lyrics display css
|
||||||
|
|
||||||
`item`
|
``item``
|
||||||
Service Item containing theme and location information
|
Service Item containing theme and location information
|
||||||
|
|
||||||
`webkitvers`
|
``webkitvers``
|
||||||
The version of qtwebkit we're using
|
The version of qtwebkit we're using
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -509,10 +514,10 @@ def build_lyrics_outline_css(theme, is_shadow=False):
|
|||||||
Build the css which controls the theme outline
|
Build the css which controls the theme outline
|
||||||
Also used by renderer for splitting verses
|
Also used by renderer for splitting verses
|
||||||
|
|
||||||
`theme`
|
``theme``
|
||||||
Object containing theme information
|
Object containing theme information
|
||||||
|
|
||||||
`is_shadow`
|
``is_shadow``
|
||||||
If true, use the shadow colors instead
|
If true, use the shadow colors instead
|
||||||
"""
|
"""
|
||||||
if theme.font_main_outline:
|
if theme.font_main_outline:
|
||||||
@ -533,13 +538,13 @@ def build_lyrics_format_css(theme, width, height):
|
|||||||
Build the css which controls the theme format
|
Build the css which controls the theme format
|
||||||
Also used by renderer for splitting verses
|
Also used by renderer for splitting verses
|
||||||
|
|
||||||
`theme`
|
``theme``
|
||||||
Object containing theme information
|
Object containing theme information
|
||||||
|
|
||||||
`width`
|
``width``
|
||||||
Width of the lyrics block
|
Width of the lyrics block
|
||||||
|
|
||||||
`height`
|
``height``
|
||||||
Height of the lyrics block
|
Height of the lyrics block
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -569,10 +574,10 @@ def build_lyrics_html(item, webkitvers):
|
|||||||
"""
|
"""
|
||||||
Build the HTML required to show the lyrics
|
Build the HTML required to show the lyrics
|
||||||
|
|
||||||
`item`
|
``item``
|
||||||
Service Item containing theme and location information
|
Service Item containing theme and location information
|
||||||
|
|
||||||
`webkitvers`
|
``webkitvers``
|
||||||
The version of qtwebkit we're using
|
The version of qtwebkit we're using
|
||||||
"""
|
"""
|
||||||
# Bugs in some versions of QtWebKit mean we sometimes need additional
|
# Bugs in some versions of QtWebKit mean we sometimes need additional
|
||||||
@ -598,7 +603,7 @@ def build_footer_css(item, height):
|
|||||||
"""
|
"""
|
||||||
Build the display of the item footer
|
Build the display of the item footer
|
||||||
|
|
||||||
`item`
|
``item``
|
||||||
Service Item to be processed.
|
Service Item to be processed.
|
||||||
"""
|
"""
|
||||||
style = """
|
style = """
|
||||||
@ -624,7 +629,7 @@ def build_alert_css(alertTab, width):
|
|||||||
"""
|
"""
|
||||||
Build the display of the footer
|
Build the display of the footer
|
||||||
|
|
||||||
`alertTab`
|
``alertTab``
|
||||||
Details from the Alert tab for fonts etc
|
Details from the Alert tab for fonts etc
|
||||||
"""
|
"""
|
||||||
style = """
|
style = """
|
||||||
|
@ -35,6 +35,7 @@ import time
|
|||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
from openlp.core.lib import resize_image, image_to_byte
|
from openlp.core.lib import resize_image, image_to_byte
|
||||||
|
from openlp.core.ui import ScreenList
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -70,18 +71,22 @@ class ImageManager(QtCore.QObject):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
QtCore.QObject.__init__(self)
|
QtCore.QObject.__init__(self)
|
||||||
|
current_screen = ScreenList.get_instance().current
|
||||||
|
self.width = current_screen[u'size'].width()
|
||||||
|
self.height = current_screen[u'size'].height()
|
||||||
self._cache = {}
|
self._cache = {}
|
||||||
self._thread_running = False
|
self._thread_running = False
|
||||||
self._cache_dirty = False
|
self._cache_dirty = False
|
||||||
self.image_thread = ImageThread(self)
|
self.image_thread = ImageThread(self)
|
||||||
|
|
||||||
def update_display(self, width, height):
|
def update_display(self):
|
||||||
"""
|
"""
|
||||||
Screen has changed size so rebuild the cache to new size
|
Screen has changed size so rebuild the cache to new size
|
||||||
"""
|
"""
|
||||||
log.debug(u'update_display')
|
log.debug(u'update_display')
|
||||||
self.width = width
|
current_screen = ScreenList.get_instance().current
|
||||||
self.height = height
|
self.width = current_screen[u'size'].width()
|
||||||
|
self.height = current_screen[u'size'].height()
|
||||||
# mark the images as dirty for a rebuild
|
# mark the images as dirty for a rebuild
|
||||||
for key in self._cache.keys():
|
for key in self._cache.keys():
|
||||||
image = self._cache[key]
|
image = self._cache[key]
|
||||||
|
@ -28,11 +28,11 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtWebKit
|
from PyQt4 import QtCore, QtWebKit
|
||||||
|
|
||||||
from openlp.core.lib import ServiceItem, ImageManager, expand_tags, \
|
from openlp.core.lib import ServiceItem, expand_tags, \
|
||||||
build_lyrics_format_css, build_lyrics_outline_css, Receiver, \
|
build_lyrics_format_css, build_lyrics_outline_css, Receiver, \
|
||||||
ItemCapabilities
|
ItemCapabilities
|
||||||
from openlp.core.lib.theme import ThemeLevel
|
from openlp.core.lib.theme import ThemeLevel
|
||||||
from openlp.core.ui import MainDisplay
|
from openlp.core.ui import MainDisplay, ScreenList
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -52,33 +52,32 @@ class Renderer(object):
|
|||||||
Class to pull all Renderer interactions into one place. The plugins will
|
Class to pull all Renderer interactions into one place. The plugins will
|
||||||
call helper methods to do the rendering but this class will provide
|
call helper methods to do the rendering but this class will provide
|
||||||
display defense code.
|
display defense code.
|
||||||
|
|
||||||
``theme_manager``
|
|
||||||
The ThemeManager instance, used to get the current theme details.
|
|
||||||
|
|
||||||
``screens``
|
|
||||||
Contains information about the Screens.
|
|
||||||
|
|
||||||
``screen_number``
|
|
||||||
Defaults to *0*. The index of the output/display screen.
|
|
||||||
"""
|
"""
|
||||||
log.info(u'Renderer Loaded')
|
log.info(u'Renderer Loaded')
|
||||||
|
|
||||||
def __init__(self, theme_manager, screens):
|
def __init__(self, image_manager, theme_manager):
|
||||||
"""
|
"""
|
||||||
Initialise the render manager.
|
Initialise the render manager.
|
||||||
|
|
||||||
|
``image_manager``
|
||||||
|
A ImageManager instance which takes care of e. g. caching and resizing
|
||||||
|
images.
|
||||||
|
|
||||||
|
``theme_manager``
|
||||||
|
The ThemeManager instance, used to get the current theme details.
|
||||||
"""
|
"""
|
||||||
log.debug(u'Initilisation started')
|
log.debug(u'Initilisation started')
|
||||||
self.screens = screens
|
|
||||||
self.image_manager = ImageManager()
|
|
||||||
self.display = MainDisplay(self, screens, False)
|
|
||||||
self.display.imageManager = self.image_manager
|
|
||||||
self.theme_manager = theme_manager
|
self.theme_manager = theme_manager
|
||||||
|
self.image_manager = image_manager
|
||||||
|
self.screens = ScreenList.get_instance()
|
||||||
self.service_theme = u''
|
self.service_theme = u''
|
||||||
self.theme_level = u''
|
self.theme_level = u''
|
||||||
self.override_background = None
|
self.override_background = None
|
||||||
self.theme_data = None
|
self.theme_data = None
|
||||||
|
self.bg_frame = None
|
||||||
self.force_page = False
|
self.force_page = False
|
||||||
|
self.display = MainDisplay(self, self.image_manager, False)
|
||||||
|
self.display.setup()
|
||||||
|
|
||||||
def update_display(self):
|
def update_display(self):
|
||||||
"""
|
"""
|
||||||
@ -86,12 +85,10 @@ class Renderer(object):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'Update Display')
|
log.debug(u'Update Display')
|
||||||
self._calculate_default(self.screens.current[u'size'])
|
self._calculate_default(self.screens.current[u'size'])
|
||||||
self.display = MainDisplay(self, self.screens, False)
|
self.display = MainDisplay(self, self.image_manager, False)
|
||||||
self.display.imageManager = self.image_manager
|
|
||||||
self.display.setup()
|
self.display.setup()
|
||||||
self.bg_frame = None
|
self.bg_frame = None
|
||||||
self.theme_data = None
|
self.theme_data = None
|
||||||
self.image_manager.update_display(self.width, self.height)
|
|
||||||
|
|
||||||
def set_global_theme(self, global_theme, theme_level=ThemeLevel.Global):
|
def set_global_theme(self, global_theme, theme_level=ThemeLevel.Global):
|
||||||
"""
|
"""
|
||||||
|
@ -37,26 +37,9 @@ from openlp.core.utils import AppLocation
|
|||||||
|
|
||||||
class SettingsManager(object):
|
class SettingsManager(object):
|
||||||
"""
|
"""
|
||||||
Class to control the initial settings for the UI and provide helper
|
Class to provide helper functions for the loading and saving of application
|
||||||
functions for the loading and saving of application settings.
|
settings.
|
||||||
"""
|
"""
|
||||||
def __init__(self, screen):
|
|
||||||
self.screen = screen.current
|
|
||||||
self.width = self.screen[u'size'].width()
|
|
||||||
self.height = self.screen[u'size'].height()
|
|
||||||
self.mainwindow_height = self.height * 0.8
|
|
||||||
mainwindow_docbars = self.width / 5
|
|
||||||
self.mainwindow_left = 0
|
|
||||||
self.mainwindow_right = 0
|
|
||||||
if mainwindow_docbars > 300:
|
|
||||||
self.mainwindow_left = 300
|
|
||||||
self.mainwindow_right = 300
|
|
||||||
else:
|
|
||||||
self.mainwindow_left = mainwindow_docbars
|
|
||||||
self.mainwindow_right = mainwindow_docbars
|
|
||||||
self.slidecontroller = (self.width - (
|
|
||||||
self.mainwindow_left + self.mainwindow_right) - 100) / 2
|
|
||||||
self.slidecontroller_image = self.slidecontroller - 50
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_last_dir(section, num=None):
|
def get_last_dir(section, num=None):
|
||||||
|
@ -56,10 +56,10 @@ from firsttimelanguageform import FirstTimeLanguageForm
|
|||||||
from themeform import ThemeForm
|
from themeform import ThemeForm
|
||||||
from filerenameform import FileRenameForm
|
from filerenameform import FileRenameForm
|
||||||
from starttimeform import StartTimeForm
|
from starttimeform import StartTimeForm
|
||||||
|
from screen import ScreenList
|
||||||
from maindisplay import MainDisplay
|
from maindisplay import MainDisplay
|
||||||
from servicenoteform import ServiceNoteForm
|
from servicenoteform import ServiceNoteForm
|
||||||
from serviceitemeditform import ServiceItemEditForm
|
from serviceitemeditform import ServiceItemEditForm
|
||||||
from screen import ScreenList
|
|
||||||
from slidecontroller import SlideController
|
from slidecontroller import SlideController
|
||||||
from splashscreen import SplashScreen
|
from splashscreen import SplashScreen
|
||||||
from generaltab import GeneralTab
|
from generaltab import GeneralTab
|
||||||
|
@ -29,6 +29,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.lib import SettingsTab, Receiver, translate
|
from openlp.core.lib import SettingsTab, Receiver, translate
|
||||||
from openlp.core.lib.ui import UiStrings
|
from openlp.core.lib.ui import UiStrings
|
||||||
|
from openlp.core.ui import ScreenList
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -36,33 +37,15 @@ 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, parent, screens):
|
def __init__(self, parent):
|
||||||
"""
|
"""
|
||||||
Initialise the general settings tab
|
Initialise the general settings tab
|
||||||
"""
|
"""
|
||||||
self.screens = screens
|
self.screens = ScreenList.get_instance()
|
||||||
self.monitorNumber = 0
|
|
||||||
# Set to True to allow PostSetup to work on application start up
|
|
||||||
self.overrideChanged = True
|
|
||||||
self.icon_path = u':/icon/openlp-logo-16x16.png'
|
self.icon_path = u':/icon/openlp-logo-16x16.png'
|
||||||
generalTranslated = translate('GeneralTab', 'General')
|
generalTranslated = translate('GeneralTab', 'General')
|
||||||
SettingsTab.__init__(self, parent, u'General', generalTranslated)
|
SettingsTab.__init__(self, parent, u'General', generalTranslated)
|
||||||
|
|
||||||
def preLoad(self):
|
|
||||||
"""
|
|
||||||
Set up the display screen and set correct screen values.
|
|
||||||
If not set before default to last screen.
|
|
||||||
"""
|
|
||||||
settings = QtCore.QSettings()
|
|
||||||
settings.beginGroup(self.settingsSection)
|
|
||||||
self.monitorNumber = settings.value(u'monitor',
|
|
||||||
QtCore.QVariant(self.screens.display_count - 1)).toInt()[0]
|
|
||||||
self.screens.set_current_display(self.monitorNumber)
|
|
||||||
self.screens.monitor_number = self.monitorNumber
|
|
||||||
self.screens.display = settings.value(
|
|
||||||
u'display on monitor', QtCore.QVariant(True)).toBool()
|
|
||||||
settings.endGroup()
|
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
"""
|
"""
|
||||||
Create the user interface for the general settings tab
|
Create the user interface for the general settings tab
|
||||||
@ -158,14 +141,14 @@ class GeneralTab(SettingsTab):
|
|||||||
self.displayLayout.addWidget(self.customXLabel, 3, 0)
|
self.displayLayout.addWidget(self.customXLabel, 3, 0)
|
||||||
self.customXValueEdit = QtGui.QSpinBox(self.displayGroupBox)
|
self.customXValueEdit = QtGui.QSpinBox(self.displayGroupBox)
|
||||||
self.customXValueEdit.setObjectName(u'customXValueEdit')
|
self.customXValueEdit.setObjectName(u'customXValueEdit')
|
||||||
self.customXValueEdit.setMaximum(9999)
|
self.customXValueEdit.setRange(-9999, 9999)
|
||||||
self.displayLayout.addWidget(self.customXValueEdit, 4, 0)
|
self.displayLayout.addWidget(self.customXValueEdit, 4, 0)
|
||||||
self.customYLabel = QtGui.QLabel(self.displayGroupBox)
|
self.customYLabel = QtGui.QLabel(self.displayGroupBox)
|
||||||
self.customYLabel.setObjectName(u'customYLabel')
|
self.customYLabel.setObjectName(u'customYLabel')
|
||||||
self.displayLayout.addWidget(self.customYLabel, 3, 1)
|
self.displayLayout.addWidget(self.customYLabel, 3, 1)
|
||||||
self.customYValueEdit = QtGui.QSpinBox(self.displayGroupBox)
|
self.customYValueEdit = QtGui.QSpinBox(self.displayGroupBox)
|
||||||
self.customYValueEdit.setObjectName(u'customYValueEdit')
|
self.customYValueEdit.setObjectName(u'customYValueEdit')
|
||||||
self.customYValueEdit.setMaximum(9999)
|
self.customYValueEdit.setRange(-9999, 9999)
|
||||||
self.displayLayout.addWidget(self.customYValueEdit, 4, 1)
|
self.displayLayout.addWidget(self.customYValueEdit, 4, 1)
|
||||||
self.customWidthLabel = QtGui.QLabel(self.displayGroupBox)
|
self.customWidthLabel = QtGui.QLabel(self.displayGroupBox)
|
||||||
self.customWidthLabel.setObjectName(u'customWidthLabel')
|
self.customWidthLabel.setObjectName(u'customWidthLabel')
|
||||||
@ -187,13 +170,15 @@ class GeneralTab(SettingsTab):
|
|||||||
QtCore.QObject.connect(self.overrideCheckBox,
|
QtCore.QObject.connect(self.overrideCheckBox,
|
||||||
QtCore.SIGNAL(u'toggled(bool)'), self.onOverrideCheckBoxToggled)
|
QtCore.SIGNAL(u'toggled(bool)'), self.onOverrideCheckBoxToggled)
|
||||||
QtCore.QObject.connect(self.customHeightValueEdit,
|
QtCore.QObject.connect(self.customHeightValueEdit,
|
||||||
QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayPositionChanged)
|
QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
|
||||||
QtCore.QObject.connect(self.customWidthValueEdit,
|
QtCore.QObject.connect(self.customWidthValueEdit,
|
||||||
QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayPositionChanged)
|
QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
|
||||||
QtCore.QObject.connect(self.customYValueEdit,
|
QtCore.QObject.connect(self.customYValueEdit,
|
||||||
QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayPositionChanged)
|
QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
|
||||||
QtCore.QObject.connect(self.customXValueEdit,
|
QtCore.QObject.connect(self.customXValueEdit,
|
||||||
QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayPositionChanged)
|
QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
|
||||||
|
QtCore.QObject.connect(self.monitorComboBox,
|
||||||
|
QtCore.SIGNAL(u'currentIndexChanged(int)'), self.onDisplayChanged)
|
||||||
# Reload the tab, as the screen resolution/count may have changed.
|
# Reload the tab, as the screen resolution/count may have changed.
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'config_screen_changed'), self.load)
|
QtCore.SIGNAL(u'config_screen_changed'), self.load)
|
||||||
@ -203,7 +188,6 @@ class GeneralTab(SettingsTab):
|
|||||||
self.passwordLabel.setVisible(False)
|
self.passwordLabel.setVisible(False)
|
||||||
self.passwordEdit.setVisible(False)
|
self.passwordEdit.setVisible(False)
|
||||||
|
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
"""
|
"""
|
||||||
Translate the general settings tab to the currently selected language
|
Translate the general settings tab to the currently selected language
|
||||||
@ -261,6 +245,9 @@ class GeneralTab(SettingsTab):
|
|||||||
settings.beginGroup(self.settingsSection)
|
settings.beginGroup(self.settingsSection)
|
||||||
self.monitorComboBox.clear()
|
self.monitorComboBox.clear()
|
||||||
self.monitorComboBox.addItems(self.screens.get_screen_list())
|
self.monitorComboBox.addItems(self.screens.get_screen_list())
|
||||||
|
monitorNumber = settings.value(u'monitor',
|
||||||
|
QtCore.QVariant(self.screens.display_count - 1)).toInt()[0]
|
||||||
|
self.monitorComboBox.setCurrentIndex(monitorNumber)
|
||||||
self.numberEdit.setText(unicode(settings.value(
|
self.numberEdit.setText(unicode(settings.value(
|
||||||
u'ccli number', QtCore.QVariant(u'')).toString()))
|
u'ccli number', QtCore.QVariant(u'')).toString()))
|
||||||
self.usernameEdit.setText(unicode(settings.value(
|
self.usernameEdit.setText(unicode(settings.value(
|
||||||
@ -271,7 +258,6 @@ class GeneralTab(SettingsTab):
|
|||||||
QtCore.QVariant(False)).toBool())
|
QtCore.QVariant(False)).toBool())
|
||||||
self.autoUnblankCheckBox.setChecked(settings.value(u'auto unblank',
|
self.autoUnblankCheckBox.setChecked(settings.value(u'auto unblank',
|
||||||
QtCore.QVariant(False)).toBool())
|
QtCore.QVariant(False)).toBool())
|
||||||
self.monitorComboBox.setCurrentIndex(self.monitorNumber)
|
|
||||||
self.displayOnMonitorCheck.setChecked(self.screens.display)
|
self.displayOnMonitorCheck.setChecked(self.screens.display)
|
||||||
self.warningCheckBox.setChecked(settings.value(u'blank warning',
|
self.warningCheckBox.setChecked(settings.value(u'blank warning',
|
||||||
QtCore.QVariant(False)).toBool())
|
QtCore.QVariant(False)).toBool())
|
||||||
@ -300,15 +286,16 @@ class GeneralTab(SettingsTab):
|
|||||||
self.customYValueEdit.setEnabled(self.overrideCheckBox.isChecked())
|
self.customYValueEdit.setEnabled(self.overrideCheckBox.isChecked())
|
||||||
self.customHeightValueEdit.setEnabled(self.overrideCheckBox.isChecked())
|
self.customHeightValueEdit.setEnabled(self.overrideCheckBox.isChecked())
|
||||||
self.customWidthValueEdit.setEnabled(self.overrideCheckBox.isChecked())
|
self.customWidthValueEdit.setEnabled(self.overrideCheckBox.isChecked())
|
||||||
|
self.display_changed = False
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
"""
|
"""
|
||||||
Save the settings from the form
|
Save the settings from the form
|
||||||
"""
|
"""
|
||||||
self.monitorNumber = self.monitorComboBox.currentIndex()
|
|
||||||
settings = QtCore.QSettings()
|
settings = QtCore.QSettings()
|
||||||
settings.beginGroup(self.settingsSection)
|
settings.beginGroup(self.settingsSection)
|
||||||
settings.setValue(u'monitor', QtCore.QVariant(self.monitorNumber))
|
settings.setValue(u'monitor',
|
||||||
|
QtCore.QVariant(self.monitorComboBox.currentIndex()))
|
||||||
settings.setValue(u'display on monitor',
|
settings.setValue(u'display on monitor',
|
||||||
QtCore.QVariant(self.displayOnMonitorCheck.isChecked()))
|
QtCore.QVariant(self.displayOnMonitorCheck.isChecked()))
|
||||||
settings.setValue(u'blank warning',
|
settings.setValue(u'blank warning',
|
||||||
@ -344,15 +331,8 @@ class GeneralTab(SettingsTab):
|
|||||||
settings.setValue(u'override position',
|
settings.setValue(u'override position',
|
||||||
QtCore.QVariant(self.overrideCheckBox.isChecked()))
|
QtCore.QVariant(self.overrideCheckBox.isChecked()))
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
self.screens.display = self.displayOnMonitorCheck.isChecked()
|
|
||||||
# Monitor Number has changed.
|
|
||||||
postUpdate = False
|
|
||||||
if self.screens.monitor_number != self.monitorNumber:
|
|
||||||
self.screens.monitor_number = self.monitorNumber
|
|
||||||
self.screens.set_current_display(self.monitorNumber)
|
|
||||||
postUpdate = True
|
|
||||||
# On save update the screens as well
|
# On save update the screens as well
|
||||||
self.postSetUp(postUpdate)
|
self.postSetUp(True)
|
||||||
|
|
||||||
def postSetUp(self, postUpdate=False):
|
def postSetUp(self, postUpdate=False):
|
||||||
"""
|
"""
|
||||||
@ -361,7 +341,11 @@ class GeneralTab(SettingsTab):
|
|||||||
"""
|
"""
|
||||||
Receiver.send_message(u'slidecontroller_live_spin_delay',
|
Receiver.send_message(u'slidecontroller_live_spin_delay',
|
||||||
self.timeoutSpinBox.value())
|
self.timeoutSpinBox.value())
|
||||||
# Reset screens after initial definition
|
# Do not continue on start up.
|
||||||
|
if not postUpdate:
|
||||||
|
return
|
||||||
|
self.screens.set_current_display(self.monitorComboBox.currentIndex())
|
||||||
|
self.screens.display = self.displayOnMonitorCheck.isChecked()
|
||||||
self.screens.override[u'size'] = QtCore.QRect(
|
self.screens.override[u'size'] = QtCore.QRect(
|
||||||
self.customXValueEdit.value(),
|
self.customXValueEdit.value(),
|
||||||
self.customYValueEdit.value(),
|
self.customYValueEdit.value(),
|
||||||
@ -371,10 +355,9 @@ class GeneralTab(SettingsTab):
|
|||||||
self.screens.set_override_display()
|
self.screens.set_override_display()
|
||||||
else:
|
else:
|
||||||
self.screens.reset_current_display()
|
self.screens.reset_current_display()
|
||||||
# Order is important so be careful if you change
|
if self.display_changed:
|
||||||
if self.overrideChanged or postUpdate:
|
|
||||||
Receiver.send_message(u'config_screen_changed')
|
Receiver.send_message(u'config_screen_changed')
|
||||||
self.overrideChanged = False
|
self.display_changed = False
|
||||||
|
|
||||||
def onOverrideCheckBoxToggled(self, checked):
|
def onOverrideCheckBoxToggled(self, checked):
|
||||||
"""
|
"""
|
||||||
@ -387,10 +370,10 @@ class GeneralTab(SettingsTab):
|
|||||||
self.customYValueEdit.setEnabled(checked)
|
self.customYValueEdit.setEnabled(checked)
|
||||||
self.customHeightValueEdit.setEnabled(checked)
|
self.customHeightValueEdit.setEnabled(checked)
|
||||||
self.customWidthValueEdit.setEnabled(checked)
|
self.customWidthValueEdit.setEnabled(checked)
|
||||||
self.overrideChanged = True
|
self.display_changed = True
|
||||||
|
|
||||||
def onDisplayPositionChanged(self):
|
def onDisplayChanged(self):
|
||||||
"""
|
"""
|
||||||
Called when the width, height, x position or y position has changed.
|
Called when the width, height, x position or y position has changed.
|
||||||
"""
|
"""
|
||||||
self.overrideChanged = True
|
self.display_changed = True
|
||||||
|
@ -36,35 +36,23 @@ from PyQt4.phonon import Phonon
|
|||||||
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \
|
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \
|
||||||
translate
|
translate
|
||||||
|
|
||||||
from openlp.core.ui import HideMode
|
from openlp.core.ui import HideMode, ScreenList
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
#http://www.steveheffernan.com/html5-video-player/demo-video-player.html
|
#http://www.steveheffernan.com/html5-video-player/demo-video-player.html
|
||||||
#http://html5demos.com/two-videos
|
#http://html5demos.com/two-videos
|
||||||
|
|
||||||
class DisplayWidget(QtGui.QGraphicsView):
|
class MainDisplay(QtGui.QGraphicsView):
|
||||||
"""
|
|
||||||
Customised version of QTableWidget which can respond to keyboard
|
|
||||||
events.
|
|
||||||
"""
|
|
||||||
log.info(u'Display Widget loaded')
|
|
||||||
|
|
||||||
def __init__(self, live, parent=None):
|
|
||||||
QtGui.QGraphicsView.__init__(self)
|
|
||||||
self.parent = parent
|
|
||||||
self.live = live
|
|
||||||
|
|
||||||
|
|
||||||
class MainDisplay(DisplayWidget):
|
|
||||||
"""
|
"""
|
||||||
This is the display screen.
|
This is the display screen.
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent, screens, live):
|
def __init__(self, parent, image_manager, live):
|
||||||
DisplayWidget.__init__(self, live, parent=None)
|
QtGui.QGraphicsView.__init__(self)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.screens = screens
|
|
||||||
self.isLive = live
|
self.isLive = live
|
||||||
|
self.image_manager = image_manager
|
||||||
|
self.screens = ScreenList.get_instance()
|
||||||
self.alertTab = None
|
self.alertTab = None
|
||||||
self.hideMode = None
|
self.hideMode = None
|
||||||
self.videoHide = False
|
self.videoHide = False
|
||||||
@ -94,8 +82,7 @@ class MainDisplay(DisplayWidget):
|
|||||||
"""
|
"""
|
||||||
Set up and build the output screen
|
Set up and build the output screen
|
||||||
"""
|
"""
|
||||||
log.debug(u'Start setup for monitor %s (live = %s)' %
|
log.debug(u'Start MainDisplay setup (live = %s)' % self.isLive)
|
||||||
(self.screens.monitor_number, self.isLive))
|
|
||||||
self.usePhonon = QtCore.QSettings().value(
|
self.usePhonon = QtCore.QSettings().value(
|
||||||
u'media/use phonon', QtCore.QVariant(True)).toBool()
|
u'media/use phonon', QtCore.QVariant(True)).toBool()
|
||||||
self.phononActive = False
|
self.phononActive = False
|
||||||
@ -106,11 +93,10 @@ class MainDisplay(DisplayWidget):
|
|||||||
self.videoWidget.setVisible(False)
|
self.videoWidget.setVisible(False)
|
||||||
self.videoWidget.setGeometry(QtCore.QRect(0, 0,
|
self.videoWidget.setGeometry(QtCore.QRect(0, 0,
|
||||||
self.screen[u'size'].width(), self.screen[u'size'].height()))
|
self.screen[u'size'].width(), self.screen[u'size'].height()))
|
||||||
log.debug(u'Setup Phonon for monitor %s' % self.screens.monitor_number)
|
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
if not self.firstTime:
|
if not self.firstTime:
|
||||||
self.createMediaObject()
|
self.createMediaObject()
|
||||||
log.debug(u'Setup webView for monitor %s' % self.screens.monitor_number)
|
log.debug(u'Setup webView')
|
||||||
self.webView = QtWebKit.QWebView(self)
|
self.webView = QtWebKit.QWebView(self)
|
||||||
self.webView.setGeometry(0, 0,
|
self.webView.setGeometry(0, 0,
|
||||||
self.screen[u'size'].width(), self.screen[u'size'].height())
|
self.screen[u'size'].width(), self.screen[u'size'].height())
|
||||||
@ -127,8 +113,8 @@ class MainDisplay(DisplayWidget):
|
|||||||
if self.isLive:
|
if self.isLive:
|
||||||
# Build the initial frame.
|
# Build the initial frame.
|
||||||
self.black = QtGui.QImage(
|
self.black = QtGui.QImage(
|
||||||
self.screens.current[u'size'].width(),
|
self.screen[u'size'].width(),
|
||||||
self.screens.current[u'size'].height(),
|
self.screen[u'size'].height(),
|
||||||
QtGui.QImage.Format_ARGB32_Premultiplied)
|
QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||||
painter_image = QtGui.QPainter()
|
painter_image = QtGui.QPainter()
|
||||||
painter_image.begin(self.black)
|
painter_image.begin(self.black)
|
||||||
@ -145,17 +131,16 @@ class MainDisplay(DisplayWidget):
|
|||||||
background_color = QtCore.Qt.white
|
background_color = QtCore.Qt.white
|
||||||
splash_image = QtGui.QImage(image_file)
|
splash_image = QtGui.QImage(image_file)
|
||||||
self.initialFrame = QtGui.QImage(
|
self.initialFrame = QtGui.QImage(
|
||||||
self.screens.current[u'size'].width(),
|
self.screen[u'size'].width(),
|
||||||
self.screens.current[u'size'].height(),
|
self.screen[u'size'].height(),
|
||||||
QtGui.QImage.Format_ARGB32_Premultiplied)
|
QtGui.QImage.Format_ARGB32_Premultiplied)
|
||||||
painter_image = QtGui.QPainter()
|
painter_image = QtGui.QPainter()
|
||||||
painter_image.begin(self.initialFrame)
|
painter_image.begin(self.initialFrame)
|
||||||
painter_image.fillRect(self.initialFrame.rect(), background_color)
|
painter_image.fillRect(self.initialFrame.rect(), background_color)
|
||||||
painter_image.drawImage(
|
painter_image.drawImage(
|
||||||
(self.screens.current[u'size'].width() -
|
(self.screen[u'size'].width() - splash_image.width()) / 2,
|
||||||
splash_image.width()) / 2,
|
(self.screen[u'size'].height() - splash_image.height()) / 2,
|
||||||
(self.screens.current[u'size'].height()
|
splash_image)
|
||||||
- splash_image.height()) / 2, splash_image)
|
|
||||||
serviceItem = ServiceItem()
|
serviceItem = ServiceItem()
|
||||||
serviceItem.bg_image_bytes = image_to_byte(self.initialFrame)
|
serviceItem.bg_image_bytes = image_to_byte(self.initialFrame)
|
||||||
self.webView.setHtml(build_html(serviceItem, self.screen,
|
self.webView.setHtml(build_html(serviceItem, self.screen,
|
||||||
@ -167,8 +152,7 @@ class MainDisplay(DisplayWidget):
|
|||||||
self.primary = False
|
self.primary = False
|
||||||
else:
|
else:
|
||||||
self.primary = True
|
self.primary = True
|
||||||
log.debug(
|
log.debug(u'Finished MainDisplay setup')
|
||||||
u'Finished setup for monitor %s' % self.screens.monitor_number)
|
|
||||||
|
|
||||||
def createMediaObject(self):
|
def createMediaObject(self):
|
||||||
self.firstTime = False
|
self.firstTime = False
|
||||||
@ -212,8 +196,8 @@ class MainDisplay(DisplayWidget):
|
|||||||
The slide text to be displayed
|
The slide text to be displayed
|
||||||
"""
|
"""
|
||||||
log.debug(u'alert to display')
|
log.debug(u'alert to display')
|
||||||
if self.height() != self.screen[u'size'].height() \
|
if self.height() != self.screen[u'size'].height() or not \
|
||||||
or not self.isVisible() or self.videoWidget.isVisible():
|
self.isVisible() or self.videoWidget.isVisible():
|
||||||
shrink = True
|
shrink = True
|
||||||
else:
|
else:
|
||||||
shrink = False
|
shrink = False
|
||||||
@ -244,7 +228,7 @@ class MainDisplay(DisplayWidget):
|
|||||||
"""
|
"""
|
||||||
API for replacement backgrounds so Images are added directly to cache
|
API for replacement backgrounds so Images are added directly to cache
|
||||||
"""
|
"""
|
||||||
self.imageManager.add_image(name, path)
|
self.image_manager.add_image(name, path)
|
||||||
self.image(name)
|
self.image(name)
|
||||||
if hasattr(self, u'serviceItem'):
|
if hasattr(self, u'serviceItem'):
|
||||||
self.override[u'image'] = name
|
self.override[u'image'] = name
|
||||||
@ -259,7 +243,7 @@ class MainDisplay(DisplayWidget):
|
|||||||
The name of the image to be displayed
|
The name of the image to be displayed
|
||||||
"""
|
"""
|
||||||
log.debug(u'image to display')
|
log.debug(u'image to display')
|
||||||
image = self.imageManager.get_image_bytes(name)
|
image = self.image_manager.get_image_bytes(name)
|
||||||
self.resetVideo()
|
self.resetVideo()
|
||||||
self.displayImage(image)
|
self.displayImage(image)
|
||||||
return self.preview()
|
return self.preview()
|
||||||
@ -451,7 +435,7 @@ class MainDisplay(DisplayWidget):
|
|||||||
self.hideDisplay(self.hideMode)
|
self.hideDisplay(self.hideMode)
|
||||||
else:
|
else:
|
||||||
# Single screen active
|
# Single screen active
|
||||||
if self.screens.monitor_number == 0:
|
if self.screens.display_count == 1:
|
||||||
# Only make visible if setting enabled
|
# Only make visible if setting enabled
|
||||||
if QtCore.QSettings().value(u'general/display on monitor',
|
if QtCore.QSettings().value(u'general/display on monitor',
|
||||||
QtCore.QVariant(True)).toBool():
|
QtCore.QVariant(True)).toBool():
|
||||||
@ -489,13 +473,13 @@ class MainDisplay(DisplayWidget):
|
|||||||
self.override = {}
|
self.override = {}
|
||||||
else:
|
else:
|
||||||
# replace the background
|
# replace the background
|
||||||
background = self.imageManager. \
|
background = self.image_manager. \
|
||||||
get_image_bytes(self.override[u'image'])
|
get_image_bytes(self.override[u'image'])
|
||||||
if self.serviceItem.themedata.background_filename:
|
if self.serviceItem.themedata.background_filename:
|
||||||
self.serviceItem.bg_image_bytes = self.imageManager. \
|
self.serviceItem.bg_image_bytes = self.image_manager. \
|
||||||
get_image_bytes(self.serviceItem.themedata.theme_name)
|
get_image_bytes(self.serviceItem.themedata.theme_name)
|
||||||
if image:
|
if image:
|
||||||
image_bytes = self.imageManager.get_image_bytes(image)
|
image_bytes = self.image_manager.get_image_bytes(image)
|
||||||
else:
|
else:
|
||||||
image_bytes = None
|
image_bytes = None
|
||||||
html = build_html(self.serviceItem, self.screen, self.alertTab,
|
html = build_html(self.serviceItem, self.screen, self.alertTab,
|
||||||
|
@ -31,7 +31,7 @@ from tempfile import gettempdir
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, \
|
from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, \
|
||||||
SettingsManager, PluginManager, Receiver, translate
|
PluginManager, Receiver, translate, ImageManager
|
||||||
from openlp.core.lib.ui import UiStrings, base_action, checkable_action, \
|
from openlp.core.lib.ui import UiStrings, base_action, checkable_action, \
|
||||||
icon_action, shortcut_action
|
icon_action, shortcut_action
|
||||||
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
|
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
|
||||||
@ -69,8 +69,6 @@ class Ui_MainWindow(object):
|
|||||||
Set up the user interface
|
Set up the user interface
|
||||||
"""
|
"""
|
||||||
mainWindow.setObjectName(u'MainWindow')
|
mainWindow.setObjectName(u'MainWindow')
|
||||||
mainWindow.resize(self.settingsmanager.width,
|
|
||||||
self.settingsmanager.height)
|
|
||||||
mainWindow.setWindowIcon(build_icon(u':/icon/openlp-logo-64x64.png'))
|
mainWindow.setWindowIcon(build_icon(u':/icon/openlp-logo-64x64.png'))
|
||||||
mainWindow.setDockNestingEnabled(True)
|
mainWindow.setDockNestingEnabled(True)
|
||||||
# Set up the main container, which contains all the other form widgets.
|
# Set up the main container, which contains all the other form widgets.
|
||||||
@ -86,10 +84,8 @@ class Ui_MainWindow(object):
|
|||||||
self.controlSplitter.setObjectName(u'controlSplitter')
|
self.controlSplitter.setObjectName(u'controlSplitter')
|
||||||
self.mainContentLayout.addWidget(self.controlSplitter)
|
self.mainContentLayout.addWidget(self.controlSplitter)
|
||||||
# Create slide controllers
|
# Create slide controllers
|
||||||
self.previewController = SlideController(self, self.settingsmanager,
|
self.previewController = SlideController(self)
|
||||||
self.screens)
|
self.liveController = SlideController(self, True)
|
||||||
self.liveController = SlideController(self, self.settingsmanager,
|
|
||||||
self.screens, True)
|
|
||||||
previewVisible = QtCore.QSettings().value(
|
previewVisible = QtCore.QSettings().value(
|
||||||
u'user interface/preview panel', QtCore.QVariant(True)).toBool()
|
u'user interface/preview panel', QtCore.QVariant(True)).toBool()
|
||||||
self.previewController.panel.setVisible(previewVisible)
|
self.previewController.panel.setVisible(previewVisible)
|
||||||
@ -137,8 +133,6 @@ class Ui_MainWindow(object):
|
|||||||
self.mediaManagerDock = OpenLPDockWidget(mainWindow,
|
self.mediaManagerDock = OpenLPDockWidget(mainWindow,
|
||||||
u'mediaManagerDock', u':/system/system_mediamanager.png')
|
u'mediaManagerDock', u':/system/system_mediamanager.png')
|
||||||
self.mediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE)
|
self.mediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE)
|
||||||
self.mediaManagerDock.setMinimumWidth(
|
|
||||||
self.settingsmanager.mainwindow_left)
|
|
||||||
# Create the media toolbox
|
# Create the media toolbox
|
||||||
self.MediaToolBox = QtGui.QToolBox(self.mediaManagerDock)
|
self.MediaToolBox = QtGui.QToolBox(self.mediaManagerDock)
|
||||||
self.MediaToolBox.setObjectName(u'MediaToolBox')
|
self.MediaToolBox.setObjectName(u'MediaToolBox')
|
||||||
@ -148,8 +142,6 @@ class Ui_MainWindow(object):
|
|||||||
# Create the service manager
|
# Create the service manager
|
||||||
self.serviceManagerDock = OpenLPDockWidget(mainWindow,
|
self.serviceManagerDock = OpenLPDockWidget(mainWindow,
|
||||||
u'serviceManagerDock', u':/system/system_servicemanager.png')
|
u'serviceManagerDock', u':/system/system_servicemanager.png')
|
||||||
self.serviceManagerDock.setMinimumWidth(
|
|
||||||
self.settingsmanager.mainwindow_right)
|
|
||||||
self.ServiceManagerContents = ServiceManager(mainWindow,
|
self.ServiceManagerContents = ServiceManager(mainWindow,
|
||||||
self.serviceManagerDock)
|
self.serviceManagerDock)
|
||||||
self.serviceManagerDock.setWidget(self.ServiceManagerContents)
|
self.serviceManagerDock.setWidget(self.ServiceManagerContents)
|
||||||
@ -158,8 +150,6 @@ class Ui_MainWindow(object):
|
|||||||
# Create the theme manager
|
# Create the theme manager
|
||||||
self.themeManagerDock = OpenLPDockWidget(mainWindow,
|
self.themeManagerDock = OpenLPDockWidget(mainWindow,
|
||||||
u'themeManagerDock', u':/system/system_thememanager.png')
|
u'themeManagerDock', u':/system/system_thememanager.png')
|
||||||
self.themeManagerDock.setMinimumWidth(
|
|
||||||
self.settingsmanager.mainwindow_right)
|
|
||||||
self.themeManagerContents = ThemeManager(mainWindow,
|
self.themeManagerContents = ThemeManager(mainWindow,
|
||||||
self.themeManagerDock)
|
self.themeManagerDock)
|
||||||
self.themeManagerContents.setObjectName(u'themeManagerContents')
|
self.themeManagerContents.setObjectName(u'themeManagerContents')
|
||||||
@ -461,13 +451,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
"""
|
"""
|
||||||
log.info(u'MainWindow loaded')
|
log.info(u'MainWindow loaded')
|
||||||
|
|
||||||
def __init__(self, screens, clipboard, arguments):
|
def __init__(self, clipboard, arguments):
|
||||||
"""
|
"""
|
||||||
This constructor sets up the interface, the various managers, and the
|
This constructor sets up the interface, the various managers, and the
|
||||||
plugins.
|
plugins.
|
||||||
"""
|
"""
|
||||||
QtGui.QMainWindow.__init__(self)
|
QtGui.QMainWindow.__init__(self)
|
||||||
self.screens = screens
|
|
||||||
self.clipboard = clipboard
|
self.clipboard = clipboard
|
||||||
self.arguments = arguments
|
self.arguments = arguments
|
||||||
# Set up settings sections for the main application
|
# Set up settings sections for the main application
|
||||||
@ -477,9 +466,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
self.serviceSettingsSection = u'servicemanager'
|
self.serviceSettingsSection = u'servicemanager'
|
||||||
self.songsSettingsSection = u'songs'
|
self.songsSettingsSection = u'songs'
|
||||||
self.serviceNotSaved = False
|
self.serviceNotSaved = False
|
||||||
self.settingsmanager = SettingsManager(screens)
|
|
||||||
self.aboutForm = AboutForm(self)
|
self.aboutForm = AboutForm(self)
|
||||||
self.settingsForm = SettingsForm(self.screens, self, self)
|
self.settingsForm = SettingsForm(self, self)
|
||||||
self.displayTagForm = DisplayTagForm(self)
|
self.displayTagForm = DisplayTagForm(self)
|
||||||
self.shortcutForm = ShortcutListForm(self)
|
self.shortcutForm = ShortcutListForm(self)
|
||||||
self.recentFiles = QtCore.QStringList()
|
self.recentFiles = QtCore.QStringList()
|
||||||
@ -487,6 +475,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
pluginpath = AppLocation.get_directory(AppLocation.PluginsDir)
|
pluginpath = AppLocation.get_directory(AppLocation.PluginsDir)
|
||||||
self.pluginManager = PluginManager(pluginpath)
|
self.pluginManager = PluginManager(pluginpath)
|
||||||
self.pluginHelpers = {}
|
self.pluginHelpers = {}
|
||||||
|
self.image_manager = ImageManager()
|
||||||
# Set up the interface
|
# Set up the interface
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
# Load settings after setupUi so default UI sizes are overwritten
|
# Load settings after setupUi so default UI sizes are overwritten
|
||||||
@ -552,8 +541,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
# warning cyclic dependency
|
# warning cyclic dependency
|
||||||
# renderer needs to call ThemeManager and
|
# renderer needs to call ThemeManager and
|
||||||
# ThemeManager needs to call Renderer
|
# ThemeManager needs to call Renderer
|
||||||
self.renderer = Renderer(
|
self.renderer = Renderer(self.image_manager, self.themeManagerContents)
|
||||||
self.themeManagerContents, self.screens)
|
|
||||||
# Define the media Dock Manager
|
# Define the media Dock Manager
|
||||||
self.mediaDockManager = MediaDockManager(self.MediaToolBox)
|
self.mediaDockManager = MediaDockManager(self.MediaToolBox)
|
||||||
log.info(u'Load Plugins')
|
log.info(u'Load Plugins')
|
||||||
@ -585,6 +573,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
# Call the initialise method to setup plugins.
|
# Call the initialise method to setup plugins.
|
||||||
log.info(u'initialise plugins')
|
log.info(u'initialise plugins')
|
||||||
self.pluginManager.initialise_plugins()
|
self.pluginManager.initialise_plugins()
|
||||||
|
# Create the displays as all necessary components are loaded.
|
||||||
|
self.previewController.screenSizeChanged()
|
||||||
|
self.liveController.screenSizeChanged()
|
||||||
log.info(u'Load data from Settings')
|
log.info(u'Load data from Settings')
|
||||||
if QtCore.QSettings().value(u'advanced/save current plugin',
|
if QtCore.QSettings().value(u'advanced/save current plugin',
|
||||||
QtCore.QVariant(False)).toBool():
|
QtCore.QVariant(False)).toBool():
|
||||||
@ -788,7 +779,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
their locations
|
their locations
|
||||||
"""
|
"""
|
||||||
log.debug(u'screenChanged')
|
log.debug(u'screenChanged')
|
||||||
|
self.image_manager.update_display()
|
||||||
self.renderer.update_display()
|
self.renderer.update_display()
|
||||||
|
self.liveController.screenSizeChanged()
|
||||||
|
self.previewController.screenSizeChanged()
|
||||||
self.setFocus()
|
self.setFocus()
|
||||||
self.activateWindow()
|
self.activateWindow()
|
||||||
|
|
||||||
|
@ -38,9 +38,16 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class ScreenList(object):
|
class ScreenList(object):
|
||||||
"""
|
"""
|
||||||
Wrapper to handle the parameters of the display screen
|
Wrapper to handle the parameters of the display screen.
|
||||||
|
|
||||||
|
To get access to the screen list call ``ScreenList.get_instance()``.
|
||||||
"""
|
"""
|
||||||
log.info(u'Screen loaded')
|
log.info(u'Screen loaded')
|
||||||
|
instance = None
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_instance():
|
||||||
|
return ScreenList.instance
|
||||||
|
|
||||||
def __init__(self, desktop):
|
def __init__(self, desktop):
|
||||||
"""
|
"""
|
||||||
@ -49,17 +56,15 @@ class ScreenList(object):
|
|||||||
``desktop``
|
``desktop``
|
||||||
A ``QDesktopWidget`` object.
|
A ``QDesktopWidget`` object.
|
||||||
"""
|
"""
|
||||||
|
ScreenList.instance = self
|
||||||
self.desktop = desktop
|
self.desktop = desktop
|
||||||
self.preview = None
|
self.preview = None
|
||||||
self.current = None
|
self.current = None
|
||||||
self.override = None
|
self.override = None
|
||||||
self.screen_list = []
|
self.screen_list = []
|
||||||
self.display_count = 0
|
self.display_count = 0
|
||||||
# actual display number
|
|
||||||
self.current_display = 0
|
|
||||||
# save config display number
|
|
||||||
self.monitor_number = 0
|
|
||||||
self.screen_count_changed()
|
self.screen_count_changed()
|
||||||
|
self._load_screen_settings()
|
||||||
QtCore.QObject.connect(desktop,
|
QtCore.QObject.connect(desktop,
|
||||||
QtCore.SIGNAL(u'resized(int)'), self.screen_resolution_changed)
|
QtCore.SIGNAL(u'resized(int)'), self.screen_resolution_changed)
|
||||||
QtCore.QObject.connect(desktop,
|
QtCore.QObject.connect(desktop,
|
||||||
@ -150,6 +155,7 @@ class ScreenList(object):
|
|||||||
screen[u'number'], screen[u'size'])
|
screen[u'number'], screen[u'size'])
|
||||||
if screen[u'primary']:
|
if screen[u'primary']:
|
||||||
self.current = screen
|
self.current = screen
|
||||||
|
self.override = copy.deepcopy(self.current)
|
||||||
self.screen_list.append(screen)
|
self.screen_list.append(screen)
|
||||||
self.display_count += 1
|
self.display_count += 1
|
||||||
|
|
||||||
@ -189,13 +195,10 @@ class ScreenList(object):
|
|||||||
log.debug(u'set_current_display %s', number)
|
log.debug(u'set_current_display %s', number)
|
||||||
if number + 1 > self.display_count:
|
if number + 1 > self.display_count:
|
||||||
self.current = self.screen_list[0]
|
self.current = self.screen_list[0]
|
||||||
self.override = copy.deepcopy(self.current)
|
|
||||||
self.current_display = 0
|
|
||||||
else:
|
else:
|
||||||
self.current = self.screen_list[number]
|
self.current = self.screen_list[number]
|
||||||
self.override = copy.deepcopy(self.current)
|
|
||||||
self.preview = copy.deepcopy(self.current)
|
self.preview = copy.deepcopy(self.current)
|
||||||
self.current_display = number
|
self.override = copy.deepcopy(self.current)
|
||||||
if self.display_count == 1:
|
if self.display_count == 1:
|
||||||
self.preview = self.screen_list[0]
|
self.preview = self.screen_list[0]
|
||||||
|
|
||||||
@ -214,4 +217,31 @@ class ScreenList(object):
|
|||||||
use the correct screen attributes.
|
use the correct screen attributes.
|
||||||
"""
|
"""
|
||||||
log.debug(u'reset_current_display')
|
log.debug(u'reset_current_display')
|
||||||
self.set_current_display(self.current_display)
|
self.set_current_display(self.current[u'number'])
|
||||||
|
|
||||||
|
def _load_screen_settings(self):
|
||||||
|
"""
|
||||||
|
Loads the screen size and the monitor number from the settings.
|
||||||
|
"""
|
||||||
|
settings = QtCore.QSettings()
|
||||||
|
settings.beginGroup(u'general')
|
||||||
|
self.set_current_display(settings.value(u'monitor',
|
||||||
|
QtCore.QVariant(self.display_count - 1)).toInt()[0])
|
||||||
|
self.display = settings.value(
|
||||||
|
u'display on monitor', QtCore.QVariant(True)).toBool()
|
||||||
|
override_display = settings.value(
|
||||||
|
u'override position', QtCore.QVariant(False)).toBool()
|
||||||
|
x = settings.value(u'x position',
|
||||||
|
QtCore.QVariant(self.current[u'size'].x())).toInt()[0]
|
||||||
|
y = settings.value(u'y position',
|
||||||
|
QtCore.QVariant(self.current[u'size'].y())).toInt()[0]
|
||||||
|
width = settings.value(u'width',
|
||||||
|
QtCore.QVariant(self.current[u'size'].width())).toInt()[0]
|
||||||
|
height = settings.value(u'height',
|
||||||
|
QtCore.QVariant(self.current[u'size'].height())).toInt()[0]
|
||||||
|
self.override[u'size'] = QtCore.QRect(x, y, width, height)
|
||||||
|
settings.endGroup()
|
||||||
|
if override_display:
|
||||||
|
self.set_override_display()
|
||||||
|
else:
|
||||||
|
self.reset_current_display()
|
||||||
|
@ -40,14 +40,14 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
|||||||
"""
|
"""
|
||||||
Provide the form to manipulate the settings for OpenLP
|
Provide the form to manipulate the settings for OpenLP
|
||||||
"""
|
"""
|
||||||
def __init__(self, screens, mainWindow, parent=None):
|
def __init__(self, mainWindow, parent=None):
|
||||||
"""
|
"""
|
||||||
Initialise the settings form
|
Initialise the settings form
|
||||||
"""
|
"""
|
||||||
QtGui.QDialog.__init__(self, parent)
|
QtGui.QDialog.__init__(self, parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
# General tab
|
# General tab
|
||||||
self.generalTab = GeneralTab(self, screens)
|
self.generalTab = GeneralTab(self)
|
||||||
# Themes tab
|
# Themes tab
|
||||||
self.themesTab = ThemesTab(self, mainWindow)
|
self.themesTab = ThemesTab(self, mainWindow)
|
||||||
# Advanced tab
|
# Advanced tab
|
||||||
|
@ -33,7 +33,7 @@ from PyQt4.phonon import Phonon
|
|||||||
from openlp.core.lib import OpenLPToolbar, Receiver, resize_image, \
|
from openlp.core.lib import OpenLPToolbar, Receiver, resize_image, \
|
||||||
ItemCapabilities, translate
|
ItemCapabilities, translate
|
||||||
from openlp.core.lib.ui import UiStrings, shortcut_action
|
from openlp.core.lib.ui import UiStrings, shortcut_action
|
||||||
from openlp.core.ui import HideMode, MainDisplay
|
from openlp.core.ui import HideMode, MainDisplay, ScreenList
|
||||||
from openlp.core.utils.actions import ActionList, CategoryOrder
|
from openlp.core.utils.actions import ActionList, CategoryOrder
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -53,18 +53,17 @@ class SlideController(QtGui.QWidget):
|
|||||||
SlideController is the slide controller widget. This widget is what the
|
SlideController is the slide controller widget. This widget is what the
|
||||||
user uses to control the displaying of verses/slides/etc on the screen.
|
user uses to control the displaying of verses/slides/etc on the screen.
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent, settingsmanager, screens, isLive=False):
|
def __init__(self, parent, isLive=False):
|
||||||
"""
|
"""
|
||||||
Set up the Slide Controller.
|
Set up the Slide Controller.
|
||||||
"""
|
"""
|
||||||
QtGui.QWidget.__init__(self, parent)
|
QtGui.QWidget.__init__(self, parent)
|
||||||
self.settingsmanager = settingsmanager
|
|
||||||
self.isLive = isLive
|
self.isLive = isLive
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.screens = screens
|
self.screens = ScreenList.get_instance()
|
||||||
self.ratio = float(self.screens.current[u'size'].width()) / \
|
self.ratio = float(self.screens.current[u'size'].width()) / \
|
||||||
float(self.screens.current[u'size'].height())
|
float(self.screens.current[u'size'].height())
|
||||||
self.display = MainDisplay(self, screens, isLive)
|
self.image_manager = self.parent.image_manager
|
||||||
self.loopList = [
|
self.loopList = [
|
||||||
u'Start Loop',
|
u'Start Loop',
|
||||||
u'Loop Separator',
|
u'Loop Separator',
|
||||||
@ -296,9 +295,6 @@ class SlideController(QtGui.QWidget):
|
|||||||
sizePolicy.setHeightForWidth(
|
sizePolicy.setHeightForWidth(
|
||||||
self.slidePreview.sizePolicy().hasHeightForWidth())
|
self.slidePreview.sizePolicy().hasHeightForWidth())
|
||||||
self.slidePreview.setSizePolicy(sizePolicy)
|
self.slidePreview.setSizePolicy(sizePolicy)
|
||||||
self.slidePreview.setFixedSize(
|
|
||||||
QtCore.QSize(self.settingsmanager.slidecontroller_image,
|
|
||||||
self.settingsmanager.slidecontroller_image / self.ratio))
|
|
||||||
self.slidePreview.setFrameShape(QtGui.QFrame.Box)
|
self.slidePreview.setFrameShape(QtGui.QFrame.Box)
|
||||||
self.slidePreview.setFrameShadow(QtGui.QFrame.Plain)
|
self.slidePreview.setFrameShadow(QtGui.QFrame.Plain)
|
||||||
self.slidePreview.setLineWidth(1)
|
self.slidePreview.setLineWidth(1)
|
||||||
@ -328,7 +324,6 @@ class SlideController(QtGui.QWidget):
|
|||||||
if self.isLive:
|
if self.isLive:
|
||||||
self.setLiveHotkeys(self)
|
self.setLiveHotkeys(self)
|
||||||
self.__addActionsToWidget(self.previewListWidget)
|
self.__addActionsToWidget(self.previewListWidget)
|
||||||
self.__addActionsToWidget(self.display)
|
|
||||||
else:
|
else:
|
||||||
self.setPreviewHotkeys()
|
self.setPreviewHotkeys()
|
||||||
self.previewListWidget.addActions(
|
self.previewListWidget.addActions(
|
||||||
@ -371,8 +366,6 @@ class SlideController(QtGui.QWidget):
|
|||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.typePrefix),
|
QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.typePrefix),
|
||||||
self.onTextRequest)
|
self.onTextRequest)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
|
||||||
QtCore.SIGNAL(u'config_screen_changed'), self.screenSizeChanged)
|
|
||||||
|
|
||||||
def setPreviewHotkeys(self, parent=None):
|
def setPreviewHotkeys(self, parent=None):
|
||||||
self.previousItem.setObjectName(u'previousItemPreview')
|
self.previousItem.setObjectName(u'previousItemPreview')
|
||||||
@ -424,8 +417,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
screen previews.
|
screen previews.
|
||||||
"""
|
"""
|
||||||
# rebuild display as screen size changed
|
# rebuild display as screen size changed
|
||||||
self.display = MainDisplay(self, self.screens, self.isLive)
|
self.display = MainDisplay(self, self.image_manager, self.isLive)
|
||||||
self.display.imageManager = self.parent.renderer.image_manager
|
|
||||||
self.display.alertTab = self.alertTab
|
self.display.alertTab = self.alertTab
|
||||||
self.display.setup()
|
self.display.setup()
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
@ -639,10 +631,8 @@ class SlideController(QtGui.QWidget):
|
|||||||
# If current slide set background to image
|
# If current slide set background to image
|
||||||
if framenumber == slideno:
|
if framenumber == slideno:
|
||||||
self.serviceItem.bg_image_bytes = \
|
self.serviceItem.bg_image_bytes = \
|
||||||
self.parent.renderer.image_manager. \
|
self.image_manager.get_image_bytes(frame[u'title'])
|
||||||
get_image_bytes(frame[u'title'])
|
image = self.image_manager.get_image(frame[u'title'])
|
||||||
image = self.parent.renderer.image_manager. \
|
|
||||||
get_image(frame[u'title'])
|
|
||||||
label.setPixmap(QtGui.QPixmap.fromImage(image))
|
label.setPixmap(QtGui.QPixmap.fromImage(image))
|
||||||
self.previewListWidget.setCellWidget(framenumber, 0, label)
|
self.previewListWidget.setCellWidget(framenumber, 0, label)
|
||||||
slideHeight = width * self.parent.renderer.screen_ratio
|
slideHeight = width * self.parent.renderer.screen_ratio
|
||||||
|
@ -119,3 +119,4 @@ class AlertsPlugin(Plugin):
|
|||||||
self.textStrings[StringContent.VisibleName] = {
|
self.textStrings[StringContent.VisibleName] = {
|
||||||
u'title': translate('AlertsPlugin', 'Alerts', 'container title')
|
u'title': translate('AlertsPlugin', 'Alerts', 'container title')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,3 +192,4 @@ class AlertsTab(SettingsTab):
|
|||||||
self.FontPreview.setFont(font)
|
self.FontPreview.setFont(font)
|
||||||
self.FontPreview.setStyleSheet(u'background-color: %s; color: %s' %
|
self.FontPreview.setStyleSheet(u'background-color: %s; color: %s' %
|
||||||
(self.bg_color, self.font_color))
|
(self.bg_color, self.font_color))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user