diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 382be85b8..08e240b5c 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -33,8 +33,7 @@ from ConfigParser import SafeConfigParser from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, PluginStatus, check_directory_exists, \ - Receiver, build_icon +from openlp.core.lib import translate, PluginStatus, Receiver, build_icon from openlp.core.utils import get_web_page, AppLocation from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage @@ -95,7 +94,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): language = unicode(self.config.get( u'bibles_%s' % lang, u'title'), u'utf8') langItem = QtGui.QTreeWidgetItem( - self.biblesTreeWidget, QtCore.QStringList(language)) + self.biblesTreeWidget, QtCore.QStringList(language)) bibles = self.config.get(u'bibles_%s' % lang, u'translations') bibles = bibles.split(u',') for bible in bibles: @@ -104,8 +103,9 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): filename = unicode(self.config.get( u'bible_%s' % bible, u'filename')) item = QtGui.QTreeWidgetItem( - langItem, QtCore.QStringList(title)) - item.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(filename)) + langItem, QtCore.QStringList(title)) + item.setData(0, QtCore.Qt.UserRole, + QtCore.QVariant(filename)) item.setCheckState(0, QtCore.Qt.Unchecked) item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable) self.biblesTreeWidget.expandAll() @@ -224,7 +224,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): 'Enabling selected plugins...')) self._setPluginStatus(self.songsCheckBox, u'songs/status') self._setPluginStatus(self.bibleCheckBox, u'bibles/status') - self._setPluginStatus(self.presentationCheckBox, u'presentations/status') + self._setPluginStatus(self.presentationCheckBox, + u'presentations/status') self._setPluginStatus(self.imageCheckBox, u'images/status') self._setPluginStatus(self.mediaCheckBox, u'media/status') self._setPluginStatus(self.remoteCheckBox, u'remotes/status') @@ -276,4 +277,3 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): status = PluginStatus.Active if field.checkState() \ == QtCore.Qt.Checked else PluginStatus.Inactive QtCore.QSettings().setValue(tag, QtCore.QVariant(status)) - diff --git a/openlp/core/ui/firsttimelanguagedialog.py b/openlp/core/ui/firsttimelanguagedialog.py index ae44abeb5..93751763f 100644 --- a/openlp/core/ui/firsttimelanguagedialog.py +++ b/openlp/core/ui/firsttimelanguagedialog.py @@ -46,7 +46,8 @@ class Ui_FirstTimeLanguageDialog(object): self.languageLabel.setObjectName(u'languageLabel') self.languageLayout.addWidget(self.languageLabel) self.languageComboBox = QtGui.QComboBox(languageDialog) - self.languageComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) + self.languageComboBox.setSizeAdjustPolicy( + QtGui.QComboBox.AdjustToContents) self.languageComboBox.setObjectName("languageComboBox") self.languageLayout.addWidget(self.languageComboBox) self.dialogLayout.addLayout(self.languageLayout) diff --git a/openlp/core/ui/firsttimelanguageform.py b/openlp/core/ui/firsttimelanguageform.py index a8ce3bd57..22057fbfc 100644 --- a/openlp/core/ui/firsttimelanguageform.py +++ b/openlp/core/ui/firsttimelanguageform.py @@ -26,7 +26,6 @@ from PyQt4 import QtGui -from openlp.core.lib import translate from openlp.core.utils import LanguageManager from firsttimelanguagedialog import Ui_FirstTimeLanguageDialog diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 50f9ad81f..76c891636 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -150,23 +150,22 @@ class MainDisplay(DisplayWidget): if not background_color.isValid(): background_color = QtCore.Qt.white splash_image = QtGui.QImage(image_file) - initialFrame = QtGui.QImage( + self.initialFrame = QtGui.QImage( self.screens.current[u'size'].width(), self.screens.current[u'size'].height(), QtGui.QImage.Format_ARGB32_Premultiplied) painter_image = QtGui.QPainter() - painter_image.begin(initialFrame) - painter_image.fillRect(initialFrame.rect(), background_color) + painter_image.begin(self.initialFrame) + painter_image.fillRect(self.initialFrame.rect(), background_color) painter_image.drawImage( (self.screens.current[u'size'].width() - splash_image.width()) / 2, (self.screens.current[u'size'].height() - splash_image.height()) / 2, splash_image) serviceItem = ServiceItem() - serviceItem.bg_image_bytes = image_to_byte(initialFrame) + serviceItem.bg_image_bytes = image_to_byte(self.initialFrame) self.webView.setHtml(build_html(serviceItem, self.screen, self.alertTab, self.isLive, None)) - self.initialFrame = True self.__hideMouse() # To display or not to display? if not self.screen[u'primary']: @@ -188,6 +187,7 @@ class MainDisplay(DisplayWidget): # Wait for the webview to update before displaying text. while not self.webLoaded: Receiver.send_message(u'openlp_process_events') + self.setGeometry(self.screen[u'size']) self.frame.evaluateJavaScript(u'show_text("%s")' % \ slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"')) return self.preview() @@ -215,12 +215,18 @@ class MainDisplay(DisplayWidget): else: shrinkItem = self if text: - shrinkItem.resize(self.width(), int(height.toString())) + alert_height = int(height.toString()) + shrinkItem.resize(self.width(), alert_height) shrinkItem.setVisible(True) + if self.alertTab.location == 1: + shrinkItem.move(self.screen[u'size'].left(), + (self.screen[u'size'].height() - alert_height) / 2) + elif self.alertTab.location == 2: + shrinkItem.move(self.screen[u'size'].left(), + self.screen[u'size'].height() - alert_height) else: shrinkItem.setVisible(False) - shrinkItem.resize(self.screen[u'size'].width(), - self.screen[u'size'].height()) + self.setGeometry(self.screen[u'size']) def directImage(self, name, path): """ @@ -250,6 +256,7 @@ class MainDisplay(DisplayWidget): """ Display an image, as is. """ + self.setGeometry(self.screen[u'size']) if image: js = u'show_image("data:image/png;base64,%s");' % image else: @@ -344,6 +351,7 @@ class MainDisplay(DisplayWidget): """ log.debug(u'video') self.webLoaded = True + self.setGeometry(self.screen[u'size']) # We are running a background theme self.override[u'theme'] = u'' self.override[u'video'] = True @@ -450,7 +458,7 @@ class MainDisplay(DisplayWidget): """ log.debug(u'buildHtml') self.webLoaded = False - self.initialFrame = False + self.initialFrame = None self.serviceItem = serviceItem background = None # We have an image override so keep the image till the theme changes diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 381712977..54b48cdf6 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -391,7 +391,7 @@ def get_uno_command(): Returns the UNO command to launch an openoffice.org instance. """ COMMAND = u'soffice' - OPTIONS = u'-nologo -norestore -minimized -invisible -nofirststartwizard' + OPTIONS = u'-nologo -norestore -minimized -nodefault -nofirststartwizard' if UNO_CONNECTION_TYPE == u'pipe': CONNECTION = u'"-accept=pipe,name=openlp_pipe;urp;"' else: diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index 4db78f7a5..6554c033a 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -80,7 +80,8 @@ class Controller(object): if self.doc.is_active(): return if not self.doc.is_loaded(): - self.doc.load_presentation() + if not self.doc.load_presentation(): + return if self.is_live: self.doc.start_presentation() if self.doc.slidenumber > 1: diff --git a/openlp/plugins/presentations/lib/powerpointcontroller.py b/openlp/plugins/presentations/lib/powerpointcontroller.py index 4dc9e8f3a..f220f558a 100644 --- a/openlp/plugins/presentations/lib/powerpointcontroller.py +++ b/openlp/plugins/presentations/lib/powerpointcontroller.py @@ -77,8 +77,11 @@ class PowerpointController(PresentationController): """ Loads PowerPoint process """ - self.process = Dispatch(u'PowerPoint.Application') - self.process.Visible = True + log.debug(u'start_process') + if not self.process: + self.process = Dispatch(u'PowerPoint.Application') + if float(self.process.Version) < 13: + self.process.Visible = True self.process.WindowState = 2 def kill(self): @@ -120,13 +123,14 @@ class PowerpointDocument(PresentationDocument): ``presentation`` The file name of the presentations to run. """ - log.debug(u'LoadPresentation') + log.debug(u'load_presentation') if not self.controller.process or not self.controller.process.Visible: self.controller.start_process() try: self.controller.process.Presentations.Open(self.filepath, False, False, True) except pywintypes.com_error: + log.debug(u'PPT open failed') return False self.presentation = self.controller.process.Presentations( self.controller.process.Presentations.Count) @@ -145,6 +149,7 @@ class PowerpointDocument(PresentationDocument): However, for the moment, we want a physical file since it makes life easier elsewhere. """ + log.debug(u'create_thumbnails') if self.check_thumbnails(): return for num in range(0, self.presentation.Slides.Count): @@ -170,6 +175,7 @@ class PowerpointDocument(PresentationDocument): """ Returns ``True`` if a presentation is loaded. """ + log.debug(u'is_loaded') try: if not self.controller.process.Visible: return False @@ -186,6 +192,7 @@ class PowerpointDocument(PresentationDocument): """ Returns ``True`` if a presentation is currently active. """ + log.debug(u'is_active') if not self.is_loaded(): return False try: @@ -201,6 +208,7 @@ class PowerpointDocument(PresentationDocument): """ Unblanks (restores) the presentation. """ + log.debug(u'unblank_screen') self.presentation.SlideShowSettings.Run() self.presentation.SlideShowWindow.View.State = 1 self.presentation.SlideShowWindow.Activate() @@ -209,12 +217,14 @@ class PowerpointDocument(PresentationDocument): """ Blanks the screen. """ + log.debug(u'blank_screen') self.presentation.SlideShowWindow.View.State = 3 def is_blank(self): """ Returns ``True`` if screen is blank. """ + log.debug(u'is_blank') if self.is_active(): return self.presentation.SlideShowWindow.View.State == 3 else: @@ -224,6 +234,7 @@ class PowerpointDocument(PresentationDocument): """ Stops the current presentation and hides the output. """ + log.debug(u'stop_presentation') self.presentation.SlideShowWindow.View.Exit() if os.name == u'nt': @@ -231,6 +242,7 @@ class PowerpointDocument(PresentationDocument): """ Starts a presentation from the beginning. """ + log.debug(u'start_presentation') #SlideShowWindow measures its size/position by points, not pixels try: dpi = win32ui.GetActiveWindow().GetDC().GetDeviceCaps(88) @@ -253,30 +265,35 @@ class PowerpointDocument(PresentationDocument): """ Returns the current slide number. """ + log.debug(u'get_slide_number') return self.presentation.SlideShowWindow.View.CurrentShowPosition def get_slide_count(self): """ Returns total number of slides. """ + log.debug(u'get_slide_count') return self.presentation.Slides.Count def goto_slide(self, slideno): """ Moves to a specific slide in the presentation. """ + log.debug(u'goto_slide') self.presentation.SlideShowWindow.View.GotoSlide(slideno) def next_step(self): """ Triggers the next effect of slide on the running presentation. """ + log.debug(u'next_step') self.presentation.SlideShowWindow.View.Next() def previous_step(self): """ Triggers the previous slide on the running presentation. """ + log.debug(u'previous_step') self.presentation.SlideShowWindow.View.Previous() def get_slide_text(self, slide_no): diff --git a/openlp/plugins/presentations/lib/pptviewcontroller.py b/openlp/plugins/presentations/lib/pptviewcontroller.py index 0900d1d9d..5ec560167 100644 --- a/openlp/plugins/presentations/lib/pptviewcontroller.py +++ b/openlp/plugins/presentations/lib/pptviewcontroller.py @@ -84,7 +84,8 @@ class PptviewController(PresentationController): dllpath = os.path.join(self.plugin.pluginManager.basepath, u'presentations', u'lib', u'pptviewlib', u'pptviewlib.dll') self.process = cdll.LoadLibrary(dllpath) - #self.process.SetDebug(1) + if log.isEnabledFor(logging.DEBUG): + self.process.SetDebug(1) def kill(self): """ @@ -140,8 +141,10 @@ class PptviewDocument(PresentationDocument): PPTviewLib creates large BMP's, but we want small PNG's for consistency. Convert them here. """ + log.debug(u'create_thumbnails') if self.check_thumbnails(): return + log.debug(u'create_thumbnails proceeding') for idx in range(self.get_slide_count()): path = u'%s\\slide%s.bmp' % (self.get_temp_folder(), unicode(idx + 1)) diff --git a/openlp/plugins/presentations/lib/pptviewlib/ppttest.py b/openlp/plugins/presentations/lib/pptviewlib/ppttest.py index 1e10def7d..f8d0fabd9 100644 --- a/openlp/plugins/presentations/lib/pptviewlib/ppttest.py +++ b/openlp/plugins/presentations/lib/pptviewlib/ppttest.py @@ -133,7 +133,7 @@ class PPTViewer(QtGui.QWidget): def OpenClick(self): oldid = self.pptid; rect = RECT(100,100,900,700) - filename = unicode(self.PPTEdit.text()) + filename = str(self.PPTEdit.text().replace(u'/', u'\\')) print filename self.pptid = pptdll.OpenPPT(filename, None, rect, 'c:\\temp\\slide') print "id: " + unicode(self.pptid) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index feabc98b7..a07b5091f 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -166,20 +166,18 @@ class SongMediaItem(MediaManagerItem): or_(Song.search_title.like(u'%' + self.whitespace.sub(u' ', search_keywords.lower()) + u'%'), Song.search_lyrics.like(u'%' + search_keywords.lower() + u'%'), - Song.comments.like(u'%' + search_keywords.lower() + u'%')), - Song.search_title.asc()) + Song.comments.like(u'%' + search_keywords.lower() + u'%'))) self.displayResultsSong(search_results) elif search_type == SongSearch.Titles: log.debug(u'Titles Search') search_results = self.parent.manager.get_all_objects(Song, Song.search_title.like(u'%' + self.whitespace.sub(u' ', - search_keywords.lower()) + u'%'), Song.search_title.asc()) + search_keywords.lower()) + u'%')) self.displayResultsSong(search_results) elif search_type == SongSearch.Lyrics: log.debug(u'Lyrics Search') search_results = self.parent.manager.get_all_objects(Song, - Song.search_lyrics.like(u'%' + search_keywords.lower() + u'%'), - Song.search_lyrics.asc()) + Song.search_lyrics.like(u'%' + search_keywords.lower() + u'%')) self.displayResultsSong(search_results) elif search_type == SongSearch.Authors: log.debug(u'Authors Search') @@ -190,7 +188,7 @@ class SongMediaItem(MediaManagerItem): elif search_type == SongSearch.Themes: log.debug(u'Theme Search') search_results = self.parent.manager.get_all_objects(Song, - Song.theme_name == search_keywords, Song.search_lyrics.asc()) + Song.theme_name == search_keywords) self.displayResultsSong(search_results) def onSongListLoad(self): @@ -461,4 +459,5 @@ class SongMediaItem(MediaManagerItem): """ Locale aware collation of song titles """ - return locale.strcoll(unicode(song_1.title), unicode(song_2.title)) + return locale.strcoll(unicode(song_1.title.lower()), + unicode(song_2.title.lower())) diff --git a/openlp/plugins/songs/lib/sofimport.py b/openlp/plugins/songs/lib/sofimport.py index 49adcd302..37f3136e9 100644 --- a/openlp/plugins/songs/lib/sofimport.py +++ b/openlp/plugins/songs/lib/sofimport.py @@ -33,7 +33,6 @@ import os import re -from songimport import SongImport from oooimport import OooImport if os.name == u'nt':