from lnx.logicnode.lnx_nodes import * class LeenkxEventNode(LnxLogicTreeNode): """Leenkx Event""" bl_idname = 'LNLeenkxEventNode' bl_label = 'Leenkx Event' bl_description = 'Trigger an event from the network passing both data and ID' lnx_category = 'Leenkx' lnx_version = 1 property1: HaxeEnumProperty('property1', items = [('onopen', 'OnOpen', 'The connection to the server is open'), ('onmessage', 'OnMessage', 'A message arrived; ID is the sender peer id, Data the payload'), ('onerror', 'OnError', 'A connection error occurred'), ('onclose', 'OnClose', 'The connection was closed'), ('onseen', 'OnSeen', 'A peer was discovered; ID is the peer id'), ('onserver', 'OnServer', 'The signaling server responded'), ('onconnections', 'OnConnections', 'The server sent the peer list; Data is the connection list'), ('onping', 'OnPing', 'Heartbeat ping roundtrip completed'), ('onleft', 'OnLeft', 'A peer left; ID is the peer id'), ('ontimeout', 'OnTimeout', 'A handshake timed out'), ('onwireleft', 'OnWireLeft', 'A BitTorrent wire peer disconnected; ID is the peer id'), ('onwireseen', 'OnWireSeen', 'A BitTorrent wire peer connected; ID is the peer id'), ('ontorrent', 'OnTorrent', 'Torrent activity on the connection; Data is the torrent'), ('ontorrentadded', 'OnTorrentAdded', 'A torrent registered on the connection; Data is the Torrent handle'), ('ontracker', 'OnTracker', 'A tracker event on the connection'), ('onannounce', 'OnAnnounce', 'A tracker announce completed'), ('ontorrentdone', 'OnTorrentDone', 'A torrent finished downloading; Data is the torrent'), ('onload', 'OnLoad', 'The connection was registered; fires once at startup')], name='', default='onopen') def __init__(self, *args, **kwargs): super(LeenkxEventNode, self).__init__(*args, **kwargs) array_nodes[str(id(self))] = self def lnx_init(self, context): #self.add_input('LnxNodeSocketAction', 'In') self.add_input('LnxStringSocket', 'Channel', default_value='8001') self.add_output('LnxNodeSocketAction', 'Out') self.add_output('LnxDynamicSocket', 'ID') self.add_output('LnxDynamicSocket', 'Data') def draw_buttons(self, context, layout): layout.prop(self, 'property1') def register(): add_category('Leenkx', icon='ORIENTATION_CURSOR') LeenkxEventNode.on_register()