forked from openlp/openlp
Menu changes
bzr-revno: 553
This commit is contained in:
commit
d27171cd09
@ -519,6 +519,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
QtCore.SIGNAL(u'triggered()'), self.onOptionsSettingsItemClicked)
|
QtCore.SIGNAL(u'triggered()'), self.onOptionsSettingsItemClicked)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'update_global_theme'), self.defaultThemeChanged)
|
QtCore.SIGNAL(u'update_global_theme'), self.defaultThemeChanged)
|
||||||
|
QtCore.QObject.connect(self.FileNewItem,
|
||||||
|
QtCore.SIGNAL(u'triggered()'), self.ServiceManagerContents.onNewService)
|
||||||
|
QtCore.QObject.connect(self.FileOpenItem,
|
||||||
|
QtCore.SIGNAL(u'triggered()'), self.ServiceManagerContents.onLoadService)
|
||||||
|
QtCore.QObject.connect(self.FileSaveItem,
|
||||||
|
QtCore.SIGNAL(u'triggered()'), self.ServiceManagerContents.onQuickSaveService)
|
||||||
|
QtCore.QObject.connect(self.FileSaveAsItem,
|
||||||
|
QtCore.SIGNAL(u'triggered()'), self.ServiceManagerContents.onSaveService)
|
||||||
#warning cyclic dependency
|
#warning cyclic dependency
|
||||||
#RenderManager needs to call ThemeManager and
|
#RenderManager needs to call ThemeManager and
|
||||||
#ThemeManager needs to call RenderManager
|
#ThemeManager needs to call RenderManager
|
||||||
|
@ -100,6 +100,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.serviceItems = []
|
self.serviceItems = []
|
||||||
self.serviceName = u''
|
self.serviceName = u''
|
||||||
|
self.isNew = True
|
||||||
self.Layout = QtGui.QVBoxLayout(self)
|
self.Layout = QtGui.QVBoxLayout(self)
|
||||||
self.Layout.setSpacing(0)
|
self.Layout.setSpacing(0)
|
||||||
self.Layout.setMargin(0)
|
self.Layout.setMargin(0)
|
||||||
@ -319,6 +320,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.ServiceManagerList.clear()
|
self.ServiceManagerList.clear()
|
||||||
self.serviceItems = []
|
self.serviceItems = []
|
||||||
self.serviceName = u''
|
self.serviceName = u''
|
||||||
|
self.isNew = True
|
||||||
self.parent.OosChanged(True, self.serviceName)
|
self.parent.OosChanged(True, self.serviceName)
|
||||||
|
|
||||||
def onDeleteFromService(self):
|
def onDeleteFromService(self):
|
||||||
@ -361,21 +363,28 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
if serviceItem == itemcount and serviceItemCount == count:
|
if serviceItem == itemcount and serviceItemCount == count:
|
||||||
self.ServiceManagerList.setCurrentItem(treewidgetitem1)
|
self.ServiceManagerList.setCurrentItem(treewidgetitem1)
|
||||||
|
|
||||||
def onSaveService(self):
|
def onSaveService(self, quick=False):
|
||||||
"""
|
"""
|
||||||
Save the current service in a zip file
|
Save the current service in a zip file
|
||||||
This file contains
|
This file contains
|
||||||
* An ood which is a pickle of the service items
|
* An ood which is a pickle of the service items
|
||||||
* All image, presentation and video files needed to run the service.
|
* All image, presentation and video files needed to run the service.
|
||||||
"""
|
"""
|
||||||
|
if not quick or self.isNew:
|
||||||
filename = QtGui.QFileDialog.getSaveFileName(self,
|
filename = QtGui.QFileDialog.getSaveFileName(self,
|
||||||
u'Save Order of Service',self.config.get_last_dir() )
|
u'Save Order of Service',self.config.get_last_dir() )
|
||||||
filename = unicode(filename)
|
else:
|
||||||
|
filename = self.config.get_last_dir()
|
||||||
if filename != u'':
|
if filename != u'':
|
||||||
|
splittedFile = filename.split(u'.')
|
||||||
|
if splittedFile[-1] != u'oos':
|
||||||
|
filename = filename + u'.oos'
|
||||||
|
filename = unicode(filename)
|
||||||
|
self.isNew = False
|
||||||
self.config.set_last_dir(filename)
|
self.config.set_last_dir(filename)
|
||||||
service = []
|
service = []
|
||||||
servicefile= filename + u'.ood'
|
servicefile= filename + u'.ood'
|
||||||
zip = zipfile.ZipFile(unicode(filename) + u'.oos', 'w')
|
zip = zipfile.ZipFile(unicode(filename), 'w')
|
||||||
for item in self.serviceItems:
|
for item in self.serviceItems:
|
||||||
service.append({u'serviceitem':item[u'data'].get_oos_repr()})
|
service.append({u'serviceitem':item[u'data'].get_oos_repr()})
|
||||||
if item[u'data'].service_item_type == ServiceType.Image or \
|
if item[u'data'].service_item_type == ServiceType.Image or \
|
||||||
@ -393,7 +402,12 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
os.remove(servicefile)
|
os.remove(servicefile)
|
||||||
except:
|
except:
|
||||||
pass #if not present do not worry
|
pass #if not present do not worry
|
||||||
self.parent.OosChanged(True, filename + u'.oos')
|
name = filename.split(os.path.sep)
|
||||||
|
self.serviceName = name[-1]
|
||||||
|
self.parent.OosChanged(True, self.serviceName)
|
||||||
|
|
||||||
|
def onQuickSaveService(self):
|
||||||
|
self.onSaveService(True)
|
||||||
|
|
||||||
def onLoadService(self):
|
def onLoadService(self):
|
||||||
"""
|
"""
|
||||||
@ -412,6 +426,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
zip = zipfile.ZipFile(unicode(filename))
|
zip = zipfile.ZipFile(unicode(filename))
|
||||||
filexml = None
|
filexml = None
|
||||||
themename = None
|
themename = None
|
||||||
|
|
||||||
for file in zip.namelist():
|
for file in zip.namelist():
|
||||||
names = file.split(os.path.sep)
|
names = file.split(os.path.sep)
|
||||||
file_to = os.path.join(self.servicePath,
|
file_to = os.path.join(self.servicePath,
|
||||||
@ -439,6 +454,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
except:
|
except:
|
||||||
log.exception(u'Problem loading a service file')
|
log.exception(u'Problem loading a service file')
|
||||||
pass
|
pass
|
||||||
|
self.isNew = False
|
||||||
self.serviceName = name[len(name) - 1]
|
self.serviceName = name[len(name) - 1]
|
||||||
self.parent.OosChanged(True, self.serviceName)
|
self.parent.OosChanged(True, self.serviceName)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user