Final cleanup of variables

This commit is contained in:
Tim Bentley 2013-02-07 11:33:47 +00:00
parent 3063526430
commit cae39247d9
33 changed files with 106 additions and 106 deletions

View File

@ -95,7 +95,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
if self.webAccess:
files = self.webAccess.read()
self.config.readfp(io.BytesIO(files))
self.updateScreenListCombo()
self.update_screen_list_combo()
self.was_download_cancelled = False
self.downloading = translate('OpenLP.FirstTimeWizard', 'Downloading %s...')
QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL('clicked()'),
@ -103,7 +103,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
QtCore.QObject.connect(self.noInternetFinishButton, QtCore.SIGNAL('clicked()'),
self.onNoInternetFinishButtonClicked)
QtCore.QObject.connect(self, QtCore.SIGNAL(u'currentIdChanged(int)'), self.onCurrentIdChanged)
Registry().register_function(u'config_screen_changed', self.updateScreenListCombo)
Registry().register_function(u'config_screen_changed', self.update_screen_list_combo)
def exec_(self):
"""
@ -227,7 +227,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
self._postWizard()
self.application.set_normal_cursor()
def updateScreenListCombo(self):
def update_screen_list_combo(self):
"""
The user changed screen resolution or enabled/disabled more screens, so
we need to update the combo box.

View File

@ -158,10 +158,10 @@ class MainDisplay(Display):
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.setTransparency(False)
if self.isLive:
Registry().register_function(u'live_display_hide', self.hideDisplay)
Registry().register_function(u'live_display_show', self.showDisplay)
Registry().register_function(u'update_display_css', self.cssChanged)
Registry().register_function(u'config_updated', self.configChanged)
Registry().register_function(u'live_display_hide', self.hide_display)
Registry().register_function(u'live_display_show', self.show_display)
Registry().register_function(u'update_display_css', self.css_changed)
Registry().register_function(u'config_updated', self.config_changed)
def setTransparency(self, enabled):
"""
@ -174,13 +174,13 @@ class MainDisplay(Display):
self.setAttribute(QtCore.Qt.WA_TranslucentBackground, enabled)
self.repaint()
def cssChanged(self):
def css_changed(self):
"""
We may need to rebuild the CSS on the live display.
"""
self.rebuildCSS = True
def configChanged(self):
def config_changed(self):
"""
Call the plugins to rebuild the Live display CSS as the screen has
not been rebuild on exit of config.
@ -362,7 +362,7 @@ class MainDisplay(Display):
# if was hidden keep it hidden
if self.isLive:
if self.hideMode:
self.hideDisplay(self.hideMode)
self.hide_display(self.hideMode)
else:
# Single screen active
if self.screens.display_count == 1:
@ -419,7 +419,7 @@ class MainDisplay(Display):
if Settings().value(u'general/auto unblank'):
Registry().execute(u'slidecontroller_live_unblank')
else:
self.hideDisplay(self.hideMode)
self.hide_display(self.hideMode)
self.__hideMouse()
def footer(self, text):
@ -430,12 +430,12 @@ class MainDisplay(Display):
js = u'show_footer(\'' + text.replace(u'\\', u'\\\\').replace(u'\'', u'\\\'') + u'\')'
self.frame.evaluateJavaScript(js)
def hideDisplay(self, mode=HideMode.Screen):
def hide_display(self, mode=HideMode.Screen):
"""
Hide the display by making all layers transparent
Store the images so they can be replaced when required
"""
log.debug(u'hideDisplay mode = %d', mode)
log.debug(u'hide_display mode = %d', mode)
if self.screens.display_count == 1:
# Only make visible if setting enabled.
if not Settings().value(u'general/display on monitor'):
@ -453,13 +453,13 @@ class MainDisplay(Display):
self.webView.setVisible(True)
self.hideMode = mode
def showDisplay(self):
def show_display(self):
"""
Show the stored layers so the screen reappears as it was
originally.
Make the stored images None to release memory.
"""
log.debug(u'showDisplay')
log.debug(u'show_display')
if self.screens.display_count == 1:
# Only make visible if setting enabled.
if not Settings().value(u'general/display on monitor'):

View File

@ -107,7 +107,7 @@ class SlideController(DisplayController):
self.selectedRow = 0
self.serviceItem = None
self.slide_limits = None
self.updateSlideLimits()
self.update_slide_limits()
self.panel = QtGui.QWidget(parent.controlSplitter)
self.slideList = {}
# Layout for holding panel
@ -169,13 +169,13 @@ class SlideController(DisplayController):
text=translate('OpenLP.SlideController', 'Previous Slide'), icon=u':/slides/slide_previous.png',
tooltip=translate('OpenLP.SlideController', 'Move to previous.'),
shortcuts=[QtCore.Qt.Key_Up, QtCore.Qt.Key_PageUp], context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category, triggers=self.onSlideSelectedPrevious)
category=self.category, triggers=self.on_slide_selected_previous)
self.toolbar.addAction(self.previousItem)
self.nextItem = create_action(self, u'nextItem_' + self.typePrefix,
text=translate('OpenLP.SlideController', 'Next Slide'), icon=u':/slides/slide_next.png',
tooltip=translate('OpenLP.SlideController', 'Move to next.'),
shortcuts=[QtCore.Qt.Key_Down, QtCore.Qt.Key_PageDown], context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category, triggers=self.onSlideSelectedNextAction)
category=self.category, triggers=self.on_slide_selected_next_action)
self.toolbar.addAction(self.nextItem)
self.toolbar.addSeparator()
self.controllerType = DisplayControllerType.Preview
@ -362,8 +362,8 @@ class SlideController(DisplayController):
# Signals
QtCore.QObject.connect(self.previewListWidget, QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
if self.isLive:
Registry().register_function(u'slidecontroller_live_spin_delay', self.receiveSpinDelay)
Registry().register_function(u'slidecontroller_toggle_display', self.toggleDisplay)
Registry().register_function(u'slidecontroller_live_spin_delay', self.receive_spin_delay)
Registry().register_function(u'slidecontroller_toggle_display', self.toggle_display)
self.toolbar.setWidgetVisible(self.loopList, False)
self.toolbar.setWidgetVisible(self.wideMenu, False)
else:
@ -375,14 +375,14 @@ class SlideController(DisplayController):
self.__addActionsToWidget(self.previewListWidget)
else:
self.previewListWidget.addActions([self.nextItem, self.previousItem])
Registry().register_function(u'slidecontroller_%s_stop_loop' % self.typePrefix, self.onStopLoop)
Registry().register_function(u'slidecontroller_%s_next' % self.typePrefix, self.onSlideSelectedNext)
Registry().register_function(u'slidecontroller_%s_previous' % self.typePrefix, self.onSlideSelectedPrevious)
Registry().register_function(u'slidecontroller_%s_change' % self.typePrefix, self.onSlideChange)
Registry().register_function(u'slidecontroller_%s_set' % self.typePrefix, self.onSlideSelectedIndex)
Registry().register_function(u'slidecontroller_%s_blank' % self.typePrefix, self.onSlideBlank)
Registry().register_function(u'slidecontroller_%s_unblank' % self.typePrefix, self.onSlideUnblank)
Registry().register_function(u'slidecontroller_update_slide_limits', self.updateSlideLimits)
Registry().register_function(u'slidecontroller_%s_stop_loop' % self.typePrefix, self.on_stop_loop)
Registry().register_function(u'slidecontroller_%s_next' % self.typePrefix, self.on_slide_selected_next)
Registry().register_function(u'slidecontroller_%s_previous' % self.typePrefix, self.on_slide_selected_previous)
Registry().register_function(u'slidecontroller_%s_change' % self.typePrefix, self.on_slide_change)
Registry().register_function(u'slidecontroller_%s_set' % self.typePrefix, self.on_slide_selected_index)
Registry().register_function(u'slidecontroller_%s_blank' % self.typePrefix, self.on_slide_blank)
Registry().register_function(u'slidecontroller_%s_unblank' % self.typePrefix, self.on_slide_unblank)
Registry().register_function(u'slidecontroller_update_slide_limits', self.update_slide_limits)
def _slideShortcutActivated(self):
"""
@ -469,7 +469,7 @@ class SlideController(DisplayController):
self.display.setVisible(False)
self.media_controller.media_stop(self)
def toggleDisplay(self, action):
def toggle_display(self, action):
"""
Toggle the display settings triggered from remote messages.
"""
@ -608,13 +608,13 @@ class SlideController(DisplayController):
self.__updatePreviewSelection(slide_no)
self.slideSelected()
def receiveSpinDelay(self, value):
def receive_spin_delay(self, value):
"""
Adjusts the value of the ``delaySpinBox`` to the given one.
"""
self.delaySpinBox.setValue(int(value))
def updateSlideLimits(self):
def update_slide_limits(self):
"""
Updates the Slide Limits variable from the settings.
"""
@ -740,7 +740,7 @@ class SlideController(DisplayController):
Display the slide number passed
"""
log.debug(u'processManagerItem live = %s' % self.isLive)
self.onStopLoop()
self.on_stop_loop()
old_item = self.serviceItem
# take a copy not a link to the servicemanager copy.
self.serviceItem = copy.copy(serviceItem)
@ -858,7 +858,7 @@ class SlideController(DisplayController):
self.__checkUpdateSelectedSlide(slideno)
# Screen event methods
def onSlideSelectedIndex(self, message):
def on_slide_selected_index(self, message):
"""
Go to the requested slide
"""
@ -891,13 +891,13 @@ class SlideController(DisplayController):
else:
self.liveEscape()
def onSlideBlank(self):
def on_slide_blank(self):
"""
Handle the slidecontroller blank event
"""
self.onBlankDisplay(True)
def onSlideUnblank(self):
def on_slide_unblank(self):
"""
Handle the slidecontroller unblank event
"""
@ -1036,7 +1036,7 @@ class SlideController(DisplayController):
Registry().execute(u'slidecontroller_%s_changed' % self.typePrefix, row)
self.display.setFocus()
def onSlideChange(self, row):
def on_slide_change(self, row):
"""
The slide has been changed. Update the slidecontroller accordingly
"""
@ -1068,14 +1068,14 @@ class SlideController(DisplayController):
winimg = QtGui.QPixmap.grabWindow(winid, rect.x(), rect.y(), rect.width(), rect.height())
self.slidePreview.setPixmap(winimg)
def onSlideSelectedNextAction(self, checked):
def on_slide_selected_next_action(self, checked):
"""
Wrapper function from create_action so we can throw away the
incorrect parameter
"""
self.onSlideSelectedNext()
self.on_slide_selected_next()
def onSlideSelectedNext(self, wrap=None):
def on_slide_selected_next(self, wrap=None):
"""
Go to the next slide.
"""
@ -1102,7 +1102,7 @@ class SlideController(DisplayController):
self.__checkUpdateSelectedSlide(row)
self.slideSelected()
def onSlideSelectedPrevious(self):
def on_slide_selected_previous(self):
"""
Go to the previous slide.
"""
@ -1141,7 +1141,7 @@ class SlideController(DisplayController):
if hide_mode is None and (self.playSlidesLoop.isChecked() or self.playSlidesOnce.isChecked()):
self.onStartLoop()
else:
self.onStopLoop()
self.on_stop_loop()
def onStartLoop(self):
"""
@ -1150,7 +1150,7 @@ class SlideController(DisplayController):
if self.previewListWidget.rowCount() > 1:
self.timer_id = self.startTimer(int(self.delaySpinBox.value()) * 1000)
def onStopLoop(self):
def on_stop_loop(self):
"""
Stop the timer loop running
"""
@ -1222,7 +1222,7 @@ class SlideController(DisplayController):
If the timer event is for this window select next slide
"""
if event.timerId() == self.timer_id:
self.onSlideSelectedNext(self.playSlidesLoop.isChecked())
self.on_slide_selected_next(self.playSlidesLoop.isChecked())
def onEditSong(self):
"""

View File

@ -104,7 +104,7 @@ class ThemesTab(SettingsTab):
QtCore.QObject.connect(self.GlobalLevelRadioButton, QtCore.SIGNAL(u'clicked()'),
self.onGlobalLevelButtonClicked)
QtCore.QObject.connect(self.DefaultComboBox, QtCore.SIGNAL(u'activated(int)'), self.onDefaultComboBoxChanged)
Registry().register_function(u'theme_update_list', self.updateThemeList)
Registry().register_function(u'theme_update_list', self.update_theme_list)
def retranslateUi(self):
"""
@ -187,7 +187,7 @@ class ThemesTab(SettingsTab):
self.renderer.set_global_theme(self.global_theme)
self.__previewGlobalTheme()
def updateThemeList(self, theme_list):
def update_theme_list(self, theme_list):
"""
Called from ThemeManager when the Themes have changed.

View File

@ -70,7 +70,7 @@ class BibleMediaItem(MediaManagerItem):
self.search_results = {}
self.second_search_results = {}
self.checkSearchResult()
Registry().register_function(u'bibles_load_list', self.reloadBibles)
Registry().register_function(u'bibles_load_list', self.reload_bibles)
Registry().register_function(u'config_updated', self.config_update)
def __checkSecondBible(self, bible, second_bible):
@ -343,7 +343,7 @@ class BibleMediaItem(MediaManagerItem):
bible = Settings().value(self.settingsSection + u'/quick bible')
find_and_set_in_combo_box(self.quickVersionComboBox, bible)
def reloadBibles(self, process=False):
def reload_bibles(self, process=False):
log.debug(u'Reloading Bibles')
self.plugin.manager.reload_bibles()
self.loadBibles()
@ -471,7 +471,7 @@ class BibleMediaItem(MediaManagerItem):
self.import_wizard = BibleImportForm(self, self.plugin.manager, self.plugin)
# If the import was not cancelled then reload.
if self.import_wizard.exec_():
self.reloadBibles()
self.reload_bibles()
def onEditClick(self):
if self.quickTab.isVisible():
@ -482,7 +482,7 @@ class BibleMediaItem(MediaManagerItem):
self.editBibleForm = EditBibleForm(self, self.main_window, self.plugin.manager)
self.editBibleForm.loadBible(bible)
if self.editBibleForm.exec_():
self.reloadBibles()
self.reload_bibles()
def onDeleteClick(self):
if self.quickTab.isVisible():
@ -497,7 +497,7 @@ class BibleMediaItem(MediaManagerItem):
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
return
self.plugin.manager.delete_bible(bible)
self.reloadBibles()
self.reload_bibles()
def onSearchTabBarCurrentChanged(self, index):
if index == 0:

View File

@ -64,9 +64,9 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
self.editAllButton.clicked.connect(self.on_edit_all_button_clicked)
self.slideListView.currentRowChanged.connect(self.on_current_row_changed)
self.slideListView.doubleClicked.connect(self.on_edit_button_clicked)
Registry().register_function(u'theme_update_list', self.loadThemes)
Registry().register_function(u'theme_update_list', self.load_themes)
def loadThemes(self, theme_list):
def load_themes(self, theme_list):
"""
Load a list of themes into the themes combo box.

View File

@ -51,7 +51,7 @@ class ImageMediaItem(MediaManagerItem):
MediaManagerItem.__init__(self, parent, plugin, icon)
self.quickPreviewAllowed = True
self.hasSearch = True
Registry().register_function(u'live_theme_changed', self.liveThemeChanged)
Registry().register_function(u'live_theme_changed', self.live_theme_changed)
# Allow DnD from the desktop
self.listView.activateDnD()
@ -194,7 +194,7 @@ class ImageMediaItem(MediaManagerItem):
self.resetAction.setVisible(False)
self.live_controller.display.resetImage()
def liveThemeChanged(self):
def live_theme_changed(self):
"""
Triggered by the change of theme in the slide controller
"""

View File

@ -71,9 +71,9 @@ class MediaMediaItem(MediaManagerItem):
self.displayController.previewDisplay.screen = {u'size':self.displayController.previewDisplay.geometry()}
self.displayController.previewDisplay.setup()
self.media_controller.setup_display(self.displayController.previewDisplay, False)
Registry().register_function(u'video_background_replaced', self.videobackgroundReplaced)
Registry().register_function(u'video_background_replaced', self.video_background_replaced)
Registry().register_function(u'mediaitem_media_rebuild', self.rebuild_players)
Registry().register_function(u'config_screen_changed', self.displaySetup)
Registry().register_function(u'config_screen_changed', self.display_setup)
# Allow DnD from the desktop
self.listView.activateDnD()
@ -132,7 +132,7 @@ class MediaMediaItem(MediaManagerItem):
self.media_controller.media_reset(self.live_controller)
self.resetAction.setVisible(False)
def videobackgroundReplaced(self):
def video_background_replaced(self):
"""
Triggered by main display on change of serviceitem.
"""
@ -213,7 +213,7 @@ class MediaMediaItem(MediaManagerItem):
u' '.join(self.media_controller.video_extensions_list),
u' '.join(self.media_controller.audio_extensions_list), UiStrings().AllFiles)
def displaySetup(self):
def display_setup(self):
self.media_controller.setup_display(self.displayController.previewDisplay, False)
def populateDisplayTypes(self):

View File

@ -60,8 +60,8 @@ class PresentationMediaItem(MediaManagerItem):
self.message_listener = MessageListener(self)
self.hasSearch = True
self.singleServiceItem = False
Registry().register_function(u'mediaitem_presentation_rebuild', self.populateDisplayTypes)
Registry().register_function(u'mediaitem_suffixes', self.buildFileMaskString)
Registry().register_function(u'mediaitem_presentation_rebuild', self.populate_display_types)
Registry().register_function(u'mediaitem_suffixes', self.build_file_mask_string)
# Allow DnD from the desktop
self.listView.activateDnD()
@ -73,7 +73,7 @@ class PresentationMediaItem(MediaManagerItem):
self.Automatic = translate('PresentationPlugin.MediaItem', 'Automatic')
self.displayTypeLabel.setText(translate('PresentationPlugin.MediaItem', 'Present using:'))
def buildFileMaskString(self):
def build_file_mask_string(self):
"""
Build the list of file extensions to be used in the Open file dialog
"""
@ -121,9 +121,9 @@ class PresentationMediaItem(MediaManagerItem):
self.listView.setIconSize(QtCore.QSize(88, 50))
files = Settings().value(self.settingsSection + u'/presentations files')
self.loadList(files, True)
self.populateDisplayTypes()
self.populate_display_types()
def populateDisplayTypes(self):
def populate_display_types(self):
"""
Load the combobox with the enabled presentation controllers,
allowing user to select a specific app if settings allow

View File

@ -90,7 +90,7 @@ class PresentationPlugin(Plugin):
except Exception:
log.warn(u'Failed to start controller process')
self.controllers[controller].available = False
self.mediaItem.buildFileMaskString()
self.mediaItem.build_file_mask_string()
def finalise(self):
"""

View File

@ -97,7 +97,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
QtCore.QObject.connect(self.audioRemoveButton, QtCore.SIGNAL(u'clicked()'), self.onAudioRemoveButtonClicked)
QtCore.QObject.connect(self.audioRemoveAllButton, QtCore.SIGNAL(u'clicked()'),
self.onAudioRemoveAllButtonClicked)
Registry().register_function(u'theme_update_list', self.loadThemes)
Registry().register_function(u'theme_update_list', self.load_themes)
self.previewButton = QtGui.QPushButton()
self.previewButton.setObjectName(u'previewButton')
self.previewButton.setText(UiStrings().SaveAndPreview)
@ -169,7 +169,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
combo.setItemData(row, object.id)
set_case_insensitive_completer(cache, combo)
def loadThemes(self, theme_list):
def load_themes(self, theme_list):
"""
Load the themes into a combobox.
"""

View File

@ -95,7 +95,7 @@ class CCLIFileImport(SongImport):
self.logError(filename,
translate('SongsPlugin.CCLIFileImport', 'The file does not have a valid extension.'))
log.info(u'Extension %s is not valid', filename)
if self.stopImportFlag:
if self.stop_import_flag:
return
def doImportUsrFile(self, textList):

View File

@ -90,7 +90,7 @@ class DreamBeamImport(SongImport):
if isinstance(self.importSource, list):
self.importWizard.progressBar.setMaximum(len(self.importSource))
for file in self.importSource:
if self.stopImportFlag:
if self.stop_import_flag:
return
self.setDefaults()
parser = etree.XMLParser(remove_blank_text=True)

