Beispiel #1
0
	async def destroy(self):
		"""
		Destroy the Manialink with it's handlers and references.
		Will also hide the Manialink for all users!
		"""
		try:
			SignalManager.get_signal('maniaplanet:manialink_answer').unregister(self.handle)
		except Exception as e:
			logging.exception(e)
		try:
			await self.manager.destroy(self)
		except:
			pass
		self.receivers = dict()
		self.data = None
		self.player_data = None
Beispiel #2
0
	def destroy_sync(self):
		"""
		Destroy the Manialink with it's handlers and references.
		Will also hide the Manialink for all users!
		
		This method is sync and will call a async method (destroying of the manialink at our players) async but will not
		be executed at the same time. Be aware with this one!
		"""
		try:
			SignalManager.get_signal('maniaplanet:manialink_answer').unregister(self.handle)
			asyncio.ensure_future(self.manager.destroy(self))
		except Exception as e:
			logging.exception(e)
		self.receivers = dict()
		self.data = None
		self.player_data = None
Beispiel #3
0
	async def display(self, player_logins=None, **kwargs):
		"""
		Display the manialink. Will also render if no body is given. Will show per player or global. depending on 
		the data given and stored!
		
		:param player_logins: Only display to the list of player logins given.
		"""
		if player_logins:
			for login in player_logins:
				self._is_player_shown[login] = True
		else:
			self._is_global_shown = True

		if not self.__register_listener:
			# Register handle
			SignalManager.listen('maniaplanet:manialink_answer', self.handle)
			self.__register_listener = True

		return await self.manager.send(self, player_logins, **kwargs)
Beispiel #4
0
    def __init__(self, call, namespace, code, target=None):
        """
		Shortcut for registering two signals, one is the raw signal and the second one is the parsed and structured
		output signal. This also glues the two together.

		:param call:
		:param namespace:
		:param code:
		:param target:
		"""
        # Initiate destination signal (ourself).
        super().__init__(code=code, namespace=namespace, process_target=target)

        # Initiate raw signal, the raw gbx/script callback.
        self.raw_signal = Signal(code=call, namespace='raw')
        self.raw_signal.register(self.glue, weak=False)

        SignalManager.register_signal(self.raw_signal, app=None, callback=True)
        SignalManager.register_signal(self, app=None)