openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00320
[Merge] lp:~trb143/openlp/bugfixes into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/bugfixes into lp:openlp.
Requested reviews:
openlp.org Core (openlp-core)
Add rendering timer points so we can confirm speed the same way
Add theme export code cos it was missing
Fix some error handling
--
https://code.launchpad.net/~trb143/openlp/bugfixes/+merge/11725
Your team openlp.org Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2009-09-13 19:31:31 +0000
+++ openlp/core/ui/slidecontroller.py 2009-09-14 19:18:49 +0000
@@ -24,6 +24,7 @@
import logging
import os
+import time
from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, translate, buildIcon, Receiver, \
@@ -241,7 +242,9 @@
if self.commandItem is not None and self.commandItem.service_item_type == ServiceType.Command:
Receiver().send_message(u'%s_stop'% self.commandItem.name.lower())
self.commandItem = item
+ before = time.time()
item.render()
+ log.info(u'Rendering took %4s' % (time.time() - before))
self.enableToolBar(item)
if item.service_item_type == ServiceType.Command:
Receiver().send_message(u'%s_start'%item.name.lower(), \
@@ -273,6 +276,7 @@
Display the slide number passed
"""
log.debug(u'displayServiceManagerItems Start')
+ before = time.time()
self.serviceitem = serviceitem
slide_image = self.serviceitem.frames[0][u'image']
size = slide_image.size()
@@ -300,6 +304,7 @@
self.PreviewListWidget.selectRow(slideno)
self.onSlideSelected()
self.PreviewListWidget.setFocus()
+ log.info(u'Display Rendering took %4s' % (time.time() - before))
log.debug(u'displayServiceManagerItems End')
#Screen event methods
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2009-09-13 15:14:45 +0000
+++ openlp/core/ui/thememanager.py 2009-09-14 18:53:56 +0000
@@ -177,7 +177,30 @@
self.pushThemes()
def onExportTheme(self):
- pass
+ """
+ Save the theme in a zip file
+ """
+ item = self.ThemeListWidget.currentItem()
+ if item is None:
+ QtGui.QMessageBox.critical(self,
+ translate(u'ThemeManager', u'Error'),
+ translate(u'ThemeManager',
+ u'You have not selected a theme!'),
+ QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
+ return
+ theme = unicode(item.text())
+ path = QtGui.QFileDialog.getExistingDirectory(self,
+ u'Save Theme',self.config.get_last_dir(1) )
+ path = unicode(path)
+ if path != u'':
+ self.config.set_last_dir(path, 1)
+ themePath = os.path.join(path, theme + u'.theme')
+ zip = zipfile.ZipFile(themePath, 'w')
+ source = os.path.join(self.path, theme)
+ for root, dirs, files in os.walk(source):
+ for name in files:
+ zip.write(os.path.join(source, name), os.path.join(theme, name))
+ zip.close()
def onImportTheme(self):
files = QtGui.QFileDialog.getOpenFileNames(None,
@@ -261,7 +284,16 @@
necessary.
"""
log.debug(u'Unzipping theme %s', filename)
- zip = zipfile.ZipFile(unicode(filename))
+ filename = unicode(filename)
+ try:
+ zip = zipfile.ZipFile(filename)
+ except:
+ QtGui.QMessageBox.critical(self,
+ translate(u'ThemeManager', u'Error'),
+ translate(u'ThemeManager',
+ u'File is not a valid theme!'),
+ QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
+ return
filexml = None
themename = None
for file in zip.namelist():
Follow ups