first get the xml doc, then pass it to DomModel. Not the other way around
authorGiovanni Gherdovich <ggherdov@brentaal.inria.fr>
Tue, 19 Oct 2010 14:50:10 +0000 (16:50 +0200)
committerGiovanni Gherdovich <ggherdov@brentaal.inria.fr>
Tue, 19 Oct 2010 14:50:10 +0000 (16:50 +0200)
sface/rspecwindow.py
sface/xmlwidget.py

index d407114..b6b8f0a 100644 (file)
@@ -72,13 +72,18 @@ class RSpecWindow(QDialog):
         self.model = None
 
         self.document = QDomDocument(self.title)
-        self.model = DomModel(self.document, self)
-
-        self.view.setModel(self.model)
-        self.view.expand(self.model.index(0, 0)) #expand first level only
 
         rspec_file = config.getSliceRSpecFile()
         if not os.path.exists(rspec_file):
             return
 
         self.document.setContent(open(rspec_file,'r').read())
+        # DomModel.__init__ is gonna purge the doc
+        # from the "xml bla bla bla" node.
+        # so the arg 'document' needs to be not None
+        # for this to happen
+        self.model = DomModel(self.document, self)
+
+        self.view.setModel(self.model)
+        self.view.expand(self.model.index(0, 0)) #expand first level only
+
index 2aa7238..b24de60 100644 (file)
@@ -32,6 +32,7 @@ class DomModel(QAbstractItemModel):
             currElem = childList.item(i)
             if (currElem.nodeType() == QDomNode.ProcessingInstructionNode):
                 document.removeChild(currElem)
+                print "REMOVED!"
                 break
         self.rootItem = DomItem(document, 0);