Changeset 3357

Show
Ignore:
Timestamp:
05/14/08 22:58:29 (2 months ago)
Author:
aaronr
Message:

Swapping in calls to markAsClean and isDirty for interacting with xml model dirty bit

Location:
trunk/opus_gui
Files:
2 modified

Legend:

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

    r3351 r3357  
    273273            self.parentObj.setWindowTitle(wintitle) 
    274274        self.dirty = True 
     275 
     276    def markAsClean(self): 
     277        if self.dirty == True: 
     278            wintitle = self.parentObj.windowTitle().replace("*", "") 
     279            self.parentObj.setWindowTitle(wintitle) 
     280        self.dirty = False 
    275281         
    276  
     282    def isDirty(self): 
     283        return self.dirty 
     284     
    277285    def setData(self,index,value,role): 
    278286        if not index.isValid(): 
  • trunk/opus_gui/main/opusgui.py

    r3351 r3357  
    216216            opusXMLTree.update(str(domDocument.toString(indentSize))) 
    217217            opusXMLTree.save() 
    218             self.toolboxStuff.runManagerTree.model.dirty = False 
    219             self.setWindowTitle(self.windowTitle().replace("*", "")) 
    220             self.toolboxStuff.dataManagerTree.model.dirty = False 
    221             self.setWindowTitle(self.windowTitle().replace("*", "")) 
    222             self.toolboxStuff.dataManagerDBSTree.model.dirty = False 
    223             self.setWindowTitle(self.windowTitle().replace("*", "")) 
    224             self.toolboxStuff.modelManagerTree.model.dirty = False 
    225             self.setWindowTitle(self.windowTitle().replace("*", "")) 
    226             self.toolboxStuff.resultsManagerTree.model.dirty = False 
    227             self.setWindowTitle(self.windowTitle().replace("*", "")) 
     218            self.toolboxStuff.runManagerTree.model.markAsClean() 
     219            self.toolboxStuff.dataManagerTree.model.markAsClean() 
     220            self.toolboxStuff.dataManagerDBSTree.model.markAsClean() 
     221            self.toolboxStuff.modelManagerTree.model.markAsClean() 
     222            self.toolboxStuff.resultsManagerTree.model.markAsClean() 
    228223        except: 
    229224            print "Unexpected error:", sys.exc_info()[0] 
     
    248243            opusXMLTree.update(str(domDocument.toString(indentSize))) 
    249244            opusXMLTree.save_as(str(fileName)) 
    250             self.toolboxStuff.runManagerTree.model.dirty = False 
    251             self.setWindowTitle(self.windowTitle().replace("*", "")) 
    252             self.toolboxStuff.dataManagerTree.model.dirty = False 
    253             self.setWindowTitle(self.windowTitle().replace("*", "")) 
    254             self.toolboxStuff.dataManagerDBSTree.model.dirty = False 
    255             self.setWindowTitle(self.windowTitle().replace("*", "")) 
    256             self.toolboxStuff.modelManagerTree.model.dirty = False 
    257             self.setWindowTitle(self.windowTitle().replace("*", "")) 
    258             self.toolboxStuff.resultsManagerTree.model.dirty = False 
    259             self.setWindowTitle(self.windowTitle().replace("*", "")) 
     245            self.toolboxStuff.runManagerTree.model.markAsClean() 
     246            self.toolboxStuff.dataManagerTree.model.markAsClean() 
     247            self.toolboxStuff.dataManagerDBSTree.model.markAsClean() 
     248            self.toolboxStuff.modelManagerTree.model.markAsClean() 
     249            self.toolboxStuff.resultsManagerTree.model.markAsClean() 
    260250        except: 
    261251            print "Unexpected error:", sys.exc_info()[0] 
     
    267257        """ 
    268258        saveBeforeOpen = QMessageBox.Discard 
    269         if self.toolboxStuff.resultsManagerTree and self.toolboxStuff.resultsManagerTree.model.dirty: 
     259        if self.toolboxStuff.resultsManagerTree and self.toolboxStuff.resultsManagerTree.model.isDirty(): 
    270260            saveBeforeOpen = QMessageBox.question(self,"Warning", 
    271261                                            "Current project contains changes... \nShould we save or discard those changes?", 
    272262                                            QMessageBox.Discard,QMessageBox.Save) 
    273         elif self.toolboxStuff.modelManagerTree and self.toolboxStuff.modelManagerTree.model.dirty: 
     263        elif self.toolboxStuff.modelManagerTree and self.toolboxStuff.modelManagerTree.model.isDirty(): 
    274264            saveBeforeOpen = QMessageBox.question(self,"Warning", 
    275265                                            "Current project contains changes... \nShould we save or discard those changes?", 
    276266                                            QMessageBox.Discard,QMessageBox.Save) 
    277         elif self.toolboxStuff.runManagerTree and self.toolboxStuff.runManagerTree.model.dirty: 
     267        elif self.toolboxStuff.runManagerTree and self.toolboxStuff.runManagerTree.model.isDirty(): 
    278268            saveBeforeOpen = QMessageBox.question(self,"Warning", 
    279269                                            "Current project contains changes... \nShould we save or discard those changes?", 
    280270                                            QMessageBox.Discard,QMessageBox.Save) 
    281         elif self.toolboxStuff.dataManagerTree and self.toolboxStuff.dataManagerTree.model.dirty: 
     271        elif self.toolboxStuff.dataManagerTree and self.toolboxStuff.dataManagerTree.model.isDirty(): 
    282272            saveBeforeOpen = QMessageBox.question(self,"Warning", 
    283273                                            "Current project contains changes... \nShould we save or discard those changes?", 
     
    289279            #if we have an existing tree we need to remove the dirty bit since we are discarding 
    290280            if self.toolboxStuff.runManagerTree: 
    291                 self.toolboxStuff.runManagerTree.model.dirty = False 
     281                self.toolboxStuff.runManagerTree.model.markAsClean() 
    292282            if self.toolboxStuff.dataManagerTree: 
    293                 self.toolboxStuff.dataManagerTree.model.dirty = False 
     283                self.toolboxStuff.dataManagerTree.model.markAsClean() 
    294284            if self.toolboxStuff.modelManagerTree: 
    295                 self.toolboxStuff.modelManagerTree.model.dirty = False 
     285                self.toolboxStuff.modelManagerTree.model.markAsClean() 
    296286            if self.toolboxStuff.resultsManagerTree: 
    297                 self.toolboxStuff.resultsManagerTree.model.dirty = False 
     287                self.toolboxStuff.resultsManagerTree.model.markAsClean() 
    298288 
    299289    def closeConfig(self):