This commit is contained in:
Tim Bentley 2010-08-01 09:30:42 +01:00
commit fb4bd1a8c2
31 changed files with 149 additions and 224 deletions

View File

@ -32,13 +32,13 @@ from optparse import OptionParser
from PyQt4 import QtCore, QtGui
log = logging.getLogger()
from openlp.core.lib import Receiver
from openlp.core.resources import qInitResources
from openlp.core.ui import SplashScreen, ScreenList
from openlp.core.utils import AppLocation, LanguageManager
from openlp.core.ui.mainwindow import MainWindow
from openlp.core.ui import MainWindow, SplashScreen, ScreenList
from openlp.core.utils import AppLocation, LanguageManager, VersionThread
log = logging.getLogger()
application_stylesheet = u"""
QMainWindow::separator
@ -142,7 +142,7 @@ class OpenLP(QtGui.QApplication):
# now kill the splashscreen
self.splash.finish(self.mainWindow)
self.mainWindow.repaint()
self.mainWindow.versionThread()
VersionThread(self.mainWindow, app_version).start()
return self.exec_()
def main():

View File

@ -132,6 +132,7 @@ class Plugin(QtCore.QObject):
self.settingsForm = plugin_helpers[u'settings form']
self.mediadock = plugin_helpers[u'toolbox']
self.pluginManager = plugin_helpers[u'pluginmanager']
self.formparent = plugin_helpers[u'formparent']
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'%s_add_service_item' % self.name),
self.processAddServiceEvent)

View File

@ -77,7 +77,6 @@ class PluginManager(object):
startdepth = len(os.path.abspath(plugin_dir).split(os.sep))
log.debug(u'finding plugins in %s at depth %d',
unicode(plugin_dir), startdepth)
for root, dirs, files in os.walk(plugin_dir):
for name in files:
if name.endswith(u'.py') and not name.startswith(u'__'):

View File

@ -25,8 +25,6 @@
###############################################################################
import logging
import time
import re
from PyQt4 import QtCore, QtGui
@ -34,8 +32,7 @@ from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
ThemeManager, SlideController, PluginForm, MediaDockManager
from openlp.core.lib import RenderManager, build_icon, OpenLPDockWidget, \
SettingsManager, PluginManager, Receiver, translate
from openlp.core.utils import check_latest_version, AppLocation, add_actions, \
LanguageManager
from openlp.core.utils import AppLocation, add_actions, LanguageManager
log = logging.getLogger(__name__)
@ -58,49 +55,6 @@ MEDIA_MANAGER_STYLE = """
font-weight: bold;
}
"""
class VersionThread(QtCore.QThread):
"""
A special Qt thread class to fetch the version of OpenLP from the website.
This is threaded so that it doesn't affect the loading time of OpenLP.
"""
def __init__(self, parent, app_version):
QtCore.QThread.__init__(self, parent)
self.parent = parent
self.app_version = app_version
self.version_splitter = re.compile(
r'([0-9]+).([0-9]+).([0-9]+)(?:-bzr([0-9]+))?')
def run(self):
"""
Run the thread.
"""
time.sleep(1)
Receiver.send_message(u'maindisplay_blank_check')
version = check_latest_version(self.app_version)
remote_version = {}
local_version = {}
match = self.version_splitter.match(version)
if match:
remote_version[u'major'] = int(match.group(1))
remote_version[u'minor'] = int(match.group(2))
remote_version[u'release'] = int(match.group(3))
if len(match.groups()) > 3 and match.group(4):
remote_version[u'revision'] = int(match.group(4))
match = self.version_splitter.match(self.app_version[u'full'])
if match:
local_version[u'major'] = int(match.group(1))
local_version[u'minor'] = int(match.group(2))
local_version[u'release'] = int(match.group(3))
if len(match.groups()) > 3 and match.group(4):
local_version[u'revision'] = int(match.group(4))
if remote_version[u'major'] > local_version[u'major'] or \
remote_version[u'minor'] > local_version[u'minor'] or \
remote_version[u'release'] > local_version[u'release']:
Receiver.send_message(u'openlp_version_check', u'%s' % version)
elif remote_version.get(u'revision') and \
local_version.get(u'revision') and \
remote_version[u'revision'] > local_version[u'revision']:
Receiver.send_message(u'openlp_version_check', u'%s' % version)
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
@ -577,20 +531,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.SIGNAL(u'triggered()'),
self.ThemeManagerContents.onExportTheme)
QtCore.QObject.connect(self.ViewMediaManagerItem,
QtCore.SIGNAL(u'triggered(bool)'),
self.toggleMediaManager)
QtCore.SIGNAL(u'triggered(bool)'), self.toggleMediaManager)
QtCore.QObject.connect(self.ViewServiceManagerItem,
QtCore.SIGNAL(u'triggered(bool)'),
self.toggleServiceManager)
QtCore.SIGNAL(u'triggered(bool)'), self.toggleServiceManager)
QtCore.QObject.connect(self.ViewThemeManagerItem,
QtCore.SIGNAL(u'triggered(bool)'),
self.toggleThemeManager)
QtCore.SIGNAL(u'triggered(bool)'), self.toggleThemeManager)
QtCore.QObject.connect(self.ViewPreviewPanel,
QtCore.SIGNAL(u'toggled(bool)'),
self.setPreviewPanelVisibility)
QtCore.SIGNAL(u'toggled(bool)'), self.setPreviewPanelVisibility)
QtCore.QObject.connect(self.ViewLivePanel,
QtCore.SIGNAL(u'toggled(bool)'),
self.setLivePanelVisibility)
QtCore.SIGNAL(u'toggled(bool)'), self.setLivePanelVisibility)
QtCore.QObject.connect(self.MediaManagerDock,
QtCore.SIGNAL(u'visibilityChanged(bool)'),
self.ViewMediaManagerItem.setChecked)
@ -608,8 +557,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.SIGNAL(u'triggered()'), self.onPluginItemClicked)
QtCore.QObject.connect(self.SettingsConfigureItem,
QtCore.SIGNAL(u'triggered()'), self.onOptionsSettingsItemClicked)
QtCore.QObject.connect(self.FileNewItem,
QtCore.SIGNAL(u'triggered()'),
QtCore.QObject.connect(self.FileNewItem, QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.onNewService)
QtCore.QObject.connect(self.FileOpenItem,
QtCore.SIGNAL(u'triggered()'),
@ -622,22 +570,18 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.ServiceManagerContents.onSaveService)
#i18n set signals for languages
QtCore.QObject.connect(self.AutoLanguageItem,
QtCore.SIGNAL(u'toggled(bool)'),
self.setAutoLanguage)
QtCore.SIGNAL(u'toggled(bool)'), self.setAutoLanguage)
self.LanguageGroup.triggered.connect(LanguageManager.set_language)
QtCore.QObject.connect(self.ModeDefaultItem,
QtCore.SIGNAL(u'triggered()'),
self.onModeDefaultItemClicked)
QtCore.SIGNAL(u'triggered()'), self.setViewMode)
QtCore.QObject.connect(self.ModeSetupItem,
QtCore.SIGNAL(u'triggered()'),
self.onModeSetupItemClicked)
QtCore.SIGNAL(u'triggered()'), self.onModeSetupItemClicked)
QtCore.QObject.connect(self.ModeLiveItem,
QtCore.SIGNAL(u'triggered()'),
self.onModeLiveItemClicked)
QtCore.SIGNAL(u'triggered()'), self.onModeLiveItemClicked)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'theme_update_global'), self.defaultThemeChanged)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlp_version_check'), self.versionCheck)
QtCore.SIGNAL(u'openlp_version_check'), self.versionNotice)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'maindisplay_blank_check'), self.blankCheck)
QtCore.QObject.connect(Receiver.get_receiver(),
@ -660,6 +604,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.plugin_helpers[u'settings form'] = self.settingsForm
self.plugin_helpers[u'toolbox'] = self.mediaDockManager
self.plugin_helpers[u'pluginmanager'] = self.plugin_manager
self.plugin_helpers[u'formparent'] = self
self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers)
# hook methods have to happen after find_plugins. Find plugins needs
# the controllers hence the hooks have moved from setupUI() to here
@ -696,12 +641,11 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
LanguageManager.AutoLanguage = value
LanguageManager.set_language(self.LanguageGroup.checkedAction())
def versionCheck(self, version):
def versionNotice(self, version):
"""
Checks the version of the Application called from openlp.pyw
Notifies the user that a newer version of OpenLP is available.
Triggered by delay thread.
"""
app_version = self.applicationVersion[u'full']
version_text = unicode(translate('OpenLP.MainWindow',
'Version %s of OpenLP is now available for download (you are '
'currently running version %s). \n\nYou can download the latest '
@ -709,9 +653,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
'<a href="http://openlp.org/">http://openlp.org/</a>.'))
QtGui.QMessageBox.question(self,
translate('OpenLP.MainWindow', 'OpenLP Version Updated'),
version_text % (version, app_version),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
version_text % (version, self.applicationVersion[u'full']))
def show(self):
"""
@ -746,13 +688,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
'The Main Display has been blanked out'))
settings.endGroup()
def versionThread(self):
"""
Start an initial setup thread to delay notifications
"""
vT = VersionThread(self, self.applicationVersion)
vT.start()
def onHelpWebSiteClicked(self):
"""
Load the OpenLP website
@ -780,35 +715,28 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
"""
self.settingsForm.exec_()
def onModeDefaultItemClicked(self):
"""
Put OpenLP into "Default" view mode.
"""
self.MediaManagerDock.setVisible(True)
self.ServiceManagerDock.setVisible(True)
self.ThemeManagerDock.setVisible(True)
self.setPreviewPanelVisibility(True)
self.setLivePanelVisibility(True)
def onModeSetupItemClicked(self):
"""
Put OpenLP into "Setup" view mode.
"""
self.MediaManagerDock.setVisible(True)
self.ServiceManagerDock.setVisible(True)
self.ThemeManagerDock.setVisible(False)
self.setPreviewPanelVisibility(True)
self.setLivePanelVisibility(False)
self.setViewMode(True, True, False, True, False)
def onModeLiveItemClicked(self):
"""
Put OpenLP into "Live" view mode.
"""
self.MediaManagerDock.setVisible(False)
self.ServiceManagerDock.setVisible(True)
self.ThemeManagerDock.setVisible(False)
self.setPreviewPanelVisibility(False)
self.setLivePanelVisibility(True)
self.setViewMode(False, True, False, False, True)
def setViewMode(self, media=True, service=True, theme=True, preview=True,
live=True):
"""
Set OpenLP to a different view mode.
"""
self.MediaManagerDock.setVisible(media)
self.ServiceManagerDock.setVisible(service)
self.ThemeManagerDock.setVisible(theme)
self.setPreviewPanelVisibility(preview)
self.setLivePanelVisibility(live)
def screenChanged(self):
"""

View File

@ -498,8 +498,7 @@ class ServiceManager(QtGui.QWidget):
'Your service is unsaved, do you want to save '
'those changes before creating a new one?'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Cancel |
QtGui.QMessageBox.Save),
QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Save),
QtGui.QMessageBox.Save)
if ret == QtGui.QMessageBox.Save:
self.onSaveService()
@ -656,8 +655,7 @@ class ServiceManager(QtGui.QWidget):
'Your current service is unsaved, do you want to '
'save the changes before opening a new one?'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Discard |
QtGui.QMessageBox.Save),
QtGui.QMessageBox.Discard | QtGui.QMessageBox.Save),
QtGui.QMessageBox.Save)
if ret == QtGui.QMessageBox.Save:
self.onSaveService()
@ -802,7 +800,6 @@ class ServiceManager(QtGui.QWidget):
``item``
Service Item to be added
"""
sitem = self.findServiceItem()[0]
item.render()
@ -847,10 +844,7 @@ class ServiceManager(QtGui.QWidget):
QtGui.QMessageBox.critical(self,
translate('OpenLP.ServiceManager', 'Missing Display Handler'),
translate('OpenLP.ServiceManager', 'Your item cannot be '
'displayed as there is no handler to display it'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
'displayed as there is no handler to display it'))
def getServiceItem(self):
"""
@ -883,10 +877,7 @@ class ServiceManager(QtGui.QWidget):
QtGui.QMessageBox.critical(self,
translate('OpenLP.ServiceManager', 'Missing Display Handler'),
translate('OpenLP.ServiceManager', 'Your item cannot be '
'displayed as there is no handler to display it'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
'displayed as there is no handler to display it'))
def remoteEdit(self):
"""

