forked from openlp/openlp
HEAD
This commit is contained in:
commit
3c303365b1
@ -39,18 +39,22 @@ from openlp.core.utils import check_latest_version, AppLocation, add_actions, \
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
MEDIA_MANAGER_STYLE = """
|
MEDIA_MANAGER_STYLE = """
|
||||||
|
QToolBox {
|
||||||
|
padding-bottom: 2px;
|
||||||
|
}
|
||||||
QToolBox::tab {
|
QToolBox::tab {
|
||||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||||
stop: 0 palette(button), stop: 1.0 palette(dark));
|
stop: 0 palette(button), stop: 0.5 palette(button),
|
||||||
border-width: 1px;
|
stop: 1.0 palette(mid));
|
||||||
border-style: outset;
|
border: 1px groove palette(mid);
|
||||||
border-color: palette(dark);
|
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
QToolBox::tab:selected {
|
QToolBox::tab:selected {
|
||||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||||
stop: 0 palette(light), stop: 1.0 palette(button));
|
stop: 0 palette(light), stop: 0.5 palette(midlight),
|
||||||
border-color: palette(button);
|
stop: 1.0 palette(dark));
|
||||||
|
border: 1px groove palette(dark);
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
class VersionThread(QtCore.QThread):
|
class VersionThread(QtCore.QThread):
|
||||||
|
@ -532,12 +532,12 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.onMediaStop()
|
self.onMediaStop()
|
||||||
if serviceItem.is_media():
|
if serviceItem.is_media():
|
||||||
self.onMediaStart(serviceItem)
|
self.onMediaStart(serviceItem)
|
||||||
# if self.isLive:
|
if self.isLive:
|
||||||
# blanked = self.blankButton.isChecked()
|
blanked = self.BlankScreen.isChecked()
|
||||||
# else:
|
else:
|
||||||
# blanked = False
|
blanked = False
|
||||||
Receiver.send_message(u'%s_start' % serviceItem.name.lower(),
|
Receiver.send_message(u'%s_start' % serviceItem.name.lower(),
|
||||||
[serviceItem, self.isLive, True, slideno])
|
[serviceItem, self.isLive, blanked, slideno])
|
||||||
self.slideList = {}
|
self.slideList = {}
|
||||||
width = self.parent.ControlSplitter.sizes()[self.split]
|
width = self.parent.ControlSplitter.sizes()[self.split]
|
||||||
#Set pointing cursor when we have somthing to point at
|
#Set pointing cursor when we have somthing to point at
|
||||||
|
@ -29,7 +29,7 @@ import os
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
||||||
SettingsManager, translate, check_item_selected
|
SettingsManager, translate, check_item_selected, Receiver
|
||||||
from openlp.plugins.presentations.lib import MessageListener
|
from openlp.plugins.presentations.lib import MessageListener
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -67,7 +67,9 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
self.ListViewWithDnD_class = PresentationListView
|
self.ListViewWithDnD_class = PresentationListView
|
||||||
MediaManagerItem.__init__(self, parent, icon, title)
|
MediaManagerItem.__init__(self, parent, icon, title)
|
||||||
self.message_listener = MessageListener(self)
|
self.message_listener = MessageListener(self)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'mediaitem_presentation_rebuild'), self.rebuild)
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
"""
|
"""
|
||||||
The name of the plugin media displayed in UI
|
The name of the plugin media displayed in UI
|
||||||
@ -76,9 +78,15 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
'Select Presentation(s)')
|
'Select Presentation(s)')
|
||||||
self.Automatic = translate('PresentationPlugin.MediaItem',
|
self.Automatic = translate('PresentationPlugin.MediaItem',
|
||||||
'Automatic')
|
'Automatic')
|
||||||
|
self.buildFileMaskString()
|
||||||
|
|
||||||
|
def buildFileMaskString(self):
|
||||||
|
"""
|
||||||
|
Build the list of file extensions to be used in the Open file dialog
|
||||||
|
"""
|
||||||
fileType = u''
|
fileType = u''
|
||||||
for controller in self.controllers:
|
for controller in self.controllers:
|
||||||
if self.controllers[controller].enabled:
|
if self.controllers[controller].enabled():
|
||||||
types = self.controllers[controller].supports + \
|
types = self.controllers[controller].supports + \
|
||||||
self.controllers[controller].alsosupports
|
self.controllers[controller].alsosupports
|
||||||
for type in types:
|
for type in types:
|
||||||
@ -131,13 +139,34 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
list = SettingsManager.load_list(
|
list = SettingsManager.load_list(
|
||||||
self.settingsSection, u'presentations')
|
self.settingsSection, u'presentations')
|
||||||
self.loadList(list, True)
|
self.loadList(list, True)
|
||||||
|
self.populateDisplayTypes()
|
||||||
|
|
||||||
|
def rebuild(self):
|
||||||
|
"""
|
||||||
|
Rebuild the tab in the media manager when changes are made in
|
||||||
|
the settings
|
||||||
|
"""
|
||||||
|
self.populateDisplayTypes()
|
||||||
|
self.buildFileMaskString()
|
||||||
|
|
||||||
|
def populateDisplayTypes(self):
|
||||||
|
"""
|
||||||
|
Load the combobox with the enabled presentation controllers,
|
||||||
|
allowing user to select a specific app if settings allow
|
||||||
|
"""
|
||||||
|
self.DisplayTypeComboBox.clear()
|
||||||
for item in self.controllers:
|
for item in self.controllers:
|
||||||
#load the drop down selection
|
#load the drop down selection
|
||||||
if self.controllers[item].enabled:
|
if self.controllers[item].enabled():
|
||||||
self.DisplayTypeComboBox.addItem(item)
|
self.DisplayTypeComboBox.addItem(item)
|
||||||
if self.DisplayTypeComboBox.count() > 1:
|
if self.DisplayTypeComboBox.count() > 1:
|
||||||
self.DisplayTypeComboBox.insertItem(0, self.Automatic)
|
self.DisplayTypeComboBox.insertItem(0, self.Automatic)
|
||||||
self.DisplayTypeComboBox.setCurrentIndex(0)
|
self.DisplayTypeComboBox.setCurrentIndex(0)
|
||||||
|
if QtCore.QSettings().value(self.settingsSection + u'/override app',
|
||||||
|
QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked:
|
||||||
|
self.PresentationWidget.show()
|
||||||
|
else:
|
||||||
|
self.PresentationWidget.hide()
|
||||||
|
|
||||||
def loadList(self, list, initialLoad=False):
|
def loadList(self, list, initialLoad=False):
|
||||||
"""
|
"""
|
||||||
@ -262,11 +291,11 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
if not filetype:
|
if not filetype:
|
||||||
return None
|
return None
|
||||||
for controller in self.controllers:
|
for controller in self.controllers:
|
||||||
if self.controllers[controller].enabled:
|
if self.controllers[controller].enabled():
|
||||||
if filetype in self.controllers[controller].supports:
|
if filetype in self.controllers[controller].supports:
|
||||||
return controller
|
return controller
|
||||||
for controller in self.controllers:
|
for controller in self.controllers:
|
||||||
if self.controllers[controller].enabled:
|
if self.controllers[controller].enabled():
|
||||||
if filetype in self.controllers[controller].alsosupports:
|
if filetype in self.controllers[controller].alsosupports:
|
||||||
return controller
|
return controller
|
||||||
return None
|
return None
|
||||||
|
@ -109,13 +109,6 @@ class PresentationController(object):
|
|||||||
self.name = name
|
self.name = name
|
||||||
self.settings_section = self.plugin.settingsSection
|
self.settings_section = self.plugin.settingsSection
|
||||||
self.available = self.check_available()
|
self.available = self.check_available()
|
||||||
if self.available:
|
|
||||||
self.enabled = QtCore.QSettings().value(
|
|
||||||
self.settings_section + u'/' + name,
|
|
||||||
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0] == \
|
|
||||||
QtCore.Qt.Checked
|
|
||||||
else:
|
|
||||||
self.enabled = False
|
|
||||||
self.temp_folder = os.path.join(
|
self.temp_folder = os.path.join(
|
||||||
AppLocation.get_section_data_path(self.settings_section), name)
|
AppLocation.get_section_data_path(self.settings_section), name)
|
||||||
self.thumbnail_folder = os.path.join(
|
self.thumbnail_folder = os.path.join(
|
||||||
@ -127,6 +120,18 @@ class PresentationController(object):
|
|||||||
if not os.path.isdir(self.temp_folder):
|
if not os.path.isdir(self.temp_folder):
|
||||||
os.makedirs(self.temp_folder)
|
os.makedirs(self.temp_folder)
|
||||||
|
|
||||||
|
def enabled(self):
|
||||||
|
"""
|
||||||
|
Return whether the controller is currently enabled
|
||||||
|
"""
|
||||||
|
if self.available:
|
||||||
|
return QtCore.QSettings().value(
|
||||||
|
self.settings_section + u'/' + self.name,
|
||||||
|
QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0] == \
|
||||||
|
QtCore.Qt.Checked
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def check_available(self):
|
def check_available(self):
|
||||||
"""
|
"""
|
||||||
Presentation app is able to run on this machine
|
Presentation app is able to run on this machine
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import SettingsTab, translate
|
from openlp.core.lib import Receiver, SettingsTab, translate
|
||||||
|
|
||||||
class PresentationTab(SettingsTab):
|
class PresentationTab(SettingsTab):
|
||||||
"""
|
"""
|
||||||
@ -77,7 +77,17 @@ class PresentationTab(SettingsTab):
|
|||||||
self.PresentationThemeLayout.setSpacing(8)
|
self.PresentationThemeLayout.setSpacing(8)
|
||||||
self.PresentationThemeLayout.setMargin(0)
|
self.PresentationThemeLayout.setMargin(0)
|
||||||
self.PresentationThemeLayout.setObjectName(u'PresentationThemeLayout')
|
self.PresentationThemeLayout.setObjectName(u'PresentationThemeLayout')
|
||||||
|
self.AdvancedGroupBox = QtGui.QGroupBox(self)
|
||||||
|
self.AdvancedGroupBox.setObjectName(u'AdvancedGroupBox')
|
||||||
|
self.AdvancedLayout = QtGui.QVBoxLayout(self.AdvancedGroupBox)
|
||||||
|
self.AdvancedLayout.setSpacing(8)
|
||||||
|
self.AdvancedLayout.setMargin(8)
|
||||||
|
self.AdvancedLayout.setObjectName(u'AdvancedLayout')
|
||||||
|
self.OverrideAppCheckBox = QtGui.QCheckBox(self.AdvancedGroupBox)
|
||||||
|
self.OverrideAppCheckBox.setObjectName(u'OverrideAppCheckBox')
|
||||||
|
self.AdvancedLayout.addWidget(self.OverrideAppCheckBox)
|
||||||
self.PresentationLeftLayout.addWidget(self.VerseDisplayGroupBox)
|
self.PresentationLeftLayout.addWidget(self.VerseDisplayGroupBox)
|
||||||
|
self.PresentationLeftLayout.addWidget(self.AdvancedGroupBox)
|
||||||
self.PresentationLeftSpacer = QtGui.QSpacerItem(40, 20,
|
self.PresentationLeftSpacer = QtGui.QSpacerItem(40, 20,
|
||||||
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||||
self.PresentationLeftLayout.addItem(self.PresentationLeftSpacer)
|
self.PresentationLeftLayout.addItem(self.PresentationLeftSpacer)
|
||||||
@ -105,6 +115,12 @@ class PresentationTab(SettingsTab):
|
|||||||
controller = self.controllers[key]
|
controller = self.controllers[key]
|
||||||
checkbox = self.PresenterCheckboxes[controller.name]
|
checkbox = self.PresenterCheckboxes[controller.name]
|
||||||
checkbox.setText(controller.name)
|
checkbox.setText(controller.name)
|
||||||
|
self.AdvancedGroupBox.setTitle(
|
||||||
|
translate('PresentationPlugin.PresentationTab',
|
||||||
|
'Advanced'))
|
||||||
|
self.OverrideAppCheckBox.setText(
|
||||||
|
translate('PresentationPlugin.PresentationTab',
|
||||||
|
'Allow presentation application to be overriden'))
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
"""
|
"""
|
||||||
@ -116,15 +132,33 @@ class PresentationTab(SettingsTab):
|
|||||||
checkbox = self.PresenterCheckboxes[controller.name]
|
checkbox = self.PresenterCheckboxes[controller.name]
|
||||||
checkbox.setChecked(QtCore.QSettings().value(
|
checkbox.setChecked(QtCore.QSettings().value(
|
||||||
self.settingsSection + u'/' + controller.name,
|
self.settingsSection + u'/' + controller.name,
|
||||||
QtCore.QVariant(0)).toInt()[0])
|
QtCore.QVariant(QtCore.Qt.Checked)).toInt()[0])
|
||||||
|
self.OverrideAppCheckBox.setChecked(QtCore.QSettings().value(
|
||||||
|
self.settingsSection + u'/override app',
|
||||||
|
QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0])
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
"""
|
"""
|
||||||
Save the settings.
|
Save the settings.
|
||||||
"""
|
"""
|
||||||
|
changed = False
|
||||||
for key in self.controllers:
|
for key in self.controllers:
|
||||||
controller = self.controllers[key]
|
controller = self.controllers[key]
|
||||||
checkbox = self.PresenterCheckboxes[controller.name]
|
checkbox = self.PresenterCheckboxes[controller.name]
|
||||||
QtCore.QSettings().setValue(
|
setting_key = self.settingsSection + u'/' + controller.name
|
||||||
self.settingsSection + u'/' + controller.name,
|
if QtCore.QSettings().value(setting_key) != checkbox.checkState():
|
||||||
QtCore.QVariant(checkbox.checkState()))
|
changed = True
|
||||||
|
QtCore.QSettings().setValue(setting_key,
|
||||||
|
QtCore.QVariant(checkbox.checkState()))
|
||||||
|
if checkbox.checkState() == QtCore.Qt.Checked:
|
||||||
|
controller.start_process()
|
||||||
|
else:
|
||||||
|
controller.kill()
|
||||||
|
setting_key = self.settingsSection + u'/override app'
|
||||||
|
if QtCore.QSettings().value(setting_key) != \
|
||||||
|
self.OverrideAppCheckBox.checkState():
|
||||||
|
QtCore.QSettings().setValue(setting_key,
|
||||||
|
QtCore.QVariant(self.OverrideAppCheckBox.checkState()))
|
||||||
|
changed = True
|
||||||
|
if changed:
|
||||||
|
Receiver.send_message(u'mediaitem_presentation_rebuild')
|
||||||
|
@ -22,7 +22,10 @@
|
|||||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
"""
|
||||||
|
The :mod:`presentationplugin` module provides the ability for OpenLP to display
|
||||||
|
presentations from a variety of document formats.
|
||||||
|
"""
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -67,7 +70,7 @@ class PresentationPlugin(Plugin):
|
|||||||
Plugin.initialise(self)
|
Plugin.initialise(self)
|
||||||
self.insertToolboxItem()
|
self.insertToolboxItem()
|
||||||
for controller in self.controllers:
|
for controller in self.controllers:
|
||||||
if self.controllers[controller].enabled:
|
if self.controllers[controller].enabled():
|
||||||
self.controllers[controller].start_process()
|
self.controllers[controller].start_process()
|
||||||
|
|
||||||
def finalise(self):
|
def finalise(self):
|
||||||
@ -79,7 +82,7 @@ class PresentationPlugin(Plugin):
|
|||||||
#Ask each controller to tidy up
|
#Ask each controller to tidy up
|
||||||
for key in self.controllers:
|
for key in self.controllers:
|
||||||
controller = self.controllers[key]
|
controller = self.controllers[key]
|
||||||
if controller.enabled:
|
if controller.enabled():
|
||||||
controller.kill()
|
controller.kill()
|
||||||
Plugin.finalise(self)
|
Plugin.finalise(self)
|
||||||
|
|
||||||
|
@ -70,11 +70,18 @@ class OldTopic(BaseModel):
|
|||||||
|
|
||||||
class OpenLPSongImport(object):
|
class OpenLPSongImport(object):
|
||||||
"""
|
"""
|
||||||
|
The :class:`OpenLPSongImport` class provides OpenLP with the ability to
|
||||||
|
import song databases from other installations of OpenLP.
|
||||||
"""
|
"""
|
||||||
def __init__(self, master_manager, source_db):
|
def __init__(self, master_manager, source_db):
|
||||||
"""
|
"""
|
||||||
|
Initialise the import.
|
||||||
|
|
||||||
|
``master_manager``
|
||||||
|
The song manager for the running OpenLP installation.
|
||||||
|
|
||||||
|
``source_db``
|
||||||
|
The database providing the data to import.
|
||||||
"""
|
"""
|
||||||
self.master_manager = master_manager
|
self.master_manager = master_manager
|
||||||
self.import_source = source_db
|
self.import_source = source_db
|
||||||
@ -82,7 +89,7 @@ class OpenLPSongImport(object):
|
|||||||
|
|
||||||
def import_source_v2_db(self):
|
def import_source_v2_db(self):
|
||||||
"""
|
"""
|
||||||
|
Run the import for an OpenLP version 2 song database.
|
||||||
"""
|
"""
|
||||||
engine = create_engine(self.import_source)
|
engine = create_engine(self.import_source)
|
||||||
source_meta = MetaData()
|
source_meta = MetaData()
|
||||||
|
Loading…
Reference in New Issue
Block a user