forked from openlp/openlp
Fix some bugs I accidentally introduced into trunk.
bzr-revno: 1179
This commit is contained in:
commit
b88e72d6ce
@ -1007,11 +1007,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
if recentFilesToDisplay:
|
||||
self.FileMenu.addSeparator()
|
||||
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)
|
||||
action.setData(QtCore.QVariant(filename))
|
||||
self.connect(action, QtCore.SIGNAL(u'triggered()'),
|
||||
self.ServiceManagerContents.loadService)
|
||||
self.ServiceManagerContents.onRecentServiceClicked)
|
||||
self.FileMenu.addAction(action)
|
||||
self.FileMenu.addSeparator()
|
||||
self.FileMenu.addAction(self.FileMenuActions[-1])
|
||||
|
@ -347,10 +347,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
elif result == QtGui.QMessageBox.Save:
|
||||
if not self.saveFile():
|
||||
return False
|
||||
self.serviceManagerList.clear()
|
||||
self.serviceItems = []
|
||||
self.setFileName(u'')
|
||||
self.setModified(False)
|
||||
self.newFile()
|
||||
|
||||
def onLoadServiceClicked(self):
|
||||
if self.isModified():
|
||||
@ -381,6 +378,19 @@ class ServiceManager(QtGui.QWidget):
|
||||
def onSaveServiceAsClicked(self):
|
||||
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):
|
||||
"""
|
||||
Save the current Service file.
|
||||
@ -457,6 +467,8 @@ class ServiceManager(QtGui.QWidget):
|
||||
def loadFile(self, fileName):
|
||||
if not fileName:
|
||||
return False
|
||||
else:
|
||||
fileName = unicode(fileName)
|
||||
zip = None
|
||||
fileTo = None
|
||||
try:
|
||||
@ -475,18 +487,18 @@ class ServiceManager(QtGui.QWidget):
|
||||
continue
|
||||
osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
|
||||
filePath = os.path.join(self.servicePath,
|
||||
split_filename(osfile)[1])
|
||||
os.path.split(osfile)[1])
|
||||
fileTo = open(filePath, u'wb')
|
||||
fileTo.write(zip.read(file))
|
||||
fileTo.flush()
|
||||
fileTo.close()
|
||||
if file_path.endswith(u'osd'):
|
||||
p_file = file_path
|
||||
if filePath.endswith(u'osd'):
|
||||
p_file = filePath
|
||||
if 'p_file' in locals():
|
||||
fileTo = open(p_file, u'r')
|
||||
items = cPickle.load(fileTo)
|
||||
fileTo.close()
|
||||
self.onNewService()
|
||||
self.newFile()
|
||||
for item in items:
|
||||
serviceItem = ServiceItem()
|
||||
serviceItem.render_manager = self.parent.renderManager
|
||||
|
Loading…
Reference in New Issue
Block a user