Andreas Preikschat has proposed merging lp:~googol/openlp/trivial into lp:openlp.
Requested reviews: Tim Bentley (trb143) For more details, see: https://code.launchpad.net/~googol/openlp/trivial/+merge/109485 Hello, - clean ups -- https://code.launchpad.net/~googol/openlp/trivial/+merge/109485 Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/eventreceiver.py' --- openlp/core/lib/eventreceiver.py 2012-04-04 07:26:51 +0000 +++ openlp/core/lib/eventreceiver.py 2012-06-09 15:47:26 +0000 @@ -268,7 +268,7 @@ <<ACTION>> )`` """ - eventreceiver = EventReceiver() + __eventreceiver__ = EventReceiver() @staticmethod def send_message(event, msg=None): @@ -281,11 +281,11 @@ ``msg`` Defaults to *None*. The message to send with the event. """ - Receiver.eventreceiver.send_message(event, msg) + Receiver.__eventreceiver__.send_message(event, msg) @staticmethod def get_receiver(): """ - Get the global ``eventreceiver`` instance. + Get the global ``__eventreceiver__`` instance. """ - return Receiver.eventreceiver + return Receiver.__eventreceiver__ === modified file 'openlp/core/lib/pluginmanager.py' --- openlp/core/lib/pluginmanager.py 2011-12-27 10:33:55 +0000 +++ openlp/core/lib/pluginmanager.py 2012-06-09 15:47:26 +0000 @@ -41,13 +41,13 @@ and executes all the hooks, as and when necessary. """ log.info(u'Plugin manager loaded') - + __instance__ = None @staticmethod def get_instance(): """ Obtain a single instance of class. """ - return PluginManager.instance + return PluginManager.__instance__ def __init__(self, plugin_dir): """ @@ -58,7 +58,7 @@ The directory to search for plugins. """ log.info(u'Plugin manager Initialising') - PluginManager.instance = self + PluginManager.__instance__ = self if not plugin_dir in sys.path: log.debug(u'Inserting %s into sys.path', plugin_dir) sys.path.insert(0, plugin_dir) === modified file 'openlp/core/lib/renderer.py' --- openlp/core/lib/renderer.py 2012-06-08 13:27:40 +0000 +++ openlp/core/lib/renderer.py 2012-06-09 15:47:26 +0000 @@ -303,7 +303,7 @@ try: text_to_render, text = \ text.split(u'\n[---]\n', 1) - except: + except ValueError: text_to_render = text.split(u'\n[---]\n')[0] text = u'' text_to_render, raw_tags, html_tags = \ === modified file 'openlp/core/ui/maindisplay.py' --- openlp/core/ui/maindisplay.py 2012-06-04 10:22:47 +0000 +++ openlp/core/ui/maindisplay.py 2012-06-09 15:47:26 +0000 @@ -100,9 +100,8 @@ self.frame.setScrollBarPolicy(QtCore.Qt.Horizontal, QtCore.Qt.ScrollBarAlwaysOff) - def resizeEvent(self, ev): - self.webView.setGeometry(0, 0, - self.width(), self.height()) + def resizeEvent(self, event): + self.webView.setGeometry(0, 0, self.width(), self.height()) def isWebLoaded(self): """ @@ -120,7 +119,6 @@ Display.__init__(self, parent, live, controller) self.imageManager = imageManager self.screens = ScreenList() - self.plugins = PluginManager.get_instance().plugins self.rebuildCSS = False self.hideMode = None self.override = {} === modified file 'openlp/core/ui/media/mediacontroller.py' --- openlp/core/ui/media/mediacontroller.py 2012-05-01 11:21:57 +0000 +++ openlp/core/ui/media/mediacontroller.py 2012-06-09 15:47:26 +0000 @@ -335,8 +335,7 @@ if controller.isLive and \ (QtCore.QSettings().value(u'general/auto unblank', QtCore.QVariant(False)).toBool() or \ - controller.media_info.is_background == True) or \ - controller.isLive == False: + controller.media_info.is_background) or not controller.isLive: if not self.video_play([controller]): critical_error_message_box( translate('MediaPlugin.MediaItem', 'Unsupported File'), @@ -495,7 +494,7 @@ return controller = self.parent.liveController for display in self.curDisplayMediaPlayer.keys(): - if display.controller != controller or \ + if display.controller != controller or \ self.curDisplayMediaPlayer[display].state != MediaState.Playing: continue self.curDisplayMediaPlayer[display].pause(display) === modified file 'openlp/core/ui/media/phononplayer.py' --- openlp/core/ui/media/phononplayer.py 2012-03-13 19:54:16 +0000 +++ openlp/core/ui/media/phononplayer.py 2012-06-09 15:47:26 +0000 @@ -38,21 +38,21 @@ log = logging.getLogger(__name__) ADDITIONAL_EXT = { - u'audio/ac3': [u'.ac3'], - u'audio/flac': [u'.flac'], - u'audio/x-m4a': [u'.m4a'], - u'audio/midi': [u'.mid', u'.midi'], - u'audio/x-mp3': [u'.mp3'], - u'audio/mpeg': [u'.mp3', u'.mp2', u'.mpga', u'.mpega', u'.m4a'], - u'audio/qcelp': [u'.qcp'], - u'audio/x-wma': [u'.wma'], - u'audio/x-ms-wma': [u'.wma'], - u'video/x-flv': [u'.flv'], - u'video/x-matroska': [u'.mpv', u'.mkv'], - u'video/x-wmv': [u'.wmv'], - u'video/x-mpg': [u'.mpg'], - u'video/mpeg' : [u'.mp4', u'.mts'], - u'video/x-ms-wmv': [u'.wmv']} + u'audio/ac3': [u'.ac3'], + u'audio/flac': [u'.flac'], + u'audio/x-m4a': [u'.m4a'], + u'audio/midi': [u'.mid', u'.midi'], + u'audio/x-mp3': [u'.mp3'], + u'audio/mpeg': [u'.mp3', u'.mp2', u'.mpga', u'.mpega', u'.m4a'], + u'audio/qcelp': [u'.qcp'], + u'audio/x-wma': [u'.wma'], + u'audio/x-ms-wma': [u'.wma'], + u'video/x-flv': [u'.flv'], + u'video/x-matroska': [u'.mpv', u'.mkv'], + u'video/x-wmv': [u'.wmv'], + u'video/x-mpg': [u'.mpg'], + u'video/mpeg' : [u'.mp4', u'.mts'], + u'video/x-ms-wmv': [u'.wmv']} class PhononPlayer(MediaPlayer): @@ -101,7 +101,7 @@ display.mediaObject = Phonon.MediaObject(display) Phonon.createPath(display.mediaObject, display.phononWidget) if display.hasAudio: - display.audio = Phonon.AudioOutput( \ + display.audio = Phonon.AudioOutput( Phonon.VideoCategory, display.mediaObject) Phonon.createPath(display.mediaObject, display.audio) display.phononWidget.raise_() @@ -148,18 +148,17 @@ controller.media_info.start_time > 0: start_time = controller.media_info.start_time display.mediaObject.play() - if self.media_state_wait(display, Phonon.PlayingState): - if start_time > 0: - self.seek(display, controller.media_info.start_time*1000) - self.volume(display, controller.media_info.volume) - controller.media_info.length = \ - int(display.mediaObject.totalTime()/1000) - controller.seekSlider.setMaximum(controller.media_info.length*1000) - self.state = MediaState.Playing - display.phononWidget.raise_() - return True - else: + if not self.media_state_wait(display, Phonon.PlayingState): return False + if start_time > 0: + self.seek(display, controller.media_info.start_time * 1000) + self.volume(display, controller.media_info.volume) + controller.media_info.length = \ + int(display.mediaObject.totalTime() / 1000) + controller.seekSlider.setMaximum(controller.media_info.length * 1000) + self.state = MediaState.Playing + display.phononWidget.raise_() + return True def pause(self, display): display.mediaObject.pause() @@ -198,9 +197,9 @@ controller = display.controller if controller.media_info.end_time > 0: if display.mediaObject.currentTime() > \ - controller.media_info.end_time*1000: + controller.media_info.end_time * 1000: self.stop(display) self.set_visible(display, False) if not controller.seekSlider.isSliderDown(): - controller.seekSlider.setSliderPosition( \ + controller.seekSlider.setSliderPosition( display.mediaObject.currentTime()) === modified file 'openlp/core/ui/media/vlcplayer.py' --- openlp/core/ui/media/vlcplayer.py 2012-04-28 16:22:37 +0000 +++ openlp/core/ui/media/vlcplayer.py 2012-06-09 15:47:26 +0000 @@ -62,7 +62,7 @@ log.debug(u'VLC could not be loaded: %s' % version) AUDIO_EXT = [ - u'*.mp3' + u'*.mp3' , u'*.wav' , u'*.ogg' ] @@ -130,9 +130,9 @@ # this is platform specific! # you have to give the id of the QFrame (or similar object) to # vlc, different platforms have different functions for this - if sys.platform == "win32": # for Windows + if sys.platform == "win32": display.vlcMediaPlayer.set_hwnd(int(display.vlcWidget.winId())) - elif sys.platform == "darwin": # for MacOS + elif sys.platform == "darwin": display.vlcMediaPlayer.set_agl(int(display.vlcWidget.winId())) else: # for Linux using the X Server @@ -181,17 +181,16 @@ if controller.media_info.start_time > 0: start_time = controller.media_info.start_time display.vlcMediaPlayer.play() - if self.media_state_wait(display, vlc.State.Playing): - if start_time > 0: - self.seek(display, controller.media_info.start_time * 1000) - controller.media_info.length = \ - int(display.vlcMediaPlayer.get_media().get_duration() / 1000) - controller.seekSlider.setMaximum(controller.media_info.length * 1000) - self.state = MediaState.Playing - display.vlcWidget.raise_() - return True - else: + if not self.media_state_wait(display, vlc.State.Playing): return False + if start_time > 0: + self.seek(display, controller.media_info.start_time * 1000) + controller.media_info.length = \ + int(display.vlcMediaPlayer.get_media().get_duration() / 1000) + controller.seekSlider.setMaximum(controller.media_info.length * 1000) + self.state = MediaState.Playing + display.vlcWidget.raise_() + return True def pause(self, display): if display.vlcMedia.get_state() != vlc.State.Playing: === modified file 'openlp/core/ui/media/webkitplayer.py' --- openlp/core/ui/media/webkitplayer.py 2012-03-13 19:54:16 +0000 +++ openlp/core/ui/media/webkitplayer.py 2012-06-09 15:47:26 +0000 @@ -227,33 +227,33 @@ """ VIDEO_EXT = [ - u'*.3gp' - , u'*.3gpp' - , u'*.3g2' - , u'*.3gpp2' - , u'*.aac' - , u'*.flv' - , u'*.f4a' - , u'*.f4b' - , u'*.f4p' - , u'*.f4v' - , u'*.mov' - , u'*.m4a' - , u'*.m4b' - , u'*.m4p' - , u'*.m4v' - , u'*.mkv' - , u'*.mp4' - , u'*.ogv' - , u'*.webm' - , u'*.mpg', u'*.wmv', u'*.mpeg', u'*.avi' - , u'*.swf' - ] + u'*.3gp' + , u'*.3gpp' + , u'*.3g2' + , u'*.3gpp2' + , u'*.aac' + , u'*.flv' + , u'*.f4a' + , u'*.f4b' + , u'*.f4p' + , u'*.f4v' + , u'*.mov' + , u'*.m4a' + , u'*.m4b' + , u'*.m4p' + , u'*.m4v' + , u'*.mkv' + , u'*.mp4' + , u'*.ogv' + , u'*.webm' + , u'*.mpg', u'*.wmv', u'*.mpeg', u'*.avi' + , u'*.swf' + ] AUDIO_EXT = [ - u'*.mp3' - , u'*.ogg' - ] + u'*.mp3' + , u'*.ogg' + ] class WebkitPlayer(MediaPlayer): @@ -339,7 +339,7 @@ else: display.frame.evaluateJavaScript(u'show_video("play");') if start_time > 0: - self.seek(display, controller.media_info.start_time*1000) + self.seek(display, controller.media_info.start_time * 1000) # TODO add playing check and get the correct media length controller.media_info.length = length self.state = MediaState.Playing @@ -375,11 +375,11 @@ controller = display.controller if controller.media_info.is_flash: seek = seekVal - display.frame.evaluateJavaScript( \ + display.frame.evaluateJavaScript( u'show_flash("seek", null, null, "%s");' % (seek)) else: - seek = float(seekVal)/1000 - display.frame.evaluateJavaScript( \ + seek = float(seekVal) / 1000 + display.frame.evaluateJavaScript( u'show_video("seek", null, null, null, "%f");' % (seek)) def reset(self, display): @@ -406,24 +406,24 @@ def update_ui(self, display): controller = display.controller if controller.media_info.is_flash: - currentTime = display.frame.evaluateJavaScript( \ + currentTime = display.frame.evaluateJavaScript( u'show_flash("currentTime");').toInt()[0] - length = display.frame.evaluateJavaScript( \ + length = display.frame.evaluateJavaScript( u'show_flash("length");').toInt()[0] else: - if display.frame.evaluateJavaScript( \ + if display.frame.evaluateJavaScript( u'show_video("isEnded");').toString() == 'true': self.stop(display) - (currentTime, ok) = display.frame.evaluateJavaScript( \ + (currentTime, ok) = display.frame.evaluateJavaScript( u'show_video("currentTime");').toFloat() # check if conversion was ok and value is not 'NaN' if ok and currentTime != float('inf'): - currentTime = int(currentTime*1000) - (length, ok) = display.frame.evaluateJavaScript( \ + currentTime = int(currentTime * 1000) + (length, ok) = display.frame.evaluateJavaScript( u'show_video("length");').toFloat() # check if conversion was ok and value is not 'NaN' if ok and length != float('inf'): - length = int(length*1000) + length = int(length * 1000) if currentTime > 0: controller.media_info.length = length controller.seekSlider.setMaximum(length) === modified file 'openlp/core/ui/pluginform.py' --- openlp/core/ui/pluginform.py 2011-12-27 10:33:55 +0000 +++ openlp/core/ui/pluginform.py 2012-06-09 15:47:26 +0000 @@ -102,9 +102,9 @@ self.versionNumberLabel.setText(self.activePlugin.version) self.aboutTextBrowser.setHtml(self.activePlugin.about()) self.programaticChange = True - status = 1 + status = PluginStatus.Active if self.activePlugin.status == PluginStatus.Active: - status = 0 + status = PluginStatus.Inactive self.statusComboBox.setCurrentIndex(status) self.statusComboBox.setEnabled(True) self.programaticChange = False @@ -129,7 +129,7 @@ def onStatusComboBoxChanged(self, status): if self.programaticChange or status == PluginStatus.Disabled: return - if status == 0: + if status == PluginStatus.Inactive: Receiver.send_message(u'cursor_busy') self.activePlugin.toggleStatus(PluginStatus.Active) Receiver.send_message(u'cursor_normal') === modified file 'openlp/core/ui/servicemanager.py' --- openlp/core/ui/servicemanager.py 2012-05-17 20:26:31 +0000 +++ openlp/core/ui/servicemanager.py 2012-06-09 15:47:26 +0000 @@ -580,10 +580,7 @@ return self.saveFileAs() self.mainwindow.addRecentFile(path_file_name) self.setModified(False) - try: - delete_file(temp_file_name) - except: - pass + delete_file(temp_file_name) return success def saveFileAs(self): === modified file 'openlp/plugins/songs/forms/editsongform.py' --- openlp/plugins/songs/forms/editsongform.py 2012-06-04 10:51:50 +0000 +++ openlp/plugins/songs/forms/editsongform.py 2012-06-09 15:47:26 +0000 @@ -172,17 +172,14 @@ def loadThemes(self, theme_list): self.themeComboBox.clear() self.themeComboBox.addItem(u'') - self.themes = [] - for theme in theme_list: - self.themeComboBox.addItem(theme) - self.themes.append(theme) + self.themes = theme_list + self.themeComboBox.addItems(theme_list) set_case_insensitive_completer(self.themes, self.themeComboBox) def loadMediaFiles(self): self.audioAddFromMediaButton.setVisible(False) for plugin in self.parent().pluginManager.plugins: - if plugin.name == u'media' and \ - plugin.status == PluginStatus.Active: + if plugin.name == u'media' and plugin.status == PluginStatus.Active: self.audioAddFromMediaButton.setVisible(True) self.mediaForm.populateFiles( plugin.mediaItem.getList(MediaType.Audio))
_______________________________________________ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp