forked from LeenkxTeam/LNXSDK
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
from lnx.logicnode.lnx_nodes import *
|
|
|
|
|
|
class WebviewLoadNode(LnxLogicTreeNode):
|
|
"""Loads HTML content or a URL into the given WebView"""
|
|
bl_idname = 'LNWebviewLoadNode'
|
|
bl_label = 'Webview Load'
|
|
lnx_category = 'Krom Runtime'
|
|
lnx_section = 'webview'
|
|
lnx_version = 1
|
|
|
|
def update_sockets(self, context):
|
|
for i in self.inputs:
|
|
self.inputs.remove(i)
|
|
self.add_input('LnxNodeSocketAction', 'In')
|
|
self.add_input('LnxIntSocket', 'ID')
|
|
if self.property0 == 'html':
|
|
self.add_input('LnxStringSocket', 'HTML')
|
|
else:
|
|
self.add_input('LnxStringSocket', 'URL')
|
|
self.add_output('LnxNodeSocketAction', 'Out')
|
|
|
|
property0: HaxeEnumProperty(
|
|
'property0',
|
|
items=[('html', 'HTML', 'Load HTML content'),
|
|
('url', 'URL', 'Load a URL')],
|
|
name='Load Type', default='url', update=update_sockets)
|
|
|
|
def lnx_init(self, context):
|
|
self.add_input('LnxNodeSocketAction', 'In')
|
|
self.add_input('LnxIntSocket', 'ID')
|
|
self.add_input('LnxStringSocket', 'URL')
|
|
|
|
self.add_output('LnxNodeSocketAction', 'Out')
|
|
|
|
def draw_buttons(self, context, layout):
|
|
layout.prop(self, 'property0')
|