← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/broken-trunk into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/broken-trunk into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/broken-trunk/+merge/44974

Fix some bugs I accidentally introduced into trunk.
-- 
https://code.launchpad.net/~raoul-snyman/openlp/broken-trunk/+merge/44974
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2010-12-31 21:45:12 +0000
+++ openlp/core/ui/mainwindow.py	2011-01-01 12:31:58 +0000
@@ -1007,11 +1007,12 @@
         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])

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2010-12-31 21:43:02 +0000
+++ openlp/core/ui/servicemanager.py	2011-01-01 12:31:58 +0000
@@ -347,10 +347,7 @@
             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 @@
     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 @@
     def loadFile(self, fileName):
         if not fileName:
             return False
+        else:
+            fileName = unicode(fileName)
         zip = None
         fileTo = None
         try:
@@ -475,18 +487,18 @@
                     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


Follow ups