
import luna.plugins #To get the configuration data type to extend from.

class Preferences:
	"""
	Offers a system to create global application preferences.
	"""

	def prepare(self):
		"""
		Finalizes the class initialisation using data that is only available at
		run time.
		"""
		original_class = self.__class__
		parent_class = luna.plugins.api("configuration").Configuration
		self.__class__ = original_class.__class__(original_class.__name__ + "Configuration", (original_class, parent_class), {}) #Add the configuration class mixin.
		super().__init__() #Execute the Configuration class' initialisation method to create the data structures.

import luna.listen #To prepare the preferences for use when plug-ins are loaded.
import luna.plugins #To get the configuration data type to extend from.

class Preferences:
	"""
	Offers a system to create global application preferences.
	"""

	def __init__(self):
		luna.listen.listen(self.check_prepare, luna.plugins, "state")

	def check_prepare(self, _, new_state):
		if new_state == luna.plugins.PluginsState.LOADED:
			self.prepare()

	def prepare(self):
		"""
		Finalizes the class initialisation using data that is only available at
		run time.
		"""
		original_class = self.__class__
		parent_class = luna.plugins.api("configuration").Configuration
		self.__class__ = original_class.__class__(original_class.__name__ + "Configuration", (original_class, parent_class), {}) #Add the configuration class mixin.
		super().__init__() #Execute the Configuration class' initialisation method to create the data structures.
Prepare once plug-ins are loaded
Prepare once plug-ins are loaded

With the new version of the listen hook.

  
+ import luna.listen #To prepare the preferences for use when plug-ins are loaded.
  import luna.plugins #To get the configuration data type to extend from.
  
  class Preferences:
  	"""
  	Offers a system to create global application preferences.
  	"""
+ 
+ 	def __init__(self):
+ 		luna.listen.listen(self.check_prepare, luna.plugins, "state")
+ 
+ 	def check_prepare(self, _, new_state):
+ 		if new_state == luna.plugins.PluginsState.LOADED:
+ 			self.prepare()
  
  	def prepare(self):
  		"""
  		Finalizes the class initialisation using data that is only available at
  		run time.
  		"""
  		original_class = self.__class__
  		parent_class = luna.plugins.api("configuration").Configuration
  		self.__class__ = original_class.__class__(original_class.__name__ + "Configuration", (original_class, parent_class), {}) #Add the configuration class mixin.
  		super().__init__() #Execute the Configuration class' initialisation method to create the data structures.
Prepare once plug-ins are loaded
## Code Before:

import luna.plugins #To get the configuration data type to extend from.

class Preferences:
	"""
	Offers a system to create global application preferences.
	"""

	def prepare(self):
		"""
		Finalizes the class initialisation using data that is only available at
		run time.
		"""
		original_class = self.__class__
		parent_class = luna.plugins.api("configuration").Configuration
		self.__class__ = original_class.__class__(original_class.__name__ + "Configuration", (original_class, parent_class), {}) #Add the configuration class mixin.
		super().__init__() #Execute the Configuration class' initialisation method to create the data structures.
## Instruction:
Prepare once plug-ins are loaded
## Code After:

import luna.listen #To prepare the preferences for use when plug-ins are loaded.
import luna.plugins #To get the configuration data type to extend from.

class Preferences:
	"""
	Offers a system to create global application preferences.
	"""

	def __init__(self):
		luna.listen.listen(self.check_prepare, luna.plugins, "state")

	def check_prepare(self, _, new_state):
		if new_state == luna.plugins.PluginsState.LOADED:
			self.prepare()

	def prepare(self):
		"""
		Finalizes the class initialisation using data that is only available at
		run time.
		"""
		original_class = self.__class__
		parent_class = luna.plugins.api("configuration").Configuration
		self.__class__ = original_class.__class__(original_class.__name__ + "Configuration", (original_class, parent_class), {}) #Add the configuration class mixin.
		super().__init__() #Execute the Configuration class' initialisation method to create the data structures.