forked from LeenkxTeam/LNXSDK
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
|
from lnx.logicnode.lnx_nodes import *
|
||
|
|
||
|
|
||
|
class DatabaseConnectNode(LnxLogicTreeNode):
|
||
|
"""Database Connect"""
|
||
|
bl_idname = 'LNDatabaseConnectNode'
|
||
|
bl_label = 'Database Connect'
|
||
|
bl_description = 'DatabaseConnect'
|
||
|
lnx_category = 'Database'
|
||
|
lnx_version = 1
|
||
|
|
||
|
|
||
|
property0: HaxeEnumProperty(
|
||
|
'property0',
|
||
|
items = [('mysql', 'MySQL', 'Connect to a MySQL Database'),
|
||
|
('sqlite', 'SQLite', 'Connect to a SQLite Database'),
|
||
|
('redis', 'Redis', 'Connect to a Redis Database')],
|
||
|
name='',
|
||
|
default='mysql')
|
||
|
|
||
|
def lnx_init(self, context):
|
||
|
self.add_input('LnxNodeSocketAction', 'In')
|
||
|
self.add_input('LnxStringSocket', 'User')
|
||
|
self.add_input('LnxStringSocket', 'Password')
|
||
|
self.add_input('LnxStringSocket', 'Socket')
|
||
|
self.add_input('LnxStringSocket', 'Host')
|
||
|
self.add_input('LnxIntSocket', 'Port')
|
||
|
self.add_input('LnxStringSocket', 'Database')
|
||
|
|
||
|
self.add_output('LnxNodeSocketAction', 'Out')
|
||
|
self.add_output('LnxDynamicSocket', 'Connection')
|
||
|
|
||
|
|
||
|
def draw_buttons(self, context, layout):
|
||
|
layout.prop(self, 'property0')
|
||
|
|
||
|
|
||
|
def register():
|
||
|
add_category('Database', icon='MESH_CYLINDER')
|
||
|
DatabaseConnectNode.on_register()
|