forked from openlp/openlp
Head
This commit is contained in:
commit
c667ed5cc9
@ -1009,11 +1009,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
if recentFilesToDisplay:
|
if recentFilesToDisplay:
|
||||||
self.FileMenu.addSeparator()
|
self.FileMenu.addSeparator()
|
||||||
for fileId, filename in enumerate(recentFilesToDisplay):
|
for fileId, filename in enumerate(recentFilesToDisplay):
|
||||||
action = QtGui.QAction(u'&%d %s' % (fileId +1,
|
log.debug('Recent file name: %s', filename)
|
||||||
|
action = QtGui.QAction(u'&%d %s' % (fileId + 1,
|
||||||
QtCore.QFileInfo(filename).fileName()), self)
|
QtCore.QFileInfo(filename).fileName()), self)
|
||||||
action.setData(QtCore.QVariant(filename))
|
action.setData(QtCore.QVariant(filename))
|
||||||
self.connect(action, QtCore.SIGNAL(u'triggered()'),
|
self.connect(action, QtCore.SIGNAL(u'triggered()'),
|
||||||
self.ServiceManagerContents.loadFile)
|
self.ServiceManagerContents.onRecentServiceClicked)
|
||||||
self.FileMenu.addAction(action)
|
self.FileMenu.addAction(action)
|
||||||
self.FileMenu.addSeparator()
|
self.FileMenu.addSeparator()
|
||||||
self.FileMenu.addAction(self.FileMenuActions[-1])
|
self.FileMenu.addAction(self.FileMenuActions[-1])
|
||||||
|
@ -347,10 +347,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
elif result == QtGui.QMessageBox.Save:
|
elif result == QtGui.QMessageBox.Save:
|
||||||
if not self.saveFile():
|
if not self.saveFile():
|
||||||
return False
|
return False
|
||||||
self.serviceManagerList.clear()
|
self.newFile()
|
||||||
self.serviceItems = []
|
|
||||||
self.setFileName(u'')
|
|
||||||
self.setModified(False)
|
|
||||||
|
|
||||||
def onLoadServiceClicked(self):
|
def onLoadServiceClicked(self):
|
||||||
if self.isModified():
|
if self.isModified():
|
||||||
@ -381,6 +378,19 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
def onSaveServiceAsClicked(self):
|
def onSaveServiceAsClicked(self):
|
||||||
self.saveFileAs()
|
self.saveFileAs()
|
||||||
|
|
||||||
|
def onRecentServiceClicked(self):
|
||||||
|
sender = self.sender()
|
||||||
|
self.loadFile(sender.data().toString())
|
||||||
|
|
||||||
|
def newFile(self):
|
||||||
|
"""
|
||||||
|
Create a blank new service file.
|
||||||
|
"""
|
||||||
|
self.serviceManagerList.clear()
|
||||||
|
self.serviceItems = []
|
||||||
|
self.setFileName(u'')
|
||||||
|
self.setModified(False)
|
||||||
|
|
||||||
def saveFile(self):
|
def saveFile(self):
|
||||||
"""
|
"""
|
||||||
Save the current Service file.
|
Save the current Service file.
|
||||||
@ -457,6 +467,8 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
def loadFile(self, fileName):
|
def loadFile(self, fileName):
|
||||||
if not fileName:
|
if not fileName:
|
||||||
return False
|
return False
|
||||||
|
else:
|
||||||
|
fileName = unicode(fileName)
|
||||||
zip = None
|
zip = None
|
||||||
fileTo = None
|
fileTo = None
|
||||||
try:
|
try:
|
||||||
@ -475,18 +487,18 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
continue
|
continue
|
||||||
osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
|
osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
|
||||||
filePath = os.path.join(self.servicePath,
|
filePath = os.path.join(self.servicePath,
|
||||||
split_filename(osfile)[1])
|
os.path.split(osfile)[1])
|
||||||
fileTo = open(filePath, u'wb')
|
fileTo = open(filePath, u'wb')
|
||||||
fileTo.write(zip.read(file))
|
fileTo.write(zip.read(file))
|
||||||
fileTo.flush()
|
fileTo.flush()
|
||||||
fileTo.close()
|
fileTo.close()
|
||||||
if file_path.endswith(u'osd'):
|
if filePath.endswith(u'osd'):
|
||||||
p_file = file_path
|
p_file = filePath
|
||||||
if 'p_file' in locals():
|
if 'p_file' in locals():
|
||||||
fileTo = open(p_file, u'r')
|
fileTo = open(p_file, u'r')
|
||||||
items = cPickle.load(fileTo)
|
items = cPickle.load(fileTo)
|
||||||
fileTo.close()
|
fileTo.close()
|
||||||
self.onNewService()
|
self.newFile()
|
||||||
for item in items:
|
for item in items:
|
||||||
serviceItem = ServiceItem()
|
serviceItem = ServiceItem()
|
||||||
serviceItem.render_manager = self.parent.renderManager
|
serviceItem.render_manager = self.parent.renderManager
|
||||||
|
Loading…
Reference in New Issue
Block a user