View File

@ -235,8 +235,7 @@ class ThemeManager(QtGui.QWidget):
QtGui.QMessageBox.critical(self,
translate('OpenLP.ThemeManager', 'Error'),
translate('OpenLP.ThemeManager',
'You are unable to delete the default theme.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'You are unable to delete the default theme.'))
else:
for plugin in self.parent.plugin_manager.plugins:
if plugin.usesTheme(theme):

View File

@ -27,20 +27,66 @@
The :mod:`utils` module provides the utility libraries for OpenLP
"""
import os
import sys
import logging
import os
import re
import sys
import time
import urllib2
from datetime import datetime
from PyQt4 import QtGui, QtCore
import openlp
from openlp.core.lib import translate
from openlp.core.lib import Receiver, translate
log = logging.getLogger(__name__)
images_filter = None
class VersionThread(QtCore.QThread):
"""
A special Qt thread class to fetch the version of OpenLP from the website.
This is threaded so that it doesn't affect the loading time of OpenLP.
"""
def __init__(self, parent, app_version):
QtCore.QThread.__init__(self, parent)
self.app_version = app_version
self.version_splitter = re.compile(
r'([0-9]+).([0-9]+).([0-9]+)(?:-bzr([0-9]+))?')
def run(self):
"""
Run the thread.
"""
time.sleep(1)
Receiver.send_message(u'maindisplay_blank_check')
version = check_latest_version(self.app_version)
remote_version = {}
local_version = {}
match = self.version_splitter.match(version)
if match:
remote_version[u'major'] = int(match.group(1))
remote_version[u'minor'] = int(match.group(2))
remote_version[u'release'] = int(match.group(3))
if len(match.groups()) > 3 and match.group(4):
remote_version[u'revision'] = int(match.group(4))
match = self.version_splitter.match(self.app_version[u'full'])
if match:
local_version[u'major'] = int(match.group(1))
local_version[u'minor'] = int(match.group(2))
local_version[u'release'] = int(match.group(3))
if len(match.groups()) > 3 and match.group(4):
local_version[u'revision'] = int(match.group(4))
if remote_version[u'major'] > local_version[u'major'] or \
remote_version[u'minor'] > local_version[u'minor'] or \
remote_version[u'release'] > local_version[u'release']:
Receiver.send_message(u'openlp_version_check', u'%s' % version)
elif remote_version.get(u'revision') and \
local_version.get(u'revision') and \
remote_version[u'revision'] > local_version[u'revision']:
Receiver.send_message(u'openlp_version_check', u'%s' % version)
class AppLocation(object):
"""
The :class:`AppLocation` class is a static class which retrieves a

View File

@ -28,7 +28,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate
from openlp.core.lib import Plugin, build_icon, translate
from openlp.core.lib.db import Manager
from openlp.plugins.alerts.lib import AlertsManager, AlertsTab
from openlp.plugins.alerts.lib.db import init_schema
@ -45,8 +45,7 @@ class AlertsPlugin(Plugin):
self.icon = build_icon(u':/plugins/plugin_alerts.png')
self.alertsmanager = AlertsManager(self)
self.manager = Manager(u'alerts', init_schema)
self.alertForm = AlertForm(self.manager, self)
self.status = PluginStatus.Active
self.alertForm = AlertForm(self)
def getSettingsTab(self):
"""

View File

@ -35,14 +35,14 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
"""
Provide UI for the alert system
"""
def __init__(self, manager, parent):
def __init__(self, plugin):
"""
Initialise the alert form
"""
self.manager = manager
self.parent = parent
self.manager = plugin.manager
self.parent = plugin
self.item_id = None
QtGui.QDialog.__init__(self, None)
QtGui.QDialog.__init__(self, plugin.formparent)
self.setupUi(self)
QtCore.QObject.connect(self.DisplayButton, QtCore.SIGNAL(u'clicked()'),
self.onDisplayClicked)

View File

@ -28,7 +28,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate
from openlp.core.lib import Plugin, build_icon, translate
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
log = logging.getLogger(__name__)
@ -41,8 +41,6 @@ class BiblePlugin(Plugin):
self.weight = -9
self.icon_path = u':/plugins/plugin_bibles.png'
self.icon = build_icon(self.icon_path)
# Register the bible Manager.
self.status = PluginStatus.Active
self.manager = None
def initialise(self):

View File

@ -129,8 +129,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Invalid Bible Location'),
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file to import your '
'Bible from.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'Bible from.'))
self.OSISLocationEdit.setFocus()
return False
elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
@ -140,8 +139,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Invalid Books File'),
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file with books of '
'the Bible to use in the import.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'the Bible to use in the import.'))
self.BooksLocationEdit.setFocus()
return False
elif self.field(u'csv_versefile').toString() == u'':
@ -150,8 +148,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Invalid Verse File'),
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file of Bible '
'verses to import.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'verses to import.'))
self.CsvVerseLocationEdit.setFocus()
return False
elif self.field(u'source_format').toInt()[0] == \
@ -162,8 +159,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Invalid OpenSong Bible'),
translate('BiblesPlugin.ImportWizardForm',
'You need to specify an OpenSong Bible '
'file to import.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'file to import.'))
self.OpenSongFileEdit.setFocus()
return False
return True
@ -178,8 +174,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Empty Version Name'),
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a version name for your '
'Bible.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'Bible.'))
self.VersionNameEdit.setFocus()
return False
elif license_copyright == u'':
@ -189,8 +184,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
translate('BiblesPlugin.ImportWizardForm',
'You need to set a copyright for your Bible! '
'Bibles in the Public Domain need to be marked as '
'such.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'such.'))
self.CopyrightEdit.setFocus()
return False
elif self.manager.exists(license_version):
@ -199,8 +193,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
'Bible Exists'),
translate('BiblesPlugin.ImportWizardForm',
'This Bible already exists! Please import '
'a different Bible or first delete the existing one.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'a different Bible or first delete the existing one.'))
self.VersionNameEdit.setFocus()
return False
return True

View File

@ -387,10 +387,7 @@ class BibleMediaItem(MediaManagerItem):
QtGui.QMessageBox.critical(self,
translate('BiblesPlugin.MediaItem', 'No Book Found'),
translate('BiblesPlugin.MediaItem',
'No matching book could be found in this Bible.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok
)
'No matching book could be found in this Bible.'))
def onAdvancedVersionComboBox(self):
self.initialiseBible(

View File

@ -28,7 +28,7 @@ import logging
from forms import EditCustomForm
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate
from openlp.core.lib import Plugin, build_icon, translate
from openlp.core.lib.db import Manager
from openlp.plugins.custom.lib import CustomMediaItem, CustomTab
from openlp.plugins.custom.lib.db import CustomSlide, init_schema
@ -53,7 +53,6 @@ class CustomPlugin(Plugin):
self.edit_custom_form = EditCustomForm(self.custommanager)
self.icon_path = u':/plugins/plugin_custom.png'
self.icon = build_icon(self.icon_path)
self.status = PluginStatus.Active
def getSettingsTab(self):
return CustomTab(self.name)

View File

@ -151,8 +151,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
valid, message = self._validate()
if not valid:
QtGui.QMessageBox.critical(self,
translate('CustomPlugin.EditCustomForm', 'Error'), message,
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
translate('CustomPlugin.EditCustomForm', 'Error'), message)
return False
sxml = CustomXMLBuilder()
sxml.new_document()

View File

@ -26,7 +26,7 @@
import logging
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate
from openlp.core.lib import Plugin, build_icon, translate
from openlp.plugins.images.lib import ImageMediaItem
log = logging.getLogger(__name__)
@ -39,7 +39,6 @@ class ImagePlugin(Plugin):
self.weight = -7
self.icon_path = u':/plugins/plugin_images.png'
self.icon = build_icon(self.icon_path)
self.status = PluginStatus.Active
def getMediaManagerItem(self):
# Create the MediaManagerItem object

View File

@ -28,7 +28,7 @@ import logging
from PyQt4.phonon import Phonon
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate
from openlp.core.lib import Plugin, build_icon, translate
from openlp.plugins.media.lib import MediaMediaItem
log = logging.getLogger(__name__)
@ -43,7 +43,6 @@ class MediaPlugin(Plugin):
self.icon = build_icon(self.icon_path)
# passed with drag and drop messages
self.dnd_id = u'Media'
self.status = PluginStatus.Active
self.audio_list = u''
self.video_list = u''
for mimetype in Phonon.BackendCapabilities.availableMimeTypes():

View File

@ -69,8 +69,8 @@ class ImpressController(PresentationController):
"""
log.debug(u'Initialising')
PresentationController.__init__(self, plugin, u'Impress')
self.supports = [u'.odp']
self.alsosupports = [u'.ppt', u'.pps', u'.pptx', u'.ppsx']
self.supports = [u'odp']
self.alsosupports = [u'ppt', u'pps', u'pptx', u'ppsx']
self.process = None
self.desktop = None
self.manager = None

View File

@ -79,7 +79,6 @@ class PresentationMediaItem(MediaManagerItem):
'Select Presentation(s)')
self.Automatic = translate('PresentationPlugin.MediaItem',
'Automatic')
self.buildFileMaskString()
def buildFileMaskString(self):
"""
@ -92,7 +91,7 @@ class PresentationMediaItem(MediaManagerItem):
self.controllers[controller].alsosupports
for type in types:
if fileType.find(type) == -1:
fileType += u'*%s ' % type
fileType += u'*.%s ' % type
self.parent.serviceManager.supportedSuffixes(type)
self.OnNewFileMasks = translate('PresentationPlugin.MediaItem',
'Presentations (%s)' % fileType)
@ -189,8 +188,7 @@ class PresentationMediaItem(MediaManagerItem):
translate('PresentationPlugin.MediaItem',
'File Exists'),
translate('PresentationPlugin.MediaItem',
'A presentation with that filename already exists.'),
QtGui.QMessageBox.Ok)
'A presentation with that filename already exists.'))
continue
controller_name = self.findControllerByType(filename)
if controller_name:
@ -214,8 +212,7 @@ class PresentationMediaItem(MediaManagerItem):
self, translate('PresentationPlugin.MediaItem',
'Unsupported File'),
translate('PresentationPlugin.MediaItem',
'This type of presentation is not supported'),
QtGui.QMessageBox.Ok)
'This type of presentation is not supported'))
continue
item_name = QtGui.QListWidgetItem(filename)
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file))
@ -288,7 +285,7 @@ class PresentationMediaItem(MediaManagerItem):
"supports" the extension. If none found, then look for a controller
which "alsosupports" it instead.
"""
filetype = os.path.splitext(filename)[1]
filetype = filename.split(u'.')[1]
if not filetype:
return None
for controller in self.controllers:

View File

@ -54,7 +54,7 @@ class PowerpointController(PresentationController):
"""
log.debug(u'Initialising')
PresentationController.__init__(self, plugin, u'Powerpoint')
self.supports = [u'.ppt', u'.pps', u'.pptx', u'.ppsx']
self.supports = [u'ppt', u'pps', u'pptx', u'ppsx']
self.process = None
def check_available(self):

View File

@ -50,7 +50,7 @@ class PptviewController(PresentationController):
log.debug(u'Initialising')
self.process = None
PresentationController.__init__(self, plugin, u'Powerpoint Viewer')
self.supports = [u'.ppt', u'.pps', u'.pptx', u'.ppsx']
self.supports = [u'ppt', u'pps', u'pptx', u'ppsx']
def check_available(self):
"""

View File

@ -30,7 +30,7 @@ presentations from a variety of document formats.
import os
import logging
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate
from openlp.core.lib import Plugin, build_icon, translate
from openlp.core.utils import AppLocation
from openlp.plugins.presentations.lib import PresentationController, \
PresentationMediaItem, PresentationTab
@ -55,7 +55,6 @@ class PresentationPlugin(Plugin):
self.weight = -8
self.icon_path = u':/plugins/plugin_presentations.png'
self.icon = build_icon(self.icon_path)
self.status = PluginStatus.Active
def getSettingsTab(self):
"""
@ -74,6 +73,7 @@ class PresentationPlugin(Plugin):
for controller in self.controllers:
if self.controllers[controller].enabled():
self.controllers[controller].start_process()
self.mediaItem.buildFileMaskString()
def finalise(self):
"""

View File

@ -72,7 +72,7 @@ class RemotesPlugin(Plugin):
Information about this plugin
"""
about_text = translate('RemotePlugin', '<strong>Remote Plugin</strong>'
'<br/ >The remote plugin provides the ability to send messages to '
'<br />The remote plugin provides the ability to send messages to '
'a running version of OpenLP on a different computer via a web '
'browser or through the remote API.')
return about_text

View File

@ -82,16 +82,14 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
QtGui.QMessageBox.critical(
self, translate('SongsPlugin.AuthorsForm', 'Error'),
translate('SongsPlugin.AuthorsForm',
'You need to type in the first name of the author.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'You need to type in the first name of the author.'))
self.FirstNameEdit.setFocus()
return False
elif not self.LastNameEdit.text():
QtGui.QMessageBox.critical(
self, translate('SongsPlugin.AuthorsForm', 'Error'),
translate('SongsPlugin.AuthorsForm',
'You need to type in the last name of the author.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'You need to type in the last name of the author.'))
self.LastNameEdit.setFocus()
return False
elif not self.DisplayEdit.text():

View File

@ -331,8 +331,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
translate('SongsPlugin.EditSongForm', 'You have not selected '
'a valid author. Either select an author from the list, '
'or type in a new author and click the "Add Author to '
'Song" button to add the new author.'),
QtGui.QMessageBox.Ok, QtGui.QMessageBox.Ok)
'Song" button to add the new author.'))
def onAuthorsListViewPressed(self):
if self.AuthorsListView.count() > 1:
@ -389,8 +388,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
translate('SongsPlugin.EditSongForm', 'You have not selected '
'a valid topic. Either select a topic from the list, or '
'type in a new topic and click the "Add Topic to Song" '
'button to add the new topic.'),
QtGui.QMessageBox.Ok, QtGui.QMessageBox.Ok)
'button to add the new topic.'))
def onTopicListViewPressed(self):
self.TopicRemoveButton.setEnabled(True)

View File

@ -52,8 +52,7 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
QtGui.QMessageBox.critical(
self, translate('SongsPlugin.SongBookForm', 'Error'),
translate('SongsPlugin.SongBookForm',
'You need to type in a name for the book.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'You need to type in a name for the book.'))
self.NameEdit.setFocus()
return False
else:

View File

@ -109,8 +109,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
'No OpenLyrics Files Selected'),
translate('SongsPlugin.ImportWizardForm',
'You need to add at least one OpenLyrics '
'song file to import from.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'song file to import from.'))
self.OpenLyricsAddButton.setFocus()
return False
elif source_format == SongFormat.OpenSong:
@ -120,8 +119,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
'No OpenSong Files Selected'),
translate('SongsPlugin.ImportWizardForm',
'You need to add at least one OpenSong '
'song file to import from.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'song file to import from.'))
self.OpenSongAddButton.setFocus()
return False
elif source_format == SongFormat.CCLI:
@ -131,8 +129,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
'No CCLI Files Selected'),
translate('SongsPlugin.ImportWizardForm',
'You need to add at least one CCLI file '
'to import from.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'to import from.'))
self.CCLIAddButton.setFocus()
return False
elif source_format == SongFormat.CSV:
@ -141,8 +138,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
translate('SongsPlugin.ImportWizardForm',
'No CSV File Selected'),
translate('SongsPlugin.ImportWizardForm',
'You need to specify a CSV file to import from.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'You need to specify a CSV file to import from.'))
self.CSVFilenameEdit.setFocus()
return False
return True

View File

@ -51,8 +51,7 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
QtGui.QMessageBox.critical(
self, translate('SongsPlugin.TopicsForm', 'Error'),
translate('SongsPlugin.TopicsForm',
'You need to type in a topic name!'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'You need to type in a topic name!'))
self.NameEdit.setFocus()
return False
else:

View File

@ -28,8 +28,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, build_icon, PluginStatus, Receiver, \
translate
from openlp.core.lib import Plugin, build_icon, Receiver, translate
from openlp.core.lib.db import Manager
from openlp.plugins.songs.lib import OpenLPSongImport, SongMediaItem, SongsTab
from openlp.plugins.songs.lib.db import init_schema, Song
@ -63,7 +62,6 @@ class SongsPlugin(Plugin):
self.manager = Manager(u'songs', init_schema)
self.icon_path = u':/plugins/plugin_songs.png'
self.icon = build_icon(self.icon_path)
self.status = PluginStatus.Active
def getSettingsTab(self):
return SongsTab(self.name)
@ -200,15 +198,11 @@ class SongsPlugin(Plugin):
except:
log.exception('Could not import SoF file')
QtGui.QMessageBox.critical(None,
translate('SongsPlugin',
'Import Error'),
translate('SongsPlugin',
'Error importing Songs of '
translate('SongsPlugin', 'Import Error'),
translate('SongsPlugin', 'Error importing Songs of '
'Fellowship file.\nOpenOffice.org must be installed'
' and you must be using an unedited copy of the RTF'
' included with the Songs of Fellowship Music Editions'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
' included with the Songs of Fellowship Music Editions'))
Receiver.send_message(u'songs_load_list')
def onImportOpenSongItemClick(self):
@ -223,12 +217,8 @@ class SongsPlugin(Plugin):
except:
log.exception('Could not import OpenSong file')
QtGui.QMessageBox.critical(None,
translate('SongsPlugin',
'Import Error'),
translate('SongsPlugin',
'Error importing OpenSong file'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
translate('SongsPlugin', 'Import Error'),
translate('SongsPlugin', 'Error importing OpenSong file'))
Receiver.send_message(u'songs_load_list')
def onImportOpenLPSongItemClick(self):
@ -252,8 +242,7 @@ class SongsPlugin(Plugin):
def onImportOooItemClick(self):
filenames = QtGui.QFileDialog.getOpenFileNames(
None, translate('SongsPlugin',
'Open documents or presentations'),
None, translate('SongsPlugin', 'Open documents or presentations'),
'', u'All Files(*.*)')
oooimport = OooImport(self.manager)
oooimport.import_docs(filenames)

View File

@ -34,7 +34,7 @@ class SongUsageDeleteForm(QtGui.QDialog, Ui_SongUsageDeleteDialog):
"""
Class documentation goes here.
"""
def __init__(self, songusagemanager, parent=None):
def __init__(self, songusagemanager, parent):
"""
Constructor
"""

View File

@ -42,12 +42,12 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
"""
log.info(u'SongUsage Detail Form Loaded')
def __init__(self, parent=None):
def __init__(self, plugin, parent):
"""
Initialise the form
"""
QtGui.QDialog.__init__(self, None)
self.parent = parent
QtGui.QDialog.__init__(self, parent)
self.plugin = plugin
self.setupUi(self)
def initialise(self):
@ -59,16 +59,16 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
self.fromDate.setSelectedDate(fromDate)
self.toDate.setSelectedDate(toDate)
self.fileLineEdit.setText(
SettingsManager.get_last_dir(self.parent.settingsSection, 1))
SettingsManager.get_last_dir(self.plugin.settingsSection, 1))
def defineOutputLocation(self):
path = QtGui.QFileDialog.getExistingDirectory(self,
translate('SongUsagePlugin.SongUsageDetailForm',
'Output File Location'),
SettingsManager.get_last_dir(self.parent.settingsSection, 1))
SettingsManager.get_last_dir(self.plugin.settingsSection, 1))
path = unicode(path)
if path != u'':
SettingsManager.set_last_dir(self.parent.settingsSection, path, 1)
SettingsManager.set_last_dir(self.plugin.settingsSection, path, 1)
self.fileLineEdit.setText(path)
def accept(self):
@ -76,7 +76,7 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
filename = u'usage_detail_%s_%s.txt' % (
self.fromDate.selectedDate().toString(u'ddMMyyyy'),
self.toDate.selectedDate().toString(u'ddMMyyyy'))
usage = self.parent.songusagemanager.get_all_objects(
usage = self.plugin.songusagemanager.get_all_objects(
SongUsageItem, and_(
SongUsageItem.usagedate >= self.fromDate.selectedDate().toPyDate(),
SongUsageItem.usagedate < self.toDate.selectedDate().toPyDate()),
@ -95,3 +95,4 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
finally:
if file:
file.close()
self.close()

View File

@ -117,8 +117,9 @@ class SongUsagePlugin(Plugin):
self.SongUsageStatus.setChecked(self.SongUsageActive)
if self.songusagemanager is None:
self.songusagemanager = Manager(u'songusage', init_schema)
self.SongUsagedeleteform = SongUsageDeleteForm(self.songusagemanager)
self.SongUsagedetailform = SongUsageDetailForm(self)
self.SongUsagedeleteform = SongUsageDeleteForm(self.songusagemanager,
self.formparent)
self.SongUsagedetailform = SongUsageDetailForm(self, self.formparent)
self.SongUsageMenu.menuAction().setVisible(True)
def finalise(self):