Skip to content

Commit

Permalink
Merge branch 'lower_required_python_version_3.6' into reinvent-hitl
Browse files Browse the repository at this point in the history
  • Loading branch information
ruokolt committed Dec 22, 2023
2 parents 63c06d0 + aa603fd commit aa4374c
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/vai_lab/utils/plugins/pluginCanvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,21 +505,14 @@ def optionsWindow(self):
self.opt_settings = {'__init__': ps.optional_settings[module][self.plugin[self.m].get()]}
# Tries to upload the settings from the actual library
try:
self.model = plugin(ini = True).model
meth_req, meth_opt = self.getArgs(self.model.__init__)
self.plugin_ini = plugin(ini = True)
meth_req, meth_opt = self.getArgs(self.plugin_ini.model.__init__)
if meth_req is not None:
self.req_settings['__init__'] = {**self.req_settings['__init__'], **meth_req}
if meth_opt is not None:
self.opt_settings['__init__'] = {**self.opt_settings['__init__'], **meth_opt}
# Find functions defined for the module
plugin_meth_list = [meth[0] for meth in getmembers(plugin, isfunction) if meth[0][0] != '_']
# Find available methods for the model
model_meth_list = [meth[0] for meth in getmembers(self.model, ismethod) if meth[0][0] != '_']
model_meth_list += [meth[0] for meth in getmembers(self.model, isfunction) if meth[0][0] != '_']
# List intersection
# TODO: use only methods from the model
set_2 = frozenset(model_meth_list)
meth_list = [x for x in plugin_meth_list if x in set_2]
# Only including mapped methods/functions
meth_list = [meth[0].split('_plugin')[0] for meth in getmembers(plugin(ini=True), isfunction) if meth[0][0] != '_']
except Exception as exc:
meth_list = []

Expand Down Expand Up @@ -651,7 +644,7 @@ def addMeth(self):
self.tree.insert(parent='', index='end', iid=meth, text='', values=tuple([meth, '']),
tags=('meth',meth))
# TODO: Remove X and y?
self.req_settings[meth], self.opt_settings[meth] = self.getArgs(getattr(self.model, meth))
self.req_settings[meth], self.opt_settings[meth] = self.getArgs(getattr(self.plugin_ini, meth+'_plugin'))
self.fill_treeview(self.req_settings[meth], self.opt_settings[meth], meth)

def deleteMeth(self):
Expand Down Expand Up @@ -854,7 +847,7 @@ def removewindow(self):
val = self.tree.item(child)["values"]
self.settingOptions(tags[0], f, val)
if hasattr(self, 'model'):
del self.model
del self.plugin_ini
self.newWindow.destroy()
self.newWindow = None
self.focus()
Expand Down

0 comments on commit aa4374c

Please sign in to comment.