Skip to content

Commit

Permalink
Changed to entity_enabled to match vscode-ibek-entities tickbox
Browse files Browse the repository at this point in the history
  • Loading branch information
niamhdougan committed Mar 22, 2022
1 parent 79b9303 commit 2c8a23b
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 48 deletions.
4 changes: 2 additions & 2 deletions src/ibek/ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Entity:
# a link back to the Definition Object that generated this Definition
__definition__: Definition

entity_disabled: bool
entity_enabled: bool

def __post_init__(self):
# If there is an argument which is an id then allow deserialization by that
Expand Down Expand Up @@ -104,7 +104,7 @@ def lookup_instance(id):

# add a field so we can control rendering of the entity without having to delete
# it
fields.append(("entity_disabled", bool, field(default=cast(Any, False))))
fields.append(("entity_enabled", bool, field(default=cast(Any, True))))

namespace = dict(__definition__=definition)

Expand Down
2 changes: 1 addition & 1 deletion src/ibek/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def render_elements(ioc: IOC, element: str) -> str:
method = getattr(sys.modules[__name__], element)
elements = ""
for instance in ioc.entities:
if not instance.entity_disabled:
if instance.entity_enabled:
element = method(instance)
if element:
elements += element + "\n"
Expand Down
8 changes: 4 additions & 4 deletions tests/samples/schemas/asyn.ibek.entities.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"port": {
"type": "string",
Expand Down Expand Up @@ -83,9 +83,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"port": {
"type": "string",
Expand Down
28 changes: 14 additions & 14 deletions tests/samples/schemas/bl45p-mo-ioc-04.ibek.entities.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"max_bytes": {
"type": "integer",
Expand All @@ -36,9 +36,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"minutes_west": {
"type": "integer",
Expand All @@ -56,9 +56,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"pv": {
"type": "string",
Expand All @@ -83,9 +83,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"name": {
"type": "string",
Expand All @@ -110,9 +110,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"name": {
"type": "string",
Expand Down Expand Up @@ -158,9 +158,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"name": {
"type": "string",
Expand All @@ -186,9 +186,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"PMAC": {
"type": "string",
Expand Down
20 changes: 10 additions & 10 deletions tests/samples/schemas/container.ibek.entities.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"port": {
"type": "string",
Expand Down Expand Up @@ -83,9 +83,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"port": {
"type": "string",
Expand Down Expand Up @@ -135,9 +135,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"name": {
"type": "string",
Expand Down Expand Up @@ -183,9 +183,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"name": {
"type": "string",
Expand All @@ -211,9 +211,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"PMAC": {
"type": "string",
Expand Down
16 changes: 8 additions & 8 deletions tests/samples/schemas/epics.ibek.defs.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"max_bytes": {
"type": "integer",
Expand All @@ -36,9 +36,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"minutes_west": {
"type": "integer",
Expand All @@ -56,9 +56,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"pv": {
"type": "string",
Expand All @@ -83,9 +83,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"name": {
"type": "string",
Expand Down
12 changes: 6 additions & 6 deletions tests/samples/schemas/pmac.ibek.entities.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"name": {
"type": "string",
Expand Down Expand Up @@ -64,9 +64,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"name": {
"type": "string",
Expand All @@ -92,9 +92,9 @@
{
"type": "object",
"properties": {
"entity_disabled": {
"entity_enabled": {
"type": "boolean",
"default": false
"default": true
},
"PMAC": {
"type": "string",
Expand Down
6 changes: 3 additions & 3 deletions tests/test_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,18 @@ def test_entity_disabled_does_not_render_elements(pmac_classes, epics_classes):
numAxes=8,
idlePoll=200,
movingPoll=800,
entity_disabled=True,
entity_enabled=False,
)
)

# Create two instances of the CA max array bytes entity, one disabled
instance_list.append(ca_max_array_bytes_class())
instance_list.append(ca_max_array_bytes_class(entity_disabled=True))
instance_list.append(ca_max_array_bytes_class(entity_enabled=False))

# Create two instances of the dpbf class
instance_list.append(dbpf_class(pv="TEST:PV:1", value="pv_value_1"))
instance_list.append(
dbpf_class(pv="TEST:PV:2", value="pv_value_2", entity_disabled=True)
dbpf_class(pv="TEST:PV:2", value="pv_value_2", entity_enabled=False)
)

# Make an IOC with our instances
Expand Down

0 comments on commit 2c8a23b

Please sign in to comment.