forked from openlp/openlp
Themes and Timer points
bzr-revno: 540
This commit is contained in:
commit
dd70e31779
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from openlp.core.lib import OpenLPToolbar, translate, buildIcon, Receiver, \
|
from openlp.core.lib import OpenLPToolbar, translate, buildIcon, Receiver, \
|
||||||
@ -247,7 +248,9 @@ class SlideController(QtGui.QWidget):
|
|||||||
if self.commandItem is not None and self.commandItem.service_item_type == ServiceType.Command:
|
if self.commandItem is not None and self.commandItem.service_item_type == ServiceType.Command:
|
||||||
Receiver().send_message(u'%s_stop'% self.commandItem.name.lower())
|
Receiver().send_message(u'%s_stop'% self.commandItem.name.lower())
|
||||||
self.commandItem = item
|
self.commandItem = item
|
||||||
|
before = time.time()
|
||||||
item.render()
|
item.render()
|
||||||
|
log.info(u'Rendering took %4s' % (time.time() - before))
|
||||||
self.enableToolBar(item)
|
self.enableToolBar(item)
|
||||||
if item.service_item_type == ServiceType.Command:
|
if item.service_item_type == ServiceType.Command:
|
||||||
Receiver().send_message(u'%s_start'%item.name.lower(), \
|
Receiver().send_message(u'%s_start'%item.name.lower(), \
|
||||||
@ -279,6 +282,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
Display the slide number passed
|
Display the slide number passed
|
||||||
"""
|
"""
|
||||||
log.debug(u'displayServiceManagerItems Start')
|
log.debug(u'displayServiceManagerItems Start')
|
||||||
|
before = time.time()
|
||||||
self.serviceitem = serviceitem
|
self.serviceitem = serviceitem
|
||||||
slide_image = self.serviceitem.frames[0][u'image']
|
slide_image = self.serviceitem.frames[0][u'image']
|
||||||
size = slide_image.size()
|
size = slide_image.size()
|
||||||
@ -306,6 +310,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.PreviewListWidget.selectRow(slideno)
|
self.PreviewListWidget.selectRow(slideno)
|
||||||
self.onSlideSelected()
|
self.onSlideSelected()
|
||||||
self.PreviewListWidget.setFocus()
|
self.PreviewListWidget.setFocus()
|
||||||
|
log.info(u'Display Rendering took %4s' % (time.time() - before))
|
||||||
log.debug(u'displayServiceManagerItems End')
|
log.debug(u'displayServiceManagerItems End')
|
||||||
|
|
||||||
#Screen event methods
|
#Screen event methods
|
||||||
|
@ -177,7 +177,30 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
self.pushThemes()
|
self.pushThemes()
|
||||||
|
|
||||||
def onExportTheme(self):
|
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):
|
def onImportTheme(self):
|
||||||
files = QtGui.QFileDialog.getOpenFileNames(None,
|
files = QtGui.QFileDialog.getOpenFileNames(None,
|
||||||
@ -261,7 +284,16 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
necessary.
|
necessary.
|
||||||
"""
|
"""
|
||||||
log.debug(u'Unzipping theme %s', filename)
|
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
|
filexml = None
|
||||||
themename = None
|
themename = None
|
||||||
for file in zip.namelist():
|
for file in zip.namelist():
|
||||||
|
Loading…
Reference in New Issue
Block a user