forked from openlp/openlp
head
This commit is contained in:
commit
c5e11ff558
@ -305,6 +305,7 @@ class Settings(QtCore.QSettings):
|
||||
(u'bibles/bookname language', u'bibles/book name language', []),
|
||||
(u'general/enable slide loop', u'advanced/slide limits', [(SlideLimits.Wrap, True), (SlideLimits.End, False)]),
|
||||
(u'songs/ccli number', u'general/ccli number', []),
|
||||
(u'media/use phonon', u'', []),
|
||||
# Changed during 2.1.x development.
|
||||
(u'advanced/stylesheet fix', u'', []),
|
||||
(u'bibles/last directory 1', u'bibles/last directory import', []),
|
||||
|
@ -175,7 +175,7 @@ class MainDisplay(Display):
|
||||
We need to rebuild the CSS on the live display.
|
||||
"""
|
||||
for plugin in self.plugin_manager.plugins:
|
||||
plugin.refreshCss(self.frame)
|
||||
plugin.refresh_css(self.frame)
|
||||
|
||||
def retranslateUi(self):
|
||||
"""
|
||||
|
@ -651,7 +651,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
for plugin in self.plugin_manager.plugins:
|
||||
self.activePlugin = plugin
|
||||
oldStatus = self.activePlugin.status
|
||||
self.activePlugin.setStatus()
|
||||
self.activePlugin.set_status()
|
||||
if oldStatus != self.activePlugin.status:
|
||||
if self.activePlugin.status == PluginStatus.Active:
|
||||
self.activePlugin.toggle_status(PluginStatus.Active)
|
||||
|
@ -84,9 +84,8 @@ class ServiceManagerList(QtGui.QTreeWidget):
|
||||
|
||||
def mouseMoveEvent(self, event):
|
||||
"""
|
||||
Drag and drop event does not care what data is selected
|
||||
as the recipient will use events to request the data move
|
||||
just tell it what plugin to call
|
||||
Drag and drop event does not care what data is selected as the recipient will use events to request the data
|
||||
move just tell it what plugin to call
|
||||
"""
|
||||
if event.buttons() != QtCore.Qt.LeftButton:
|
||||
event.ignore()
|
||||
@ -284,10 +283,9 @@ class ServiceManagerDialog(object):
|
||||
|
||||
class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
"""
|
||||
Manages the services. This involves taking text strings from plugins and
|
||||
adding them to the service. This service can then be zipped up with all
|
||||
the resources used into one OSZ or oszl file for use on any OpenLP v2
|
||||
installation. Also handles the UI tasks of moving things up and down etc.
|
||||
Manages the services. This involves taking text strings from plugins and adding them to the service. This service
|
||||
can then be zipped up with all the resources used into one OSZ or oszl file for use on any OpenLP v2 installation.
|
||||
Also handles the UI tasks of moving things up and down etc.
|
||||
"""
|
||||
def __init__(self, parent=None):
|
||||
"""
|
||||
@ -316,8 +314,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
|
||||
def set_modified(self, modified=True):
|
||||
"""
|
||||
Setter for property "modified". Sets whether or not the current service
|
||||
has been modified.
|
||||
Setter for property "modified". Sets whether or not the current service has been modified.
|
||||
"""
|
||||
if modified:
|
||||
self.service_id += 1
|
||||
@ -361,7 +358,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
|
||||
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``
|
||||
New Suffix to be supported
|
||||
@ -384,12 +381,10 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
|
||||
def on_load_service_clicked(self, load_file=None):
|
||||
"""
|
||||
Loads the service file and saves the existing one it there is one
|
||||
unchanged
|
||||
Loads the service file and saves the existing one it there is one unchanged.
|
||||
|
||||
``load_file``
|
||||
The service file to the loaded. Will be None is from menu so
|
||||
selection will be required.
|
||||
The service file to the loaded. Will be None is from menu so selection will be required.
|
||||
"""
|
||||
if self.is_modified():
|
||||
result = self.save_modified_service()
|
||||
@ -445,10 +440,9 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
"""
|
||||
Save the current service file.
|
||||
|
||||
A temporary file is created so that we don't overwrite the existing one
|
||||
and leave a mangled service file should there be an error when saving.
|
||||
Audio files are also copied into the service manager directory, and
|
||||
then packaged into the zip file.
|
||||
A temporary file is created so that we don't overwrite the existing one and leave a mangled service file should
|
||||
there be an error when saving. Audio files are also copied into the service manager directory, and then packaged
|
||||
into the zip file.
|
||||
"""
|
||||
if not self.file_name():
|
||||
return self.save_file_as()
|
||||
@ -514,8 +508,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
total_size += file_size
|
||||
log.debug(u'ServiceManager.save_file - ZIP contents size is %i bytes' % total_size)
|
||||
service_content = cPickle.dumps(service)
|
||||
# Usual Zip file cannot exceed 2GiB, file with Zip64 cannot be
|
||||
# extracted using unzip in UNIX.
|
||||
# Usual Zip file cannot exceed 2GiB, file with Zip64 cannot be extracted using unzip in UNIX.
|
||||
allow_zip_64 = (total_size > 2147483648 + len(service_content))
|
||||
log.debug(u'ServiceManager.save_file - allowZip64 is %s' % allow_zip_64)
|
||||
zip_file = None
|
||||
@ -523,18 +516,15 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
self.main_window.increment_progress_bar()
|
||||
try:
|
||||
zip_file = zipfile.ZipFile(temp_file_name, 'w', zipfile.ZIP_STORED, allow_zip_64)
|
||||
# First we add service contents.
|
||||
# We save ALL file_names into ZIP using UTF-8.
|
||||
# First we add service contents. We save ALL file_names into ZIP using UTF-8.
|
||||
zip_file.writestr(service_file_name.encode(u'utf-8'), service_content)
|
||||
# Finally add all the listed media files.
|
||||
for write_from in write_list:
|
||||
zip_file.write(write_from, write_from.encode(u'utf-8'))
|
||||
for audio_from, audio_to in audio_files:
|
||||
if audio_from.startswith(u'audio'):
|
||||
# When items are saved, they get new unique_identifier. Let's copy the
|
||||
# file to the new location. Unused files can be ignored,
|
||||
# OpenLP automatically cleans up the service manager dir on
|
||||
# exit.
|
||||
# When items are saved, they get new unique_identifier. Let's copy the file to the new location.
|
||||
# Unused files can be ignored, OpenLP automatically cleans up the service manager dir on exit.
|
||||
audio_from = os.path.join(self.servicePath, audio_from)
|
||||
save_file = os.path.join(self.servicePath, audio_to)
|
||||
save_path = os.path.split(save_file)[0]
|
||||
@ -587,7 +577,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
for item in self.service_items:
|
||||
self.main_window.increment_progress_bar()
|
||||
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})
|
||||
self.main_window.increment_progress_bar()
|
||||
service_content = cPickle.dumps(service)
|
||||
@ -622,8 +612,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
|
||||
def save_file_as(self):
|
||||
"""
|
||||
Get a file name and then call :func:`ServiceManager.save_file` to
|
||||
save the file.
|
||||
Get a file name and then call :func:`ServiceManager.save_file` to save the file.
|
||||
"""
|
||||
default_service_enabled = Settings().value(u'advanced/default service enabled')
|
||||
if default_service_enabled:
|
||||
@ -645,8 +634,8 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
default_file_name = u''
|
||||
directory = Settings().value(self.main_window.service_manager_settings_section + u'/last directory')
|
||||
path = os.path.join(directory, default_file_name)
|
||||
# SaveAs from osz to oszl is not valid as the files will be deleted
|
||||
# on exit which is not sensible or usable in the long term.
|
||||
# SaveAs from osz to oszl is not valid as the files will be deleted on exit which is not sensible or usable in
|
||||
# the long term.
|
||||
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,
|
||||
translate('OpenLP.ServiceManager',
|
||||
@ -764,9 +753,8 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
|
||||
def load_Last_file(self):
|
||||
"""
|
||||
Load the last service item from the service manager when the
|
||||
service was last closed. Can be blank if there was no service
|
||||
present.
|
||||
Load the last service item from the service manager when the service was last closed. Can be blank if there was
|
||||
no service present.
|
||||
"""
|
||||
file_name = Settings().value(u'servicemanager/last file')
|
||||
if file_name:
|
||||
@ -860,8 +848,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
|
||||
def toggle_auto_play_slides_once(self):
|
||||
"""
|
||||
Toggle Auto play slide once.
|
||||
Inverts auto play once option for the item
|
||||
Toggle Auto play slide once. Inverts auto play once option for the item
|
||||
"""
|
||||
item = self.find_service_item()[0]
|
||||
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):
|
||||
"""
|
||||
Opens a dialog to edit the service item and update the service
|
||||
display if changes are saved.
|
||||
Opens a dialog to edit the service item and update the service display if changes are saved.
|
||||
"""
|
||||
item = self.find_service_item()[0]
|
||||
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):
|
||||
"""
|
||||
Called by the SlideController to request a preview item be made live
|
||||
and allows the next preview to be updated if relevant.
|
||||
|
||||
Called by the SlideController to request a preview item be made live and allows the next preview to be updated
|
||||
if relevant.
|
||||
|
||||
``unique_identifier``
|
||||
Reference to the service_item
|
||||
|
||||
|
||||
``row``
|
||||
individual row number
|
||||
|
||||
"""
|
||||
for sitem in self.service_items:
|
||||
if sitem[u'service_item'].unique_identifier == unique_identifier:
|
||||
@ -1021,8 +1004,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
|
||||
def on_move_selection_up(self):
|
||||
"""
|
||||
Moves the cursor selection up the window.
|
||||
Called by the up arrow.
|
||||
Moves the cursor selection up the window. Called by the up arrow.
|
||||
"""
|
||||
item = self.service_manager_list.currentItem()
|
||||
itemBefore = self.service_manager_list.itemAbove(item)
|
||||
@ -1032,8 +1014,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
|
||||
def on_move_selection_down(self):
|
||||
"""
|
||||
Moves the cursor selection down the window.
|
||||
Called by the down arrow.
|
||||
Moves the cursor selection down the window. Called by the down arrow.
|
||||
"""
|
||||
item = self.service_manager_list.currentItem()
|
||||
itemAfter = self.service_manager_list.itemBelow(item)
|
||||
@ -1051,8 +1032,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
|
||||
def collapsed(self, item):
|
||||
"""
|
||||
Record if an item is collapsed. Used when repainting the list to get the
|
||||
correct state.
|
||||
Record if an item is collapsed. Used when repainting the list to get the correct state.
|
||||
"""
|
||||
pos = item.data(0, QtCore.Qt.UserRole)
|
||||
self.service_items[pos - 1][u'expanded'] = False
|
||||
@ -1067,8 +1047,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
|
||||
def expanded(self, item):
|
||||
"""
|
||||
Record if an item is collapsed. Used when repainting the list to get the
|
||||
correct state.
|
||||
Record if an item is collapsed. Used when repainting the list to get the correct state.
|
||||
"""
|
||||
pos = item.data(0, QtCore.Qt.UserRole)
|
||||
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):
|
||||
"""
|
||||
Clear the existing service list and prepaint all the items. This is
|
||||
used when moving items as the move takes place in a supporting list,
|
||||
and when regenerating all the items due to theme changes.
|
||||
Clear the existing service list and prepaint all the items. This is used when moving items as the move takes
|
||||
place in a supporting list, and when regenerating all the items due to theme changes.
|
||||
|
||||
``service_item``
|
||||
The item which changed. (int)
|
||||
@ -1233,8 +1211,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
|
||||
def theme_change(self):
|
||||
"""
|
||||
The theme may have changed in the settings dialog so make
|
||||
sure the theme combo box is in the correct state.
|
||||
The theme may have changed in the settings dialog so make sure the theme combo box is in the correct state.
|
||||
"""
|
||||
log.debug(u'theme_change')
|
||||
visible = self.renderer.theme_level == ThemeLevel.Global
|
||||
@ -1243,8 +1220,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
|
||||
def regenerate_service_Items(self, changed=False):
|
||||
"""
|
||||
Rebuild the service list as things have changed and a
|
||||
repaint is the easiest way to do this.
|
||||
Rebuild the service list as things have changed and a repaint is the easiest way to do this.
|
||||
"""
|
||||
self.application.set_busy_cursor()
|
||||
log.debug(u'regenerate_service_Items')
|
||||
@ -1272,8 +1248,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
for item in tempServiceItems:
|
||||
self.add_service_item(item[u'service_item'], False, expand=item[u'expanded'], repaint=False,
|
||||
selected=item[u'selected'])
|
||||
# Set to False as items may have changed rendering
|
||||
# does not impact the saved song so True may also be valid
|
||||
# Set to False as items may have changed rendering does not impact the saved song so True may also be valid
|
||||
if changed:
|
||||
self.set_modified()
|
||||
# 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):
|
||||
"""
|
||||
Triggered from plugins to update service items.
|
||||
Save the values as they will be used as part of the service load
|
||||
Triggered from plugins to update service items. Save the values as they will be used as part of the service load
|
||||
"""
|
||||
self.load_item_unique_identifier = unique_identifier
|
||||
self.load_item_edit_id = int(edit_id)
|
||||
@ -1291,8 +1265,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
|
||||
def replace_service_item(self, newItem):
|
||||
"""
|
||||
Using the service item passed replace the one with the same edit id
|
||||
if found.
|
||||
Using the service item passed replace the one with the same edit id if found.
|
||||
"""
|
||||
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:
|
||||
@ -1375,8 +1348,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
|
||||
def on_make_live(self):
|
||||
"""
|
||||
Send the current item to the Live slide controller but triggered
|
||||
by a tablewidget click event.
|
||||
Send the current item to the Live slide controller but triggered by a tablewidget click event.
|
||||
"""
|
||||
self.make_live()
|
||||
|
||||
@ -1385,8 +1357,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
Send the current item to the Live slide controller
|
||||
|
||||
``row``
|
||||
Row number to be displayed if from preview.
|
||||
-1 is passed if the value is not set
|
||||
Row number to be displayed if from preview. -1 is passed if the value is not set
|
||||
"""
|
||||
item, child = self.find_service_item()
|
||||
# No items in service
|
||||
@ -1431,10 +1402,9 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
|
||||
def find_service_item(self):
|
||||
"""
|
||||
Finds the first selected ServiceItem in the list and returns the
|
||||
position of the serviceitem and its selected child item. For example,
|
||||
if the third child item (in the Slidecontroller known as slide) in the
|
||||
second service item is selected this will return::
|
||||
Finds the first selected ServiceItem in the list and returns the position of the serviceitem and its selected
|
||||
child item. For example, if the third child item (in the Slidecontroller known as slide) in the second service
|
||||
item is selected this will return::
|
||||
|
||||
(1, 2)
|
||||
"""
|
||||
@ -1456,8 +1426,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
|
||||
def drop_event(self, event):
|
||||
"""
|
||||
Receive drop event and trigger an internal event to get the
|
||||
plugins to build and push the correct service item
|
||||
Receive drop event and trigger an internal event to get the plugins to build and push the correct service item.
|
||||
The drag event payload carries the plugin name
|
||||
|
||||
``event``
|
||||
@ -1529,8 +1498,8 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
theme_group = QtGui.QActionGroup(self.theme_menu)
|
||||
theme_group.setExclusive(True)
|
||||
theme_group.setObjectName(u'theme_group')
|
||||
# Create a "Default" theme, which allows the user to reset the item's
|
||||
# theme to the service theme or global theme.
|
||||
# Create a "Default" theme, which allows the user to reset the item's theme to the service theme or global
|
||||
# theme.
|
||||
defaultTheme = create_widget_action(self.theme_menu, text=UiStrings().Default, checked=False,
|
||||
triggers=self.on_theme_change_action)
|
||||
self.theme_menu.setDefaultAction(defaultTheme)
|
||||
|
@ -184,7 +184,7 @@ class ThemesTab(SettingsTab):
|
||||
"""
|
||||
self.global_theme = self.default_combo_box.currentText()
|
||||
self.renderer.set_global_theme()
|
||||
self._previewGlobalTheme()
|
||||
self._preview_global_theme()
|
||||
|
||||
def update_theme_list(self, theme_list):
|
||||
"""
|
||||
|
@ -225,7 +225,7 @@ class AlertsPlugin(Plugin):
|
||||
``frame``
|
||||
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")' %
|
||||
(align, self.settingsTab.font_face, self.settingsTab.font_size,
|
||||
self.settingsTab.font_color, self.settingsTab.background_color))
|
||||
(align, self.settings_tab.font_face, self.settings_tab.font_size,
|
||||
self.settings_tab.font_color, self.settings_tab.background_color))
|
||||
|
@ -206,7 +206,7 @@ class BiblesTab(SettingsTab):
|
||||
self.layout_style = self.layout_style_combo_box.currentIndex()
|
||||
|
||||
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):
|
||||
self.show_new_chapters = False
|
||||
|
@ -516,13 +516,13 @@ class BibleMediaItem(MediaManagerItem):
|
||||
def onQuickStyleComboBoxChanged(self):
|
||||
self.settings.layout_style = self.quickStyleComboBox.currentIndex()
|
||||
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)
|
||||
|
||||
def onAdvancedStyleComboBoxChanged(self):
|
||||
self.settings.layout_style = self.advancedStyleComboBox.currentIndex()
|
||||
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)
|
||||
|
||||
def onAdvancedVersionComboBox(self):
|
||||
|
@ -26,6 +26,3 @@
|
||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from editcustomform import EditCustomForm
|
||||
from editcustomslideform import EditCustomSlideForm
|
||||
|
@ -91,8 +91,8 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
||||
self.slide_list_view.clear()
|
||||
if id == 0:
|
||||
self.custom_slide = CustomSlide()
|
||||
self.title_edit.set_text(u'')
|
||||
self.credit_edit.set_text(u'')
|
||||
self.title_edit.setText(u'')
|
||||
self.credit_edit.setText(u'')
|
||||
self.theme_combo_box.setCurrentIndex(0)
|
||||
else:
|
||||
self.custom_slide = self.manager.get_object(CustomSlide, id)
|
||||
|
@ -34,7 +34,7 @@ from sqlalchemy.sql import or_, func, and_
|
||||
|
||||
from openlp.core.lib import Registry, MediaManagerItem, ItemCapabilities, ServiceItemContext, Settings, PluginStatus,\
|
||||
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.db import CustomSlide
|
||||
|
||||
|
@ -118,31 +118,6 @@ class MediaPlugin(Plugin):
|
||||
"""
|
||||
return self.media_controller.get_media_display_html()
|
||||
|
||||
def app_startup(self):
|
||||
"""
|
||||
Do a couple of things when the app starts up. In this particular case
|
||||
we want to check if we have the old "Use Phonon" setting, and convert
|
||||
it to "enable Phonon" and "make it the first one in the list".
|
||||
"""
|
||||
Plugin.app_startup(self)
|
||||
settings = Settings()
|
||||
settings.beginGroup(self.settings_section)
|
||||
if settings.contains(u'use phonon'):
|
||||
log.info(u'Found old Phonon setting')
|
||||
players = self.media_controller.mediaPlayers.keys()
|
||||
has_phonon = u'phonon' in players
|
||||
if settings.value(u'use phonon') and has_phonon:
|
||||
log.debug(u'Converting old setting to new setting')
|
||||
new_players = []
|
||||
if players:
|
||||
new_players = [player for player in players if player != u'phonon']
|
||||
new_players.insert(0, u'phonon')
|
||||
self.media_controller.mediaPlayers[u'phonon'].is_active = True
|
||||
settings.setValue(u'players', u','.join(new_players))
|
||||
self.settingsTab.load()
|
||||
settings.remove(u'use phonon')
|
||||
settings.endGroup()
|
||||
|
||||
def _get_media_controller(self):
|
||||
"""
|
||||
Adds the media controller to the class dynamically
|
||||
|
@ -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'/twelve hour', self.twelve_hour)
|
||||
if changed:
|
||||
Registry().register_function(u'remotes_config_updated')
|
||||
Registry().execute(u'remotes_config_updated')
|
||||
|
||||
def onTwelveHourCheckBoxChanged(self, check_state):
|
||||
self.twelve_hour = False
|
||||
|
@ -256,8 +256,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
A QtGui.QKeyEvent event.
|
||||
"""
|
||||
if event.key() in (QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return):
|
||||
if self.authorsComboBox.hasFocus() and self.authorsComboBox.currentText():
|
||||
self.onAuthorAddButtonClicked()
|
||||
if self.authors_combo_box.hasFocus() and self.authors_combo_box.currentText():
|
||||
self.on_author_add_button_clicked()
|
||||
return
|
||||
if self.topicsComboBox.hasFocus() and self.topicsComboBox.currentText():
|
||||
self.on_topic_add_button_clicked()
|
||||
|
@ -18,7 +18,6 @@
|
||||
<file>author_maintenance.png</file>
|
||||
<file>topic_maintenance.png</file>
|
||||
<file>song_author_edit.png</file>
|
||||
<file>song_topic_edit.png</file>
|
||||
<file>song_book_edit.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="images">
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 830 B |
Binary file not shown.
Before Width: | Height: | Size: 352 KiB |
@ -1,5 +1,5 @@
|
||||
#!/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 #
|
||||
@ -47,8 +47,7 @@ mv openlp/core/resources.py openlp/core/resources.py.old
|
||||
pyrcc4 -py3 -o openlp/core/resources.py.new resources/images/openlp-2.qrc
|
||||
|
||||
# Remove patch breaking lines
|
||||
cat openlp/core/resources.py.new | sed '/# Created: /d;/# by: /d' \
|
||||
> openlp/core/resources.py
|
||||
cat openlp/core/resources.py.new | sed '/# Created: /d;/# by: /d' > openlp/core/resources.py
|
||||
|
||||
# Patch resources.py to OpenLP coding style
|
||||
patch --posix -s openlp/core/resources.py scripts/resources.patch
|
||||
|
BIN
tests/interfaces/openlp_plugins/__init__.pyc
Normal file
BIN
tests/interfaces/openlp_plugins/__init__.pyc
Normal file
Binary file not shown.
0
tests/interfaces/openlp_plugins/custom/__init__.py
Normal file
0
tests/interfaces/openlp_plugins/custom/__init__.py
Normal 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.'
|
0
tests/interfaces/openlp_plugins/songs/__init__.py
Normal file
0
tests/interfaces/openlp_plugins/songs/__init__.py
Normal file
Loading…
Reference in New Issue
Block a user