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():
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)
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()
self.__hideMouse()
# To display or not to display?
if not self.screen[u'primary']:
self.show()
@ -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()
@ -199,7 +199,7 @@ class MainDisplay(DisplayWidget):
`slide`
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() \
or not self.isVisible() or self.videoWidget.isVisible():
shrink = True
@ -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
@ -443,7 +451,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

View File

@ -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:

View File

@ -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:

View File

@ -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):

View File

@ -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))

View File

@ -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)

View File

@ -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):
@ -458,4 +456,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()))