def save(self, filename, additionalFileDictionary=None):
        if not filename:
            return

        # Create a nested meta dict for saving node locations
        nodeMetaDict = self.graphicsScene.nodeMetaDict()

        # Create a nested meta dict for saving connection offsets
        connectionMetaDict = self.graphicsScene.connectionMetaDict()

        # Store all but read-only variables to the state
        varDicts = depends_variables.changeableList()

        # TODO: A generic way to pass additional dicts into the snapshot function might be good.
        #       The parameter list is getting long and specific!  (also, variableList->variableDict)
        #       Or maybe we should just merge it all right here?
        # Concoct a full snapshot from the current DAG and additional information fed into the function
        snapshot = self.dag.snapshot(nodeMetaDict=nodeMetaDict, connectionMetaDict=connectionMetaDict, variableMetaList=varDicts)
        fullSnap = {"DAG":snapshot}
        if additionalFileDictionary:
            fullSnap = dict({"DAG":snapshot}.items() + additionalFileDictionary.items())

        # Serialize to disk
        fp = open(filename, 'wb')
        fp.write(json.dumps(fullSnap, sort_keys=True, indent=4))
        fp.close()
        
        # UI tidies
        self.undoStack.setClean()
        self.workingFilename = filename
        self.setWindowTitle("Depends (%s)" % self.workingFilename)
Functionality for writing snapshots of the software's running state
dataset/ETHPy150Open andrew-gardner/dependsworkflow/depends/depends_main_window.py/MainWindow.save