This commit is contained in:
Andreas Preikschat 2013-03-30 09:40:49 +01:00
commit fd3cad1c7c
27 changed files with 126 additions and 98 deletions

View File

@ -175,7 +175,7 @@ class MainDisplay(Display):
We need to rebuild the CSS on the live display. We need to rebuild the CSS on the live display.
""" """
for plugin in self.plugin_manager.plugins: for plugin in self.plugin_manager.plugins:
plugin.refreshCss(self.frame) plugin.refresh_css(self.frame)
def retranslateUi(self): def retranslateUi(self):
""" """

View File

@ -650,7 +650,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
for plugin in self.plugin_manager.plugins: for plugin in self.plugin_manager.plugins:
self.activePlugin = plugin self.activePlugin = plugin
oldStatus = self.activePlugin.status oldStatus = self.activePlugin.status
self.activePlugin.setStatus() self.activePlugin.set_status()
if oldStatus != self.activePlugin.status: if oldStatus != self.activePlugin.status:
if self.activePlugin.status == PluginStatus.Active: if self.activePlugin.status == PluginStatus.Active:
self.activePlugin.toggle_status(PluginStatus.Active) self.activePlugin.toggle_status(PluginStatus.Active)

View File

@ -84,9 +84,8 @@ class ServiceManagerList(QtGui.QTreeWidget):
def mouseMoveEvent(self, event): def mouseMoveEvent(self, event):
""" """
Drag and drop event does not care what data is selected Drag and drop event does not care what data is selected as the recipient will use events to request the data
as the recipient will use events to request the data move move just tell it what plugin to call
just tell it what plugin to call
""" """
if event.buttons() != QtCore.Qt.LeftButton: if event.buttons() != QtCore.Qt.LeftButton:
event.ignore() event.ignore()
@ -284,10 +283,9 @@ class ServiceManagerDialog(object):
class ServiceManager(QtGui.QWidget, ServiceManagerDialog): class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
""" """
Manages the services. This involves taking text strings from plugins and Manages the services. This involves taking text strings from plugins and adding them to the service. This service
adding them to the service. This service can then be zipped up with all can then be zipped up with all the resources used into one OSZ or oszl file for use on any OpenLP v2 installation.
the resources used into one OSZ or oszl file for use on any OpenLP v2 Also handles the UI tasks of moving things up and down etc.
installation. Also handles the UI tasks of moving things up and down etc.
""" """
def __init__(self, parent=None): def __init__(self, parent=None):
""" """
@ -316,8 +314,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def set_modified(self, modified=True): def set_modified(self, modified=True):
""" """
Setter for property "modified". Sets whether or not the current service Setter for property "modified". Sets whether or not the current service has been modified.
has been modified.
""" """
if modified: if modified:
self.service_id += 1 self.service_id += 1
@ -361,7 +358,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def supported_suffixes(self, suffix): def supported_suffixes(self, suffix):
""" """
Adds Suffixes supported to the master list. Called from Plugins. Adds Suffixes supported to the master list. Called from Plugins.
``suffix`` ``suffix``
New Suffix to be supported New Suffix to be supported
@ -384,12 +381,10 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def on_load_service_clicked(self, load_file=None): def on_load_service_clicked(self, load_file=None):
""" """
Loads the service file and saves the existing one it there is one Loads the service file and saves the existing one it there is one unchanged.
unchanged
``load_file`` ``load_file``
The service file to the loaded. Will be None is from menu so The service file to the loaded. Will be None is from menu so selection will be required.
selection will be required.
""" """
if self.is_modified(): if self.is_modified():
result = self.save_modified_service() result = self.save_modified_service()
@ -445,10 +440,9 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
""" """
Save the current service file. Save the current service file.
A temporary file is created so that we don't overwrite the existing one A temporary file is created so that we don't overwrite the existing one and leave a mangled service file should
and leave a mangled service file should there be an error when saving. there be an error when saving. Audio files are also copied into the service manager directory, and then packaged
Audio files are also copied into the service manager directory, and into the zip file.
then packaged into the zip file.
""" """
if not self.file_name(): if not self.file_name():
return self.save_file_as() return self.save_file_as()
@ -514,8 +508,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
total_size += file_size total_size += file_size
log.debug(u'ServiceManager.save_file - ZIP contents size is %i bytes' % total_size) log.debug(u'ServiceManager.save_file - ZIP contents size is %i bytes' % total_size)
service_content = cPickle.dumps(service) service_content = cPickle.dumps(service)
# Usual Zip file cannot exceed 2GiB, file with Zip64 cannot be # Usual Zip file cannot exceed 2GiB, file with Zip64 cannot be extracted using unzip in UNIX.
# extracted using unzip in UNIX.
allow_zip_64 = (total_size > 2147483648 + len(service_content)) allow_zip_64 = (total_size > 2147483648 + len(service_content))
log.debug(u'ServiceManager.save_file - allowZip64 is %s' % allow_zip_64) log.debug(u'ServiceManager.save_file - allowZip64 is %s' % allow_zip_64)
zip_file = None zip_file = None
@ -523,18 +516,15 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
self.main_window.increment_progress_bar() self.main_window.increment_progress_bar()
try: try:
zip_file = zipfile.ZipFile(temp_file_name, 'w', zipfile.ZIP_STORED, allow_zip_64) zip_file = zipfile.ZipFile(temp_file_name, 'w', zipfile.ZIP_STORED, allow_zip_64)
# First we add service contents. # First we add service contents. We save ALL file_names into ZIP using UTF-8.
# We save ALL file_names into ZIP using UTF-8.
zip_file.writestr(service_file_name.encode(u'utf-8'), service_content) zip_file.writestr(service_file_name.encode(u'utf-8'), service_content)
# Finally add all the listed media files. # Finally add all the listed media files.
for write_from in write_list: for write_from in write_list:
zip_file.write(write_from, write_from.encode(u'utf-8')) zip_file.write(write_from, write_from.encode(u'utf-8'))
for audio_from, audio_to in audio_files: for audio_from, audio_to in audio_files:
if audio_from.startswith(u'audio'): if audio_from.startswith(u'audio'):
# When items are saved, they get new unique_identifier. Let's copy the # When items are saved, they get new unique_identifier. Let's copy the file to the new location.
# file to the new location. Unused files can be ignored, # Unused files can be ignored, OpenLP automatically cleans up the service manager dir on exit.
# OpenLP automatically cleans up the service manager dir on
# exit.
audio_from = os.path.join(self.servicePath, audio_from) audio_from = os.path.join(self.servicePath, audio_from)
save_file = os.path.join(self.servicePath, audio_to) save_file = os.path.join(self.servicePath, audio_to)
save_path = os.path.split(save_file)[0] save_path = os.path.split(save_file)[0]
@ -587,7 +577,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
for item in self.service_items: for item in self.service_items:
self.main_window.increment_progress_bar() self.main_window.increment_progress_bar()
service_item = item[u'service_item'].get_service_repr(self._save_lite) service_item = item[u'service_item'].get_service_repr(self._save_lite)
#@todo check for file item on save. #TODO: check for file item on save.
service.append({u'serviceitem': service_item}) service.append({u'serviceitem': service_item})
self.main_window.increment_progress_bar() self.main_window.increment_progress_bar()
service_content = cPickle.dumps(service) service_content = cPickle.dumps(service)
@ -622,8 +612,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def save_file_as(self): def save_file_as(self):
""" """
Get a file name and then call :func:`ServiceManager.save_file` to Get a file name and then call :func:`ServiceManager.save_file` to save the file.
save the file.
""" """
default_service_enabled = Settings().value(u'advanced/default service enabled') default_service_enabled = Settings().value(u'advanced/default service enabled')
if default_service_enabled: if default_service_enabled:
@ -645,8 +634,8 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
default_file_name = u'' default_file_name = u''
directory = Settings().value(self.main_window.service_manager_settings_section + u'/last directory') directory = Settings().value(self.main_window.service_manager_settings_section + u'/last directory')
path = os.path.join(directory, default_file_name) path = os.path.join(directory, default_file_name)
# SaveAs from osz to oszl is not valid as the files will be deleted # SaveAs from osz to oszl is not valid as the files will be deleted on exit which is not sensible or usable in
# on exit which is not sensible or usable in the long term. # the long term.
if self._file_name.endswith(u'oszl') or self.service_has_all_original_files: if self._file_name.endswith(u'oszl') or self.service_has_all_original_files:
file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path, file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path,
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
@ -764,9 +753,8 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def load_Last_file(self): def load_Last_file(self):
""" """
Load the last service item from the service manager when the Load the last service item from the service manager when the service was last closed. Can be blank if there was
service was last closed. Can be blank if there was no service no service present.
present.
""" """
file_name = Settings().value(u'servicemanager/last file') file_name = Settings().value(u'servicemanager/last file')
if file_name: if file_name:
@ -860,8 +848,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def toggle_auto_play_slides_once(self): def toggle_auto_play_slides_once(self):
""" """
Toggle Auto play slide once. Toggle Auto play slide once. Inverts auto play once option for the item
Inverts auto play once option for the item
""" """
item = self.find_service_item()[0] item = self.find_service_item()[0]
service_item = self.service_items[item][u'service_item'] service_item = self.service_items[item][u'service_item']
@ -922,8 +909,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def on_service_item_edit_form(self): def on_service_item_edit_form(self):
""" """
Opens a dialog to edit the service item and update the service Opens a dialog to edit the service item and update the service display if changes are saved.
display if changes are saved.
""" """
item = self.find_service_item()[0] item = self.find_service_item()[0]
self.service_item_edit_form.set_service_item(self.service_items[item][u'service_item']) self.service_item_edit_form.set_service_item(self.service_items[item][u'service_item'])
@ -933,17 +919,14 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def preview_live(self, unique_identifier, row): def preview_live(self, unique_identifier, row):
""" """
Called by the SlideController to request a preview item be made live Called by the SlideController to request a preview item be made live and allows the next preview to be updated
and allows the next preview to be updated if relevant. if relevant.
``unique_identifier`` ``unique_identifier``
Reference to the service_item Reference to the service_item
``row`` ``row``
individual row number individual row number
""" """
for sitem in self.service_items: for sitem in self.service_items:
if sitem[u'service_item'].unique_identifier == unique_identifier: if sitem[u'service_item'].unique_identifier == unique_identifier:
@ -1021,8 +1004,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def on_move_selection_up(self): def on_move_selection_up(self):
""" """
Moves the cursor selection up the window. Moves the cursor selection up the window. Called by the up arrow.
Called by the up arrow.
""" """
item = self.service_manager_list.currentItem() item = self.service_manager_list.currentItem()
itemBefore = self.service_manager_list.itemAbove(item) itemBefore = self.service_manager_list.itemAbove(item)
@ -1032,8 +1014,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def on_move_selection_down(self): def on_move_selection_down(self):
""" """
Moves the cursor selection down the window. Moves the cursor selection down the window. Called by the down arrow.
Called by the down arrow.
""" """
item = self.service_manager_list.currentItem() item = self.service_manager_list.currentItem()
itemAfter = self.service_manager_list.itemBelow(item) itemAfter = self.service_manager_list.itemBelow(item)
@ -1051,8 +1032,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def collapsed(self, item): def collapsed(self, item):
""" """
Record if an item is collapsed. Used when repainting the list to get the Record if an item is collapsed. Used when repainting the list to get the correct state.
correct state.
""" """
pos = item.data(0, QtCore.Qt.UserRole) pos = item.data(0, QtCore.Qt.UserRole)
self.service_items[pos - 1][u'expanded'] = False self.service_items[pos - 1][u'expanded'] = False
@ -1067,8 +1047,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def expanded(self, item): def expanded(self, item):
""" """
Record if an item is collapsed. Used when repainting the list to get the Record if an item is collapsed. Used when repainting the list to get the correct state.
correct state.
""" """
pos = item.data(0, QtCore.Qt.UserRole) pos = item.data(0, QtCore.Qt.UserRole)
self.service_items[pos - 1][u'expanded'] = True self.service_items[pos - 1][u'expanded'] = True
@ -1133,9 +1112,8 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def repaint_service_list(self, service_item, service_item_child): def repaint_service_list(self, service_item, service_item_child):
""" """
Clear the existing service list and prepaint all the items. This is Clear the existing service list and prepaint all the items. This is used when moving items as the move takes
used when moving items as the move takes place in a supporting list, place in a supporting list, and when regenerating all the items due to theme changes.
and when regenerating all the items due to theme changes.
``service_item`` ``service_item``
The item which changed. (int) The item which changed. (int)
@ -1233,8 +1211,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def theme_change(self): def theme_change(self):
""" """
The theme may have changed in the settings dialog so make The theme may have changed in the settings dialog so make sure the theme combo box is in the correct state.
sure the theme combo box is in the correct state.
""" """
log.debug(u'theme_change') log.debug(u'theme_change')
visible = self.renderer.theme_level == ThemeLevel.Global visible = self.renderer.theme_level == ThemeLevel.Global
@ -1243,8 +1220,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def regenerate_service_Items(self, changed=False): def regenerate_service_Items(self, changed=False):
""" """
Rebuild the service list as things have changed and a Rebuild the service list as things have changed and a repaint is the easiest way to do this.
repaint is the easiest way to do this.
""" """
self.application.set_busy_cursor() self.application.set_busy_cursor()
log.debug(u'regenerate_service_Items') log.debug(u'regenerate_service_Items')
@ -1272,8 +1248,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
for item in tempServiceItems: for item in tempServiceItems:
self.add_service_item(item[u'service_item'], False, expand=item[u'expanded'], repaint=False, self.add_service_item(item[u'service_item'], False, expand=item[u'expanded'], repaint=False,
selected=item[u'selected']) selected=item[u'selected'])
# Set to False as items may have changed rendering # Set to False as items may have changed rendering does not impact the saved song so True may also be valid
# does not impact the saved song so True may also be valid
if changed: if changed:
self.set_modified() self.set_modified()
# Repaint it once only at the end # Repaint it once only at the end
@ -1282,8 +1257,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def service_item_update(self, edit_id, unique_identifier, temporary=False): def service_item_update(self, edit_id, unique_identifier, temporary=False):
""" """
Triggered from plugins to update service items. Triggered from plugins to update service items. Save the values as they will be used as part of the service load
Save the values as they will be used as part of the service load
""" """
self.load_item_unique_identifier = unique_identifier self.load_item_unique_identifier = unique_identifier
self.load_item_edit_id = int(edit_id) self.load_item_edit_id = int(edit_id)
@ -1291,8 +1265,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def replace_service_item(self, newItem): def replace_service_item(self, newItem):
""" """
Using the service item passed replace the one with the same edit id Using the service item passed replace the one with the same edit id if found.
if found.
""" """
for item_count, item in enumerate(self.service_items): for item_count, item in enumerate(self.service_items):
if item[u'service_item'].edit_id == newItem.edit_id and item[u'service_item'].name == newItem.name: if item[u'service_item'].edit_id == newItem.edit_id and item[u'service_item'].name == newItem.name:
@ -1375,8 +1348,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def on_make_live(self): def on_make_live(self):
""" """
Send the current item to the Live slide controller but triggered Send the current item to the Live slide controller but triggered by a tablewidget click event.
by a tablewidget click event.
""" """
self.make_live() self.make_live()
@ -1385,8 +1357,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
Send the current item to the Live slide controller Send the current item to the Live slide controller
``row`` ``row``
Row number to be displayed if from preview. Row number to be displayed if from preview. -1 is passed if the value is not set
-1 is passed if the value is not set
""" """
item, child = self.find_service_item() item, child = self.find_service_item()
# No items in service # No items in service
@ -1431,10 +1402,9 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def find_service_item(self): def find_service_item(self):
""" """
Finds the first selected ServiceItem in the list and returns the Finds the first selected ServiceItem in the list and returns the position of the serviceitem and its selected
position of the serviceitem and its selected child item. For example, child item. For example, if the third child item (in the Slidecontroller known as slide) in the second service
if the third child item (in the Slidecontroller known as slide) in the item is selected this will return::
second service item is selected this will return::
(1, 2) (1, 2)
""" """
@ -1456,8 +1426,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
def drop_event(self, event): def drop_event(self, event):
""" """
Receive drop event and trigger an internal event to get the Receive drop event and trigger an internal event to get the plugins to build and push the correct service item.
plugins to build and push the correct service item
The drag event payload carries the plugin name The drag event payload carries the plugin name
``event`` ``event``
@ -1529,8 +1498,8 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
theme_group = QtGui.QActionGroup(self.theme_menu) theme_group = QtGui.QActionGroup(self.theme_menu)
theme_group.setExclusive(True) theme_group.setExclusive(True)
theme_group.setObjectName(u'theme_group') theme_group.setObjectName(u'theme_group')
# Create a "Default" theme, which allows the user to reset the item's # Create a "Default" theme, which allows the user to reset the item's theme to the service theme or global
# theme to the service theme or global theme. # theme.
defaultTheme = create_widget_action(self.theme_menu, text=UiStrings().Default, checked=False, defaultTheme = create_widget_action(self.theme_menu, text=UiStrings().Default, checked=False,
triggers=self.on_theme_change_action) triggers=self.on_theme_change_action)
self.theme_menu.setDefaultAction(defaultTheme) self.theme_menu.setDefaultAction(defaultTheme)

View File

@ -184,7 +184,7 @@ class ThemesTab(SettingsTab):
""" """
self.global_theme = self.default_combo_box.currentText() self.global_theme = self.default_combo_box.currentText()
self.renderer.set_global_theme() self.renderer.set_global_theme()
self._previewGlobalTheme() self._preview_global_theme()
def update_theme_list(self, theme_list): def update_theme_list(self, theme_list):
""" """

View File

@ -225,7 +225,7 @@ class AlertsPlugin(Plugin):
``frame`` ``frame``
The Web frame holding the page. The Web frame holding the page.
""" """
align = VerticalType.Names[self.settingsTab.location] align = VerticalType.Names[self.settings_tab.location]
frame.evaluateJavaScript(u'update_css("%s", "%s", "%s", "%s", "%s")' % frame.evaluateJavaScript(u'update_css("%s", "%s", "%s", "%s", "%s")' %
(align, self.settingsTab.font_face, self.settingsTab.font_size, (align, self.settings_tab.font_face, self.settings_tab.font_size,
self.settingsTab.font_color, self.settingsTab.background_color)) self.settings_tab.font_color, self.settings_tab.background_color))

View File

@ -206,7 +206,7 @@ class BiblesTab(SettingsTab):
self.layout_style = self.layout_style_combo_box.currentIndex() self.layout_style = self.layout_style_combo_box.currentIndex()
def on_language_selection_combo_box_changed(self): def on_language_selection_combo_box_changed(self):
self.language_selection = self.language_selectioncombo_box.currentIndex() self.language_selection = self.language_selection_combo_box.currentIndex()
def on_new_chapters_check_box_changed(self, check_state): def on_new_chapters_check_box_changed(self, check_state):
self.show_new_chapters = False self.show_new_chapters = False

View File

@ -516,13 +516,13 @@ class BibleMediaItem(MediaManagerItem):
def onQuickStyleComboBoxChanged(self): def onQuickStyleComboBoxChanged(self):
self.settings.layout_style = self.quickStyleComboBox.currentIndex() self.settings.layout_style = self.quickStyleComboBox.currentIndex()
self.advancedStyleComboBox.setCurrentIndex(self.settings.layout_style) self.advancedStyleComboBox.setCurrentIndex(self.settings.layout_style)
self.settings.layoutStyleComboBox.setCurrentIndex(self.settings.layout_style) self.settings.layout_style_combo_box.setCurrentIndex(self.settings.layout_style)
Settings().setValue(self.settings_section + u'/verse layout style', self.settings.layout_style) Settings().setValue(self.settings_section + u'/verse layout style', self.settings.layout_style)
def onAdvancedStyleComboBoxChanged(self): def onAdvancedStyleComboBoxChanged(self):
self.settings.layout_style = self.advancedStyleComboBox.currentIndex() self.settings.layout_style = self.advancedStyleComboBox.currentIndex()
self.quickStyleComboBox.setCurrentIndex(self.settings.layout_style) self.quickStyleComboBox.setCurrentIndex(self.settings.layout_style)
self.settings.layoutStyleComboBox.setCurrentIndex(self.settings.layout_style) self.settings.layout_style_combo_box.setCurrentIndex(self.settings.layout_style)
Settings().setValue(self.settings_section + u'/verse layout style', self.settings.layout_style) Settings().setValue(self.settings_section + u'/verse layout style', self.settings.layout_style)
def onAdvancedVersionComboBox(self): def onAdvancedVersionComboBox(self):

View File

@ -26,6 +26,3 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from editcustomform import EditCustomForm
from editcustomslideform import EditCustomSlideForm

View File

@ -91,8 +91,8 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
self.slide_list_view.clear() self.slide_list_view.clear()
if id == 0: if id == 0:
self.custom_slide = CustomSlide() self.custom_slide = CustomSlide()
self.title_edit.set_text(u'') self.title_edit.setText(u'')
self.credit_edit.set_text(u'') self.credit_edit.setText(u'')
self.theme_combo_box.setCurrentIndex(0) self.theme_combo_box.setCurrentIndex(0)
else: else:
self.custom_slide = self.manager.get_object(CustomSlide, id) self.custom_slide = self.manager.get_object(CustomSlide, id)

View File

@ -34,7 +34,7 @@ from sqlalchemy.sql import or_, func, and_
from openlp.core.lib import Registry, MediaManagerItem, ItemCapabilities, ServiceItemContext, Settings, PluginStatus,\ from openlp.core.lib import Registry, MediaManagerItem, ItemCapabilities, ServiceItemContext, Settings, PluginStatus,\
UiStrings, check_item_selected, translate UiStrings, check_item_selected, translate
from openlp.plugins.custom.forms import EditCustomForm from openlp.plugins.custom.forms.editcustomform import EditCustomForm
from openlp.plugins.custom.lib import CustomXMLParser, CustomXMLBuilder from openlp.plugins.custom.lib import CustomXMLParser, CustomXMLBuilder
from openlp.plugins.custom.lib.db import CustomSlide from openlp.plugins.custom.lib.db import CustomSlide

View File

@ -150,7 +150,7 @@ class RemoteTab(SettingsTab):
Settings().setValue(self.settings_section + u'/ip address', self.address_edit.text()) Settings().setValue(self.settings_section + u'/ip address', self.address_edit.text())
Settings().setValue(self.settings_section + u'/twelve hour', self.twelve_hour) Settings().setValue(self.settings_section + u'/twelve hour', self.twelve_hour)
if changed: if changed:
Registry().register_function(u'remotes_config_updated') Registry().execute(u'remotes_config_updated')
def onTwelveHourCheckBoxChanged(self, check_state): def onTwelveHourCheckBoxChanged(self, check_state):
self.twelve_hour = False self.twelve_hour = False

View File

@ -256,8 +256,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
A QtGui.QKeyEvent event. A QtGui.QKeyEvent event.
""" """
if event.key() in (QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return): if event.key() in (QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return):
if self.authorsComboBox.hasFocus() and self.authorsComboBox.currentText(): if self.authors_combo_box.hasFocus() and self.authors_combo_box.currentText():
self.onAuthorAddButtonClicked() self.on_author_add_button_clicked()
return return
if self.topicsComboBox.hasFocus() and self.topicsComboBox.currentText(): if self.topicsComboBox.hasFocus() and self.topicsComboBox.currentText():
self.on_topic_add_button_clicked() self.on_topic_add_button_clicked()

