How to use the pytmx.mason.UnsupportedFeature function in PyTMX

To help you get started, we’ve selected a few PyTMX examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitcraft / PyTMX / pytmx / mason.py View on Github external
This method will attempt to call another method of this
        call named "add_ + tag".

        For example, if the tag is "image", this method will attempt to
        call Token.add_image().  An exception is raised if the method is not
        available.

        :param child:
        :param tag:
        :return:
        """
        try:
            func = getattr(self, 'add_' + tag)
        except AttributeError:
            raise UnsupportedFeature(self.__class__.__name__, tag)
        func(child)
github bitcraft / PyTMX / pytmx / mason.py View on Github external
def get_loader(path):
    name, ext = os.path.splitext(path.lower())
    try:
        func = globals()['load_' + ext[1:]]
        return func(path)
    except KeyError:
        raise UnsupportedFeature(ext)
github bitcraft / PyTMX / pytmx / mason.py View on Github external
self.firstgid = int(content.get('firstgid'))

            # we need to mangle the path - tiled stores relative paths
            dirname = os.path.dirname(self.parent.filename)
            path = os.path.abspath(os.path.join(dirname, source))
            try:
                content = ElementTree.parse(path).getroot()
            except IOError:
                msg = 'Cannot load external tileset: {0}'
                logger.error(msg.format(path))
                raise Exception

        else:
            msg = 'Found external tileset, but cannot handle type: {0}'
            logger.error(msg.format(self.source))
            raise UnsupportedFeature(self.source)
github bitcraft / PyTMX / pytmx / mason.py View on Github external
def add_group(self, item):
        raise UnsupportedFeature
github bitcraft / PyTMX / pytmx / mason.py View on Github external
def get_processor(feature):
    try:
        return globals()[feature + 'Token']()
    except KeyError:
        raise UnsupportedFeature(feature)