Development:Code Style

This page is about the migration from 80 to 120 column lines. Whilst style is a personal preference here is some pointers to good style.

Change to continuation indents
A change to the indentation helps to see the continuation if display == self.parent.previewController.previewDisplay or \ display == self.parent.liveController.previewDisplay: display.hasAudio = False becomes if display == self.parent.previewController.previewDisplay or \ display == self.parent.liveController.previewDisplay: display.hasAudio = False

Or if display.controller != controller or \ self.curDisplayMediaPlayer[display].state != MediaState.Playing: continue self.curDisplayMediaPlayer[display].pause(display) becomes if display.controller != controller or \ self.curDisplayMediaPlayer[display].state != MediaState.Playing: continue self.curDisplayMediaPlayer[display].pause(display)

Line Extensions
When to continue is a matter of taste and style.

service_header = { u'name': self.name, u'plugin': self.name, u'theme': self.theme, u'title': self.title, u'icon': self.icon, Leave this as is as it is very readable

self._raw_frames.append(           {u'title': title, u'raw_slide': raw_slide, u'verseTag': verse_tag}) is less readable than self._raw_frames.append({u'title': title, u'raw_slide': raw_slide, u'verseTag': verse_tag})

log.debug(u'ServiceManager.saveFile - %s', path_file_name) SettingsManager.set_last_dir(           self.mainwindow.serviceManagerSettingsSection,            path) service = [] is less readable than log.debug(u'ServiceManager.saveFile - %s', path_file_name) SettingsManager.set_last_dir(self.mainwindow.serviceManagerSettingsSection, path) service = []

Receiver.send_message(u'cursor_normal') title = unicode(translate('OpenLP.ServiceManager', 'Service File(s) Missing')) message = unicode(translate('OpenLP.ServiceManager', 'The following file(s) in the service are missing:\n\t%s\n\n' 'These files will be removed if you continue to save.')               ) % "\n\t".join(missing_list) answer = QtGui.QMessageBox.critical(self, title,               message,                QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel)) if answer == QtGui.QMessageBox.Cancel: self.mainwindow.finishedProgressBar return False Receiver.send_message(u'cursor_busy') becomes Receiver.send_message(u'cursor_normal') title = unicode(translate('OpenLP.ServiceManager', 'Service File(s) Missing')) message = unicode(translate('OpenLP.ServiceManager', 'The following file(s) in the service are missing:\n\t%s\n\n' 'These files will be removed if you continue to save.')) % "\n\t".join(missing_list) answer = QtGui.QMessageBox.critical(self, title, message,               QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel)) if answer == QtGui.QMessageBox.Cancel: self.mainwindow.finishedProgressBar return False Receiver.send_message(u'cursor_busy')