View File

@ -18,7 +18,6 @@
<file>author_maintenance.png</file> <file>author_maintenance.png</file>
<file>topic_maintenance.png</file> <file>topic_maintenance.png</file>
<file>song_author_edit.png</file> <file>song_author_edit.png</file>
<file>song_topic_edit.png</file>
<file>song_book_edit.png</file> <file>song_book_edit.png</file>
</qresource> </qresource>
<qresource prefix="images"> <qresource prefix="images">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 352 KiB

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -47,8 +47,7 @@ mv openlp/core/resources.py openlp/core/resources.py.old
pyrcc4 -o openlp/core/resources.py.new resources/images/openlp-2.qrc pyrcc4 -o openlp/core/resources.py.new resources/images/openlp-2.qrc
# Remove patch breaking lines # Remove patch breaking lines
cat openlp/core/resources.py.new | sed '/# Created: /d;/# by: /d' \ cat openlp/core/resources.py.new | sed '/# Created: /d;/# by: /d' > openlp/core/resources.py
> openlp/core/resources.py
# Patch resources.py to OpenLP coding style # Patch resources.py to OpenLP coding style
patch --posix -s openlp/core/resources.py scripts/resources.patch patch --posix -s openlp/core/resources.py scripts/resources.patch

Binary file not shown.

