E5XML/SessionReader.py

changeset 6052
8b49d3e0b4c8
parent 6048
82ad8ec9548c
child 6352
4bdc6503df81
--- a/E5XML/SessionReader.py	Sun Dec 31 18:54:06 2017 +0100
+++ b/E5XML/SessionReader.py	Mon Jan 01 19:06:33 2018 +0100
@@ -19,14 +19,16 @@
     """
     Class for reading an XML session file.
     """
-    supportedVersions = ["4.3", "4.4", "5.0", "6.0"]
+    supportedVersions = ["4.3", "4.4", "5.0", "6.0", "6.1"]
     
     def __init__(self, device, isGlobal):
         """
         Constructor
         
-        @param device reference to the I/O device to read from (QIODevice)
-        @param isGlobal flag indicating to read the global session (boolean).
+        @param device reference to the I/O device to read from
+        @type QIODevice
+        @param isGlobal flag indicating to read the global session
+        @type bool
         """
         XMLStreamReaderBase.__init__(self, device)
         
@@ -56,7 +58,8 @@
         Public method to read and parse the XML document.
         
         @param quiet flag indicating quiet operations.
-                If this flag is true, no errors are reported.
+            If this flag is true, no errors are reported.
+        @type bool
         """
         while not self.atEnd():
             self.readNext()
@@ -92,6 +95,11 @@
                     self.__readBookmarks()
                 elif self.name() == "ProjectBrowserStates":
                     self.__readProjectBrowserStates()
+                elif self.name() == "ViewManagerSplits":
+                    splitCount = int(self.attribute("count", "0"))
+                    orientation = int(self.attribute("orientation", "1"))
+                    self.vm.setSplitOrientation(orientation)
+                    self.vm.setSplitCount(splitCount)
                 else:
                     self.raiseUnexpectedStartTag(self.name())
         
@@ -102,6 +110,7 @@
         """
         Private method to read the file name infos.
         """
+        editorDict = {}
         while not self.atEnd():
             self.readNext()
             if self.isEndElement() and self.name() == "Filenames":
@@ -117,10 +126,20 @@
                     else:
                         folds = []
                     zoom = int(self.attribute("zoom", "-9999"))
+                    cloned = bool(int(self.attribute("cloned", "0")))
+                    splitIndex = int(self.attribute("splitindex", "0"))
+                    editorIndex = int(self.attribute("editorindex", "-1"))
                     filename = self.readElementText()
                     
-                    self.vm.openFiles(filename)
-                    ed = self.vm.getOpenEditor(filename)
+                    if cloned and filename in editorDict:
+                        editor = editorDict[filename]
+                        ed = self.vm.newEditorView(
+                            filename, editor, editor.getFileType(),
+                            indexes=(splitIndex, editorIndex))
+                    else:
+                        ed = self.vm.openSourceFile(
+                            filename, indexes=(splitIndex, editorIndex))
+                        editorDict[filename] = ed
                     if ed is not None:
                         if zoom > -9999:
                             ed.zoomTo(zoom)
@@ -366,7 +385,8 @@
         """
         Private method to read the project browser state info.
         
-        @param browserName name of the project browser (string)
+        @param browserName name of the project browser
+        @type str
         """
         expandedNames = []
         

eric ide

mercurial