Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.editor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.editor
Commits
b91ed246
Commit
b91ed246
authored
3 years ago
by
Samuel GAIST
Browse files
Options
Downloads
Patches
Plain Diff
[widgets][plotterparameterseditor] Fix bool type default value handling
parent
f2902bcb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!150
Add pyproject.toml
Pipeline
#49892
failed
3 years ago
Stage: build
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beat/editor/widgets/plotterparameterseditor.py
+16
-4
16 additions, 4 deletions
beat/editor/widgets/plotterparameterseditor.py
with
16 additions
and
4 deletions
beat/editor/widgets/plotterparameterseditor.py
+
16
−
4
View file @
b91ed246
...
...
@@ -126,17 +126,29 @@ class RestrictedParameterWidget(QWidget):
super
().
__init__
(
parent
)
self
.
_type
=
data
.
get
(
"
type
"
,
None
)
default
=
data
.
get
(
"
default
"
,
""
if
self
.
_type
==
"
string
"
else
0
)
# cast the default value to the required type
cast_fn
=
np
.
cast
[
self
.
_type
]
if
self
.
_type
!=
"
string
"
else
str
if
self
.
_type
==
"
string
"
:
cast_fn
=
str
default
=
data
.
get
(
"
default
"
,
""
)
self
.
default
=
""
elif
self
.
_type
==
"
bool
"
:
cast_fn
=
bool
default
=
data
.
get
(
"
default
"
,
False
)
self
.
default
=
False
else
:
cast_fn
=
np
.
cast
[
self
.
_type
]
default
=
data
.
get
(
"
default
"
,
0
)
self
.
default
=
0
try
:
default
=
cast_fn
(
default
)
except
ValueError
:
logger
.
exception
(
f
"
Failed to convert the default value:
{
default
}
to type
{
self
.
_type
}
"
,
)
default
=
cast_fn
(
""
if
self
.
_type
==
"
string
"
else
0
)
self
.
default
=
default
else
:
self
.
default
=
default
self
.
current_type
=
InputType
[
self
.
_type
.
upper
()]
self
.
modality
=
"
single
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment