This commit is contained in:
Andreas Preikschat 2011-03-15 20:45:56 +01:00
commit f339c11ccf
7 changed files with 54 additions and 26 deletions

View File

@ -150,24 +150,23 @@ class MainDisplay(DisplayWidget):
if not background_color.isValid(): if not background_color.isValid():
background_color = QtCore.Qt.white background_color = QtCore.Qt.white
splash_image = QtGui.QImage(image_file) splash_image = QtGui.QImage(image_file)
initialFrame = QtGui.QImage( self.initialFrame = QtGui.QImage(
self.screens.current[u'size'].width(), self.screens.current[u'size'].width(),
self.screens.current[u'size'].height(), self.screens.current[u'size'].height(),
QtGui.QImage.Format_ARGB32_Premultiplied) QtGui.QImage.Format_ARGB32_Premultiplied)
painter_image = QtGui.QPainter() painter_image = QtGui.QPainter()
painter_image.begin(initialFrame) painter_image.begin(self.initialFrame)
painter_image.fillRect(initialFrame.rect(), background_color) painter_image.fillRect(self.initialFrame.rect(), background_color)
painter_image.drawImage( painter_image.drawImage(
(self.screens.current[u'size'].width() - (self.screens.current[u'size'].width() -
splash_image.width()) / 2, splash_image.width()) / 2,
(self.screens.current[u'size'].height() (self.screens.current[u'size'].height()
- splash_image.height()) / 2, splash_image) - splash_image.height()) / 2, splash_image)
serviceItem = ServiceItem() 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.webView.setHtml(build_html(serviceItem, self.screen,
self.alertTab, self.isLive, None)) self.alertTab, self.isLive, None))
self.initialFrame = True self.__hideMouse()
self.__hideMouse()
# To display or not to display? # To display or not to display?
if not self.screen[u'primary']: if not self.screen[u'primary']:
self.show() self.show()
@ -188,6 +187,7 @@ class MainDisplay(DisplayWidget):
# Wait for the webview to update before displaying text. # Wait for the webview to update before displaying text.
while not self.webLoaded: while not self.webLoaded:
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
self.setGeometry(self.screen[u'size'])
self.frame.evaluateJavaScript(u'show_text("%s")' % \ self.frame.evaluateJavaScript(u'show_text("%s")' % \
slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"')) slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
return self.preview() return self.preview()
@ -199,7 +199,7 @@ class MainDisplay(DisplayWidget):
`slide` `slide`
The slide text to be displayed The slide text to be displayed
""" """
log.debug(u'alert to display') log.debug(u'alert to display')
if self.height() != self.screen[u'size'].height() \ if self.height() != self.screen[u'size'].height() \
or not self.isVisible() or self.videoWidget.isVisible(): or not self.isVisible() or self.videoWidget.isVisible():
shrink = True shrink = True
@ -215,12 +215,18 @@ class MainDisplay(DisplayWidget):
else: else:
shrinkItem = self shrinkItem = self
if text: if text:
shrinkItem.resize(self.width(), int(height.toString())) alert_height = int(height.toString())
shrinkItem.resize(self.width(), alert_height)
shrinkItem.setVisible(True) 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: else:
shrinkItem.setVisible(False) shrinkItem.setVisible(False)
shrinkItem.resize(self.screen[u'size'].width(), self.setGeometry(self.screen[u'size'])
self.screen[u'size'].height())
def directImage(self, name, path): def directImage(self, name, path):
""" """
@ -250,6 +256,7 @@ class MainDisplay(DisplayWidget):
""" """
Display an image, as is. Display an image, as is.
""" """
self.setGeometry(self.screen[u'size'])
if image: if image:
js = u'show_image("data:image/png;base64,%s");' % image js = u'show_image("data:image/png;base64,%s");' % image
else: else:
@ -344,6 +351,7 @@ class MainDisplay(DisplayWidget):
""" """
log.debug(u'video') log.debug(u'video')
self.webLoaded = True self.webLoaded = True
self.setGeometry(self.screen[u'size'])
# We are running a background theme # We are running a background theme
self.override[u'theme'] = u'' self.override[u'theme'] = u''
self.override[u'video'] = True self.override[u'video'] = True
@ -443,7 +451,7 @@ class MainDisplay(DisplayWidget):
""" """
log.debug(u'buildHtml') log.debug(u'buildHtml')
self.webLoaded = False self.webLoaded = False
self.initialFrame = False self.initialFrame = None
self.serviceItem = serviceItem self.serviceItem = serviceItem
background = None background = None
# We have an image override so keep the image till the theme changes # We have an image override so keep the image till the theme changes

View File

@ -391,7 +391,7 @@ def get_uno_command():
Returns the UNO command to launch an openoffice.org instance. Returns the UNO command to launch an openoffice.org instance.
""" """
COMMAND = u'soffice' COMMAND = u'soffice'
OPTIONS = u'-nologo -norestore -minimized -invisible -nofirststartwizard' OPTIONS = u'-nologo -norestore -minimized -nodefault -nofirststartwizard'
if UNO_CONNECTION_TYPE == u'pipe': if UNO_CONNECTION_TYPE == u'pipe':
CONNECTION = u'"-accept=pipe,name=openlp_pipe;urp;"' CONNECTION = u'"-accept=pipe,name=openlp_pipe;urp;"'
else: else:

View File

@ -80,7 +80,8 @@ class Controller(object):
if self.doc.is_active(): if self.doc.is_active():
return return
if not self.doc.is_loaded(): if not self.doc.is_loaded():
self.doc.load_presentation() if not self.doc.load_presentation():
return
if self.is_live: if self.is_live:
self.doc.start_presentation() self.doc.start_presentation()
if self.doc.slidenumber > 1: if self.doc.slidenumber > 1:

View File

@ -77,8 +77,11 @@ class PowerpointController(PresentationController):
""" """
Loads PowerPoint process Loads PowerPoint process
""" """
self.process = Dispatch(u'PowerPoint.Application') log.debug(u'start_process')
self.process.Visible = True if not self.process:
self.process = Dispatch(u'PowerPoint.Application')
if float(self.process.Version) < 13:
self.process.Visible = True
self.process.WindowState = 2 self.process.WindowState = 2
def kill(self): def kill(self):
@ -120,13 +123,14 @@ class PowerpointDocument(PresentationDocument):
``presentation`` ``presentation``
The file name of the presentations to run. 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: if not self.controller.process or not self.controller.process.Visible:
self.controller.start_process() self.controller.start_process()
try: try:
self.controller.process.Presentations.Open(self.filepath, False, self.controller.process.Presentations.Open(self.filepath, False,
False, True) False, True)
except pywintypes.com_error: except pywintypes.com_error:
log.debug(u'PPT open failed')
return False return False
self.presentation = self.controller.process.Presentations( self.presentation = self.controller.process.Presentations(
self.controller.process.Presentations.Count) 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 However, for the moment, we want a physical file since it makes life
easier elsewhere. easier elsewhere.
""" """
log.debug(u'create_thumbnails')
if self.check_thumbnails(): if self.check_thumbnails():
return return
for num in range(0, self.presentation.Slides.Count): for num in range(0, self.presentation.Slides.Count):
@ -170,6 +175,7 @@ class PowerpointDocument(PresentationDocument):
""" """
Returns ``True`` if a presentation is loaded. Returns ``True`` if a presentation is loaded.
""" """
log.debug(u'is_loaded')
try: try:
if not self.controller.process.Visible: if not self.controller.process.Visible:
return False return False
@ -186,6 +192,7 @@ class PowerpointDocument(PresentationDocument):
""" """
Returns ``True`` if a presentation is currently active. Returns ``True`` if a presentation is currently active.
""" """
log.debug(u'is_active')
if not self.is_loaded(): if not self.is_loaded():
return False return False
try: try:
@ -201,6 +208,7 @@ class PowerpointDocument(PresentationDocument):
""" """
Unblanks (restores) the presentation. Unblanks (restores) the presentation.
""" """
log.debug(u'unblank_screen')
self.presentation.SlideShowSettings.Run() self.presentation.SlideShowSettings.Run()
self.presentation.SlideShowWindow.View.State = 1 self.presentation.SlideShowWindow.View.State = 1
self.presentation.SlideShowWindow.Activate() self.presentation.SlideShowWindow.Activate()
@ -209,12 +217,14 @@ class PowerpointDocument(PresentationDocument):
""" """
Blanks the screen. Blanks the screen.
""" """
log.debug(u'blank_screen')
self.presentation.SlideShowWindow.View.State = 3 self.presentation.SlideShowWindow.View.State = 3
def is_blank(self): def is_blank(self):
""" """
Returns ``True`` if screen is blank. Returns ``True`` if screen is blank.
""" """
log.debug(u'is_blank')
if self.is_active(): if self.is_active():
return self.presentation.SlideShowWindow.View.State == 3 return self.presentation.SlideShowWindow.View.State == 3
else: else:
@ -224,6 +234,7 @@ class PowerpointDocument(PresentationDocument):
""" """
Stops the current presentation and hides the output. Stops the current presentation and hides the output.
""" """
log.debug(u'stop_presentation')
self.presentation.SlideShowWindow.View.Exit() self.presentation.SlideShowWindow.View.Exit()
if os.name == u'nt': if os.name == u'nt':
@ -231,6 +242,7 @@ class PowerpointDocument(PresentationDocument):
""" """
Starts a presentation from the beginning. Starts a presentation from the beginning.
""" """
log.debug(u'start_presentation')
#SlideShowWindow measures its size/position by points, not pixels #SlideShowWindow measures its size/position by points, not pixels
try: try:
dpi = win32ui.GetActiveWindow().GetDC().GetDeviceCaps(88) dpi = win32ui.GetActiveWindow().GetDC().GetDeviceCaps(88)
@ -253,30 +265,35 @@ class PowerpointDocument(PresentationDocument):
""" """
Returns the current slide number. Returns the current slide number.
""" """
log.debug(u'get_slide_number')
return self.presentation.SlideShowWindow.View.CurrentShowPosition return self.presentation.SlideShowWindow.View.CurrentShowPosition
def get_slide_count(self): def get_slide_count(self):
""" """
Returns total number of slides. Returns total number of slides.
""" """
log.debug(u'get_slide_count')
return self.presentation.Slides.Count return self.presentation.Slides.Count
def goto_slide(self, slideno): def goto_slide(self, slideno):
""" """
Moves to a specific slide in the presentation. Moves to a specific slide in the presentation.
""" """
log.debug(u'goto_slide')
self.presentation.SlideShowWindow.View.GotoSlide(slideno) self.presentation.SlideShowWindow.View.GotoSlide(slideno)
def next_step(self): def next_step(self):
""" """
Triggers the next effect of slide on the running presentation. Triggers the next effect of slide on the running presentation.
""" """
log.debug(u'next_step')
self.presentation.SlideShowWindow.View.Next() self.presentation.SlideShowWindow.View.Next()
def previous_step(self): def previous_step(self):
""" """
Triggers the previous slide on the running presentation. Triggers the previous slide on the running presentation.
""" """
log.debug(u'previous_step')
self.presentation.SlideShowWindow.View.Previous() self.presentation.SlideShowWindow.View.Previous()
def get_slide_text(self, slide_no): def get_slide_text(self, slide_no):

View File

@ -84,7 +84,8 @@ class PptviewController(PresentationController):
dllpath = os.path.join(self.plugin.pluginManager.basepath, dllpath = os.path.join(self.plugin.pluginManager.basepath,
u'presentations', u'lib', u'pptviewlib', u'pptviewlib.dll') u'presentations', u'lib', u'pptviewlib', u'pptviewlib.dll')
self.process = cdll.LoadLibrary(dllpath) self.process = cdll.LoadLibrary(dllpath)
#self.process.SetDebug(1) if log.isEnabledFor(logging.DEBUG):
self.process.SetDebug(1)
def kill(self): def kill(self):
""" """
@ -140,8 +141,10 @@ class PptviewDocument(PresentationDocument):
PPTviewLib creates large BMP's, but we want small PNG's for consistency. PPTviewLib creates large BMP's, but we want small PNG's for consistency.
Convert them here. Convert them here.
""" """
log.debug(u'create_thumbnails')
if self.check_thumbnails(): if self.check_thumbnails():
return return
log.debug(u'create_thumbnails proceeding')
for idx in range(self.get_slide_count()): for idx in range(self.get_slide_count()):
path = u'%s\\slide%s.bmp' % (self.get_temp_folder(), path = u'%s\\slide%s.bmp' % (self.get_temp_folder(),
unicode(idx + 1)) unicode(idx + 1))

View File

@ -133,7 +133,7 @@ class PPTViewer(QtGui.QWidget):
def OpenClick(self): def OpenClick(self):
oldid = self.pptid; oldid = self.pptid;
rect = RECT(100,100,900,700) rect = RECT(100,100,900,700)
filename = unicode(self.PPTEdit.text()) filename = str(self.PPTEdit.text().replace(u'/', u'\\'))
print filename print filename
self.pptid = pptdll.OpenPPT(filename, None, rect, 'c:\\temp\\slide') self.pptid = pptdll.OpenPPT(filename, None, rect, 'c:\\temp\\slide')
print "id: " + unicode(self.pptid) print "id: " + unicode(self.pptid)

View File

@ -166,20 +166,18 @@ class SongMediaItem(MediaManagerItem):
or_(Song.search_title.like(u'%' + self.whitespace.sub(u' ', or_(Song.search_title.like(u'%' + self.whitespace.sub(u' ',
search_keywords.lower()) + u'%'), search_keywords.lower()) + u'%'),
Song.search_lyrics.like(u'%' + search_keywords.lower() + u'%'), Song.search_lyrics.like(u'%' + search_keywords.lower() + u'%'),
Song.comments.like(u'%' + search_keywords.lower() + u'%')), Song.comments.like(u'%' + search_keywords.lower() + u'%')))
Song.search_title.asc())
self.displayResultsSong(search_results) self.displayResultsSong(search_results)
elif search_type == SongSearch.Titles: elif search_type == SongSearch.Titles:
log.debug(u'Titles Search') log.debug(u'Titles Search')
search_results = self.parent.manager.get_all_objects(Song, search_results = self.parent.manager.get_all_objects(Song,
Song.search_title.like(u'%' + self.whitespace.sub(u' ', 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) self.displayResultsSong(search_results)
elif search_type == SongSearch.Lyrics: elif search_type == SongSearch.Lyrics:
log.debug(u'Lyrics Search') log.debug(u'Lyrics Search')
search_results = self.parent.manager.get_all_objects(Song, search_results = self.parent.manager.get_all_objects(Song,
Song.search_lyrics.like(u'%' + search_keywords.lower() + u'%'), Song.search_lyrics.like(u'%' + search_keywords.lower() + u'%'))
Song.search_lyrics.asc())
self.displayResultsSong(search_results) self.displayResultsSong(search_results)
elif search_type == SongSearch.Authors: elif search_type == SongSearch.Authors:
log.debug(u'Authors Search') log.debug(u'Authors Search')
@ -190,7 +188,7 @@ class SongMediaItem(MediaManagerItem):
elif search_type == SongSearch.Themes: elif search_type == SongSearch.Themes:
log.debug(u'Theme Search') log.debug(u'Theme Search')
search_results = self.parent.manager.get_all_objects(Song, 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) self.displayResultsSong(search_results)
def onSongListLoad(self): def onSongListLoad(self):
@ -458,4 +456,5 @@ class SongMediaItem(MediaManagerItem):
""" """
Locale aware collation of song titles 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()))