View File

@ -58,7 +58,7 @@ class EasySlidesImport(SongImport):
song_xml = objectify.fromstring(xml)
self.importWizard.progressBar.setMaximum(len(song_xml.Item))
for song in song_xml.Item:
if self.stopImportFlag:
if self.stop_import_flag:
return
self._parseSong(song)

View File

@ -142,7 +142,7 @@ class EasyWorshipSongImport(SongImport):
rec_count = (rec_count + record_size) / record_size
# Loop through each record within the current block
for i in range(rec_count):
if self.stopImportFlag:
if self.stop_import_flag:
break
raw_record = db_file.read(record_size)
self.fields = self.recordStruct.unpack(raw_record)
@ -216,7 +216,7 @@ class EasyWorshipSongImport(SongImport):
if len(self.comments) > 5:
self.comments += unicode(translate('SongsPlugin.EasyWorshipSongImport',
'\n[above are Song Tags with notes imported from EasyWorship]'))
if self.stopImportFlag:
if self.stop_import_flag:
break
if not self.finish():
self.logError(self.importSource)

View File

@ -124,7 +124,7 @@ class FoilPresenterImport(SongImport):
self.importWizard.progressBar.setMaximum(len(self.importSource))
parser = etree.XMLParser(remove_blank_text=True)
for file_path in self.importSource:
if self.stopImportFlag:
if self.stop_import_flag:
return
self.importWizard.incrementProgressBar(
WizardStrings.ImportingType % os.path.basename(file_path))

View File

@ -100,7 +100,7 @@ class SongMediaItem(MediaManagerItem):
triggers=self.onSongMaintenanceClick)
self.addSearchToToolBar()
# Signals and slots
Registry().register_function(u'songs_load_list', self.onSongListLoad)
Registry().register_function(u'songs_load_list', self.on_song_list_load)
Registry().register_function(u'config_updated', self.config_update)
Registry().register_function(u'songs_preview', self.onPreviewClick)
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
@ -199,12 +199,12 @@ class SongMediaItem(MediaManagerItem):
Song.search_lyrics.like(u'%' + clean_string(search_keywords) + u'%'),
Song.comments.like(u'%' + search_keywords.lower() + u'%')))
def onSongListLoad(self):
def on_song_list_load(self):
"""
Handle the exit from the edit dialog and trigger remote updates
of songs
"""
log.debug(u'onSongListLoad - start')
log.debug(u'on_song_list_load - start')
# Called to redisplay the song list screen edit from a search
# or from the exit of the Song edit dialog. If remote editing is active
# Trigger it and clean up so it will not update again.
@ -213,7 +213,7 @@ class SongMediaItem(MediaManagerItem):
item = self.buildServiceItem(self.editItem)
self.service_manager.replace_service_item(item)
self.onSearchTextButtonClicked()
log.debug(u'onSongListLoad - finished')
log.debug(u'on_song_list_load - finished')
def displayResultsSong(self, searchresults):
log.debug(u'display results Song')
@ -325,7 +325,7 @@ class SongMediaItem(MediaManagerItem):
self.editSongForm.loadSong(song_id, preview)
if self.editSongForm.exec_() == QtGui.QDialog.Accepted:
self.autoSelectId = -1
self.onSongListLoad()
self.on_song_list_load()
self.remoteSong = song_id
self.remoteTriggered = True
item = self.buildServiceItem(remote=True)
@ -346,7 +346,7 @@ class SongMediaItem(MediaManagerItem):
self.editSongForm.loadSong(item_id, False)
self.editSongForm.exec_()
self.autoSelectId = -1
self.onSongListLoad()
self.on_song_list_load()
self.editItem = None
def onDeleteClick(self):
@ -398,7 +398,7 @@ class SongMediaItem(MediaManagerItem):
new_song.title = u'%s <%s>' % (new_song.title,
translate('SongsPlugin.MediaItem', 'copy', 'For song cloning'))
self.plugin.manager.save_object(new_song)
self.onSongListLoad()
self.on_song_list_load()
def generateSlideData(self, service_item, item=None, xmlVersion=False,
remote=False, context=ServiceItemContext.Service):

View File

@ -66,7 +66,7 @@ class MediaShoutImport(SongImport):
songs = cursor.fetchall()
self.importWizard.progressBar.setMaximum(len(songs))
for song in songs:
if self.stopImportFlag:
if self.stop_import_flag:
break
cursor.execute(u'SELECT Type, Number, Text FROM Verses '
u'WHERE Record = %s ORDER BY Type, Number' % song.Record)

View File

@ -110,7 +110,7 @@ class OpenLP1SongImport(SongImport):
self.importWizard.progressBar.setMaximum(len(songs))
for song in songs:
self.setDefaults()
if self.stopImportFlag:
if self.stop_import_flag:
break
song_id = song[0]
self.title = song[1]
@ -131,13 +131,13 @@ class OpenLP1SongImport(SongImport):
u'WHERE songid = %s' % song_id)
author_ids = cursor.fetchall()
for author_id in author_ids:
if self.stopImportFlag:
if self.stop_import_flag:
break
for author in authors:
if author[0] == author_id[0]:
self.parseAuthor(author[1])
break
if self.stopImportFlag:
if self.stop_import_flag:
break
if db_has_tracks:
cursor.execute(u'-- types int, int')
@ -146,14 +146,14 @@ class OpenLP1SongImport(SongImport):
u'WHERE songid = %s ORDER BY listindex' % song_id)
track_ids = cursor.fetchall()
for track_id, listindex in track_ids:
if self.stopImportFlag:
if self.stop_import_flag:
break
for track in tracks:
if track[0] == track_id:
media_file = self.expandMediaFile(track[1])
self.addMediaFile(media_file, listindex)
break
if self.stopImportFlag:
if self.stop_import_flag:
break
if not self.finish():
self.logError(self.importSource)

View File

@ -225,6 +225,6 @@ class OpenLPSongImport(SongImport):
progressDialog.setLabelText(WizardStrings.ImportingType % new_song.title)
else:
self.importWizard.incrementProgressBar(WizardStrings.ImportingType % new_song.title)
if self.stopImportFlag:
if self.stop_import_flag:
break
engine.dispose()

View File

@ -77,7 +77,7 @@ class OooImport(SongImport):
return
self.importWizard.progressBar.setMaximum(len(self.importSource))
for filename in self.importSource:
if self.stopImportFlag:
if self.stop_import_flag:
break
filename = unicode(filename)
if os.path.isfile(filename):
@ -189,7 +189,7 @@ class OooImport(SongImport):
slides = doc.getDrawPages()
text = u''
for slide_no in range(slides.getCount()):
if self.stopImportFlag:
if self.stop_import_flag:
self.importWizard.incrementProgressBar(u'Import cancelled', 0)
return
slide = slides.getByIndex(slide_no)

View File

@ -63,7 +63,7 @@ class OpenLyricsImport(SongImport):
self.importWizard.progressBar.setMaximum(len(self.importSource))
parser = etree.XMLParser(remove_blank_text=True)
for file_path in self.importSource:
if self.stopImportFlag:
if self.stop_import_flag:
return
self.importWizard.incrementProgressBar(WizardStrings.ImportingType % os.path.basename(file_path))
try:

View File

@ -113,7 +113,7 @@ class OpenSongImport(SongImport):
def doImport(self):
self.importWizard.progressBar.setMaximum(len(self.importSource))
for filename in self.importSource:
if self.stopImportFlag:
if self.stop_import_flag:
return
song_file = open(filename)
self.doImportFile(song_file)

View File

@ -106,7 +106,7 @@ class PowerSongImport(SongImport):
return
self.importWizard.progressBar.setMaximum(len(self.importSource))
for file in self.importSource:
if self.stopImportFlag:
if self.stop_import_flag:
return
self.setDefaults()
parse_error = False

View File

