Changeset 3350

Show
Ignore:
Timestamp:
05/14/08 20:55:08 (2 months ago)
Author:
aaronr
Message:

Clean up to get the xml data model to use markAsDirty on all items that change the model. Should be good for cleaning up other areas of the code

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/opus_gui/config/xmlmodelview/opusdatamodel.py

    r3324 r3350  
    289289                if not domElement.isNull(): 
    290290                    domElement.setTagName(value.toString()) 
    291                     if self.dirty == False: 
    292                         wintitle = self.parentObj.windowTitle().replace(" - ", " - *") 
    293                         self.parentObj.setWindowTitle(wintitle) 
    294                     self.dirty = True 
     291                    self.markAsDirty() 
    295292        elif index.column() == 1: 
    296293            if domNode.hasChildNodes(): 
     
    299296                    if children.item(x).isText(): 
    300297                        children.item(x).setNodeValue(QString(value.toString())) 
    301                         if self.dirty == False: 
    302                             wintitle = self.parentObj.windowTitle().replace(" - ", " - *") 
    303                             self.parentObj.setWindowTitle(wintitle)                          
    304                         self.dirty = True 
     298                        self.markAsDirty() 
    305299            else: 
    306300                #print "New text node to be added" 
     
    308302                newText = self.domDocument.createTextNode(QString(value.toString())) 
    309303                domNode.appendChild(newText) 
    310                 if self.dirty == False: 
    311                     wintitle = self.parentObj.windowTitle().replace(" - ", " - *") 
    312                     self.parentObj.setWindowTitle(wintitle) 
    313                 self.dirty = True 
     304                self.markAsDirty() 
    314305        return True 
    315306 
     
    334325        self.endInsertRows() 
    335326        #print "debug" 
     327        self.markAsDirty() 
    336328        return returnval 
    337329 
     
    347339        parentItem.childItems.pop(row) 
    348340        self.endRemoveRows() 
     341        self.markAsDirty() 
    349342        return returnval 
    350343 
     
    359352                self.removeRow(currentRow,currentParent) 
    360353                self.insertRow(currentRow-howmany,currentParent,clone) 
     354                self.markAsDirty() 
    361355 
    362356    def moveDown(self,item,howmany=1): 
     
    374368                self.removeRow(currentRow,currentParent) 
    375369                self.insertRow(currentRow+howmany,currentParent,clone) 
     370                self.markAsDirty() 
    376371 
    377372    def findElementIndexByName(self,name,parent,multiple=False): 
     
    451446        newNode.setAttribute(QString("type"),QString(type)) 
    452447        newText = document.createTextNode(QString(value)) 
    453         newNode.appendChild(newText) 
    454          
     448        newNode.appendChild(newText)         
    455449        if choices is not None: 
    456450            newNode.setAttribute(QString('choices'), QString(choices)) 
     451        self.markAsDirty() 
    457452        return newNode 
    458453 
     
    463458                # remove the attribute 
    464459                parentElement.removeAttribute(QString(attribute)) 
     460                self.markAsDirty() 
    465461            rows = parent.childNodes().count() 
    466462            for x in xrange(0,rows,1): 
     
    472468                        # remove the attribute 
    473469                        childElement.removeAttribute(QString(attribute)) 
     470                        self.markAsDirty() 
    474471                    # If this child has other children then we recurse 
    475472                    childRows = child.childNodes().count() 
     
    484481                # remove the attribute 
    485482                parentElement.removeAttribute(QString(attribute)) 
     483                self.markAsDirty() 
    486484            grandParent = parent.parentNode() 
    487485            if not grandParent.isNull():