Skip to content

Commit

Permalink
chore: replace gui_element Slider by Spinbox, remove gui_element Simp…
Browse files Browse the repository at this point in the history
…leText for intervals, et al. (DEV-2501) (#452)
  • Loading branch information
jnussbaum committed Aug 7, 2023
1 parent 15096e7 commit 5e668f0
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 92 deletions.
4 changes: 1 addition & 3 deletions .github/pull_request_template.md
@@ -1,7 +1,7 @@
===REMOVE===

Important! Please follow the guidelines for naming Pull Requests:
<https://docs.dasch.swiss/latest/developers/dsp/contribution/#pull-request-guidelines>
<https://docs.dasch.swiss/latest/developers/contribution/#pull-request-guidelines>

**Note:**
When squash-merging a PR into the main branch,
Expand All @@ -12,5 +12,3 @@ GitHub will take the name of this single commit as squash-merge-commit message.
In this case, you have to manually ensure that the squash-merge commit message is identical to the PR title.

===REMOVE===

resolves DEV-
13 changes: 10 additions & 3 deletions README.md
@@ -1,6 +1,13 @@
[![PyPI version](https://badge.fury.io/py/dsp-tools.svg)](https://badge.fury.io/py/dsp-tools)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![linting: pylint](https://img.shields.io/badge/linting-pylint-yellowgreen)](https://github.com/pylint-dev/pylint)
[![](https://badge.fury.io/py/dsp-tools.svg)](https://badge.fury.io/py/dsp-tools)
[![](https://img.shields.io/pypi/pyversions/dsp-tools.svg)](https://pypi.org/project/dsp-tools/)
[![](https://img.shields.io/badge/Python%20code%20style-black-000000.svg)](https://github.com/psf/black)
[![](https://img.shields.io/badge/Python%20linting-pylint-darkgreen)](https://github.com/pylint-dev/pylint)
[![](https://img.shields.io/badge/Python%20typing-mypy-darkgreen)](https://github.com/python/mypy)
[![](https://img.shields.io/badge/Markdown%20linting-markdownlint-darkgreen)](
https://github.com/igorshubovych/markdownlint-cli)
[![](https://img.shields.io/badge/Link%20validation-markdown%20link%20validator-darkgreen)](
https://www.npmjs.com/package/markdown-link-validator)


# DSP-TOOLS - DaSCH Service Platform Tools

Expand Down
12 changes: 4 additions & 8 deletions docs/file-formats/json-project/ontologies.md
Expand Up @@ -251,7 +251,7 @@ These three are related as follows:
| hasValue | BooleanValue | Checkbox |
| hasColor | ColorValue | Colorpicker |
| hasValue | DateValue | Date |
| hasValue | DecimalValue | Slider, <br>SimpleText |
| hasValue | DecimalValue | Spinbox, <br>SimpleText |
| hasValue | GeonameValue | Geonames |
| hasValue | IntValue | Spinbox, <br>SimpleText |
| hasValue | ListValue | List |
Expand Down Expand Up @@ -364,7 +364,7 @@ information.

*gui_elements / gui_attributes*:

- `Slider`: Provides a slider to select a decimal value.
- `Spinbox`: Provides a spinbox to select a decimal value.
- *gui_attributes*:
- `max=decimal` (mandatory): maximal value
- `min=decimal` (mandatory): minimal value
Expand Down Expand Up @@ -896,12 +896,8 @@ See the [`isSequenceOf` property](#issequenceof-property) or the

*gui_elements / gui_attributes*:

- `SimpleText`: A simple text entry box (one line only).
- *gui_attributes*:
- `maxlength=integer` (optional): The maximum number of characters accepted
- `size=integer` (optional): The size of the input field
- `Interval`: Two Sliders, one for each decimal
- *gui_attributes*: No attributes
- `Interval`: Two spinboxes, one for each decimal
- *gui_attributes*: No attributes

Example:

Expand Down
12 changes: 9 additions & 3 deletions docs/index.md
@@ -1,6 +1,12 @@
[![PyPI version](https://badge.fury.io/py/dsp-tools.svg)](https://badge.fury.io/py/dsp-tools)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![linting: pylint](https://img.shields.io/badge/linting-pylint-yellowgreen)](https://github.com/pylint-dev/pylint)
[![](https://badge.fury.io/py/dsp-tools.svg)](https://badge.fury.io/py/dsp-tools)
[![](https://img.shields.io/pypi/pyversions/dsp-tools.svg)](https://pypi.org/project/dsp-tools/)
[![](https://img.shields.io/badge/Python%20code%20style-black-000000.svg)](https://github.com/psf/black)
[![](https://img.shields.io/badge/Python%20linting-pylint-darkgreen)](https://github.com/pylint-dev/pylint)
[![](https://img.shields.io/badge/Python%20typing-mypy-darkgreen)](https://github.com/python/mypy)
[![](https://img.shields.io/badge/Markdown%20linting-markdownlint-darkgreen)](
https://github.com/igorshubovych/markdownlint-cli)
[![](https://img.shields.io/badge/Link%20validation-markdown%20link%20validator-darkgreen)](
https://www.npmjs.com/package/markdown-link-validator)

# DSP-TOOLS documentation

Expand Down
36 changes: 2 additions & 34 deletions src/dsp_tools/resources/schema/project.json
Expand Up @@ -112,7 +112,6 @@
"Richtext",
"Searchbox",
"SimpleText",
"Slider",
"Spinbox",
"Textarea",
"TimeStamp"
Expand Down Expand Up @@ -589,7 +588,7 @@
},
"gui_element": {
"enum": [
"Slider",
"Spinbox",
"SimpleText"
]
}
Expand Down Expand Up @@ -755,10 +754,7 @@
}
},
"gui_element": {
"enum": [
"Interval",
"SimpleText"
]
"const": "Interval"
}
}
}
Expand Down Expand Up @@ -897,34 +893,6 @@
}
}
},
{
"if": {
"properties": {
"gui_element": {
"const": "Slider"
}
}
},
"then": {
"properties": {
"gui_attributes": {
"type": "object",
"properties": {
"max": {
"type": "number"
},
"min": {
"type": "number"
}
},
"additionalProperties": false
}
},
"required": [
"gui_attributes"
]
}
},
{
"if": {
"properties": {
Expand Down
36 changes: 2 additions & 34 deletions src/dsp_tools/resources/schema/properties-only.json
Expand Up @@ -88,7 +88,6 @@
"Richtext",
"Searchbox",
"SimpleText",
"Slider",
"Spinbox",
"Textarea",
"TimeStamp"
Expand Down Expand Up @@ -419,7 +418,7 @@
},
"gui_element": {
"enum": [
"Slider",
"Spinbox",
"SimpleText"
]
}
Expand Down Expand Up @@ -585,10 +584,7 @@
}
},
"gui_element": {
"enum": [
"Interval",
"SimpleText"
]
"const": "Interval"
}
}
}
Expand Down Expand Up @@ -727,34 +723,6 @@
}
}
},
{
"if": {
"properties": {
"gui_element": {
"const": "Slider"
}
}
},
"then": {
"properties": {
"gui_attributes": {
"type": "object",
"properties": {
"max": {
"type": "number"
},
"min": {
"type": "number"
}
},
"additionalProperties": false
}
},
"required": [
"gui_attributes"
]
}
},
{
"if": {
"properties": {
Expand Down
6 changes: 3 additions & 3 deletions test/unittests/test_excel_to_json_properties.py
Expand Up @@ -248,7 +248,7 @@ def test_excel2properties(self) -> None:
"Date",
"SimpleText",
"Colorpicker",
"Slider",
"Spinbox",
"TimeStamp",
"Interval",
"Checkbox",
Expand Down Expand Up @@ -334,11 +334,11 @@ def test_validate_properties(self) -> None:
"testdata/invalid-testdata/excel2json/properties-invalid-gui_element.xlsx",
"did not pass validation. The problematic property is 'hasInterval' in Excel row 4. "
r"The problem is that the column 'gui_element' has an invalid value: "
r"'Geonames' is not one of \['Interval', 'SimpleText'\]",
r"'Interval' was expected",
),
(
"testdata/invalid-testdata/excel2json/properties-invalid-gui_attribute.xlsx",
"did not pass validation. The problematic property is 'hasInterval' in Excel row 4. "
"did not pass validation. The problematic property is 'hasInteger' in Excel row 4. "
r"The problem is that the column 'gui_attributes' has an invalid value: "
r"Additional properties are not allowed \('rows' was unexpected\)",
),
Expand Down
2 changes: 1 addition & 1 deletion testdata/excel2json/excel2json-expected-output.json
Expand Up @@ -376,7 +376,7 @@
"de": "Dezimalzahl",
"fr": "Chiffre décimale"
},
"gui_element": "Slider",
"gui_element": "Spinbox",
"gui_attributes": {
"min": 0.0,
"max": 100.0
Expand Down
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions testdata/json-project/test-project-systematic.json
Expand Up @@ -352,10 +352,10 @@
"labels": {
"en": "Decimal number"
},
"gui_element": "SimpleText",
"gui_element": "Spinbox",
"gui_attributes": {
"maxlength": 255,
"size": 80
"max": 100.0,
"min": 0.0
}
},
{
Expand Down

0 comments on commit 5e668f0

Please sign in to comment.