@ -100,7 +100,7 @@ class SofImport(OooImport):
try:
paragraphs = self.document.getText().createEnumeration()
while paragraphs.hasMoreElements():
if self.stopImportFlag:
if self.stop_import_flag:
return
paragraph = paragraphs.nextElement()
if paragraph.supportsService("com.sun.star.text.Paragraph"):

View File

@ -109,7 +109,7 @@ class SongBeamerImport(SongImport):
return
for file in self.importSource:
# TODO: check that it is a valid SongBeamer file
if self.stopImportFlag:
if self.stop_import_flag:
return
self.setDefaults()
self.currentVerse = u''

View File

@ -81,9 +81,9 @@ class SongImport(QtCore.QObject):
log.debug(self.importSource)
self.importWizard = None
self.song = None
self.stopImportFlag = False
self.stop_import_flag = False
self.setDefaults()
Registry().register_function(u'openlp_stop_wizard', self.stopImport)
Registry().register_function(u'openlp_stop_wizard', self.stop_import)
def setDefaults(self):
"""
@ -133,12 +133,12 @@ class SongImport(QtCore.QObject):
self.importWizard.errorSaveToButton.setVisible(True)
self.importWizard.errorReportTextEdit.append(u'- %s (%s)' % (filepath, reason))
def stopImport(self):
def stop_import(self):
"""
Sets the flag for importers to stop their import
"""
log.debug(u'Stopping songs import')
self.stopImportFlag = True
self.stop_import_flag = True
def register(self, import_wizard):
self.importWizard = import_wizard

View File

@ -83,7 +83,7 @@ class SongProImport(SongImport):
tag = u''
text = u''
for file_line in songs_file:
if self.stopImportFlag:
if self.stop_import_flag:
break
file_line = unicode(file_line, u'cp1252')
file_text = file_line.rstrip()

View File

@ -105,7 +105,7 @@ class SongShowPlusImport(SongImport):
return
self.importWizard.progressBar.setMaximum(len(self.importSource))
for file in self.importSource:
if self.stopImportFlag:
if self.stop_import_flag:
return
self.sspVerseOrderList = []
other_count = 0

View File

@ -66,7 +66,7 @@ class SundayPlusImport(SongImport):
def doImport(self):
self.importWizard.progressBar.setMaximum(len(self.importSource))
for filename in self.importSource:
if self.stopImportFlag:
if self.stop_import_flag:
return
song_file = open(filename)
self.doImportFile(song_file)

View File

@ -108,7 +108,7 @@ class WowImport(SongImport):
if isinstance(self.importSource, list):
self.importWizard.progressBar.setMaximum(len(self.importSource))
for source in self.importSource:
if self.stopImportFlag:
if self.stop_import_flag:
return
self.setDefaults()
song_data = open(source, 'rb')

View File

@ -96,7 +96,7 @@ class ZionWorxImport(SongImport):
log.info(u'%s records found in CSV file' % num_records)
self.importWizard.progressBar.setMaximum(num_records)
for index, record in enumerate(records, 1):
if self.stopImportFlag:
if self.stop_import_flag:
return
self.setDefaults()
try:

View File

@ -123,8 +123,8 @@ class SongUsagePlugin(Plugin):
def initialise(self):
log.info(u'SongUsage Initialising')
Plugin.initialise(self)
Registry().register_function(u'slidecontroller_live_started', self.displaySongUsage)
Registry().register_function(u'print_service_started', self.printSongUsage)
Registry().register_function(u'slidecontroller_live_started', self.display_song_usage)
Registry().register_function(u'print_service_started', self.print_song_usage)
self.songUsageActive = Settings().value(self.settingsSection + u'/active')
# Set the button and checkbox state
self.setButtonState()
@ -183,13 +183,13 @@ class SongUsagePlugin(Plugin):
self.songUsageStatus.blockSignals(False)
def displaySongUsage(self, item):
def display_song_usage(self, item):
"""
Song Usage for which has been displayed
"""
self._add_song_usage(translate('SongUsagePlugin', 'display'), item)
def printSongUsage(self, item):
def print_song_usage(self, item):
"""
Song Usage for which has been printed
"""