def loadAtlasFromXml(self, node, filePath): try: atlas = self.atlases[filePath] drawable = atlas.drawable except KeyError: atlas = Atlas(self.factory) atlas.path = filePath atlas.connect("sprite-added", self.workzone._spriteAddedCb) atlas.connect("sprite-removed", self.workzone._spriteRemovedCb) atlas.loadSprites(node) atlas.connect("sprite-removed", self._atlasChangedCb) atlas.connect("sprite-added", self._atlasChangedCb) observer = AtlasLogObserver(self.workzone.app.action_log) observer.startObserving(atlas) self.atlases[filePath] = atlas try: drawable = self.factory.makeDrawableFromPath(filePath) self.logger.info("User opened an atlas : %s", filePath) except: drawable = self.factory.makeNewDrawable(node.attrib["width"], node.attrib["height"]) atlas.setDrawable(drawable) atlas.setXmlNode(node) self.currentAtlas = atlas try: atlas.selection.disconnect_by_function(self.photoshop._atlasSelectionChangedCb) except Exception: pass atlas.selection.connect("selected-changed", self.photoshop._atlasSelectionChangedCb) self.photoshop.displayImage(drawable.image) self._getOffsetsFromXml(node)