From a1db5428186aec297889a87bac97cef4cc0bc98d Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 20 May 2021 12:15:44 +0100 Subject: [PATCH] Add icon display setting Added "iconDisplay" setting to configure. Updated readme and full example. --- README.md | 4 ++++ componentize.py | 3 ++- examples/Test_KitchenSink/metadata.json | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c9b9a52..a7116bc 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,10 @@ Optionally, tag it with a version: * `hideInput`: **(optional)** Defines whether to hide or not the `code` input parameter. Defaults to `True`. * `isAdvancedMode`: **(optional)** Defines whether the script is in advanced mode (aka GH_Component SDK mode) or procedural mode. Defaults to `False`. * `marshalOutGuids`: **(optional)** Defines whether output Guids will be looked up or not. Defaults to `True`. Change to `False` to preserve output Guids. + * `iconDisplay`: **(optional)** Defines whether to display the icon or not. Defaults to `0`. + * `0` : Application setting + * `1` : Text display + * `2` : Icon display * `inputParameters`: List of input parameters. * `name`: Name of the input parameter. * `nickname`: **(optional)** Abbreviation of the input parameter. Defaults to the same as `name`. diff --git a/componentize.py b/componentize.py index a0c3f2f..27d80ea 100644 --- a/componentize.py +++ b/componentize.py @@ -193,11 +193,12 @@ def create_ghuser_component(source, target, version=None): ghpython_root.SetBoolean('HideOutput', ghpython_data.get('hideOutput', True)) ghpython_root.SetBoolean('HideInput', ghpython_data.get('hideInput', True)) ghpython_root.SetBoolean('IsAdvancedMode', ghpython_data.get('isAdvancedMode', False)) + ghpython_root.SetInt32('IconDisplay', ghpython_data.get('iconDisplay', 0)) ghpython_root.SetString('Name', data['name']) ghpython_root.SetString('NickName', data['nickname']) ghpython_root.SetBoolean('MarshalOutGuids', ghpython_data.get('marshalOutGuids', True)) ghpython_root.SetString('CodeInput', code) - + # ghpython_root.CreateChunk('Attributes') # for mf in ('Bounds', 'Pivot', 'Selected'): params = ghpython_root.CreateChunk('ParameterData') diff --git a/examples/Test_KitchenSink/metadata.json b/examples/Test_KitchenSink/metadata.json index 93696a9..6426448 100644 --- a/examples/Test_KitchenSink/metadata.json +++ b/examples/Test_KitchenSink/metadata.json @@ -12,6 +12,7 @@ "hideInput": true, "isAdvancedMode": true, "marshalOutGuids": true, + "iconDisplay": 2, "inputParameters": [ { "name": "X",