Changed logic of invisible to a (forced) visibility field

This commit is contained in:
Jan Böhmer 2023-12-03 15:29:17 +01:00
parent bc37d11f13
commit 7d69d6ba30
9 changed files with 37 additions and 29 deletions

View file

@ -38,10 +38,10 @@ class EDACategoryInfo
#[Groups(['full', 'category:read', 'category:write'])] #[Groups(['full', 'category:read', 'category:write'])]
private ?string $reference_prefix = null; private ?string $reference_prefix = null;
/** @var bool|null If this is true, then this part is invisible for the EDA software */ /** @var bool|null Visibility of this part to EDA software in trinary logic. True=Visible, False=Invisible, Null=Auto */
#[Column(type: Types::BOOLEAN, nullable: true)] #[Column(name: 'invisible', type: Types::BOOLEAN, nullable: true)] //TODO: Rename column to visibility
#[Groups(['full', 'category:read', 'category:write'])] #[Groups(['full', 'category:read', 'category:write'])]
private ?bool $invisible = null; private ?bool $visibility = null;
/** @var bool|null If this is set to true, then this part will be excluded from the BOM */ /** @var bool|null If this is set to true, then this part will be excluded from the BOM */
#[Column(type: Types::BOOLEAN, nullable: true)] #[Column(type: Types::BOOLEAN, nullable: true)]
@ -74,14 +74,14 @@ class EDACategoryInfo
return $this; return $this;
} }
public function getInvisible(): ?bool public function getVisibility(): ?bool
{ {
return $this->invisible; return $this->visibility;
} }
public function setInvisible(?bool $invisible): EDACategoryInfo public function setVisibility(?bool $visibility): EDACategoryInfo
{ {
$this->invisible = $invisible; $this->visibility = $visibility;
return $this; return $this;
} }

View file

@ -43,10 +43,10 @@ class EDAPartInfo
#[Groups(['full', 'eda_info:read', 'eda_info:write'])] #[Groups(['full', 'eda_info:read', 'eda_info:write'])]
private ?string $value = null; private ?string $value = null;
/** @var bool|null If this is true, then this part is invisible for the EDA software */ /** @var bool|null Visibility of this part to EDA software in trinary logic. True=Visible, False=Invisible, Null=Auto */
#[Column(type: Types::BOOLEAN, nullable: true)] #[Column(name: 'invisible', type: Types::BOOLEAN, nullable: true)] //TODO: Rename column to visibility
#[Groups(['full', 'eda_info:read', 'eda_info:write'])] #[Groups(['full', 'eda_info:read', 'eda_info:write'])]
private ?bool $invisible = null; private ?bool $visibility = null;
/** @var bool|null If this is set to true, then this part will be excluded from the BOM */ /** @var bool|null If this is set to true, then this part will be excluded from the BOM */
#[Column(type: Types::BOOLEAN, nullable: true)] #[Column(type: Types::BOOLEAN, nullable: true)]
@ -100,14 +100,14 @@ class EDAPartInfo
return $this; return $this;
} }
public function getInvisible(): ?bool public function getVisibility(): ?bool
{ {
return $this->invisible; return $this->visibility;
} }
public function setInvisible(?bool $invisible): EDAPartInfo public function setVisibility(?bool $visibility): EDAPartInfo
{ {
$this->invisible = $invisible; $this->visibility = $visibility;
return $this; return $this;
} }

View file

