diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 4403ac8ec..9af8debb8 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -29,8 +29,7 @@ The :mod:`lib` module contains most of the components and libraries that make OpenLP work. """ import logging -import os.path -import types +import os from PyQt4 import QtCore, QtGui, Qt @@ -63,6 +62,7 @@ class ServiceItemAction(object): PreviousLastSlide = 2 Next = 3 + def translate(context, text, comment=None, encoding=QtCore.QCoreApplication.CodecForTr, n=-1, translate=QtCore.QCoreApplication.translate): @@ -84,6 +84,7 @@ def translate(context, text, comment=None, """ return translate(context, text, comment, encoding, n) + def get_text_file_string(text_file): """ Open a file and return its content as unicode string. If the supplied file @@ -112,6 +113,7 @@ def get_text_file_string(text_file): file_handle.close() return content_string + def str_to_bool(stringvalue): """ Convert a string version of a boolean into a real boolean. @@ -123,6 +125,7 @@ def str_to_bool(stringvalue): return stringvalue return unicode(stringvalue).strip().lower() in (u'true', u'yes', u'y') + def build_icon(icon): """ Build a QIcon instance from an existing QIcon, a resource location, or a @@ -149,6 +152,7 @@ def build_icon(icon): QtGui.QIcon.Normal, QtGui.QIcon.Off) return button_icon + def image_to_byte(image): """ Resize an image to fit on the current screen for the web and returns @@ -167,6 +171,7 @@ def image_to_byte(image): # convert to base64 encoding so does not get missed! return byte_array.toBase64() + def create_thumb(image_path, thumb_path, return_icon=True, size=None): """ Create a thumbnail from the given image path and depending on @@ -202,6 +207,7 @@ def create_thumb(image_path, thumb_path, return_icon=True, size=None): # Fallback for files with animation support. return build_icon(unicode(image_path)) + def validate_thumb(file_path, thumb_path): """ Validates whether an file's thumb still exists and if is up to date. @@ -220,6 +226,7 @@ def validate_thumb(file_path, thumb_path): thumb_date = os.stat(thumb_path).st_mtime return image_date <= thumb_date + def resize_image(image_path, width, height, background=u'#000000'): """ Resize an image to fit on the current screen. @@ -267,6 +274,7 @@ def resize_image(image_path, width, height, background=u'#000000'): painter.drawImage((width - realw) / 2, (height - realh) / 2, preview) return new_image + def check_item_selected(list_widget, message): """ Check if a list item is selected so an action may be performed on it @@ -283,6 +291,7 @@ def check_item_selected(list_widget, message): return False return True + def clean_tags(text): """ Remove Tags from text for display @@ -295,6 +304,7 @@ def clean_tags(text): text = text.replace(tag[u'end tag'], u'') return text + def expand_tags(text): """ Expand tags HTML for display @@ -304,6 +314,7 @@ def expand_tags(text): text = text.replace(tag[u'end tag'], tag[u'end html']) return text + def check_directory_exists(dir): """ Check a theme directory exists and if not create it @@ -318,6 +329,7 @@ def check_directory_exists(dir): except IOError: pass + def create_separated_list(stringlist): """ Returns a string that represents a join of a list of strings with a @@ -346,6 +358,7 @@ def create_separated_list(stringlist): return unicode(translate('OpenLP.core.lib', '%1, %2', u'Locale list separator: start').arg(stringlist[0], merged)) + from eventreceiver import Receiver from listwidgetwithdnd import ListWidgetWithDnD from formattingtags import FormattingTags diff --git a/openlp/core/lib/listwidgetwithdnd.py b/openlp/core/lib/listwidgetwithdnd.py index 67fa45f74..9e9787914 100644 --- a/openlp/core/lib/listwidgetwithdnd.py +++ b/openlp/core/lib/listwidgetwithdnd.py @@ -27,7 +27,7 @@ """ Extend QListWidget to handle drag and drop functionality """ -import os.path +import os from PyQt4 import QtCore, QtGui diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 49d4d3e4c..0fff153a3 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -582,7 +582,7 @@ class MediaManagerItem(QtGui.QWidget): Common method for generating a service item """ serviceItem = ServiceItem(self.plugin) - serviceItem.add_icon(self.plugin.icon_path) + serviceItem.add_icon(self.plugin.iconPath) if self.generateSlideData(serviceItem, item, xmlVersion, remote): return serviceItem else: diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index f704bd9cd..a27e496cf 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -155,9 +155,9 @@ class Plugin(QtCore.QObject): self.version = get_application_version()[u'version'] self.settingsSection = self.name self.icon = None - self.media_item_class = media_item_class - self.settings_tab_class = settings_tab_class - self.settings_tab = None + self.mediaItemClass = media_item_class + self.settingsTabClass = settings_tab_class + self.settingsTab = None self.mediaItem = None self.weight = 0 self.status = PluginStatus.Inactive @@ -166,9 +166,9 @@ class Plugin(QtCore.QObject): self.renderer = plugin_helpers[u'renderer'] self.serviceManager = plugin_helpers[u'service'] self.settingsForm = plugin_helpers[u'settings form'] - self.mediadock = plugin_helpers[u'toolbox'] + self.mediaDock = plugin_helpers[u'toolbox'] self.pluginManager = plugin_helpers[u'pluginmanager'] - self.formparent = plugin_helpers[u'formparent'] + self.formParent = plugin_helpers[u'formparent'] self.mediaController = plugin_helpers[u'mediacontroller'] QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'%s_add_service_item' % self.name), @@ -219,8 +219,8 @@ class Plugin(QtCore.QObject): Construct a MediaManagerItem object with all the buttons and things you need, and return it for integration into OpenLP. """ - if self.media_item_class: - self.mediaItem = self.media_item_class(self.mediadock.media_dock, + if self.mediaItemClass: + self.mediaItem = self.mediaItemClass(self.mediaDock.media_dock, self, self.icon) def addImportMenuItem(self, importMenu): @@ -255,10 +255,10 @@ class Plugin(QtCore.QObject): Create a tab for the settings window to display the configurable options for this plugin to the user. """ - if self.settings_tab_class: - self.settings_tab = self.settings_tab_class(parent, self.name, + if self.settingsTabClass: + self.settingsTab = self.settingsTabClass(parent, self.name, self.getString(StringContent.VisibleName)[u'title'], - self.icon_path) + self.iconPath) def addToMenu(self, menubar): """ @@ -294,14 +294,14 @@ class Plugin(QtCore.QObject): """ if self.mediaItem: self.mediaItem.initialise() - self.mediadock.insert_dock(self.mediaItem, self.icon, self.weight) + self.mediaDock.insert_dock(self.mediaItem, self.icon, self.weight) def finalise(self): """ Called by the plugin Manager to cleanup things. """ if self.mediaItem: - self.mediadock.remove_dock(self.mediaItem) + self.mediaDock.remove_dock(self.mediaItem) def appStartup(self): """ diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index cb5b1a5a5..39f69dda6 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -236,18 +236,18 @@ class Renderer(object): # the first two slides (and neglect the last for now). if len(slides) == 3: html_text = expand_tags(u'\n'.join(slides[:2])) - # We check both slides to determine if the virtual break is - # needed (there is only one virtual break). + # We check both slides to determine if the optional break is + # needed (there is only one optional break). else: html_text = expand_tags(u'\n'.join(slides)) html_text = html_text.replace(u'\n', u'
') if self._text_fits_on_slide(html_text): - # The first two virtual slides fit (as a whole) on one + # The first two optional slides fit (as a whole) on one # slide. Replace the first occurrence of [---]. text = text.replace(u'\n[---]', u'', 1) else: - # The first virtual slide fits, which means we have to - # render the first virtual slide. + # The first optional slide fits, which means we have to + # render the first optional slide. text_contains_break = u'[---]' in text if text_contains_break: try: diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index 61ee87d51..c5ca8dca5 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -47,7 +47,7 @@ class SettingsTab(QtGui.QWidget): self.tabTitleVisible = visible_title self.settingsSection = self.tabTitle.lower() if icon_path: - self.icon_path = icon_path + self.iconPath = icon_path self.setupUi() self.retranslateUi() self.initialise() diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 7f411f3dc..c4b1181b1 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -124,7 +124,7 @@ class UiStrings(object): self.Settings = translate('OpenLP.Ui', 'Settings') self.SaveService = translate('OpenLP.Ui', 'Save Service') self.Service = translate('OpenLP.Ui', 'Service') - self.Split = translate('OpenLP.Ui', '&Split') + self.Split = translate('OpenLP.Ui', 'Optional &Split') self.SplitToolTip = translate('OpenLP.Ui', 'Split a slide into two ' 'only if it does not fit on the screen as one slide.') self.StartTimeCode = unicode(translate('OpenLP.Ui', 'Start %s')) @@ -143,6 +143,7 @@ class UiStrings(object): self.View = translate('OpenLP.Ui', 'View') self.ViewMode = translate('OpenLP.Ui', 'View Mode') + def add_welcome_page(parent, image): """ Generate an opening welcome page for a wizard using a provided image. @@ -170,6 +171,7 @@ def add_welcome_page(parent, image): parent.welcomeLayout.addStretch() parent.addPage(parent.welcomePage) + def create_button_box(dialog, name, standard_buttons, custom_buttons=[]): """ Creates a QDialogButtonBox with the given buttons. The ``accepted()`` and @@ -216,6 +218,7 @@ def create_button_box(dialog, name, standard_buttons, custom_buttons=[]): dialog.reject) return button_box + def critical_error_message_box(title=None, message=None, parent=None, question=False): """ @@ -242,6 +245,7 @@ def critical_error_message_box(title=None, message=None, parent=None, data[u'title'] = title if title else UiStrings().Error return Receiver.send_message(u'openlp_error_message', data) + def create_horizontal_adjusting_combo_box(parent, name): """ Creates a QComboBox with adapting width for media items. @@ -258,6 +262,7 @@ def create_horizontal_adjusting_combo_box(parent, name): combo.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) return combo + def create_button(parent, name, **kwargs): """ Return an button with the object name set and the given parameters. @@ -324,6 +329,7 @@ def create_button(parent, name, **kwargs): log.warn(u'Parameter %s was not consumed in create_button().', key) return button + def create_action(parent, name, **kwargs): """ Return an action with the object name set and the given parameters. @@ -411,6 +417,7 @@ def create_action(parent, name, **kwargs): log.warn(u'Parameter %s was not consumed in create_action().', key) return action + def create_widget_action(parent, name=u'', **kwargs): """ Return a new QAction by calling ``create_action(parent, name, **kwargs)``. @@ -422,6 +429,7 @@ def create_widget_action(parent, name=u'', **kwargs): parent.addAction(action) return action + def set_case_insensitive_completer(cache, widget): """ Sets a case insensitive text completer for a widget. @@ -436,6 +444,7 @@ def set_case_insensitive_completer(cache, widget): completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) widget.setCompleter(completer) + def create_valign_selection_widgets(parent): """ Creates a standard label and combo box for asking users to select a @@ -455,6 +464,7 @@ def create_valign_selection_widgets(parent): label.setBuddy(combo_box) return label, combo_box + def find_and_set_in_combo_box(combo_box, value_to_find): """ Find a string in a combo box and set it as the selected item if present diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 9783c31b0..8b60a55ee 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -59,7 +59,7 @@ class AdvancedTab(SettingsTab): '#strftime-strptime-behavior for more information.')) self.defaultImage = u':/graphics/openlp-splash-screen.png' self.defaultColor = u'#ffffff' - self.icon_path = u':/system/system_settings.png' + self.iconPath = u':/system/system_settings.png' advanced_translated = translate('OpenLP.AdvancedTab', 'Advanced') SettingsTab.__init__(self, parent, u'Advanced', advanced_translated) diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index ed720581c..7ea3a5bc1 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -77,6 +77,8 @@ try: UNO_VERSION = node.getByName(u'ooSetupVersion') except ImportError: UNO_VERSION = u'-' +except: + UNO_VERSION = u'- (Possible non-standard UNO installation)' try: WEBKIT_VERSION = QtWebKit.qWebKitVersion() except AttributeError: diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 423c6239f..baf28f40f 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -43,7 +43,7 @@ class GeneralTab(SettingsTab): Initialise the general settings tab """ self.screens = ScreenList.get_instance() - self.icon_path = u':/icon/openlp-logo-16x16.png' + self.iconPath = u':/icon/openlp-logo-16x16.png' generalTranslated = translate('OpenLP.GeneralTab', 'General') SettingsTab.__init__(self, parent, u'General', generalTranslated) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 9662a8fcc..0ebf66aab 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -554,9 +554,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): # (not for use by plugins) self.uiSettingsSection = u'user interface' self.generalSettingsSection = u'general' - self.advancedlSettingsSection = u'advanced' + self.advancedSettingsSection = u'advanced' self.shortcutsSettingsSection = u'shortcuts' - self.servicemanagerSettingsSection = u'servicemanager' + self.serviceManagerSettingsSection = u'servicemanager' self.songsSettingsSection = u'songs' self.themesSettingsSection = u'themes' self.displayTagsSection = u'displayTags' @@ -568,8 +568,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.shortcutForm = ShortcutListForm(self) self.recentFiles = QtCore.QStringList() # Set up the path with plugins - pluginpath = AppLocation.get_directory(AppLocation.PluginsDir) - self.pluginManager = PluginManager(pluginpath) + plugin_path = AppLocation.get_directory(AppLocation.PluginsDir) + self.pluginManager = PluginManager(plugin_path) self.pluginHelpers = {} self.imageManager = ImageManager() self.mediaController = MediaController(self) @@ -661,7 +661,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.pluginHelpers[u'pluginmanager'] = self.pluginManager self.pluginHelpers[u'formparent'] = self self.pluginHelpers[u'mediacontroller'] = self.mediaController - self.pluginManager.find_plugins(pluginpath, self.pluginHelpers) + self.pluginManager.find_plugins(plugin_path, self.pluginHelpers) # hook methods have to happen after find_plugins. Find plugins needs # the controllers hence the hooks have moved from setupUI() to here # Find and insert settings tabs @@ -944,10 +944,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): setting_sections = [] # Add main sections. setting_sections.extend([self.generalSettingsSection]) - setting_sections.extend([self.advancedlSettingsSection]) + setting_sections.extend([self.advancedSettingsSection]) setting_sections.extend([self.uiSettingsSection]) setting_sections.extend([self.shortcutsSettingsSection]) - setting_sections.extend([self.servicemanagerSettingsSection]) + setting_sections.extend([self.serviceManagerSettingsSection]) setting_sections.extend([self.themesSettingsSection]) setting_sections.extend([self.displayTagsSection]) setting_sections.extend([self.headerSection]) @@ -1027,10 +1027,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): setting_sections = [] # Add main sections. setting_sections.extend([self.generalSettingsSection]) - setting_sections.extend([self.advancedlSettingsSection]) + setting_sections.extend([self.advancedSettingsSection]) setting_sections.extend([self.uiSettingsSection]) setting_sections.extend([self.shortcutsSettingsSection]) - setting_sections.extend([self.servicemanagerSettingsSection]) + setting_sections.extend([self.serviceManagerSettingsSection]) setting_sections.extend([self.themesSettingsSection]) setting_sections.extend([self.displayTagsSection]) # Add plugin sections. @@ -1314,10 +1314,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): u'/enable slide loop'): if QtCore.QSettings().value(self.generalSettingsSection + u'/enable slide loop', QtCore.QVariant(True)).toBool(): - QtCore.QSettings().setValue(self.advancedlSettingsSection + + QtCore.QSettings().setValue(self.advancedSettingsSection + u'/slide limits', QtCore.QVariant(SlideLimits.Wrap)) else: - QtCore.QSettings().setValue(self.advancedlSettingsSection + + QtCore.QSettings().setValue(self.advancedSettingsSection + u'/slide limits', QtCore.QVariant(SlideLimits.End)) QtCore.QSettings().remove(self.generalSettingsSection + u'/enable slide loop') diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 74e4e6ee8..deb2b306f 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -105,6 +105,7 @@ class ServiceManager(QtGui.QWidget): self.suffixes = [] self.dropPosition = 0 self.expandTabs = False + self.serviceId = 0 # is a new service and has not been saved self._modified = False self._fileName = u'' @@ -271,7 +272,7 @@ class ServiceManager(QtGui.QWidget): QtCore.SIGNAL(u'service_item_update'), self.serviceItemUpdate) # Last little bits of setting up self.service_theme = unicode(QtCore.QSettings().value( - self.mainwindow.servicemanagerSettingsSection + u'/service theme', + self.mainwindow.serviceManagerSettingsSection + u'/service theme', QtCore.QVariant(u'')).toString()) self.servicePath = AppLocation.get_section_data_path(u'servicemanager') # build the drag and drop context menu @@ -331,6 +332,8 @@ class ServiceManager(QtGui.QWidget): Setter for property "modified". Sets whether or not the current service has been modified. """ + if modified: + self.serviceId += 1 self._modified = modified serviceFile = self.shortFileName() or translate( 'OpenLP.ServiceManager', 'Untitled Service') @@ -408,7 +411,7 @@ class ServiceManager(QtGui.QWidget): self.mainwindow, translate('OpenLP.ServiceManager', 'Open File'), SettingsManager.get_last_dir( - self.mainwindow.servicemanagerSettingsSection), + self.mainwindow.serviceManagerSettingsSection), translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz)'))) if not fileName: @@ -416,7 +419,7 @@ class ServiceManager(QtGui.QWidget): else: fileName = loadFile SettingsManager.set_last_dir( - self.mainwindow.servicemanagerSettingsSection, + self.mainwindow.serviceManagerSettingsSection, split_filename(fileName)[0]) self.loadFile(fileName) @@ -439,6 +442,7 @@ class ServiceManager(QtGui.QWidget): self.serviceManagerList.clear() self.serviceItems = [] self.setFileName(u'') + self.serviceId += 1 self.setModified(False) QtCore.QSettings(). \ setValue(u'servicemanager/last file',QtCore.QVariant(u'')) @@ -465,7 +469,7 @@ class ServiceManager(QtGui.QWidget): service_file_name = '%s.osd' % basename log.debug(u'ServiceManager.saveFile - %s', path_file_name) SettingsManager.set_last_dir( - self.mainwindow.servicemanagerSettingsSection, + self.mainwindow.serviceManagerSettingsSection, path) service = [] write_list = [] @@ -618,7 +622,7 @@ class ServiceManager(QtGui.QWidget): else: default_filename = u'' directory = unicode(SettingsManager.get_last_dir( - self.mainwindow.servicemanagerSettingsSection)) + self.mainwindow.serviceManagerSettingsSection)) path = os.path.join(directory, default_filename) fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.mainwindow, UiStrings().SaveService, path, @@ -1103,7 +1107,7 @@ class ServiceManager(QtGui.QWidget): self.service_theme = unicode(self.themeComboBox.currentText()) self.mainwindow.renderer.set_service_theme(self.service_theme) QtCore.QSettings().setValue( - self.mainwindow.servicemanagerSettingsSection + + self.mainwindow.serviceManagerSettingsSection + u'/service theme', QtCore.QVariant(self.service_theme)) self.regenerateServiceItems(True) diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index b2e09e809..b6808030a 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -65,8 +65,8 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): self.insertTab(self.advancedTab, 2, PluginStatus.Active) count = 3 for plugin in self.plugins: - if plugin.settings_tab: - self.insertTab(plugin.settings_tab, count, plugin.status) + if plugin.settingsTab: + self.insertTab(plugin.settingsTab, count, plugin.status) count += 1 self.settingListWidget.setCurrentRow(0) return QtGui.QDialog.exec_(self) @@ -80,7 +80,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): pos = self.stackedLayout.addWidget(tab) if is_active: item_name = QtGui.QListWidgetItem(tab.tabTitleVisible) - icon = build_icon(tab.icon_path) + icon = build_icon(tab.iconPath) item_name.setIcon(icon) self.settingListWidget.insertItem(location, item_name) else: @@ -114,8 +114,8 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): self.themesTab.postSetUp() self.advancedTab.postSetUp() for plugin in self.plugins: - if plugin.settings_tab: - plugin.settings_tab.postSetUp() + if plugin.settingsTab: + plugin.settingsTab.postSetUp() def tabChanged(self, tabIndex): """ diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 523bf9664..a1b3a84b2 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -648,8 +648,8 @@ class SlideController(Controller): def onSongBarHandler(self): request = unicode(self.sender().text()) - slideno = self.slideList[request] - self.__updatePreviewSelection(slideno) + slide_no = self.slideList[request] + self.__updatePreviewSelection(slide_no) self.slideSelected() def receiveSpinDelay(self, value): @@ -663,7 +663,7 @@ class SlideController(Controller): Updates the Slide Limits variable from the settings. """ self.slide_limits = QtCore.QSettings().value( - self.parent().advancedlSettingsSection + u'/slide limits', + self.parent().advancedSettingsSection + u'/slide limits', QtCore.QVariant(SlideLimits.End)).toInt()[0] def enableToolBar(self, item): diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index e6003f75d..f763a9e74 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -39,7 +39,7 @@ class ThemesTab(SettingsTab): self.mainwindow = mainwindow generalTranslated = translate('OpenLP.ThemesTab', 'Themes') SettingsTab.__init__(self, parent, u'Themes', generalTranslated) - self.icon_path = u':/themes/theme_new.png' + self.iconPath = u':/themes/theme_new.png' def setupUi(self): self.setObjectName(u'ThemesTab') diff --git a/openlp/core/ui/wizard.py b/openlp/core/ui/wizard.py index 305e85f24..5369c9799 100644 --- a/openlp/core/ui/wizard.py +++ b/openlp/core/ui/wizard.py @@ -46,6 +46,7 @@ class WizardStrings(object): # the writers translating their own product name. CCLI = u'CCLI/SongSelect' CSV = u'CSV' + DB = u'DreamBeam' EW = u'EasyWorship' ES = u'EasySlides' FP = u'Foilpresenter' diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 05ba2e8bb..ebaabb214 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -117,8 +117,8 @@ class AlertsPlugin(Plugin): Plugin.__init__(self, u'alerts', plugin_helpers, settings_tab_class=AlertsTab) self.weight = -3 - self.icon_path = u':/plugins/plugin_alerts.png' - self.icon = build_icon(self.icon_path) + self.iconPath = u':/plugins/plugin_alerts.png' + self.icon = build_icon(self.iconPath) self.alertsmanager = AlertsManager(self) self.manager = Manager(u'alerts', init_schema) self.alertForm = AlertForm(self) @@ -197,10 +197,10 @@ class AlertsPlugin(Plugin): """ Add CSS to the main display. """ - align = VerticalType.Names[self.settings_tab.location] - return CSS % (align, self.settings_tab.font_face, - self.settings_tab.font_size, self.settings_tab.font_color, - self.settings_tab.bg_color) + align = VerticalType.Names[self.settingsTab.location] + return CSS % (align, self.settingsTab.font_face, + self.settingsTab.font_size, self.settingsTab.font_color, + self.settingsTab.bg_color) def getDisplayHtml(self): """ @@ -215,7 +215,7 @@ class AlertsPlugin(Plugin): ``frame`` The Web frame holding the page. """ - align = VerticalType.Names[self.settings_tab.location] + align = VerticalType.Names[self.settingsTab.location] frame.evaluateJavaScript(u'update_css("%s", "%s", "%s", "%s", "%s")' % - (align, self.settings_tab.font_face, self.settings_tab.font_size, - self.settings_tab.font_color, self.settings_tab.bg_color)) + (align, self.settingsTab.font_face, self.settingsTab.font_size, + self.settingsTab.font_color, self.settingsTab.bg_color)) diff --git a/openlp/plugins/alerts/forms/alertform.py b/openlp/plugins/alerts/forms/alertform.py index 188914c5d..d2d4813a1 100644 --- a/openlp/plugins/alerts/forms/alertform.py +++ b/openlp/plugins/alerts/forms/alertform.py @@ -43,7 +43,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog): self.manager = plugin.manager self.plugin = plugin self.item_id = None - QtGui.QDialog.__init__(self, plugin.formparent) + QtGui.QDialog.__init__(self, plugin.formParent) self.setupUi(self) QtCore.QObject.connect(self.displayButton, QtCore.SIGNAL(u'clicked()'), self.onDisplayClicked) diff --git a/openlp/plugins/alerts/lib/alertsmanager.py b/openlp/plugins/alerts/lib/alertsmanager.py index 7c92df75e..7e90b3965 100644 --- a/openlp/plugins/alerts/lib/alertsmanager.py +++ b/openlp/plugins/alerts/lib/alertsmanager.py @@ -84,7 +84,7 @@ class AlertsManager(QtCore.QObject): if not self.alertList: return text = self.alertList.pop(0) - alertTab = self.parent().settings_tab + alertTab = self.parent().settingsTab self.parent().liveController.display.alert(text, alertTab.location) # Check to see if we have a timer running. if self.timer_id == 0: @@ -100,7 +100,7 @@ class AlertsManager(QtCore.QObject): """ log.debug(u'timer event') if event.timerId() == self.timer_id: - alertTab = self.parent().settings_tab + alertTab = self.parent().settingsTab self.parent().liveController.display.alert(u'', alertTab.location) self.killTimer(self.timer_id) self.timer_id = 0 diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 4b8b322ac..06d8b1c98 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -27,7 +27,7 @@ import logging -from PyQt4 import QtGui +from PyQt4 import QtCore, QtGui from openlp.core.lib import Plugin, StringContent, build_icon, translate from openlp.core.lib.ui import create_action, UiStrings @@ -44,8 +44,8 @@ class BiblePlugin(Plugin): Plugin.__init__(self, u'bibles', plugin_helpers, BibleMediaItem, BiblesTab) self.weight = -9 - self.icon_path = u':/plugins/plugin_bibles.png' - self.icon = build_icon(self.icon_path) + self.iconPath = u':/plugins/plugin_bibles.png' + self.icon = build_icon(self.iconPath) self.manager = None def initialise(self): @@ -81,16 +81,23 @@ class BiblePlugin(Plugin): def appStartup(self): """ - Perform tasks on application starup + Perform tasks on application startup """ if len(self.manager.old_bible_databases): - if QtGui.QMessageBox.information(self.formparent, + if QtGui.QMessageBox.information(self.formParent, translate('OpenLP', 'Information'), translate('OpenLP', 'Bible format has changed.\nYou have to upgrade your ' 'existing Bibles.\nShould OpenLP upgrade now?'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) == QtGui.QMessageBox.Yes: self.onToolsUpgradeItemTriggered() + settings = QtCore.QSettings() + settings.beginGroup(self.settingsSection) + if settings.contains(u'bookname language'): + settings.setValue(u'book name language', settings.value( + u'bookname language', QtCore.QVariant(0)).toInt()[0]) + settings.remove(u'bookname language') + settings.endGroup() def addImportMenuItem(self, import_menu): self.importBibleItem = create_action(import_menu, u'importBibleItem', @@ -126,7 +133,7 @@ class BiblePlugin(Plugin): Upgrade older bible databases. """ if not hasattr(self, u'upgrade_wizard'): - self.upgrade_wizard = BibleUpgradeForm(self.formparent, + self.upgrade_wizard = BibleUpgradeForm(self.formParent, self.manager, self) # If the import was not cancelled then reload. if self.upgrade_wizard.exec_(): @@ -148,7 +155,7 @@ class BiblePlugin(Plugin): Returns ``True`` if the theme is being used, otherwise returns ``False``. """ - return unicode(self.settings_tab.bible_theme) == theme + return unicode(self.settingsTab.bible_theme) == theme def renameTheme(self, oldTheme, newTheme): """ @@ -162,8 +169,8 @@ class BiblePlugin(Plugin): ``newTheme`` The new name the plugin should now use. """ - self.settings_tab.bible_theme = newTheme - self.settings_tab.save() + self.settingsTab.bible_theme = newTheme + self.settingsTab.save() def setPluginTextStrings(self): """ diff --git a/openlp/plugins/bibles/forms/__init__.py b/openlp/plugins/bibles/forms/__init__.py index 69cc839fb..710ca2c92 100644 --- a/openlp/plugins/bibles/forms/__init__.py +++ b/openlp/plugins/bibles/forms/__init__.py @@ -55,6 +55,7 @@ from booknameform import BookNameForm from languageform import LanguageForm from bibleimportform import BibleImportForm from bibleupgradeform import BibleUpgradeForm +from editbibleform import EditBibleForm __all__ = [u'BookNameForm', u'LanguageForm', u'BibleImportForm', - u'BibleUpgradeForm'] + u'BibleUpgradeForm', u'EditBibleForm'] diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index ee7b5a063..cc50fdf9b 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -29,7 +29,6 @@ The bible import functions for OpenLP """ import logging import os -import os.path import locale from PyQt4 import QtCore, QtGui diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index 7c7f14979..0ef418de8 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -371,7 +371,7 @@ class BibleUpgradeForm(OpenLPWizard): """ Perform the actual upgrade. """ - self.include_webbible = False + self.includeWebBible = False proxy_server = None if not self.files: self.progressLabel.setText( @@ -383,14 +383,14 @@ class BibleUpgradeForm(OpenLPWizard): for number, file in enumerate(self.files): if self.checkBox[number].checkState() == QtCore.Qt.Checked: max_bibles += 1 - oldBible = None + old_bible = None for number, filename in enumerate(self.files): # Close the previous bible's connection. - if oldBible is not None: - oldBible.close_connection() + if old_bible is not None: + old_bible.close_connection() # Set to None to make obvious that we have already closed the # database. - oldBible = None + old_bible = None if self.stop_import_flag: self.success[number] = False break @@ -398,7 +398,7 @@ class BibleUpgradeForm(OpenLPWizard): self.success[number] = False continue self.progressBar.reset() - oldBible = OldBibleDB(self.mediaItem, path=self.temp_dir, + old_bible = OldBibleDB(self.mediaItem, path=self.temp_dir, file=filename[0]) name = filename[1] self.progressLabel.setText(unicode(translate( @@ -408,33 +408,39 @@ class BibleUpgradeForm(OpenLPWizard): self.newbibles[number] = BibleDB(self.mediaItem, path=self.path, name=name, file=filename[0]) self.newbibles[number].register(self.plugin.upgrade_wizard) - metadata = oldBible.get_metadata() - webbible = False + metadata = old_bible.get_metadata() + web_bible = False meta_data = {} for meta in metadata: + # Upgrade the names of the metadata keys + if meta[u'key'] == u'Version': + meta[u'key'] = u'name' + if meta[u'key'] == u'Bookname language': + meta[u'key'] = 'book_name_language' + meta[u'key'] = meta[u'key'].lower().replace(' ', '_') + # Copy the metadata meta_data[meta[u'key']] = meta[u'value'] - if not meta[u'key'] == u'Version' and not meta[u'key'] == \ - u'dbversion': - self.newbibles[number].create_meta(meta[u'key'], + if meta[u'key'] != u'name' and meta[u'key'] != u'dbversion': + self.newbibles[number].save_meta(meta[u'key'], meta[u'value']) - if meta[u'key'] == u'download source': - webbible = True - self.include_webbible = True - if meta.has_key(u'proxy server'): - proxy_server = meta[u'proxy server'] - if webbible: - if meta_data[u'download source'].lower() == u'crosswalk': + if meta[u'key'] == u'download_source': + web_bible = True + self.includeWebBible = True + if meta.has_key(u'proxy_server'): + proxy_server = meta[u'proxy_server'] + if web_bible: + if meta_data[u'download_source'].lower() == u'crosswalk': handler = CWExtract(proxy_server) - elif meta_data[u'download source'].lower() == u'biblegateway': + elif meta_data[u'download_source'].lower() == u'biblegateway': handler = BGExtract(proxy_server) - elif meta_data[u'download source'].lower() == u'bibleserver': + elif meta_data[u'download_source'].lower() == u'bibleserver': handler = BSExtract(proxy_server) - books = handler.get_books_from_http(meta_data[u'download name']) + books = handler.get_books_from_http(meta_data[u'download_name']) if not books: log.error(u'Upgrading books from %s - download '\ u'name: "%s" failed' % ( - meta_data[u'download source'], - meta_data[u'download name'])) + meta_data[u'download_source'], + meta_data[u'download_name'])) self.newbibles[number].session.close() del self.newbibles[number] critical_error_message_box( @@ -451,11 +457,11 @@ class BibleUpgradeForm(OpenLPWizard): self.success[number] = False continue bible = BiblesResourcesDB.get_webbible( - meta_data[u'download name'], - meta_data[u'download source'].lower()) + meta_data[u'download_name'], + meta_data[u'download_source'].lower()) if bible and bible[u'language_id']: language_id = bible[u'language_id'] - self.newbibles[number].create_meta(u'language_id', + self.newbibles[number].save_meta(u'language_id', language_id) else: language_id = self.newbibles[number].get_language(name) @@ -485,8 +491,8 @@ class BibleUpgradeForm(OpenLPWizard): if not book_ref_id: log.warn(u'Upgrading books from %s - download '\ u'name: "%s" aborted by user' % ( - meta_data[u'download source'], - meta_data[u'download name'])) + meta_data[u'download_source'], + meta_data[u'download_name'])) self.newbibles[number].session.close() del self.newbibles[number] self.success[number] = False @@ -495,9 +501,9 @@ class BibleUpgradeForm(OpenLPWizard): db_book = self.newbibles[number].create_book(book, book_ref_id, book_details[u'testament_id']) # Try to import already downloaded verses. - oldbook = oldBible.get_book(book) + oldbook = old_bible.get_book(book) if oldbook: - verses = oldBible.get_verses(oldbook[u'id']) + verses = old_bible.get_verses(oldbook[u'id']) if not verses: log.warn(u'No verses found to import for book ' u'"%s"', book) @@ -527,7 +533,7 @@ class BibleUpgradeForm(OpenLPWizard): self.progressBar.maximum() - self.progressBar.value()) self.success[number] = False continue - books = oldBible.get_books() + books = old_bible.get_books() self.progressBar.setMaximum(len(books)) for book in books: if self.stop_import_flag: @@ -551,7 +557,7 @@ class BibleUpgradeForm(OpenLPWizard): book_details = BiblesResourcesDB.get_book_by_id(book_ref_id) db_book = self.newbibles[number].create_book(book[u'name'], book_ref_id, book_details[u'testament_id']) - verses = oldBible.get_verses(book[u'id']) + verses = old_bible.get_verses(book[u'id']) if not verses: log.warn(u'No verses found to import for book ' u'"%s"', book[u'name']) @@ -574,7 +580,7 @@ class BibleUpgradeForm(OpenLPWizard): self.progressBar.maximum() - self.progressBar.value()) else: self.success[number] = True - self.newbibles[number].create_meta(u'Version', name) + self.newbibles[number].save_meta(u'name', name) self.incrementProgressBar(unicode(translate( 'BiblesPlugin.UpgradeWizardForm', 'Upgrading Bible %s of %s: "%s"\n' @@ -583,8 +589,8 @@ class BibleUpgradeForm(OpenLPWizard): if self.newbibles.has_key(number): self.newbibles[number].session.close() # Close the last bible's connection if possible. - if oldBible is not None: - oldBible.close_connection() + if old_bible is not None: + old_bible.close_connection() def postWizard(self): """ @@ -608,7 +614,7 @@ class BibleUpgradeForm(OpenLPWizard): else: failed_import_text = u'' if successful_import > 0: - if self.include_webbible: + if self.includeWebBible: self.progressLabel.setText(unicode( translate('BiblesPlugin.UpgradeWizardForm', 'Upgrading ' 'Bible(s): %s successful%s\nPlease note that verses from ' diff --git a/openlp/plugins/bibles/forms/booknamedialog.py b/openlp/plugins/bibles/forms/booknamedialog.py index db056cce3..b0ab9ade1 100644 --- a/openlp/plugins/bibles/forms/booknamedialog.py +++ b/openlp/plugins/bibles/forms/booknamedialog.py @@ -90,7 +90,7 @@ class Ui_BookNameDialog(object): 'Select Book Name')) self.infoLabel.setText(translate('BiblesPlugin.BookNameDialog', 'The following book name cannot be matched up internally. Please ' - 'select the corresponding English name from the list.')) + 'select the corresponding name from the list.')) self.currentLabel.setText(translate('BiblesPlugin.BookNameDialog', 'Current name:')) self.correspondingLabel.setText(translate( diff --git a/openlp/plugins/bibles/forms/booknameform.py b/openlp/plugins/bibles/forms/booknameform.py index f08d2c637..493dc9c1d 100644 --- a/openlp/plugins/bibles/forms/booknameform.py +++ b/openlp/plugins/bibles/forms/booknameform.py @@ -28,6 +28,7 @@ Module implementing BookNameForm. """ import logging +import re from PyQt4.QtGui import QDialog from PyQt4 import QtCore @@ -36,6 +37,7 @@ from openlp.core.lib import translate from openlp.core.lib.ui import critical_error_message_box from openlp.plugins.bibles.forms.booknamedialog import \ Ui_BookNameDialog +from openlp.plugins.bibles.lib import BibleStrings from openlp.plugins.bibles.lib.db import BiblesResourcesDB log = logging.getLogger(__name__) @@ -54,6 +56,8 @@ class BookNameForm(QDialog, Ui_BookNameDialog): QDialog.__init__(self, parent) self.setupUi(self) self.customSignals() + self.book_names = BibleStrings().BookNames + self.book_id = False def customSignals(self): """ @@ -97,7 +101,8 @@ class BookNameForm(QDialog, Ui_BookNameDialog): and item[u'testament_id'] == 3: addBook = False if addBook: - self.correspondingComboBox.addItem(item[u'name']) + self.correspondingComboBox.addItem( + self.book_names[item[u'abbreviation']]) def exec_(self, name, books, maxbooks): self.books = books @@ -120,4 +125,13 @@ class BookNameForm(QDialog, Ui_BookNameDialog): self.correspondingComboBox.setFocus() return False else: + cor_book = unicode(self.correspondingComboBox.currentText()) + for character in u'\\.^$*+?{}[]()': + cor_book = cor_book.replace(character, u'\\' + character) + books = filter(lambda key: + re.match(cor_book, unicode(self.book_names[key]), re.UNICODE), + self.book_names.keys()) + books = filter(None, map(BiblesResourcesDB.get_book, books)) + if books: + self.book_id = books[0][u'id'] return QDialog.accept(self) diff --git a/openlp/plugins/bibles/forms/editbibledialog.py b/openlp/plugins/bibles/forms/editbibledialog.py new file mode 100644 index 000000000..489057c22 --- /dev/null +++ b/openlp/plugins/bibles/forms/editbibledialog.py @@ -0,0 +1,181 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # +# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # +# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # +# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +from PyQt4 import QtCore, QtGui + +from openlp.core.lib import build_icon, translate +from openlp.core.lib.ui import create_button_box +from openlp.plugins.bibles.lib import LanguageSelection, BibleStrings +from openlp.plugins.bibles.lib.db import BiblesResourcesDB + + +class Ui_EditBibleDialog(object): + def setupUi(self, editBibleDialog): + editBibleDialog.setObjectName(u'editBibleDialog') + editBibleDialog.resize(520, 400) + editBibleDialog.setWindowIcon( + build_icon(u':/icon/openlp-logo-16x16.png')) + editBibleDialog.setModal(True) + self.dialogLayout = QtGui.QVBoxLayout(editBibleDialog) + self.dialogLayout.setSpacing(8) + self.dialogLayout.setContentsMargins(8, 8, 8, 8) + self.dialogLayout.setObjectName(u'dialogLayout') + self.bibleTabWidget = QtGui.QTabWidget(editBibleDialog) + self.bibleTabWidget.setObjectName(u'BibleTabWidget') + # Meta tab + self.metaTab = QtGui.QWidget() + self.metaTab.setObjectName(u'metaTab') + self.metaTabLayout = QtGui.QVBoxLayout(self.metaTab) + self.metaTabLayout.setObjectName(u'metaTabLayout') + self.licenseDetailsGroupBox = QtGui.QGroupBox(self.metaTab) + self.licenseDetailsGroupBox.setObjectName(u'licenseDetailsGroupBox') + self.licenseDetailsLayout = QtGui.QFormLayout( + self.licenseDetailsGroupBox) + self.licenseDetailsLayout.setObjectName(u'licenseDetailsLayout') + self.versionNameLabel = QtGui.QLabel(self.licenseDetailsGroupBox) + self.versionNameLabel.setObjectName(u'versionNameLabel') + self.versionNameEdit = QtGui.QLineEdit(self.licenseDetailsGroupBox) + self.versionNameEdit.setObjectName(u'versionNameEdit') + self.versionNameLabel.setBuddy(self.versionNameEdit) + self.licenseDetailsLayout.addRow(self.versionNameLabel, + self.versionNameEdit) + self.copyrightLabel = QtGui.QLabel(self.licenseDetailsGroupBox) + self.copyrightLabel.setObjectName(u'copyrightLabel') + self.copyrightEdit = QtGui.QLineEdit(self.licenseDetailsGroupBox) + self.copyrightEdit.setObjectName(u'copyrightEdit') + self.copyrightLabel.setBuddy(self.copyrightEdit) + self.licenseDetailsLayout.addRow(self.copyrightLabel, + self.copyrightEdit) + self.permissionsLabel = QtGui.QLabel(self.licenseDetailsGroupBox) + self.permissionsLabel.setObjectName(u'permissionsLabel') + self.permissionsEdit = QtGui.QLineEdit(self.licenseDetailsGroupBox) + self.permissionsEdit.setObjectName(u'permissionsEdit') + self.permissionsLabel.setBuddy(self.permissionsEdit) + self.licenseDetailsLayout.addRow(self.permissionsLabel, + self.permissionsEdit) + self.metaTabLayout.addWidget(self.licenseDetailsGroupBox) + self.languageSelectionGroupBox = QtGui.QGroupBox(self.metaTab) + self.languageSelectionGroupBox.setObjectName( + u'languageSelectionGroupBox') + self.languageSelectionLayout = QtGui.QVBoxLayout( + self.languageSelectionGroupBox) + self.languageSelectionLabel = QtGui.QLabel( + self.languageSelectionGroupBox) + self.languageSelectionLabel.setObjectName(u'languageSelectionLabel') + self.languageSelectionComboBox = QtGui.QComboBox( + self.languageSelectionGroupBox) + self.languageSelectionComboBox.setObjectName( + u'languageSelectionComboBox') + self.languageSelectionComboBox.addItems([u'', u'', u'', u'']) + self.languageSelectionLayout.addWidget(self.languageSelectionLabel) + self.languageSelectionLayout.addWidget(self.languageSelectionComboBox) + self.metaTabLayout.addWidget(self.languageSelectionGroupBox) + self.metaTabLayout.addStretch() + self.bibleTabWidget.addTab(self.metaTab, u'') + # Book name tab + self.bookNameTab = QtGui.QWidget() + self.bookNameTab.setObjectName(u'bookNameTab') + self.bookNameTabLayout = QtGui.QVBoxLayout(self.bookNameTab) + self.bookNameTabLayout.setObjectName(u'bookNameTabLayout') + self.bookNameNotice = QtGui.QLabel(self.bookNameTab) + self.bookNameNotice.setObjectName(u'bookNameNotice') + self.bookNameNotice.setWordWrap(True) + self.bookNameTabLayout.addWidget(self.bookNameNotice) + self.scrollArea = QtGui.QScrollArea(self.bookNameTab) + self.scrollArea.setWidgetResizable(True) + self.scrollArea.setObjectName(u'scrollArea') + self.scrollArea.setHorizontalScrollBarPolicy( + QtCore.Qt.ScrollBarAlwaysOff) + self.bookNameWidget = QtGui.QWidget(self.scrollArea) + self.bookNameWidget.setObjectName(u'bookNameWidget') + self.bookNameWidgetLayout = QtGui.QFormLayout(self.bookNameWidget) + self.bookNameWidgetLayout.setObjectName(u'bookNameWidgetLayout') + self.bookNameLabel = {} + self.bookNameEdit= {} + for book in BiblesResourcesDB.get_books(): + self.bookNameLabel[book[u'abbreviation']] = QtGui.QLabel( + self.bookNameWidget) + self.bookNameLabel[book[u'abbreviation']].setObjectName( + u'bookNameLabel[%s]' % book[u'abbreviation']) + self.bookNameEdit[book[u'abbreviation']] = QtGui.QLineEdit( + self.bookNameWidget) + self.bookNameEdit[book[u'abbreviation']].setObjectName( + u'bookNameEdit[%s]' % book[u'abbreviation']) + self.bookNameWidgetLayout.addRow( + self.bookNameLabel[book[u'abbreviation']], + self.bookNameEdit[book[u'abbreviation']]) + self.scrollArea.setWidget(self.bookNameWidget) + self.bookNameTabLayout.addWidget(self.scrollArea) + self.bookNameTabLayout.addStretch() + self.bibleTabWidget.addTab(self.bookNameTab, u'') + # Last few bits + self.dialogLayout.addWidget(self.bibleTabWidget) + self.buttonBox = create_button_box(editBibleDialog, u'buttonBox', + [u'cancel', u'save']) + self.dialogLayout.addWidget(self.buttonBox) + self.retranslateUi(editBibleDialog) + QtCore.QMetaObject.connectSlotsByName(editBibleDialog) + + def retranslateUi(self, editBibleDialog): + self.book_names = BibleStrings().BookNames + editBibleDialog.setWindowTitle( + translate('BiblesPlugin.EditBibleForm', 'Bible Editor')) + # Meta tab + self.bibleTabWidget.setTabText( + self.bibleTabWidget.indexOf(self.metaTab), + translate('SongsPlugin.EditBibleForm', 'Meta Data')) + self.licenseDetailsGroupBox.setTitle( + translate('BiblesPlugin.EditBibleForm', 'License Details')) + self.versionNameLabel.setText( + translate('BiblesPlugin.EditBibleForm', 'Version name:')) + self.copyrightLabel.setText( + translate('BiblesPlugin.EditBibleForm', 'Copyright:')) + self.permissionsLabel.setText( + translate('BiblesPlugin.EditBibleForm', 'Permissions:')) + self.languageSelectionGroupBox.setTitle(translate( + 'BiblesPlugin.EditBibleForm', 'Default Bible Language')) + self.languageSelectionLabel.setText( + translate('BiblesPlugin.EditBibleForm', + 'Book name language in search field, search results and on ' + 'display:')) + self.languageSelectionComboBox.setItemText(0, + translate('BiblesPlugin.EditBibleForm', 'Global Settings')) + self.languageSelectionComboBox.setItemText(LanguageSelection.Bible + 1, + translate('BiblesPlugin.EditBibleForm', 'Bible Language')) + self.languageSelectionComboBox.setItemText( + LanguageSelection.Application + 1, + translate('BiblesPlugin.EditBibleForm', 'Application Language')) + self.languageSelectionComboBox.setItemText( + LanguageSelection.English + 1, + translate('BiblesPlugin.EditBibleForm', 'English')) + # Book name tab + self.bibleTabWidget.setTabText( + self.bibleTabWidget.indexOf(self.bookNameTab), + translate('SongsPlugin.EditBibleForm', 'Custom Book Names')) + for book in BiblesResourcesDB.get_books(): + self.bookNameLabel[book[u'abbreviation']].setText( + u'%s:' % unicode(self.book_names[book[u'abbreviation']])) diff --git a/openlp/plugins/bibles/forms/editbibleform.py b/openlp/plugins/bibles/forms/editbibleform.py new file mode 100644 index 000000000..87ad86200 --- /dev/null +++ b/openlp/plugins/bibles/forms/editbibleform.py @@ -0,0 +1,211 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # +# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # +# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # +# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +import logging +import re + +from PyQt4 import QtGui + +from openlp.core.lib import Receiver, translate +from openlp.core.lib.ui import UiStrings, critical_error_message_box +from editbibledialog import Ui_EditBibleDialog +from openlp.plugins.bibles.lib import BibleStrings +from openlp.plugins.bibles.lib.db import BiblesResourcesDB + +log = logging.getLogger(__name__) + +class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog): + """ + Class to manage the editing of a bible + """ + log.info(u'%s EditBibleForm loaded', __name__) + + def __init__(self, mediaitem, parent, manager): + """ + Constructor + """ + QtGui.QDialog.__init__(self, parent) + self.mediaitem = mediaitem + self.book_names = BibleStrings().BookNames + self.setupUi(self) + self.manager = manager + + def loadBible(self, bible): + """ + Loads a bible. + + ``bible`` + The name of the bible. + """ + log.debug(u'Load Bible') + self.bible = bible + self.versionNameEdit.setText( + self.manager.get_meta_data(self.bible, u'name').value) + self.copyrightEdit.setText( + self.manager.get_meta_data(self.bible, u'copyright').value) + self.permissionsEdit.setText( + self.manager.get_meta_data(self.bible, u'permissions').value) + book_name_language = self.manager.get_meta_data(self.bible, + u'book_name_language') + if book_name_language and book_name_language.value != u'None': + self.languageSelectionComboBox.setCurrentIndex( + int(book_name_language.value) + 1) + self.books = {} + self.webbible = self.manager.get_meta_data(self.bible, + u'download_source') + if self.webbible: + self.bookNameNotice.setText(translate('BiblesPlugin.EditBibleForm', + 'This is a Web Download Bible.\nIt is not possible to ' + 'customize the Book Names.')) + self.scrollArea.hide() + else: + self.bookNameNotice.setText(translate('BiblesPlugin.EditBibleForm', + 'To use the customized book names, "Bible language" must be ' + 'selected on the Meta Data tab or, if "Global settings" is ' + 'selected, on the Bible page in Configure OpenLP.')) + for book in BiblesResourcesDB.get_books(): + self.books[book[u'abbreviation']] = self.manager.get_book_by_id( + self.bible, book[u'id']) + if self.books[book[u'abbreviation']] and not self.webbible: + self.bookNameEdit[book[u'abbreviation']].setText( + self.books[book[u'abbreviation']].name) + else: + # It is nessecary to remove the Widget otherwise there still + # exists the vertical spacing in QFormLayout + self.bookNameWidgetLayout.removeWidget( + self.bookNameLabel[book[u'abbreviation']]) + self.bookNameLabel[book[u'abbreviation']].hide() + self.bookNameWidgetLayout.removeWidget( + self.bookNameEdit[book[u'abbreviation']]) + self.bookNameEdit[book[u'abbreviation']].hide() + + def reject(self): + """ + Exit Dialog and do not save + """ + log.debug(u'BibleEditForm.reject') + self.bible = None + QtGui.QDialog.reject(self) + + def accept(self): + """ + Exit Dialog and save data + """ + log.debug(u'BibleEditForm.accept') + version = unicode(self.versionNameEdit.text()) + copyright = unicode(self.copyrightEdit.text()) + permissions = unicode(self.permissionsEdit.text()) + book_name_language = self.languageSelectionComboBox.currentIndex() - 1 + if book_name_language == -1: + book_name_language = None + if not self.validateMeta(version, copyright): + return + if not self.webbible: + custom_names = {} + for abbr, book in self.books.iteritems(): + if book: + custom_names[abbr] = unicode(self.bookNameEdit[abbr].text()) + if book.name != custom_names[abbr]: + if not self.validateBook(custom_names[abbr], abbr): + return + Receiver.send_message(u'openlp_process_events') + Receiver.send_message(u'cursor_busy') + self.manager.save_meta_data(self.bible, version, copyright, permissions, + book_name_language) + if not self.webbible: + for abbr, book in self.books.iteritems(): + if book: + if book.name != custom_names[abbr]: + book.name = custom_names[abbr] + self.manager.update_book(self.bible, book) + self.bible = None + Receiver.send_message(u'cursor_normal') + QtGui.QDialog.accept(self) + + def validateMeta(self, name, copyright): + """ + Validate the Meta before saving. + """ + if not name: + self.versionNameEdit.setFocus() + critical_error_message_box(UiStrings().EmptyField, + translate('BiblesPlugin.BibleEditForm', + 'You need to specify a version name for your Bible.')) + return False + elif not copyright: + self.copyrightEdit.setFocus() + critical_error_message_box(UiStrings().EmptyField, + translate('BiblesPlugin.BibleEditForm', + 'You need to set a copyright for your Bible. ' + 'Bibles in the Public Domain need to be marked as such.')) + return False + elif self.manager.exists(name) and \ + self.manager.get_meta_data(self.bible, u'name').value != \ + name: + self.versionNameEdit.setFocus() + critical_error_message_box( + translate('BiblesPlugin.BibleEditForm', 'Bible Exists'), + translate('BiblesPlugin.BibleEditForm', + 'This Bible already exists. Please import ' + 'a different Bible or first delete the existing one.')) + return False + return True + + def validateBook(self, new_book_name, abbreviation): + """ + Validate a book. + """ + book_regex = re.compile(u'[\d]*[^\d]+$') + if not new_book_name: + self.bookNameEdit[abbreviation].setFocus() + critical_error_message_box(UiStrings().EmptyField, + unicode(translate('BiblesPlugin.BibleEditForm', + 'You need to specify a book name for "%s".')) % + self.book_names[abbreviation]) + return False + elif not book_regex.match(new_book_name): + self.bookNameEdit[abbreviation].setFocus() + critical_error_message_box(UiStrings().EmptyField, + unicode(translate('BiblesPlugin.BibleEditForm', + 'The book name "%s" is not correct.\nNumbers can only be used ' + 'at the beginning and must\nbe followed by one or more ' + 'non-numeric characters.')) % new_book_name) + return False + for abbr, book in self.books.iteritems(): + if book: + if abbr == abbreviation: + continue + if unicode(self.bookNameEdit[abbr].text()) == new_book_name: + self.bookNameEdit[abbreviation].setFocus() + critical_error_message_box( + translate('BiblesPlugin.BibleEditForm', + 'Duplicate Book Name'), + unicode(translate('BiblesPlugin.BibleEditForm', + 'The Book Name "%s" has been entered more than once.')) + % new_book_name) + return False + return True diff --git a/openlp/plugins/bibles/lib/__init__.py b/openlp/plugins/bibles/lib/__init__.py index 4eccc087f..4f8582bdf 100644 --- a/openlp/plugins/bibles/lib/__init__.py +++ b/openlp/plugins/bibles/lib/__init__.py @@ -88,7 +88,7 @@ class BibleStrings(object): """ These strings should need a good reason to be retranslated elsewhere. """ - self.Booknames = { + self.BookNames = { u'Gen': translate('BiblesPlugin', 'Genesis'), u'Exod': translate('BiblesPlugin', 'Exodus'), u'Lev': translate('BiblesPlugin', 'Leviticus'), @@ -355,7 +355,7 @@ def parse_reference(reference, bible, language_selection, book_ref_id=False): log.debug(u'Matched reference %s' % reference) book = match.group(u'book') if not book_ref_id: - booknames = BibleStrings().Booknames + book_names = BibleStrings().BookNames # escape reserved characters book_escaped = book for character in u'\\.^$*+?{}[]()': @@ -369,7 +369,7 @@ def parse_reference(reference, bible, language_selection, book_ref_id=False): book_ref_id = db_book.book_reference_id elif language_selection == LanguageSelection.Application: books = filter(lambda key: - regex_book.match(unicode(booknames[key])), booknames.keys()) + regex_book.match(unicode(book_names[key])), book_names.keys()) books = filter(None, map(BiblesResourcesDB.get_book, books)) for value in books: if bible.get_book_by_book_ref_id(value[u'id']): diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index 353dc265d..c352a5faf 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -276,15 +276,16 @@ class BiblesTab(SettingsTab): 'end marks may be defined.\nThey have to be separated by a ' 'vertical bar "|".\nPlease clear this edit line to use the ' 'default value.')) - self.languageSelectionGroupBox.setTitle(translate('BiblesPlugin.BiblesTab', - 'Default Search Field Language')) + self.languageSelectionGroupBox.setTitle(translate( + 'BiblesPlugin.BiblesTab', 'Default Bible Language')) self.languageSelectionLabel.setText(translate('BiblesPlugin.BiblesTab', - 'Book name language in search field:')) + 'Book name language in search field,\nsearch results and on ' + 'display:')) self.languageSelectionComboBox.setItemText(LanguageSelection.Bible, - translate('BiblesPlugin.BiblesTab', 'Bible language')) + translate('BiblesPlugin.BiblesTab', 'Bible Language')) self.languageSelectionComboBox.setItemText( LanguageSelection.Application, - translate('BiblesPlugin.BiblesTab', 'Application language')) + translate('BiblesPlugin.BiblesTab', 'Application Language')) self.languageSelectionComboBox.setItemText(LanguageSelection.English, translate('BiblesPlugin.BiblesTab', 'English')) @@ -482,7 +483,7 @@ class BiblesTab(SettingsTab): self.getGreyTextPalette(False)) self.endSeparatorCheckBox.setChecked(True) self.language_selection = settings.value( - u'bookname language', QtCore.QVariant(0)).toInt()[0] + u'book name language', QtCore.QVariant(0)).toInt()[0] self.languageSelectionComboBox.setCurrentIndex(self.language_selection) settings.endGroup() @@ -495,7 +496,7 @@ class BiblesTab(SettingsTab): QtCore.QVariant(self.display_style)) settings.setValue(u'verse layout style', QtCore.QVariant(self.layout_style)) - settings.setValue(u'bookname language', + settings.setValue(u'book name language', QtCore.QVariant(self.language_selection)) settings.setValue(u'second bibles', QtCore.QVariant(self.second_bibles)) settings.setValue(u'bible theme', QtCore.QVariant(self.bible_theme)) diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index c4afb47f6..84a9f81e2 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -39,6 +39,7 @@ from openlp.core.lib import Receiver, translate from openlp.core.lib.db import BaseModel, init_db, Manager from openlp.core.lib.ui import critical_error_message_box from openlp.core.utils import AppLocation, clean_filename +import upgrade log = logging.getLogger(__name__) @@ -147,7 +148,7 @@ class BibleDB(QtCore.QObject, Manager): self.file = clean_filename(self.name) + u'.sqlite' if u'file' in kwargs: self.file = kwargs[u'file'] - Manager.__init__(self, u'bibles', init_schema, self.file) + Manager.__init__(self, u'bibles', init_schema, self.file, upgrade) if u'file' in kwargs: self.get_name() if u'path' in kwargs: @@ -167,7 +168,7 @@ class BibleDB(QtCore.QObject, Manager): """ Returns the version name of the Bible. """ - version_name = self.get_object(BibleMeta, u'Version') + version_name = self.get_object(BibleMeta, u'name') self.name = version_name.value if version_name else None return self.name @@ -182,7 +183,6 @@ class BibleDB(QtCore.QObject, Manager): The actual Qt wizard form. """ self.wizard = wizard - self.create_meta(u'dbversion', u'2') return self.name def create_book(self, name, bk_ref_id, testament=1): @@ -205,6 +205,16 @@ class BibleDB(QtCore.QObject, Manager): self.save_object(book) return book + def update_book(self, book): + """ + Update a book in the database. + + ``book`` + The book object + """ + log.debug(u'BibleDB.update_book("%s")', book.name) + return self.save_object(book) + def delete_book(self, db_book): """ Delete a book from the database. @@ -271,9 +281,9 @@ class BibleDB(QtCore.QObject, Manager): self.session.add(verse) return verse - def create_meta(self, key, value): + def save_meta(self, key, value): """ - Utility method to save BibleMeta objects in a Bible database. + Utility method to save or update BibleMeta objects in a Bible database. ``key`` The key for this instance. @@ -284,7 +294,12 @@ class BibleDB(QtCore.QObject, Manager): if not isinstance(value, unicode): value = unicode(value) log.debug(u'BibleDB.save_meta("%s/%s")', key, value) - self.save_object(BibleMeta.populate(key=key, value=value)) + meta = self.get_object(BibleMeta, key) + if meta: + meta.value = value + self.save_object(meta) + else: + self.save_object(BibleMeta.populate(key=key, value=value)) def get_book(self, book): """ @@ -317,6 +332,7 @@ class BibleDB(QtCore.QObject, Manager): def get_book_ref_id_by_name(self, book, maxbooks, language_id=None): log.debug(u'BibleDB.get_book_ref_id_by_name:("%s", "%s")', book, language_id) + book_id = None if BiblesResourcesDB.get_book(book, True): book_temp = BiblesResourcesDB.get_book(book, True) book_id = book_temp[u'id'] @@ -326,26 +342,13 @@ class BibleDB(QtCore.QObject, Manager): book_id = AlternativeBookNamesDB.get_book_reference_id(book) else: from openlp.plugins.bibles.forms import BookNameForm - book_ref = None book_name = BookNameForm(self.wizard) if book_name.exec_(book, self.get_books(), maxbooks): - book_ref = unicode( - book_name.correspondingComboBox.currentText()) - if not book_ref: - return None - else: - book_temp = BiblesResourcesDB.get_book(book_ref) - if book_temp: - book_id = book_temp[u'id'] - else: - return None + book_id = book_name.book_id if book_id: AlternativeBookNamesDB.create_alternative_book_name( book, book_id, language_id) - if book_id: - return book_id - else: - return None + return book_id def get_verses(self, reference_list, show_error=True): """ @@ -471,7 +474,7 @@ class BibleDB(QtCore.QObject, Manager): return False language = BiblesResourcesDB.get_language(language) language_id = language[u'id'] - self.create_meta(u'language_id', language_id) + self.save_meta(u'language_id', language_id) return language_id def is_old_database(self): @@ -480,7 +483,7 @@ class BibleDB(QtCore.QObject, Manager): prior to 1.9.6. """ try: - columns = self.session.query(Book).all() + self.session.query(Book).all() except: return True return False @@ -547,16 +550,13 @@ class BiblesResourcesDB(QtCore.QObject, Manager): log.debug(u'BiblesResourcesDB.get_books()') books = BiblesResourcesDB.run_sql(u'SELECT id, testament_id, name, ' u'abbreviation, chapters FROM book_reference ORDER BY id') - return [ - { - u'id': book[0], - u'testament_id': book[1], - u'name': unicode(book[2]), - u'abbreviation': unicode(book[3]), - u'chapters': book[4] - } - for book in books - ] + return [{ + u'id': book[0], + u'testament_id': book[1], + u'name': unicode(book[2]), + u'abbreviation': unicode(book[3]), + u'chapters': book[4] + } for book in books] @staticmethod def get_book(name, lower=False): @@ -598,7 +598,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager): Return the books which include string. ``string`` - The string to search for in the booknames or abbreviations. + The string to search for in the book names or abbreviations. """ log.debug(u'BiblesResourcesDB.get_book_like("%s")', string) if not isinstance(string, unicode): @@ -608,16 +608,13 @@ class BiblesResourcesDB(QtCore.QObject, Manager): u'LOWER(name) LIKE ? OR LOWER(abbreviation) LIKE ?', (u'%' + string.lower() + u'%', u'%' + string.lower() + u'%')) if books: - return [ - { + return [{ u'id': book[0], u'testament_id': book[1], u'name': unicode(book[2]), u'abbreviation': unicode(book[3]), u'chapters': book[4] - } - for book in books - ] + } for book in books] else: return None @@ -744,16 +741,13 @@ class BiblesResourcesDB(QtCore.QObject, Manager): u'language_id, download_source_id FROM webbibles WHERE ' u'download_source_id = ?', (source[u'id'],)) if bibles: - return [ - { + return [{ u'id': bible[0], u'name': bible[1], u'abbreviation': bible[2], u'language_id': bible[3], u'download_source_id': bible[4] - } - for bible in bibles - ] + } for bible in bibles] else: return None @@ -786,7 +780,7 @@ class BiblesResourcesDB(QtCore.QObject, Manager): u'abbreviation': bible[0][2], u'language_id': bible[0][3], u'download_source_id': bible[0][4] - } + } except (IndexError, TypeError): return None @@ -847,14 +841,11 @@ class BiblesResourcesDB(QtCore.QObject, Manager): languages = BiblesResourcesDB.run_sql(u'SELECT id, name, code FROM ' u'language ORDER by name') if languages: - return [ - { + return [{ u'id': language[0], u'name': unicode(language[1]), u'code': unicode(language[2]) - } - for language in languages - ] + } for language in languages] else: return None @@ -1033,7 +1024,7 @@ class OldBibleDB(QtCore.QObject, Manager): Returns the version name of the Bible. """ version_name = self.run_sql(u'SELECT value FROM ' - u'metadata WHERE key = "Version"') + u'metadata WHERE key = "name"') if version_name: self.name = version_name[0][0] else: @@ -1047,13 +1038,10 @@ class OldBibleDB(QtCore.QObject, Manager): metadata = self.run_sql(u'SELECT key, value FROM metadata ' u'ORDER BY rowid') if metadata: - return [ - { + return [{ u'key': unicode(meta[0]), u'value': unicode(meta[1]) - } - for meta in metadata - ] + } for meta in metadata] else: return None @@ -1085,13 +1073,10 @@ class OldBibleDB(QtCore.QObject, Manager): """ books = self.run_sql(u'SELECT name, id FROM book ORDER BY id') if books: - return [ - { + return [{ u'name': unicode(book[0]), u'id':int(book[1]) - } - for book in books - ] + } for book in books] else: return None @@ -1102,15 +1087,12 @@ class OldBibleDB(QtCore.QObject, Manager): verses = self.run_sql(u'SELECT book_id, chapter, verse, text FROM ' u'verse WHERE book_id = ? ORDER BY id', (book_id, )) if verses: - return [ - { + return [{ u'book_id': int(verse[0]), u'chapter': int(verse[1]), u'verse': int(verse[2]), u'text': unicode(verse[3]) - } - for verse in verses - ] + } for verse in verses] else: return None diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 7f2ddeccd..302bdf999 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -49,28 +49,28 @@ class BGExtract(object): """ Extract verses from BibleGateway """ - def __init__(self, proxyurl=None): - log.debug(u'BGExtract.init("%s")', proxyurl) - self.proxyurl = proxyurl + def __init__(self, proxy_url=None): + log.debug(u'BGExtract.init("%s")', proxy_url) + self.proxy_url = proxy_url socket.setdefaulttimeout(30) - def get_bible_chapter(self, version, bookname, chapter): + def get_bible_chapter(self, version, book_name, chapter): """ Access and decode Bibles via the BibleGateway website. ``version`` The version of the Bible like 31 for New International version. - ``bookname`` + ``book_name`` Name of the Book. ``chapter`` Chapter number. """ log.debug(u'BGExtract.get_bible_chapter("%s", "%s", "%s")', version, - bookname, chapter) - urlbookname = urllib.quote(bookname.encode("utf-8")) - url_params = u'search=%s+%s&version=%s' % (urlbookname, chapter, + book_name, chapter) + url_book_name = urllib.quote(book_name.encode("utf-8")) + url_params = u'search=%s+%s&version=%s' % (url_book_name, chapter, version) cleaner = [(re.compile(' |
|\'\+\''), lambda match: '')] soup = get_soup_for_bible_ref( @@ -120,7 +120,7 @@ class BGExtract(object): clean_verse_num = int(str(raw_verse_num)) except ValueError: log.warn(u'Illegal verse number in %s %s %s:%s', - version, bookname, chapter, unicode(raw_verse_num)) + version, book_name, chapter, unicode(raw_verse_num)) if clean_verse_num: verse_text = raw_verse_num.next part = raw_verse_num.next.next @@ -138,7 +138,7 @@ class BGExtract(object): log.debug(u'No content found in the BibleGateway response.') send_error_message(u'parse') return None - return SearchResults(bookname, chapter, verse_list) + return SearchResults(book_name, chapter, verse_list) def get_books_from_http(self, version): """ @@ -195,30 +195,30 @@ class BSExtract(object): """ Extract verses from Bibleserver.com """ - def __init__(self, proxyurl=None): - log.debug(u'BSExtract.init("%s")', proxyurl) - self.proxyurl = proxyurl + def __init__(self, proxy_url=None): + log.debug(u'BSExtract.init("%s")', proxy_url) + self.proxy_url = proxy_url socket.setdefaulttimeout(30) - def get_bible_chapter(self, version, bookname, chapter): + def get_bible_chapter(self, version, book_name, chapter): """ Access and decode bibles via Bibleserver mobile website ``version`` The version of the bible like NIV for New International Version - ``bookname`` + ``book_name`` Text name of bible book e.g. Genesis, 1. John, 1John or Offenbarung ``chapter`` Chapter number """ log.debug(u'BSExtract.get_bible_chapter("%s", "%s", "%s")', version, - bookname, chapter) - urlversion = urllib.quote(version.encode("utf-8")) - urlbookname = urllib.quote(bookname.encode("utf-8")) + book_name, chapter) + url_version = urllib.quote(version.encode("utf-8")) + url_book_name = urllib.quote(book_name.encode("utf-8")) chapter_url = u'http://m.bibleserver.com/text/%s/%s%d' % \ - (urlversion, urlbookname, chapter) + (url_version, url_book_name, chapter) header = (u'Accept-Language', u'en') soup = get_soup_for_bible_ref(chapter_url, header) if not soup: @@ -236,7 +236,7 @@ class BSExtract(object): Receiver.send_message(u'openlp_process_events') versenumber = int(verse_number.sub(r'\3', verse[u'class'])) verses[versenumber] = verse.contents[1].rstrip(u'\n') - return SearchResults(bookname, chapter, verses) + return SearchResults(book_name, chapter, verses) def get_books_from_http(self, version): """ @@ -268,72 +268,72 @@ class CWExtract(object): """ Extract verses from CrossWalk/BibleStudyTools """ - def __init__(self, proxyurl=None): - log.debug(u'CWExtract.init("%s")', proxyurl) - self.proxyurl = proxyurl + def __init__(self, proxy_url=None): + log.debug(u'CWExtract.init("%s")', proxy_url) + self.proxy_url = proxy_url socket.setdefaulttimeout(30) - def get_bible_chapter(self, version, bookname, chapter): + def get_bible_chapter(self, version, book_name, chapter): """ Access and decode bibles via the Crosswalk website ``version`` The version of the Bible like niv for New International Version - ``bookname`` + ``book_name`` Text name of in english e.g. 'gen' for Genesis ``chapter`` Chapter number """ log.debug(u'CWExtract.get_bible_chapter("%s", "%s", "%s")', version, - bookname, chapter) - urlbookname = bookname.replace(u' ', u'-') - urlbookname = urlbookname.lower() - urlbookname = urllib.quote(urlbookname.encode("utf-8")) + book_name, chapter) + url_book_name = book_name.replace(u' ', u'-') + url_book_name = url_book_name.lower() + url_book_name = urllib.quote(url_book_name.encode("utf-8")) chapter_url = u'http://www.biblestudytools.com/%s/%s/%s.html' % \ - (version, urlbookname, chapter) + (version, url_book_name, chapter) soup = get_soup_for_bible_ref(chapter_url) if not soup: return None Receiver.send_message(u'openlp_process_events') - htmlverses = soup.findAll(u'span', u'versetext') - if not htmlverses: + html_verses = soup.findAll(u'span', u'versetext') + if not html_verses: log.error(u'No verses found in the CrossWalk response.') send_error_message(u'parse') return None verses = {} reduce_spaces = re.compile(r'[ ]{2,}') fix_punctuation = re.compile(r'[ ]+([.,;])') - for verse in htmlverses: + for verse in html_verses: Receiver.send_message(u'openlp_process_events') - versenumber = int(verse.contents[0].contents[0]) - versetext = u'' + verse_number = int(verse.contents[0].contents[0]) + verse_text = u'' for part in verse.contents: Receiver.send_message(u'openlp_process_events') if isinstance(part, NavigableString): - versetext = versetext + part + verse_text = verse_text + part elif part and part.attrMap and \ (part.attrMap[u'class'] == u'WordsOfChrist' or \ part.attrMap[u'class'] == u'strongs'): for subpart in part.contents: Receiver.send_message(u'openlp_process_events') if isinstance(subpart, NavigableString): - versetext = versetext + subpart + verse_text = verse_text + subpart elif subpart and subpart.attrMap and \ subpart.attrMap[u'class'] == u'strongs': for subsub in subpart.contents: Receiver.send_message(u'openlp_process_events') if isinstance(subsub, NavigableString): - versetext = versetext + subsub + verse_text = verse_text + subsub Receiver.send_message(u'openlp_process_events') # Fix up leading and trailing spaces, multiple spaces, and spaces # between text and , and . - versetext = versetext.strip(u'\n\r\t ') - versetext = reduce_spaces.sub(u' ', versetext) - versetext = fix_punctuation.sub(r'\1', versetext) - verses[versenumber] = versetext - return SearchResults(bookname, chapter, verses) + verse_text = verse_text.strip(u'\n\r\t ') + verse_text = reduce_spaces.sub(u' ', verse_text) + verse_text = fix_punctuation.sub(r'\1', verse_text) + verses[verse_number] = verse_text + return SearchResults(book_name, chapter, verses) def get_books_from_http(self, version): """ @@ -401,16 +401,16 @@ class HTTPBible(BibleDB): self.wizard.incrementProgressBar(unicode(translate( 'BiblesPlugin.HTTPBible', 'Registering Bible and loading books...'))) - self.create_meta(u'download source', self.download_source) - self.create_meta(u'download name', self.download_name) + self.save_meta(u'download_source', self.download_source) + self.save_meta(u'download_name', self.download_name) if self.proxy_server: - self.create_meta(u'proxy server', self.proxy_server) + self.save_meta(u'proxy_server', self.proxy_server) if self.proxy_username: # Store the proxy userid. - self.create_meta(u'proxy username', self.proxy_username) + self.save_meta(u'proxy_username', self.proxy_username) if self.proxy_password: # Store the proxy password. - self.create_meta(u'proxy password', self.proxy_password) + self.save_meta(u'proxy_password', self.proxy_password) if self.download_source.lower() == u'crosswalk': handler = CWExtract(self.proxy_server) elif self.download_source.lower() == u'biblegateway': @@ -429,7 +429,7 @@ class HTTPBible(BibleDB): self.download_source.lower()) if bible[u'language_id']: language_id = bible[u'language_id'] - self.create_meta(u'language_id', language_id) + self.save_meta(u'language_id', language_id) else: language_id = self.get_language(bible_name) if not language_id: @@ -499,10 +499,10 @@ class HTTPBible(BibleDB): ## if it was there. By reusing the returned book name ## we get a correct book. For example it is possible ## to request ac and get Acts back. - bookname = search_results.book + book_name = search_results.book Receiver.send_message(u'openlp_process_events') # Check to see if book/chapter exists. - db_book = self.get_book(bookname) + db_book = self.get_book(book_name) self.create_chapter(db_book.id, search_results.chapter, search_results.verselist) Receiver.send_message(u'openlp_process_events') diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 577589555..9a82cc388 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -31,7 +31,6 @@ import os from PyQt4 import QtCore from openlp.core.lib import Receiver, SettingsManager, translate -from openlp.core.lib.ui import critical_error_message_box from openlp.core.utils import AppLocation, delete_file from openlp.plugins.bibles.lib import parse_reference, \ get_reference_separator, LanguageSelection @@ -141,7 +140,8 @@ class BibleManager(object): BibleDB class. """ log.debug(u'Reload bibles') - files = SettingsManager.get_files(self.settingsSection, self.suffix) + files = SettingsManager.get_files(self.settingsSection, + self.suffix) if u'alternative_book_names.sqlite' in files: files.remove(u'alternative_book_names.sqlite') log.debug(u'Bible Files %s', files) @@ -164,12 +164,12 @@ class BibleManager(object): self.db_cache[name] = bible # Look to see if lazy load bible exists and get create getter. source = self.db_cache[name].get_object(BibleMeta, - u'download source') + u'download_source') if source: download_name = self.db_cache[name].get_object(BibleMeta, - u'download name').value + u'download_name').value meta_proxy = self.db_cache[name].get_object(BibleMeta, - u'proxy url') + u'proxy_server') web_bible = HTTPBible(self.parent, path=self.path, file=filename, download_source=source.value, download_name=download_name) @@ -204,6 +204,27 @@ class BibleManager(object): self.db_cache[name] = importer return importer + def delete_bible(self, name): + """ + Delete a bible completly. + + ``name`` + The name of the bible. + """ + log.debug(u'BibleManager.delete_bible("%s")', name) + files = SettingsManager.get_files(self.settingsSection, + self.suffix) + if u'alternative_book_names.sqlite' in files: + files.remove(u'alternative_book_names.sqlite') + for filename in files: + bible = BibleDB(self.parent, path=self.path, file=filename) + # Remove the bible files + if name == bible.get_name(): + bible.session.close() + if delete_file(os.path.join(self.path, filename)): + return True + return False + def get_bibles(self): """ Returns a dict with all available Bibles. @@ -309,9 +330,13 @@ class BibleManager(object): 'Import Wizard to install one or more Bibles.') }) return None - language_selection = QtCore.QSettings().value( - self.settingsSection + u'/bookname language', - QtCore.QVariant(0)).toInt()[0] + language_selection = self.get_meta_data(bible, u'book_name_language') + if language_selection: + language_selection = int(language_selection.value) + if language_selection is None or language_selection == -1: + language_selection = QtCore.QSettings().value( + self.settingsSection + u'/bookname language', + QtCore.QVariant(0)).toInt()[0] reflist = parse_reference(versetext, self.db_cache[bible], language_selection, book_ref_id) if reflist: @@ -344,6 +369,22 @@ class BibleManager(object): }) return None + def get_language_selection(self, bible): + """ + Returns the language selection of a bible. + + ``bible`` + Unicode. The Bible to get the language selection from. + """ + log.debug(u'BibleManager.get_language_selection("%s")', bible) + language_selection = self.get_meta_data(bible, u'book_name_language') + if language_selection and language_selection.value != u'None': + return int(language_selection.value) + if language_selection is None or language_selection.value == u'None': + return QtCore.QSettings().value( + self.settingsSection + u'/bookname language', + QtCore.QVariant(0)).toInt()[0] + def verse_search(self, bible, second_bible, text): """ Does a verse search for the given bible and text. @@ -369,17 +410,17 @@ class BibleManager(object): return None # Check if the bible or second_bible is a web bible. webbible = self.db_cache[bible].get_object(BibleMeta, - u'download source') + u'download_source') second_webbible = u'' if second_bible: second_webbible = self.db_cache[second_bible].get_object(BibleMeta, - u'download source') + u'download_source') if webbible or second_webbible: Receiver.send_message(u'openlp_information_message', { u'title': translate('BiblesPlugin.BibleManager', - 'Web Bible cannot be used'), + 'Web Bible cannot be used'), u'message': translate('BiblesPlugin.BibleManager', - 'Text Search is not available with Web Bibles.') + 'Text Search is not available with Web Bibles.') }) return None if text: @@ -387,24 +428,27 @@ class BibleManager(object): else: Receiver.send_message(u'openlp_information_message', { u'title': translate('BiblesPlugin.BibleManager', - 'Scripture Reference Error'), + 'Scripture Reference Error'), u'message': translate('BiblesPlugin.BibleManager', - 'You did not enter a search keyword.\n' - 'You can separate different keywords by a space to search for ' - 'all of your keywords and you can separate them by a comma to ' - 'search for one of them.') + 'You did not enter a search keyword.\n' + 'You can separate different keywords by a space to ' + 'search for all of your keywords and you can separate ' + 'them by a comma to search for one of them.') }) return None - def save_meta_data(self, bible, version, copyright, permissions): + def save_meta_data(self, bible, version, copyright, permissions, + book_name_language=None): """ Saves the bibles meta data. """ - log.debug(u'save_meta data %s,%s, %s,%s', + log.debug(u'save_meta data %s, %s, %s, %s', bible, version, copyright, permissions) - self.db_cache[bible].create_meta(u'Version', version) - self.db_cache[bible].create_meta(u'Copyright', copyright) - self.db_cache[bible].create_meta(u'Permissions', permissions) + self.db_cache[bible].save_meta(u'name', version) + self.db_cache[bible].save_meta(u'copyright', copyright) + self.db_cache[bible].save_meta(u'permissions', permissions) + self.db_cache[bible].save_meta(u'book_name_language', + book_name_language) def get_meta_data(self, bible, key): """ @@ -412,6 +456,13 @@ class BibleManager(object): """ log.debug(u'get_meta %s,%s', bible, key) return self.db_cache[bible].get_object(BibleMeta, key) + + def update_book(self, bible, book): + """ + Update a book of the bible. + """ + log.debug(u'BibleManager.update_book("%s", "%s")', bible, book.name) + self.db_cache[bible].update_book(book) def exists(self, name): """ diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 00b7b01ef..e3d173fad 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -36,9 +36,10 @@ from openlp.core.lib.searchedit import SearchEdit from openlp.core.lib.ui import UiStrings, set_case_insensitive_completer, \ create_horizontal_adjusting_combo_box, critical_error_message_box, \ find_and_set_in_combo_box, build_icon -from openlp.plugins.bibles.forms import BibleImportForm +from openlp.plugins.bibles.forms import BibleImportForm, EditBibleForm from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \ - VerseReferenceList, get_reference_separator, LanguageSelection, BibleStrings + VerseReferenceList, get_reference_separator, LanguageSelection, \ + BibleStrings from openlp.plugins.bibles.lib.db import BiblesResourcesDB log = logging.getLogger(__name__) @@ -63,7 +64,7 @@ class BibleMediaItem(MediaManagerItem): self.unlockIcon = build_icon(u':/bibles/bibles_search_unlock.png') MediaManagerItem.__init__(self, parent, plugin, icon) # Place to store the search results for both bibles. - self.settings = self.plugin.settings_tab + self.settings = self.plugin.settingsTab self.quickPreviewAllowed = True self.hasSearch = True self.search_results = {} @@ -109,8 +110,8 @@ class BibleMediaItem(MediaManagerItem): MediaManagerItem.requiredIcons(self) self.hasImportIcon = True self.hasNewIcon = False - self.hasEditIcon = False - self.hasDeleteIcon = False + self.hasEditIcon = True + self.hasDeleteIcon = True self.addToServiceItem = False def addSearchTab(self, prefix, name): @@ -352,10 +353,6 @@ class BibleMediaItem(MediaManagerItem): log.debug(u'bible manager initialise') self.plugin.manager.media = self self.loadBibles() - bible = QtCore.QSettings().value( - self.settingsSection + u'/quick bible', QtCore.QVariant( - self.quickVersionComboBox.currentText())).toString() - find_and_set_in_combo_box(self.quickVersionComboBox, bible) self.quickSearchEdit.setSearchTypes([ (BibleSearch.Reference, u':/bibles/bibles_search_reference.png', translate('BiblesPlugin.MediaItem', 'Scripture Reference'), @@ -397,6 +394,10 @@ class BibleMediaItem(MediaManagerItem): self.initialiseAdvancedBible(unicode(bible)) elif len(bibles): self.initialiseAdvancedBible(bibles[0]) + bible = QtCore.QSettings().value( + self.settingsSection + u'/quick bible', QtCore.QVariant( + self.quickVersionComboBox.currentText())).toString() + find_and_set_in_combo_box(self.quickVersionComboBox, bible) def reloadBibles(self, process=False): log.debug(u'Reloading Bibles') @@ -431,10 +432,8 @@ class BibleMediaItem(MediaManagerItem): book_data = book_data_temp self.advancedBookComboBox.clear() first = True - language_selection = QtCore.QSettings().value( - self.settingsSection + u'/bookname language', - QtCore.QVariant(0)).toInt()[0] - booknames = BibleStrings().Booknames + language_selection = self.plugin.manager.get_language_selection(bible) + book_names = BibleStrings().BookNames for book in book_data: row = self.advancedBookComboBox.count() if language_selection == LanguageSelection.Bible: @@ -443,7 +442,7 @@ class BibleMediaItem(MediaManagerItem): data = BiblesResourcesDB.get_book_by_id( book[u'book_reference_id']) self.advancedBookComboBox.addItem( - booknames[data[u'abbreviation']]) + book_names[data[u'abbreviation']]) elif language_selection == LanguageSelection.English: data = BiblesResourcesDB.get_book_by_id( book[u'book_reference_id']) @@ -505,18 +504,17 @@ class BibleMediaItem(MediaManagerItem): secondbook.book_reference_id: book_data_temp.append(book) book_data = book_data_temp - language_selection = QtCore.QSettings().value( - self.settingsSection + u'/bookname language', - QtCore.QVariant(0)).toInt()[0] + language_selection = self.plugin.manager.get_language_selection( + bible) if language_selection == LanguageSelection.Bible: books = [book.name + u' ' for book in book_data] elif language_selection == LanguageSelection.Application: - booknames = BibleStrings().Booknames + book_names = BibleStrings().BookNames for book in book_data: data = BiblesResourcesDB.get_book_by_id( book.book_reference_id) books.append(unicode( - booknames[data[u'abbreviation']]) + u' ') + book_names[data[u'abbreviation']]) + u' ') elif language_selection == LanguageSelection.English: for book in book_data: data = BiblesResourcesDB.get_book_by_id( @@ -533,6 +531,34 @@ class BibleMediaItem(MediaManagerItem): if self.import_wizard.exec_(): self.reloadBibles() + def onEditClick(self): + if self.quickTab.isVisible(): + bible = unicode(self.quickVersionComboBox.currentText()) + elif self.advancedTab.isVisible(): + bible = unicode(self.advancedVersionComboBox.currentText()) + if bible: + self.editBibleForm = EditBibleForm(self, self.plugin.formParent, + self.plugin.manager) + self.editBibleForm.loadBible(bible) + if self.editBibleForm.exec_(): + self.reloadBibles() + + def onDeleteClick(self): + if self.quickTab.isVisible(): + bible = unicode(self.quickVersionComboBox.currentText()) + elif self.advancedTab.isVisible(): + bible = unicode(self.advancedVersionComboBox.currentText()) + if bible: + if QtGui.QMessageBox.question(self, UiStrings().ConfirmDelete, + unicode(translate('BiblesPlugin.MediaItem', + 'Are you sure you want to delete "%s"?')) % bible, + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | + QtGui.QMessageBox.No), + QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No: + return + self.plugin.manager.delete_bible(bible) + self.reloadBibles() + def onSearchTabBarCurrentChanged(self, index): if index == 0: self.advancedTab.setVisible(False) @@ -780,24 +806,36 @@ class BibleMediaItem(MediaManagerItem): further action is saved for/in each row. """ verse_separator = get_reference_separator(u'sep_v_display') - version = self.plugin.manager.get_meta_data(bible, u'Version').value - copyright = self.plugin.manager.get_meta_data(bible, u'Copyright').value + version = self.plugin.manager.get_meta_data(bible, u'name').value + copyright = self.plugin.manager.get_meta_data(bible, u'copyright').value permissions = \ - self.plugin.manager.get_meta_data(bible, u'Permissions').value + self.plugin.manager.get_meta_data(bible, u'permissions').value second_version = u'' second_copyright = u'' second_permissions = u'' if second_bible: second_version = self.plugin.manager.get_meta_data( - second_bible, u'Version').value + second_bible, u'name').value second_copyright = self.plugin.manager.get_meta_data( - second_bible, u'Copyright').value + second_bible, u'copyright').value second_permissions = self.plugin.manager.get_meta_data( - second_bible, u'Permissions').value + second_bible, u'permissions').value items = [] + language_selection = self.plugin.manager.get_language_selection(bible) for count, verse in enumerate(search_results): + if language_selection == LanguageSelection.Bible: + book = verse.book.name + elif language_selection == LanguageSelection.Application: + book_names = BibleStrings().Booknames + data = BiblesResourcesDB.get_book_by_id( + verse.book.book_reference_id) + book = unicode(book_names[data[u'abbreviation']]) + elif language_selection == LanguageSelection.English: + data = BiblesResourcesDB.get_book_by_id( + verse.book.book_reference_id) + book = data[u'name'] data = { - 'book': QtCore.QVariant(verse.book.name), + 'book': QtCore.QVariant(book), 'chapter': QtCore.QVariant(verse.chapter), 'verse': QtCore.QVariant(verse.verse), 'bible': QtCore.QVariant(bible), @@ -819,12 +857,11 @@ class BibleMediaItem(MediaManagerItem): log.exception(u'The second_search_results does not have as ' 'many verses as the search_results.') break - bible_text = u'%s %d%s%d (%s, %s)' % (verse.book.name, - verse.chapter, verse_separator, verse.verse, version, - second_version) + bible_text = u'%s %d%s%d (%s, %s)' % (book, verse.chapter, + verse_separator, verse.verse, version, second_version) else: - bible_text = u'%s %d%s%d (%s)' % (verse.book.name, - verse.chapter, verse_separator, verse.verse, version) + bible_text = u'%s %d%s%d (%s)' % (book, verse.chapter, + verse_separator, verse.verse, version) bible_verse = QtGui.QListWidgetItem(bible_text) bible_verse.setData(QtCore.Qt.UserRole, QtCore.QVariant(data)) items.append(bible_verse) diff --git a/openlp/plugins/bibles/lib/osis.py b/openlp/plugins/bibles/lib/osis.py index 4afee912d..7300bd032 100644 --- a/openlp/plugins/bibles/lib/osis.py +++ b/openlp/plugins/bibles/lib/osis.py @@ -26,7 +26,6 @@ ############################################################################### import os -import os.path import logging import chardet import codecs @@ -51,8 +50,6 @@ class OSISBible(BibleDB): log.debug(self.__class__.__name__) BibleDB.__init__(self, parent, **kwargs) self.filename = kwargs[u'filename'] - fbibles = None - self.books = {} self.language_regex = re.compile(r'(.*?)') self.verse_regex = re.compile( r'(.*?)') @@ -75,16 +72,6 @@ class OSISBible(BibleDB): filepath = os.path.join( AppLocation.get_directory(AppLocation.PluginsDir), u'bibles', u'resources', u'osisbooks.csv') - try: - fbibles = open(filepath, u'r') - for line in fbibles: - book = line.split(u',') - self.books[book[0]] = (book[1].strip(), book[2].strip()) - except IOError: - log.exception(u'OSIS bible import failed') - finally: - if fbibles: - fbibles.close() def do_import(self, bible_name=None): """ @@ -102,6 +89,8 @@ class OSISBible(BibleDB): try: detect_file = open(self.filename, u'r') details = chardet.detect(detect_file.read(1048576)) + detect_file.seek(0) + lines_in_file = int(len(detect_file.readlines())) except IOError: log.exception(u'Failed to detect OSIS file encoding') return @@ -112,6 +101,17 @@ class OSISBible(BibleDB): osis = codecs.open(self.filename, u'r', details['encoding']) repl = replacement language_id = False + # Decide if the bible propably contains only NT or AT and NT or + # AT, NT and Apocrypha + if lines_in_file < 11500: + book_count = 27 + chapter_count = 260 + elif lines_in_file < 34200: + book_count = 66 + chapter_count = 1188 + else: + book_count = 67 + chapter_count = 1336 for file_record in osis: if self.stop_import_flag: break @@ -123,7 +123,7 @@ class OSISBible(BibleDB): language_match.group(1)) if language: language_id = language[u'id'] - self.create_meta(u'language_id', language_id) + self.save_meta(u'language_id', language_id) continue match = self.verse_regex.search(file_record) if match: @@ -135,36 +135,32 @@ class OSISBible(BibleDB): % self.filename) return False match_count += 1 - book = match.group(1) + book = unicode(match.group(1)) chapter = int(match.group(2)) verse = int(match.group(3)) verse_text = match.group(4) - if not db_book or db_book.name != self.books[book][0]: - log.debug(u'New book: "%s"' % self.books[book][0]) - book_ref_id = self.get_book_ref_id_by_name(unicode( - self.books[book][0]), 67, language_id) - if not book_ref_id: - log.exception(u'Importing books from "%s" '\ - 'failed' % self.filename) - return False - book_details = BiblesResourcesDB.get_book_by_id( - book_ref_id) + book_ref_id = self.get_book_ref_id_by_name(book, book_count, + language_id) + if not book_ref_id: + log.exception(u'Importing books from "%s" failed' % + self.filename) + return False + book_details = BiblesResourcesDB.get_book_by_id(book_ref_id) + if not db_book or db_book.name != book_details[u'name']: + log.debug(u'New book: "%s"' % book_details[u'name']) db_book = self.create_book( - unicode(self.books[book][0]), + book_details[u'name'], book_ref_id, book_details[u'testament_id']) if last_chapter == 0: - if book == u'Gen': - self.wizard.progressBar.setMaximum(1188) - else: - self.wizard.progressBar.setMaximum(260) + self.wizard.progressBar.setMaximum(chapter_count) if last_chapter != chapter: if last_chapter != 0: self.session.commit() self.wizard.incrementProgressBar(unicode(translate( 'BiblesPlugin.OsisImport', 'Importing %s %s...', 'Importing ...')) % - (self.books[match.group(1)][0], chapter)) + (book_details[u'name'], chapter)) last_chapter = chapter # All of this rigmarol below is because the mod2osis # tool from the Sword library embeds XML in the OSIS diff --git a/openlp/plugins/bibles/lib/upgrade.py b/openlp/plugins/bibles/lib/upgrade.py new file mode 100644 index 000000000..b2b372261 --- /dev/null +++ b/openlp/plugins/bibles/lib/upgrade.py @@ -0,0 +1,191 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # +# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # +# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # +# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### +""" +The :mod:`upgrade` module provides a way for the database and schema that is the +backend for the Bibles plugin +""" +import logging + +from sqlalchemy import Table, func, select, insert + +__version__ = 1 +log = logging.getLogger(__name__) + +def upgrade_setup(metadata): + """ + Set up the latest revision all tables, with reflection, needed for the + upgrade process. If you want to drop a table, you need to remove it from + here, and add it to your upgrade function. + """ + # Don't define the "metadata" table, as the upgrade mechanism already + # defines it. + tables = { + u'book': Table(u'book', metadata, autoload=True), + u'verse': Table(u'verse', metadata, autoload=True) + } + return tables + + +def upgrade_1(session, metadata, tables): + """ + Version 1 upgrade. + + This upgrade renames a number of keys to a single naming convention.. + """ + metadata_table = metadata.tables[u'metadata'] + # Copy "Version" to "name" ("version" used by upgrade system) + # TODO: Clean up in a subsequent release of OpenLP (like 2.0 final) + session.execute(insert(metadata_table).values( + key=u'name', + value=select( + [metadata_table.c.value], + metadata_table.c.key == u'Version' + ).as_scalar() + )) + # Copy "Copyright" to "copyright" + # TODO: Clean up in a subsequent release of OpenLP (like 2.0 final) + session.execute(insert(metadata_table).values( + key=u'copyright', + value=select( + [metadata_table.c.value], + metadata_table.c.key == u'Copyright' + ).as_scalar() + )) + # Copy "Permissions" to "permissions" + # TODO: Clean up in a subsequent release of OpenLP (like 2.0 final) + session.execute(insert(metadata_table).values( + key=u'permissions', + value=select( + [metadata_table.c.value], + metadata_table.c.key == u'Permissions' + ).as_scalar() + )) + # Copy "Bookname language" to "book_name_language" + # TODO: Clean up in a subsequent release of OpenLP (like 2.0 final) + value_count = session.execute( + select( + [func.count(metadata_table.c.value)], + metadata_table.c.key == u'Bookname language' + ) + ).scalar() + if value_count > 0: + session.execute(insert(metadata_table).values( + key=u'book_name_language', + value=select( + [metadata_table.c.value], + metadata_table.c.key == u'Bookname language' + ).as_scalar() + )) + # Copy "download source" to "download_source" + # TODO: Clean up in a subsequent release of OpenLP (like 2.0 final) + value_count = session.execute( + select( + [func.count(metadata_table.c.value)], + metadata_table.c.key == u'download source' + ) + ).scalar() + log.debug(u'download source: %s', value_count) + if value_count > 0: + session.execute(insert(metadata_table).values( + key=u'download_source', + value=select( + [metadata_table.c.value], + metadata_table.c.key == u'download source' + ).as_scalar() + )) + # Copy "download name" to "download_name" + # TODO: Clean up in a subsequent release of OpenLP (like 2.0 final) + value_count = session.execute( + select( + [func.count(metadata_table.c.value)], + metadata_table.c.key == u'download name' + ) + ).scalar() + log.debug(u'download name: %s', value_count) + if value_count > 0: + session.execute(insert(metadata_table).values( + key=u'download_name', + value=select( + [metadata_table.c.value], + metadata_table.c.key == u'download name' + ).as_scalar() + )) + # Copy "proxy server" to "proxy_server" + # TODO: Clean up in a subsequent release of OpenLP (like 2.0 final) + value_count = session.execute( + select( + [func.count(metadata_table.c.value)], + metadata_table.c.key == u'proxy server' + ) + ).scalar() + log.debug(u'proxy server: %s', value_count) + if value_count > 0: + session.execute(insert(metadata_table).values( + key=u'proxy_server', + value=select( + [metadata_table.c.value], + metadata_table.c.key == u'proxy server' + ).as_scalar() + )) + # Copy "proxy username" to "proxy_username" + # TODO: Clean up in a subsequent release of OpenLP (like 2.0 final) + value_count = session.execute( + select( + [func.count(metadata_table.c.value)], + metadata_table.c.key == u'proxy username' + ) + ).scalar() + log.debug(u'proxy username: %s', value_count) + if value_count > 0: + session.execute(insert(metadata_table).values( + key=u'proxy_username', + value=select( + [metadata_table.c.value], + metadata_table.c.key == u'proxy username' + ).as_scalar() + )) + # Copy "proxy password" to "proxy_password" + # TODO: Clean up in a subsequent release of OpenLP (like 2.0 final) + value_count = session.execute( + select( + [func.count(metadata_table.c.value)], + metadata_table.c.key == u'proxy password' + ) + ).scalar() + log.debug(u'proxy password: %s', value_count) + if value_count > 0: + session.execute(insert(metadata_table).values( + key=u'proxy_password', + value=select( + [metadata_table.c.value], + metadata_table.c.key == u'proxy password' + ).as_scalar() + )) + # TODO: Clean up in a subsequent release of OpenLP (like 2.0 final) + #session.execute(delete(metadata_table)\ + # .where(metadata_table.c.key == u'dbversion')) + session.commit() diff --git a/openlp/plugins/bibles/resources/osisbooks.csv b/openlp/plugins/bibles/resources/osisbooks.csv deleted file mode 100644 index 372cbd92d..000000000 --- a/openlp/plugins/bibles/resources/osisbooks.csv +++ /dev/null @@ -1,76 +0,0 @@ -Gen,Genesis,Gen -Exod,Exodus,Exod -Lev,Leviticus,Lev -Num,Numbers,Num -Deut,Deuteronomy,Deut -Josh,Joshua,Josh -Judg,Judges,Judg -Ruth,Ruth,Ruth -1Sam,1 Samuel,1Sam -2Sam,2 Samuel,2Sam -1Kgs,1 Kings,1Kgs -2Kgs,2 Kings,2Kgs -1Chr,1 Chronicles,1Chr -2Chr,2 Chronicles,2Chr -Ezra,Ezra,Ezra -Neh,Nehemiah,Neh -Esth,Esther,Esth -Job,Job,Job -Ps,Psalms,Ps -Prov,Proverbs,Prov -Eccl,Ecclesiastes,Eccl -Song,Song of Songs,Song -Isa,Isaiah,Isa -Jer,Jeremiah,Jer -Lam,Lamentations,Lam -Ezek,Ezekiel,Ezek -Dan,Daniel,Dan -Hos,Hosea,Hos -Joel,Joel,Joel -Amos,Amos,Amos -Obad,Obad,Obad -Jonah,Jonah,Jonah -Mic,Micah,Mic -Nah,Naham,Nah -Hab,Habakkuk,Hab -Zeph,Zephaniah,Zeph -Hag,Haggai,Hag -Zech,Zechariah,Zech -Mal,Malachi,Mal -Matt,Matthew,Matt -Mark,Mark,Mark -Luke,Luke,Luke -John,John,John -Acts,Acts,Acts -Rom,Romans,Rom -1Cor,1 Corinthians,1Cor -2Cor,2 Corinthians,2Cor -Gal,Galatians,Gal -Eph,Ephesians,Eph -Phil,Philippians,Phil -Col,Colossians,Col -1Thess,1 Thessalonians,1Thess -2Thess,2 Thessalonians,2Thess -1Tim,1 Timothy,1Tim -2Tim,2 Timothy,2Tim -Titus,Titus,Titus -Phlm,Philemon,Phlm -Heb,Hebrews,Heb -Jas,James,Jas -1Pet,1 Peter,1Pet -2Pet,2 Peter,2Pet -1John,1 John,1John -2John,2 John,2John -3John,3 John,3John -Jude,Jude,Jude -Rev,Revelation,Rev -Jdt,Judith,Jdt -Wis,Wisdom,Wis -Tob,Tobit,Tob -Sir,Sirach,Sir -Bar,Baruch,Bar -1Macc,1 Maccabees,1Macc -2Macc,2 Maccabees,2Macc -AddDan,Rest of Daniel,AddDan -AddEsth,Rest of Esther,AddEsth -PrMan,Prayer of Manasses,PrMan diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index 51206901d..f05802eb3 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -50,8 +50,8 @@ class CustomPlugin(Plugin): CustomMediaItem, CustomTab) self.weight = -5 self.manager = Manager(u'custom', init_schema) - self.icon_path = u':/plugins/plugin_custom.png' - self.icon = build_icon(self.icon_path) + self.iconPath = u':/plugins/plugin_custom.png' + self.icon = build_icon(self.iconPath) def about(self): about_text = translate('CustomPlugin', 'Custom Slide Plugin' diff --git a/openlp/plugins/custom/forms/editcustomslideform.py b/openlp/plugins/custom/forms/editcustomslideform.py index ad9f9391b..8f00058d9 100644 --- a/openlp/plugins/custom/forms/editcustomslideform.py +++ b/openlp/plugins/custom/forms/editcustomslideform.py @@ -77,7 +77,7 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog): def onSplitButtonClicked(self): """ - Adds a virtual split at cursor. + Adds an optional split at cursor. """ self.insertSingleLineTextAtCursor(u'[---]') self.slideTextEdit.setFocus() diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 5cf872990..541403cda 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -57,7 +57,7 @@ class CustomMediaItem(MediaManagerItem): def __init__(self, parent, plugin, icon): self.IconPath = u'custom/custom' MediaManagerItem.__init__(self, parent, plugin, icon) - self.edit_custom_form = EditCustomForm(self, self.plugin.formparent, + self.edit_custom_form = EditCustomForm(self, self.plugin.formParent, self.plugin.manager) self.singleServiceItem = False self.quickPreviewAllowed = True diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index 5997498d7..53f825916 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -42,8 +42,8 @@ class ImagePlugin(Plugin): Plugin.__init__(self, u'images', plugin_helpers, ImageMediaItem, ImageTab) self.weight = -7 - self.icon_path = u':/plugins/plugin_images.png' - self.icon = build_icon(self.icon_path) + self.iconPath = u':/plugins/plugin_images.png' + self.icon = build_icon(self.iconPath) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'image_updated'), self.image_updated) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 702bc7e96..ffa67b95e 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -106,24 +106,24 @@ class ImageMediaItem(MediaManagerItem): row_list = [item.row() for item in self.listView.selectedIndexes()] row_list.sort(reverse=True) Receiver.send_message(u'cursor_busy') - self.plugin.formparent.displayProgressBar(len(row_list)) + self.plugin.formParent.displayProgressBar(len(row_list)) for row in row_list: text = self.listView.item(row) if text: delete_file(os.path.join(self.servicePath, unicode(text.text()))) self.listView.takeItem(row) - self.plugin.formparent.incrementProgressBar() + self.plugin.formParent.incrementProgressBar() SettingsManager.set_list(self.settingsSection, u'images', self.getFileList()) - self.plugin.formparent.finishedProgressBar() + self.plugin.formParent.finishedProgressBar() Receiver.send_message(u'cursor_normal') self.listView.blockSignals(False) def loadList(self, images, initialLoad=False): if not initialLoad: Receiver.send_message(u'cursor_busy') - self.plugin.formparent.displayProgressBar(len(images)) + self.plugin.formParent.displayProgressBar(len(images)) # Sort the themes by its filename considering language specific # characters. lower() is needed for windows! images.sort(cmp=locale.strcoll, @@ -144,9 +144,9 @@ class ImageMediaItem(MediaManagerItem): item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(imageFile)) self.listView.addItem(item_name) if not initialLoad: - self.plugin.formparent.incrementProgressBar() + self.plugin.formParent.incrementProgressBar() if not initialLoad: - self.plugin.formparent.finishedProgressBar() + self.plugin.formParent.finishedProgressBar() Receiver.send_message(u'cursor_normal') def generateSlideData(self, service_item, item=None, xmlVersion=False, diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index cd3f8b3dd..13c636e83 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -41,8 +41,8 @@ class MediaPlugin(Plugin): Plugin.__init__(self, u'media', plugin_helpers, MediaMediaItem) self.weight = -6 - self.icon_path = u':/plugins/plugin_media.png' - self.icon = build_icon(self.icon_path) + self.iconPath = u':/plugins/plugin_media.png' + self.icon = build_icon(self.iconPath) # passed with drag and drop messages self.dnd_id = u'Media' self.audio_extensions_list = \ @@ -59,8 +59,8 @@ class MediaPlugin(Plugin): Create the settings Tab """ visible_name = self.getString(StringContent.VisibleName) - self.settings_tab = MediaTab(parent, self.name, visible_name[u'title'], - self.mediaController.mediaPlayers, self.icon_path) + self.settingsTab = MediaTab(parent, self.name, visible_name[u'title'], + self.mediaController.mediaPlayers, self.iconPath) def about(self): about_text = translate('MediaPlugin', 'Media Plugin' @@ -142,6 +142,6 @@ class MediaPlugin(Plugin): self.mediaController.mediaPlayers[u'phonon'].isActive = True settings.setValue(u'players', \ QtCore.QVariant(u','.join(new_players))) - self.settings_tab.load() + self.settingsTab.load() settings.remove(u'use phonon') settings.endGroup() diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index d647249a3..bef745136 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -42,6 +42,9 @@ import time if os.name == u'nt': from win32com.client import Dispatch import pywintypes + # Declare an empty exception to match the exception imported from UNO + class ErrorCodeIOException(Exception): + pass else: try: import uno diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index aa16c0cd1..68eea809b 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -166,14 +166,14 @@ class PresentationMediaItem(MediaManagerItem): Receiver.send_message(u'cursor_busy') if not initialLoad: Receiver.send_message(u'cursor_busy') - self.plugin.formparent.displayProgressBar(len(files)) + self.plugin.formParent.displayProgressBar(len(files)) # Sort the themes by its filename considering language specific # characters. lower() is needed for windows! files.sort(cmp=locale.strcoll, key=lambda filename: os.path.split(unicode(filename))[1].lower()) for file in files: if not initialLoad: - self.plugin.formparent.incrementProgressBar() + self.plugin.formParent.incrementProgressBar() if currlist.count(file) > 0: continue filename = os.path.split(unicode(file))[1] @@ -217,7 +217,7 @@ class PresentationMediaItem(MediaManagerItem): self.listView.addItem(item_name) Receiver.send_message(u'cursor_normal') if not initialLoad: - self.plugin.formparent.finishedProgressBar() + self.plugin.formParent.finishedProgressBar() Receiver.send_message(u'cursor_normal') def onDeleteClick(self): @@ -229,7 +229,7 @@ class PresentationMediaItem(MediaManagerItem): row_list = [item.row() for item in items] row_list.sort(reverse=True) Receiver.send_message(u'cursor_busy') - self.plugin.formparent.displayProgressBar(len(row_list)) + self.plugin.formParent.displayProgressBar(len(row_list)) for item in items: filepath = unicode(item.data( QtCore.Qt.UserRole).toString()) @@ -237,8 +237,8 @@ class PresentationMediaItem(MediaManagerItem): doc = self.controllers[cidx].add_document(filepath) doc.presentation_deleted() doc.close_presentation() - self.plugin.formparent.incrementProgressBar() - self.plugin.formparent.finishedProgressBar() + self.plugin.formParent.incrementProgressBar() + self.plugin.formParent.finishedProgressBar() Receiver.send_message(u'cursor_normal') for row in row_list: self.listView.takeItem(row) diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index 733a075dd..995b91e14 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -54,16 +54,16 @@ class PresentationPlugin(Plugin): self.controllers = {} Plugin.__init__(self, u'presentations', plugin_helpers) self.weight = -8 - self.icon_path = u':/plugins/plugin_presentations.png' - self.icon = build_icon(self.icon_path) + self.iconPath = u':/plugins/plugin_presentations.png' + self.icon = build_icon(self.iconPath) def createSettingsTab(self, parent): """ Create the settings Tab """ visible_name = self.getString(StringContent.VisibleName) - self.settings_tab = PresentationTab(parent, self.name, - visible_name[u'title'], self.controllers, self.icon_path) + self.settingsTab = PresentationTab(parent, self.name, + visible_name[u'title'], self.controllers, self.iconPath) def initialise(self): """ @@ -99,7 +99,7 @@ class PresentationPlugin(Plugin): Create the Media Manager List """ self.mediaItem = PresentationMediaItem( - self.mediadock.media_dock, self, self.icon, self.controllers) + self.mediaDock.media_dock, self, self.icon, self.controllers) def registerControllers(self, controller): """ diff --git a/openlp/plugins/remotes/html/images/ajax-loader.gif b/openlp/plugins/remotes/html/images/ajax-loader.gif new file mode 100644 index 000000000..fd1a189c2 Binary files /dev/null and b/openlp/plugins/remotes/html/images/ajax-loader.gif differ diff --git a/openlp/plugins/remotes/html/images/ajax-loader.png b/openlp/plugins/remotes/html/images/ajax-loader.png index 811a2cdd1..13b208ddd 100644 Binary files a/openlp/plugins/remotes/html/images/ajax-loader.png and b/openlp/plugins/remotes/html/images/ajax-loader.png differ diff --git a/openlp/plugins/remotes/html/images/favicon.ico b/openlp/plugins/remotes/html/images/favicon.ico new file mode 100644 index 000000000..0e2ed314f Binary files /dev/null and b/openlp/plugins/remotes/html/images/favicon.ico differ diff --git a/openlp/plugins/remotes/html/images/icons-18-black.png b/openlp/plugins/remotes/html/images/icons-18-black.png index 1ecfd26fb..ce1b758ad 100644 Binary files a/openlp/plugins/remotes/html/images/icons-18-black.png and b/openlp/plugins/remotes/html/images/icons-18-black.png differ diff --git a/openlp/plugins/remotes/html/images/icons-18-white.png b/openlp/plugins/remotes/html/images/icons-18-white.png index 0c70831ac..1ab012723 100644 Binary files a/openlp/plugins/remotes/html/images/icons-18-white.png and b/openlp/plugins/remotes/html/images/icons-18-white.png differ diff --git a/openlp/plugins/remotes/html/images/icons-36-black.png b/openlp/plugins/remotes/html/images/icons-36-black.png index 4c72adf1e..1a59d7c37 100644 Binary files a/openlp/plugins/remotes/html/images/icons-36-black.png and b/openlp/plugins/remotes/html/images/icons-36-black.png differ diff --git a/openlp/plugins/remotes/html/images/icons-36-white.png b/openlp/plugins/remotes/html/images/icons-36-white.png index 84ea9fb31..5647bdc94 100644 Binary files a/openlp/plugins/remotes/html/images/icons-36-white.png and b/openlp/plugins/remotes/html/images/icons-36-white.png differ diff --git a/openlp/plugins/remotes/html/index.html b/openlp/plugins/remotes/html/index.html index fd1b37472..c2aa38b05 100644 --- a/openlp/plugins/remotes/html/index.html +++ b/openlp/plugins/remotes/html/index.html @@ -31,6 +31,7 @@ ${app_title} + @@ -39,7 +40,7 @@ "go_live": "${go_live}", "add_to_service": "${add_to_service}", "no_results": "${no_results}", - "back": "${back}" + "home": "${home}" } @@ -58,71 +59,79 @@
-
- ${back} +
+ ${home}

${service_manager}

${refresh} -
-
- -
-
-
- ${back} +
+ ${home}

${slide_controller}

${refresh} -
-
- -
-
- ${back} + ${home}

${alerts}

+
+ +
@@ -133,9 +142,17 @@