Head 1815

This commit is contained in:
Tim Bentley 2011-12-03 17:02:11 +00:00
commit add75e9c7f
27 changed files with 74 additions and 68 deletions

View File

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

View File

@ -104,7 +104,7 @@ class ListWidgetWithDnD(QtGui.QListWidget):
elif os.path.isdir(localFile):
listing = os.listdir(localFile)
for file in listing:
files.append(os.path.join(localFile,file))
Receiver.send_message(u'%s_dnd' % self.mimeDataText,files)
files.append(os.path.join(localFile, file))
Receiver.send_message(u'%s_dnd' % self.mimeDataText, files)
else:
event.ignore()

View File

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

View File

@ -65,7 +65,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
self.downloadCanceled = False
self.downloading = unicode(translate('OpenLP.FirstTimeWizard',
'Downloading %s...'))
QtCore.QObject.connect(self.cancelButton,QtCore.SIGNAL('clicked()'),
QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL('clicked()'),
self.onCancelButtonClicked)
QtCore.QObject.connect(self.noInternetFinishButton,
QtCore.SIGNAL('clicked()'), self.onNoInternetFinishButtonClicked)

View File

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

View File

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

View File

@ -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
@ -136,8 +135,9 @@ class MediaController(object):
savedPlayers = playerSettings.split(u',')
invalidMediaPlayers = [mediaPlayer for mediaPlayer in savedPlayers \
if not mediaPlayer in self.mediaPlayers]
if len(invalidMediaPlayers)>0:
[savedPlayers.remove(invalidPlayer) for invalidPlayer in invalidMediaPlayers]
if len(invalidMediaPlayers) > 0:
for invalidPlayer in invalidMediaPlayers:
savedPlayers.remove(invalidPlayer)
newPlayerSetting = u','.join(savedPlayers)
QtCore.QSettings().setValue(u'media/players',
QtCore.QVariant(newPlayerSetting))
@ -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,17 +356,19 @@ 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:
self.resize(controller, display, player)
if player.load(display):
self.curDisplayMediaPlayer[display] = player
controller.media_info.media_type = MediaType.Video
return True
controller.media_info.is_background and \
player.canBackground:
self.resize(controller, display, player)
if player.load(display):
self.curDisplayMediaPlayer[display] = player
controller.media_info.media_type = MediaType.Video
return True
if suffix in player.audio_extensions_list:
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()

View File

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

View File

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

View File

@ -117,16 +117,17 @@ 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.nameStrings[u'singular'] == plugin_name_singular:
self.activePlugin = plugin
break
if plugin.status != PluginStatus.Disabled:
if plugin.nameStrings[u'singular'] == plugin_name_singular:
self.activePlugin = plugin
break
if self.activePlugin:
self._setDetails()
else:
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')

View File

@ -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])
@ -573,7 +572,6 @@ class SlideController(Controller):
"""
self.keypress_queue.append(u'previous')
self._process_queue()
def serviceNext(self):
"""
@ -581,21 +579,20 @@ class SlideController(Controller):
"""
self.keypress_queue.append(u'next')
self._process_queue()
def _process_queue(self):
"""
Process the service item request queue. The key presses can arrive
faster than the processing so implement a FIFO queue.
Process the service item request queue. The key presses can arrive
faster than the processing so implement a FIFO queue.
"""
if len(self.keypress_queue):
while len(self.keypress_queue) and not self.keypress_loop:
self.keypress_loop = True
self.keypress_loop = True
if self.keypress_queue.popleft() == u'previous':
Receiver.send_message('servicemanager_previous_item')
Receiver.send_message('servicemanager_previous_item')
else:
Receiver.send_message('servicemanager_next_item')
self.keypress_loop = False
def screenSizeChanged(self):
"""
@ -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())

View File

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

View File

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

View File

@ -192,7 +192,7 @@ class AlertsTab(SettingsTab):
settings.setValue(u'location', QtCore.QVariant(self.location))
settings.endGroup()
if self.changed:
Receiver.send_message(u'update_display_css')
Receiver.send_message(u'update_display_css')
self.changed = False
def updateDisplay(self):

View File

@ -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'],

View File

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

View File

@ -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', \

View File

@ -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):
"""

View File

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

View File

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

View File

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

View File

@ -39,7 +39,7 @@ 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, MediaFile, Song, Topic
from songimport import SongImport
log = logging.getLogger(__name__)

View File

@ -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
from openlp.plugins.songs.lib.db import Song

View File

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

View File

@ -30,7 +30,6 @@ backend for the SongsUsage plugin
"""
from sqlalchemy import Column, Table, types
from migrate import changeset
__version__ = 1

View File

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

View File

@ -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,