Skip to content

Commit

Permalink
add version select
Browse files Browse the repository at this point in the history
  • Loading branch information
IzaZed committed Oct 12, 2023
1 parent 9c9d75f commit d5f8fdf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 10 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,14 @@ def execute(self, context):
return {"FINISHED"}


_uplogic_versions = [
('1.9.5', '1.9.5', 'Suitable for Logic Nodes 2.3 or lower')
]


class LogicNodesAddonPreferences(bpy.types.AddonPreferences):
bl_idname = __name__
uplogic_version: bpy.props.EnumProperty(items=_uplogic_versions)

def draw(self, context):
layout = self.layout
Expand All @@ -528,6 +534,7 @@ def draw(self, context):
)
row = col.row(align=True)
row.operator('bge_netlogic.install_uplogic_module', icon='IMPORT')
row.prop(self, 'uplogic_version', text='')
# col.operator('bge_netlogic.install_fake_bge_module', icon='IMPORT')
main_row = layout.row()
col = layout.column()
Expand Down Expand Up @@ -679,8 +686,9 @@ def _get_key_for_class(c):

def update_uplogic_module():
try:
prefs = bpy.context.preferences.addons['bge_netlogic'].preferences
os.system(f'"{sys.executable}" -m ensurepip')
os.system(f'"{sys.executable}" -m pip install uplogic --upgrade')
os.system(f'"{sys.executable}" -m pip install uplogic=={prefs.uplogic_version}')
global UPLOGIC_INSTALLED
UPLOGIC_INSTALLED = True
except Exception:
Expand All @@ -690,7 +698,7 @@ def update_uplogic_module():
def get_uplogic_module():
try:
os.system(f'"{sys.executable}" -m ensurepip')
os.system(f'"{sys.executable}" -m pip install uplogic')
os.system(f'"{sys.executable}" -m pip install uplogic==1.9.5')
global UPLOGIC_INSTALLED
UPLOGIC_INSTALLED = True
except Exception:
Expand Down
3 changes: 2 additions & 1 deletion ops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ class NLInstallUplogicModuleOperator(bpy.types.Operator):
def execute(self, context):
utils.notify('Installing uplogic module...')
try:
prefs = bpy.context.preferences.addons['bge_netlogic'].preferences
os.system(f'"{sys.executable}" -m ensurepip')
os.system(f'"{sys.executable}" -m pip install uplogic --upgrade')
os.system(f'"{sys.executable}" -m pip install uplogic=={prefs.uplogic_version}')
bge_netlogic.UPLOGIC_INSTALLED = True
utils.success('Installed.')
except Exception as e:
Expand Down

0 comments on commit d5f8fdf

Please sign in to comment.