@ -45,8 +45,9 @@ class EDACategoryInfoType extends AbstractType
] ]
] ]
) )
->add('invisible', TriStateCheckboxType::class, [ ->add('visibility', TriStateCheckboxType::class, [
'label' => 'eda_info.invisible', 'help' => 'eda_info.visibility.help',
'label' => 'eda_info.visibility',
]) ])
->add('exclude_from_bom', TriStateCheckboxType::class, [ ->add('exclude_from_bom', TriStateCheckboxType::class, [
'label' => 'eda_info.exclude_from_bom', 'label' => 'eda_info.exclude_from_bom',

View file

@ -50,8 +50,9 @@ class EDAPartInfoType extends AbstractType
'placeholder' => t('eda_info.value.placeholder'), 'placeholder' => t('eda_info.value.placeholder'),
] ]
]) ])
->add('invisible', TriStateCheckboxType::class, [ ->add('visibility', TriStateCheckboxType::class, [
'label' => 'eda_info.invisible', 'help' => 'eda_info.visibility.help',
'label' => 'eda_info.visibility',
]) ])
->add('exclude_from_bom', TriStateCheckboxType::class, [ ->add('exclude_from_bom', TriStateCheckboxType::class, [
'label' => 'eda_info.exclude_from_bom', 'label' => 'eda_info.exclude_from_bom',

View file

@ -80,7 +80,7 @@ class KiCadHelper
$result = []; $result = [];
foreach ($categories as $category) { foreach ($categories as $category) {
//Skip invisible categories //Skip invisible categories
if ($category->getEdaInfo()->getInvisible() ?? false) { if ($category->getEdaInfo()->getVisibility() === false) {
continue; continue;
} }
@ -146,7 +146,7 @@ class KiCadHelper
$result = []; $result = [];
foreach ($parts as $part) { foreach ($parts as $part) {
//If the part is invisible, then skip it //If the part is invisible, then skip it
if ($part->getEdaInfo()->getInvisible() ?? $part->getCategory()?->getEdaInfo()->getInvisible() ?? false) { if ($part->getEdaInfo()->getVisibility() === false || $part->getCategory()?->getEdaInfo()->getVisibility() === false) {
continue; continue;
} }

View file

@ -41,7 +41,7 @@
<div class="row"> <div class="row">
<div class="col-sm-9 offset-sm-3"> <div class="col-sm-9 offset-sm-3">
{{ form_row(form.eda_info.invisible) }} {{ form_row(form.eda_info.visibility) }}
</div> </div>
</div> </div>

View file

@ -3,7 +3,7 @@
<div class="row"> <div class="row">
<div class="col-sm-9 offset-sm-3"> <div class="col-sm-9 offset-sm-3">
{{ form_row(form.eda_info.invisible) }} {{ form_row(form.eda_info.visibility) }}
</div> </div>
</div> </div>

View file

@ -92,7 +92,7 @@
<br> <br>
<b>{% trans %}eda_info.value{% endtrans %}:</b> {{ part.edaInfo.value }} <b>{% trans %}eda_info.value{% endtrans %}:</b> {{ part.edaInfo.value }}
<br> <br>
<b>{% trans %}eda_info.invisible{% endtrans %}:</b> {{ helper.boolean_badge( part.edaInfo.invisible ?? part.category.edaInfo.invisible ?? false) }} <b>{% trans %}eda_info.visibility{% endtrans %}:</b> {{ helper.boolean_badge( part.edaInfo.visibility ?? part.category.edaInfo.visibility) }}
<br> <br>
<b>{% trans %}eda_info.exclude_from_bom{% endtrans %}:</b> {{ helper.boolean_badge( part.edaInfo.excludeFromBom ?? part.category.edaInfo.excludeFromBom ?? false) }} <b>{% trans %}eda_info.exclude_from_bom{% endtrans %}:</b> {{ helper.boolean_badge( part.edaInfo.excludeFromBom ?? part.category.edaInfo.excludeFromBom ?? false) }}
<br> <br>

View file

@ -12107,12 +12107,6 @@ Please note, that you can not impersonate a disabled user. If you try you will g
<target>e.g. 100n</target> <target>e.g. 100n</target>
</segment> </segment>
</unit> </unit>
<unit id="Q8nJNWg" name="eda_info.invisible">
<segment>
<source>eda_info.invisible</source>
<target>Invisible to EDA software</target>
</segment>
</unit>
<unit id="VphdbQ9" name="eda_info.exclude_from_bom"> <unit id="VphdbQ9" name="eda_info.exclude_from_bom">
<segment> <segment>
<source>eda_info.exclude_from_bom</source> <source>eda_info.exclude_from_bom</source>
@ -12179,5 +12173,17 @@ Please note, that you can not impersonate a disabled user. If you try you will g
<target>KiCad API root URL</target> <target>KiCad API root URL</target>
</segment> </segment>
</unit> </unit>
<unit id="UXT_MIM" name="eda_info.visibility">
<segment>
<source>eda_info.visibility</source>
<target>Force visibility</target>
</segment>
</unit>
<unit id="NN5DZ4F" name="eda_info.visibility.help">
<segment>
<source>eda_info.visibility.help</source>
<target>By default, the visibility to the EDA software is automatically determined. With this checkbox, you can force the part to be visible or invisible.</target>
</segment>
</unit>
</file> </file>
</xliff> </xliff>