コード例 #1
0
ファイル: shortcuts.py プロジェクト: cagemonkey/GunGame
def get_addon_type(name):
    '''
    Returns a string value of the addon type:
        "custom"
        "included"
    '''

    # Return the type of addon
    return ValidAddons.get_addon_type(str(name).lower())
コード例 #2
0
ファイル: instance.py プロジェクト: cagemonkey/GunGame
    def __init__(self, addon):
        """Called when the addon is first imported"""

        # Store the addon's name
        self.basename = addon

        # Get the type of addon (included or custom)
        self.addon_type = ValidAddons.get_addon_type(self.basename)

        # Store the __module__ path for the addon
        self.module = "gungame51.scripts.%s.%s.%s" % (self.addon_type, self.basename, self.basename)

        # Get the imported instance of the addon
        instance = __import__(self.module, globals(), locals(), [""])

        # Reload the instance to make sure all data is correct
        reload(instance)

        # Store the Globals for the instance
        self.globals = instance.__dict__

        # Store the AddonInfo instance of the addon
        self.info = self._get_addon_info()
コード例 #3
0
    def __init__(self, addon):
        '''Called when the addon is first imported'''

        # Store the addon's name
        self.basename = addon

        # Get the type of addon (included or custom)
        self.addon_type = ValidAddons.get_addon_type(self.basename)

        # Store the __module__ path for the addon
        self.module = 'gungame51.scripts.%s.%s.%s' % (
            self.addon_type, self.basename, self.basename)

        # Get the imported instance of the addon
        instance = __import__(self.module, globals(), locals(), [''])

        # Reload the instance to make sure all data is correct
        reload(instance)

        # Store the Globals for the instance
        self.globals = instance.__dict__

        # Store the AddonInfo instance of the addon
        self.info = self._get_addon_info()