forked from openlp/openlp
sync
This commit is contained in:
commit
ae5998e2dc
@ -182,6 +182,7 @@ class Manager(object):
|
||||
settings.beginGroup(plugin_name)
|
||||
self.db_url = u''
|
||||
self.is_dirty = False
|
||||
self.session = None
|
||||
db_type = unicode(
|
||||
settings.value(u'db type', QtCore.QVariant(u'sqlite')).toString())
|
||||
if db_type == u'sqlite':
|
||||
|
@ -158,6 +158,8 @@ class PluginManager(object):
|
||||
for plugin in self.plugins:
|
||||
if plugin.status is not PluginStatus.Disabled:
|
||||
plugin.settings_tab = plugin.getSettingsTab(settings_form)
|
||||
else:
|
||||
plugin.settings_tab = None
|
||||
settings_form.plugins = self.plugins
|
||||
|
||||
def hook_import_menu(self, import_menu):
|
||||
|
@ -29,7 +29,6 @@ The :mod:`maindisplay` module provides the functionality to display screens
|
||||
and play multimedia within OpenLP.
|
||||
"""
|
||||
import logging
|
||||
import os
|
||||
|
||||
from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
|
||||
from PyQt4.phonon import Phonon
|
||||
|
@ -35,8 +35,7 @@ from datetime import datetime
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, \
|
||||
PluginManager, Receiver, translate, ImageManager, PluginStatus, \
|
||||
SettingsManager
|
||||
PluginManager, Receiver, translate, ImageManager, PluginStatus
|
||||
from openlp.core.lib.ui import UiStrings, base_action, checkable_action, \
|
||||
icon_action, shortcut_action
|
||||
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
|
||||
@ -44,7 +43,7 @@ from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
|
||||
ShortcutListForm, FormattingTagForm
|
||||
from openlp.core.ui.media import MediaController
|
||||
from openlp.core.utils import AppLocation, add_actions, LanguageManager, \
|
||||
get_application_version, delete_file
|
||||
get_application_version
|
||||
from openlp.core.utils.actions import ActionList, CategoryOrder
|
||||
from openlp.core.ui.firsttimeform import FirstTimeForm
|
||||
from openlp.core.ui import ScreenList
|
||||
@ -504,7 +503,8 @@ class Ui_MainWindow(object):
|
||||
self.toolsFirstTimeWizard.setText(
|
||||
translate('OpenLP.MainWindow', 'Re-run First Time Wizard'))
|
||||
self.toolsFirstTimeWizard.setStatusTip(translate('OpenLP.MainWindow',
|
||||
'Re-run the First Time Wizard, importing songs, Bibles and themes.'))
|
||||
'Re-run the First Time Wizard, importing songs, Bibles and '
|
||||
'themes.'))
|
||||
self.updateThemeImages.setText(
|
||||
translate('OpenLP.MainWindow', 'Update Theme Images'))
|
||||
self.updateThemeImages.setStatusTip(
|
||||
@ -720,7 +720,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
args = []
|
||||
for a in self.arguments:
|
||||
args.extend([a])
|
||||
self.serviceManagerContents.loadFile(unicode(args[0]))
|
||||
self.serviceManagerContents.loadFile(unicode(args[0],
|
||||
sys.getfilesystemencoding()))
|
||||
elif QtCore.QSettings().value(
|
||||
self.generalSettingsSection + u'/auto open',
|
||||
QtCore.QVariant(False)).toBool():
|
||||
@ -1312,7 +1313,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
settings.value(u'preview splitter geometry').toByteArray())
|
||||
self.controlSplitter.restoreState(
|
||||
settings.value(u'mainwindow splitter geometry').toByteArray())
|
||||
|
||||
settings.endGroup()
|
||||
|
||||
def saveSettings(self):
|
||||
@ -1388,6 +1388,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
maxRecentFiles = QtCore.QSettings().value(u'advanced/max recent files',
|
||||
QtCore.QVariant(20)).toInt()[0]
|
||||
if filename:
|
||||
# Add some cleanup to reduce duplication in the recent file list
|
||||
filename = os.path.abspath(filename)
|
||||
# abspath() only capitalises the drive letter if it wasn't provided
|
||||
# in the given filename which then causes duplication.
|
||||
if filename[1:3] == ':\\':
|
||||
filename = filename[0].upper() + filename[1:]
|
||||
position = self.recentFiles.indexOf(filename)
|
||||
if position != -1:
|
||||
self.recentFiles.removeAt(position)
|
||||
|
@ -26,13 +26,12 @@
|
||||
###############################################################################
|
||||
|
||||
import logging
|
||||
|
||||
import sys, os,time
|
||||
from PyQt4 import QtCore, QtGui, QtWebKit
|
||||
import os
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import OpenLPToolbar, Receiver, translate
|
||||
from openlp.core.lib.mediaplayer import MediaPlayer
|
||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from openlp.core.ui.media import MediaState, MediaInfo, MediaType
|
||||
from openlp.core.utils import AppLocation
|
||||
|
||||
@ -137,7 +136,8 @@ class MediaController(object):
|
||||
invalidMediaPlayers = [mediaPlayer for mediaPlayer in savedPlayers \
|
||||
if not mediaPlayer in self.mediaPlayers]
|
||||
if len(invalidMediaPlayers) > 0:
|
||||
[savedPlayers.remove(invalidPlayer) for invalidPlayer in invalidMediaPlayers]
|
||||
for invalidPlayer in invalidMediaPlayers:
|
||||
savedPlayers.remove(invalidPlayer)
|
||||
newPlayerSetting = u','.join(savedPlayers)
|
||||
QtCore.QSettings().setValue(u'media/players',
|
||||
QtCore.QVariant(newPlayerSetting))
|
||||
@ -206,15 +206,15 @@ class MediaController(object):
|
||||
controller.mediabar = OpenLPToolbar(controller)
|
||||
controller.mediabar.addToolbarButton(
|
||||
u'media_playback_play', u':/slides/media_playback_start.png',
|
||||
translate('OpenLP.SlideController', 'Start playing media'),
|
||||
translate('OpenLP.SlideController', 'Start playing media.'),
|
||||
controller.sendToPlugins)
|
||||
controller.mediabar.addToolbarButton(
|
||||
u'media_playback_pause', u':/slides/media_playback_pause.png',
|
||||
translate('OpenLP.SlideController', 'Pause playing media'),
|
||||
translate('OpenLP.SlideController', 'Pause playing media.'),
|
||||
controller.sendToPlugins)
|
||||
controller.mediabar.addToolbarButton(
|
||||
u'media_playback_stop', u':/slides/media_playback_stop.png',
|
||||
translate('OpenLP.SlideController', 'Stop playing media'),
|
||||
translate('OpenLP.SlideController', 'Stop playing media.'),
|
||||
controller.sendToPlugins)
|
||||
# Build the seekSlider.
|
||||
controller.seekSlider = QtGui.QSlider(QtCore.Qt.Horizontal)
|
||||
@ -346,7 +346,7 @@ class MediaController(object):
|
||||
|
||||
def check_file_type(self, controller, display):
|
||||
"""
|
||||
Used to choose the right media Player type from the prioritized Player list
|
||||
Select the correct media Player type from the prioritized Player list
|
||||
"""
|
||||
playerSettings = str(QtCore.QSettings().value(u'media/players',
|
||||
QtCore.QVariant(u'webkit')).toString())
|
||||
@ -356,12 +356,14 @@ class MediaController(object):
|
||||
if self.overridenPlayer != '':
|
||||
usedPlayers = [self.overridenPlayer]
|
||||
if controller.media_info.file_info.isFile():
|
||||
suffix = u'*.%s' % controller.media_info.file_info.suffix().toLower()
|
||||
suffix = u'*.%s' % \
|
||||
controller.media_info.file_info.suffix().toLower()
|
||||
for title in usedPlayers:
|
||||
player = self.mediaPlayers[title]
|
||||
if suffix in player.video_extensions_list:
|
||||
if not controller.media_info.is_background or \
|
||||
controller.media_info.is_background and player.canBackground:
|
||||
controller.media_info.is_background and \
|
||||
player.canBackground:
|
||||
self.resize(controller, display, player)
|
||||
if player.load(display):
|
||||
self.curDisplayMediaPlayer[display] = player
|
||||
@ -399,7 +401,8 @@ class MediaController(object):
|
||||
return False
|
||||
if status:
|
||||
display.frame.evaluateJavaScript(u'show_blank("desktop");')
|
||||
self.curDisplayMediaPlayer[display].set_visible(display, True)
|
||||
self.curDisplayMediaPlayer[display].set_visible(display,
|
||||
True)
|
||||
if controller.isLive:
|
||||
if controller.hideMenu.defaultAction().isChecked():
|
||||
controller.hideMenu.defaultAction().trigger()
|
||||
|
@ -29,7 +29,6 @@ import logging
|
||||
import mimetypes
|
||||
from datetime import datetime
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
from openlp.core.lib import Receiver
|
||||
|
@ -27,9 +27,6 @@
|
||||
|
||||
import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui, QtWebKit
|
||||
|
||||
from openlp.core.lib import OpenLPToolbar, translate
|
||||
from openlp.core.lib.mediaplayer import MediaPlayer
|
||||
from openlp.core.ui.media import MediaState
|
||||
|
||||
|
@ -117,6 +117,7 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
||||
self.pluginListWidget.currentItem().text().split(u'(')[0][:-1]
|
||||
self.activePlugin = None
|
||||
for plugin in self.parent().pluginManager.plugins:
|
||||
if plugin.status != PluginStatus.Disabled:
|
||||
if plugin.nameStrings[u'singular'] == plugin_name_singular:
|
||||
self.activePlugin = plugin
|
||||
break
|
||||
@ -126,7 +127,7 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
||||
self._clearDetails()
|
||||
|
||||
def onStatusComboBoxChanged(self, status):
|
||||
if self.programaticChange:
|
||||
if self.programaticChange or status == PluginStatus.Disabled:
|
||||
return
|
||||
if status == 0:
|
||||
Receiver.send_message(u'cursor_busy')
|
||||
|
@ -402,6 +402,9 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
||||
settings.endGroup()
|
||||
|
||||
def update_song_usage(self):
|
||||
# Only continue when we include the song's text.
|
||||
if not self.slideTextCheckBox.isChecked():
|
||||
return
|
||||
for index, item in enumerate(self.serviceManager.serviceItems):
|
||||
# Trigger Audit requests
|
||||
Receiver.send_message(u'print_service_started',
|
||||
|
@ -27,12 +27,10 @@
|
||||
|
||||
import os
|
||||
import logging
|
||||
import time
|
||||
import copy
|
||||
from collections import deque
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, \
|
||||
translate, build_icon, ServiceItem, build_html, PluginManager, ServiceItem
|
||||
@ -68,7 +66,8 @@ class Controller(QtGui.QWidget):
|
||||
created from within other plugins
|
||||
This function is needed to catch the current controller
|
||||
"""
|
||||
sender = self.sender().objectName() if self.sender().objectName() else self.sender().text()
|
||||
sender = self.sender().objectName() if self.sender().objectName() \
|
||||
else self.sender().text()
|
||||
controller = self
|
||||
Receiver.send_message('%s' % sender, [controller, args])
|
||||
|
||||
@ -574,7 +573,6 @@ class SlideController(Controller):
|
||||
self.keypress_queue.append(u'previous')
|
||||
self._process_queue()
|
||||
|
||||
|
||||
def serviceNext(self):
|
||||
"""
|
||||
Live event to select the next service item from the service manager.
|
||||
@ -596,7 +594,6 @@ class SlideController(Controller):
|
||||
Receiver.send_message('servicemanager_next_item')
|
||||
self.keypress_loop = False
|
||||
|
||||
|
||||
def screenSizeChanged(self):
|
||||
"""
|
||||
Settings dialog has changed the screen size of adjust output and
|
||||
@ -640,11 +637,12 @@ class SlideController(Controller):
|
||||
self.previewFrame.height()):
|
||||
# We have to take the height as limit.
|
||||
max_height = self.previewFrame.height() - self.grid.margin() * 2
|
||||
self.slidePreview.setFixedSize(QtCore.QSize(max_height * self.ratio,
|
||||
max_height))
|
||||
self.previewDisplay.setFixedSize(QtCore.QSize(max_height * self.ratio,
|
||||
max_height))
|
||||
self.previewDisplay.screen = {u'size':self.previewDisplay.geometry()}
|
||||
self.slidePreview.setFixedSize(QtCore.QSize(
|
||||
max_height * self.ratio, max_height))
|
||||
self.previewDisplay.setFixedSize(QtCore.QSize(
|
||||
max_height * self.ratio, max_height))
|
||||
self.previewDisplay.screen = {
|
||||
u'size': self.previewDisplay.geometry()}
|
||||
else:
|
||||
# We have to take the width as limit.
|
||||
max_width = self.previewFrame.width() - self.grid.margin() * 2
|
||||
@ -652,7 +650,8 @@ class SlideController(Controller):
|
||||
max_width / self.ratio))
|
||||
self.previewDisplay.setFixedSize(QtCore.QSize(max_width,
|
||||
max_width / self.ratio))
|
||||
self.previewDisplay.screen = {u'size':self.previewDisplay.geometry()}
|
||||
self.previewDisplay.screen = {
|
||||
u'size': self.previewDisplay.geometry()}
|
||||
# Make sure that the frames have the correct size.
|
||||
self.previewListWidget.setColumnWidth(0,
|
||||
self.previewListWidget.viewport().size().width())
|
||||
|
@ -28,7 +28,6 @@
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib.ui import create_accept_reject_button_box
|
||||
|
||||
|
||||
class Ui_ThemeLayoutDialog(object):
|
||||
|
@ -29,9 +29,6 @@ from PyQt4 import QtGui, QtCore
|
||||
|
||||
from themelayoutdialog import Ui_ThemeLayoutDialog
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||
|
||||
class ThemeLayoutForm(QtGui.QDialog, Ui_ThemeLayoutDialog):
|
||||
"""
|
||||
The exception dialog
|
||||
|
@ -188,6 +188,7 @@ class ActionList(object):
|
||||
actions or categories.
|
||||
"""
|
||||
instance = None
|
||||
shortcut_map = {}
|
||||
|
||||
def __init__(self):
|
||||
self.categories = CategoryList()
|
||||
@ -226,17 +227,41 @@ class ActionList(object):
|
||||
self.categories[category].actions.append(action)
|
||||
else:
|
||||
self.categories[category].actions.add(action, weight)
|
||||
if category is None:
|
||||
# Stop here, as this action is not configurable.
|
||||
return
|
||||
# Load the shortcut from the config.
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup(u'shortcuts')
|
||||
shortcuts = settings.value(action.objectName(),
|
||||
QtCore.QVariant(action.shortcuts())).toStringList()
|
||||
settings.endGroup()
|
||||
if not shortcuts:
|
||||
action.setShortcuts([])
|
||||
return
|
||||
shortcuts = map(unicode, shortcuts)
|
||||
# Check the alternate shortcut first, to avoid problems when the
|
||||
# alternate shortcut becomes the primary shortcut after removing the
|
||||
# (initial) primary shortcut due to confllicts.
|
||||
if len(shortcuts) == 2:
|
||||
existing_actions = ActionList.shortcut_map.get(shortcuts[1], [])
|
||||
# Check for conflicts with other actions considering the shortcut
|
||||
# context.
|
||||
if self._shortcut_available(existing_actions, action):
|
||||
actions = ActionList.shortcut_map.get(shortcuts[1], [])
|
||||
actions.append(action)
|
||||
ActionList.shortcut_map[shortcuts[1]] = actions
|
||||
else:
|
||||
shortcuts.remove(shortcuts[1])
|
||||
# Check the primary shortcut.
|
||||
existing_actions = ActionList.shortcut_map.get(shortcuts[0], [])
|
||||
# Check for conflicts with other actions considering the shortcut
|
||||
# context.
|
||||
if self._shortcut_available(existing_actions, action):
|
||||
actions = ActionList.shortcut_map.get(shortcuts[0], [])
|
||||
actions.append(action)
|
||||
ActionList.shortcut_map[shortcuts[0]] = actions
|
||||
else:
|
||||
shortcuts.remove(shortcuts[0])
|
||||
action.setShortcuts(
|
||||
[QtGui.QKeySequence(shortcut) for shortcut in shortcuts])
|
||||
settings.endGroup()
|
||||
|
||||
def remove_action(self, action, category=None):
|
||||
"""
|
||||
@ -244,7 +269,7 @@ class ActionList(object):
|
||||
automatically removed.
|
||||
|
||||
``action``
|
||||
The QAction object to be removed.
|
||||
The ``QAction`` object to be removed.
|
||||
|
||||
``category``
|
||||
The name (unicode string) of the category, which contains the
|
||||
@ -279,6 +304,30 @@ class ActionList(object):
|
||||
return
|
||||
self.categories.add(name, weight)
|
||||
|
||||
def _shortcut_available(self, existing_actions, action):
|
||||
"""
|
||||
Checks if the given ``action`` may use its assigned shortcut(s) or not.
|
||||
Returns ``True`` or ``False.
|
||||
|
||||
``existing_actions``
|
||||
A list of actions which already use a particular shortcut.
|
||||
|
||||
``action``
|
||||
The action which wants to use a particular shortcut.
|
||||
"""
|
||||
for existing_action in existing_actions:
|
||||
if action is existing_action:
|
||||
continue
|
||||
if existing_action.parent() is action.parent():
|
||||
return False
|
||||
if existing_action.shortcutContext() in [QtCore.Qt.WindowShortcut,
|
||||
QtCore.Qt.ApplicationShortcut]:
|
||||
return False
|
||||
if action.shortcutContext() in [QtCore.Qt.WindowShortcut,
|
||||
QtCore.Qt.ApplicationShortcut]:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class CategoryOrder(object):
|
||||
"""
|
||||
|
@ -72,7 +72,8 @@ class VerseReferenceList(object):
|
||||
continue
|
||||
prev = index - 1
|
||||
if self.verse_list[prev][u'version'] != verse[u'version']:
|
||||
result = u'%s (%s)' % (result, self.verse_list[prev][u'version'])
|
||||
result = u'%s (%s)' % (result,
|
||||
self.verse_list[prev][u'version'])
|
||||
result = result + u', '
|
||||
if self.verse_list[prev][u'book'] != verse[u'book']:
|
||||
result = u'%s%s %s:' % (result, verse[u'book'],
|
||||
|
@ -30,7 +30,8 @@ import logging
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import Receiver, translate
|
||||
from openlp.core.lib.ui import critical_error_message_box, find_and_set_in_combo_box
|
||||
from openlp.core.lib.ui import critical_error_message_box, \
|
||||
find_and_set_in_combo_box
|
||||
from openlp.plugins.custom.lib import CustomXMLBuilder, CustomXMLParser
|
||||
from openlp.plugins.custom.lib.db import CustomSlide
|
||||
from editcustomdialog import Ui_CustomEditDialog
|
||||
|
@ -30,7 +30,6 @@ import os
|
||||
import locale
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
|
||||
SettingsManager, translate, check_item_selected, Receiver, MediaType, \
|
||||
@ -139,7 +138,8 @@ class MediaMediaItem(MediaManagerItem):
|
||||
# Add the Media widget to the page layout
|
||||
self.pageLayout.addWidget(self.mediaWidget)
|
||||
QtCore.QObject.connect(self.displayTypeComboBox,
|
||||
QtCore.SIGNAL(u'currentIndexChanged (int)'), self.overridePlayerChanged)
|
||||
QtCore.SIGNAL(u'currentIndexChanged (int)'),
|
||||
self.overridePlayerChanged)
|
||||
|
||||
def overridePlayerChanged(self, index):
|
||||
Receiver.send_message(u'media_override_player', \
|
||||
|
@ -28,7 +28,7 @@
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate, Receiver
|
||||
from openlp.core.lib.ui import UiStrings, critical_error_message_box
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
|
||||
class MediaTab(SettingsTab):
|
||||
"""
|
||||
|
@ -26,7 +26,6 @@
|
||||
###############################################################################
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate
|
||||
from openlp.plugins.media.lib import MediaMediaItem, MediaTab
|
||||
|
@ -285,7 +285,8 @@ class PresentationMediaItem(MediaManagerItem):
|
||||
critical_error_message_box(
|
||||
translate('PresentationPlugin.MediaItem',
|
||||
'Missing Presentation'),
|
||||
unicode(translate('PresentationPlugin.MediaItem',
|
||||
unicode(translate(
|
||||
'PresentationPlugin.MediaItem',
|
||||
'The Presentation %s is incomplete,'
|
||||
' please reload.')) % filename)
|
||||
return False
|
||||
|
@ -330,8 +330,10 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
self.topicsListView.addItem(topic_name)
|
||||
self.audioListWidget.clear()
|
||||
for media in self.song.media_files:
|
||||
media_file = QtGui.QListWidgetItem(os.path.split(media.file_name)[1])
|
||||
media_file.setData(QtCore.Qt.UserRole, QtCore.QVariant(media.file_name))
|
||||
media_file = QtGui.QListWidgetItem(
|
||||
os.path.split(media.file_name)[1])
|
||||
media_file.setData(QtCore.Qt.UserRole,
|
||||
QtCore.QVariant(media.file_name))
|
||||
self.audioListWidget.addItem(media_file)
|
||||
self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
|
||||
# Hide or show the preview button.
|
||||
@ -720,7 +722,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
"""
|
||||
if self.mediaForm.exec_():
|
||||
for filename in self.mediaForm.getSelectedFiles():
|
||||
item = QtGui.QListWidgetItem(os.path.split(unicode(filename))[1])
|
||||
item = QtGui.QListWidgetItem(
|
||||
os.path.split(unicode(filename))[1])
|
||||
item.setData(QtCore.Qt.UserRole, filename)
|
||||
self.audioListWidget.addItem(item)
|
||||
|
||||
@ -875,7 +878,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
os.remove(audio)
|
||||
except:
|
||||
log.exception('Could not remove file: %s', audio)
|
||||
pass
|
||||
if not files:
|
||||
try:
|
||||
os.rmdir(save_path)
|
||||
|
@ -30,7 +30,7 @@ song databases into the current installation database.
|
||||
"""
|
||||
import logging
|
||||
|
||||
from sqlalchemy import create_engine, MetaData
|
||||
from sqlalchemy import create_engine, MetaData, Table
|
||||
from sqlalchemy.orm import class_mapper, mapper, relation, scoped_session, \
|
||||
sessionmaker
|
||||
from sqlalchemy.orm.exc import UnmappedClassError
|
||||
@ -39,11 +39,33 @@ from openlp.core.lib import translate
|
||||
from openlp.core.lib.db import BaseModel
|
||||
from openlp.core.ui.wizard import WizardStrings
|
||||
from openlp.plugins.songs.lib import clean_song
|
||||
from openlp.plugins.songs.lib.db import Author, Book, Song, Topic #, MediaFile
|
||||
from openlp.plugins.songs.lib.db import Author, Book, Song, Topic, MediaFile
|
||||
from songimport import SongImport
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class OpenLPSongImport(SongImport):
|
||||
"""
|
||||
The :class:`OpenLPSongImport` class provides OpenLP with the ability to
|
||||
import song databases from other installations of OpenLP.
|
||||
"""
|
||||
def __init__(self, manager, **kwargs):
|
||||
"""
|
||||
Initialise the import.
|
||||
|
||||
``manager``
|
||||
The song manager for the running OpenLP installation.
|
||||
|
||||
``source_db``
|
||||
The database providing the data to import.
|
||||
"""
|
||||
SongImport.__init__(self, manager, **kwargs)
|
||||
self.sourceSession = None
|
||||
|
||||
def doImport(self):
|
||||
"""
|
||||
Run the import for an OpenLP version 2 song database.
|
||||
"""
|
||||
class OldAuthor(BaseModel):
|
||||
"""
|
||||
Author model
|
||||
@ -79,28 +101,6 @@ class OldTopic(BaseModel):
|
||||
pass
|
||||
|
||||
|
||||
class OpenLPSongImport(SongImport):
|
||||
"""
|
||||
The :class:`OpenLPSongImport` class provides OpenLP with the ability to
|
||||
import song databases from other installations of OpenLP.
|
||||
"""
|
||||
def __init__(self, manager, **kwargs):
|
||||
"""
|
||||
Initialise the import.
|
||||
|
||||
``manager``
|
||||
The song manager for the running OpenLP installation.
|
||||
|
||||
``source_db``
|
||||
The database providing the data to import.
|
||||
"""
|
||||
SongImport.__init__(self, manager, **kwargs)
|
||||
self.sourceSession = None
|
||||
|
||||
def doImport(self):
|
||||
"""
|
||||
Run the import for an OpenLP version 2 song database.
|
||||
"""
|
||||
if not self.importSource.endswith(u'.sqlite'):
|
||||
self.logError(self.importSource,
|
||||
translate('SongsPlugin.OpenLPSongImport',
|
||||
@ -121,6 +121,7 @@ class OpenLPSongImport(SongImport):
|
||||
source_topics_table = source_meta.tables[u'topics']
|
||||
source_authors_songs_table = source_meta.tables[u'authors_songs']
|
||||
source_songs_topics_table = source_meta.tables[u'songs_topics']
|
||||
source_media_files_songs_table = None
|
||||
if has_media_files:
|
||||
source_media_files_table = source_meta.tables[u'media_files']
|
||||
source_media_files_songs_table = \
|
||||
@ -137,13 +138,16 @@ class OpenLPSongImport(SongImport):
|
||||
secondary=source_songs_topics_table)
|
||||
}
|
||||
if has_media_files:
|
||||
if source_media_files_songs_table:
|
||||
if isinstance(source_media_files_songs_table, Table):
|
||||
song_props['media_files'] = relation(OldMediaFile,
|
||||
backref='songs',
|
||||
secondary=source_media_files_songs_table)
|
||||
else:
|
||||
song_props['media_files'] = relation(OldMediaFile,
|
||||
backref='songs')
|
||||
backref='songs',
|
||||
foreign_keys=[source_media_files_table.c.song_id],
|
||||
primaryjoin=source_songs_table.c.id == \
|
||||
source_media_files_table.c.song_id)
|
||||
try:
|
||||
class_mapper(OldAuthor)
|
||||
except UnmappedClassError:
|
||||
|
@ -31,7 +31,6 @@ backend for the Songs plugin
|
||||
|
||||
from sqlalchemy import Column, Table, types
|
||||
from sqlalchemy.sql.expression import func
|
||||
from migrate import changeset
|
||||
from migrate.changeset.constraint import ForeignKeyConstraint
|
||||
|
||||
__version__ = 2
|
||||
|
@ -64,6 +64,9 @@ class SongsPlugin(Plugin):
|
||||
self.icon_path = u':/plugins/plugin_songs.png'
|
||||
self.icon = build_icon(self.icon_path)
|
||||
|
||||
def checkPreConditions(self):
|
||||
return self.manager.session is not None
|
||||
|
||||
def initialise(self):
|
||||
log.info(u'Songs Initialising')
|
||||
Plugin.initialise(self)
|
||||
|
@ -30,7 +30,6 @@ backend for the SongsUsage plugin
|
||||
"""
|
||||
|
||||
from sqlalchemy import Column, Table, types
|
||||
from migrate import changeset
|
||||
|
||||
__version__ = 1
|
||||
|
||||
|
@ -54,6 +54,9 @@ class SongUsagePlugin(Plugin):
|
||||
self.inactiveIcon = build_icon(u':/songusage/song_usage_inactive.png')
|
||||
self.songUsageActive = False
|
||||
|
||||
def checkPreConditions(self):
|
||||
return self.manager.session is not None
|
||||
|
||||
def addToolsMenuItem(self, tools_menu):
|
||||
"""
|
||||
Give the SongUsage plugin the opportunity to add items to the
|
||||
|
@ -10,8 +10,9 @@ Homepage: http://openlp.org/
|
||||
Package: openlp
|
||||
Architecture: all
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, python-qt4,
|
||||
python-qt4-phonon, python-sqlalchemy, python-chardet, python-beautifulsoup,
|
||||
python-lxml, python-sqlite, python-enchant, python-mako, python-migrate
|
||||
python-qt4-phonon, python-qt4-gl, python-sqlalchemy, python-chardet,
|
||||
python-beautifulsoup, python-lxml, python-sqlite, python-enchant,
|
||||
python-mako, python-migrate
|
||||
Conflicts: python-openlp
|
||||
Description: Church lyrics projection application
|
||||
OpenLP is free church presentation software, or lyrics projection software,
|
||||
|
Loading…
Reference in New Issue
Block a user