20 # |
20 # |
21 # You should have received a copy of the GNU General Public License |
21 # You should have received a copy of the GNU General Public License |
22 # along with this program; if not, write to the Free Software |
22 # along with this program; if not, write to the Free Software |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 |
24 |
25 from __future__ import absolute_import |
25 |
26 from functools import reduce |
26 from functools import reduce |
27 import wx |
27 import wx |
28 |
28 |
29 # ------------------------------------------------------------------------------- |
29 # ------------------------------------------------------------------------------- |
30 # Helpers |
30 # Helpers |
31 # ------------------------------------------------------------------------------- |
31 # ------------------------------------------------------------------------------- |
32 |
32 |
33 |
33 |
34 [CATEGORY, BLOCK] = range(2) |
34 [CATEGORY, BLOCK] = list(range(2)) |
35 |
35 |
36 |
36 |
37 # ------------------------------------------------------------------------------- |
37 # ------------------------------------------------------------------------------- |
38 # Library Panel |
38 # Library Panel |
39 # ------------------------------------------------------------------------------- |
39 # ------------------------------------------------------------------------------- |
344 type_inputs = item_pydata.get("inputs", None) |
344 type_inputs = item_pydata.get("inputs", None) |
345 type_extension = item_pydata.get("extension", None) |
345 type_extension = item_pydata.get("extension", None) |
346 if inputs is not None and type_inputs is not None: |
346 if inputs is not None and type_inputs is not None: |
347 same_inputs = reduce( |
347 same_inputs = reduce( |
348 lambda x, y: x and y, |
348 lambda x, y: x and y, |
349 map( |
349 [x[0] == x[1] or x[0] == 'ANY' or x[1] == 'ANY' for x in zip(type_inputs, |
350 lambda x: x[0] == x[1] or x[0] == 'ANY' or x[1] == 'ANY', |
|
351 zip(type_inputs, |
|
352 (inputs[:type_extension] |
350 (inputs[:type_extension] |
353 if type_extension is not None |
351 if type_extension is not None |
354 else inputs))), |
352 else inputs))], |
355 True) |
353 True) |
356 else: |
354 else: |
357 same_inputs = True |
355 same_inputs = True |
358 |
356 |
359 # Return item if block data corresponds to informations given |
357 # Return item if block data corresponds to informations given |