View File

@ -0,0 +1,64 @@
"""
Module to test the custom edit form.
"""
from unittest import TestCase
from mock import MagicMock, patch
from PyQt4 import QtGui, QtTest, QtCore
from openlp.core.lib import Registry
# Import needed due to import problems.
from openlp.plugins.custom.lib.mediaitem import CustomMediaItem
from openlp.plugins.custom.forms.editcustomform import EditCustomForm
class TestCustomFrom(TestCase):
"""
Test the EditCustomForm.
"""
def setUp(self):
"""
Create the UI
"""
Registry.create()
self.app = QtGui.QApplication([])
self.main_window = QtGui.QMainWindow()
Registry().register(u'main_window', self.main_window)
media_item = MagicMock()
manager = MagicMock()
self.form = EditCustomForm(media_item, self.main_window, manager)
def tearDown(self):
"""
Delete all the C++ objects at the end so that we don't have a segfault
"""
del self.form
del self.main_window
del self.app
def load_custom_test(self):
"""
Test the load_custom() method.
"""
# GIVEN: A mocked QDialog.exec_() method
with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec:
# WHEN: Show the dialog and create a new custom item.
self.form.exec_()
self.form.load_custom(0)
#THEN: The line edits should not contain any text.
self.assertEqual(self.form.title_edit.text(), u'', u'The title edit should be empty')
self.assertEqual(self.form.credit_edit.text(), u'', u'The credit edit should be empty')
def on_add_button_clicked_test(self):
"""
Test the on_add_button_clicked_test method / add_button button.
"""
# GIVEN: A mocked QDialog.exec_() method
with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec:
# WHEN: Show the dialog and add a new slide.
self.form.exec_()
QtTest.QTest.mouseClick(self.form.add_button, QtCore.Qt.LeftButton)
#THEN: One slide should be added.
assert self.form.slide_list_view.count() == 1, u'There should be one slide added.'