-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #188 from nodedge/feature/script-style-svg
Add a script to change style of SVGs.
- Loading branch information
Showing
14 changed files
with
271 additions
and
42 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
examples/discrete/discrete_transfer_function_example.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
{ | ||
"id": 2187663561552, | ||
"sceneWidth": 64000, | ||
"sceneHeight": 64000, | ||
"nodes": [ | ||
{ | ||
"id": 2187628269008, | ||
"title": "discrete_tf", | ||
"posX": -105.0, | ||
"posY": -30.0, | ||
"inputSockets": [ | ||
{ | ||
"id": 2187631814160, | ||
"index": 0, | ||
"allowMultiEdges": false, | ||
"location": 1, | ||
"socketType": 1 | ||
} | ||
], | ||
"outputSockets": [ | ||
{ | ||
"id": 2187663402000, | ||
"index": 0, | ||
"allowMultiEdges": true, | ||
"location": 4, | ||
"socketType": 1 | ||
} | ||
], | ||
"content": {}, | ||
"operationCode": 53, | ||
"params": { | ||
"numerator": { | ||
"value": "[1,1]", | ||
"type": 3, | ||
"minValue": null, | ||
"maxValue": null, | ||
"step": null | ||
}, | ||
"denominator": { | ||
"value": "[1,1]", | ||
"type": 3, | ||
"minValue": null, | ||
"maxValue": null, | ||
"step": null | ||
}, | ||
"initial state": { | ||
"value": 0.0, | ||
"type": 0, | ||
"minValue": null, | ||
"maxValue": null, | ||
"step": null | ||
} | ||
} | ||
}, | ||
{ | ||
"id": 2187663428880, | ||
"title": "constant", | ||
"posX": -435.0, | ||
"posY": -45.0, | ||
"inputSockets": [], | ||
"outputSockets": [ | ||
{ | ||
"id": 2187663569552, | ||
"index": 0, | ||
"allowMultiEdges": true, | ||
"location": 4, | ||
"socketType": 0 | ||
} | ||
], | ||
"content": { | ||
"value": "1" | ||
}, | ||
"operationCode": 1, | ||
"params": {} | ||
}, | ||
{ | ||
"id": 2187663439824, | ||
"title": "output", | ||
"posX": 222.0, | ||
"posY": -60.0, | ||
"inputSockets": [ | ||
{ | ||
"id": 2187777699984, | ||
"index": 0, | ||
"allowMultiEdges": false, | ||
"location": 1, | ||
"socketType": 0 | ||
} | ||
], | ||
"outputSockets": [], | ||
"content": {}, | ||
"operationCode": 2, | ||
"params": { | ||
"Scientific notation": { | ||
"value": true, | ||
"type": 2, | ||
"minValue": null, | ||
"maxValue": null, | ||
"step": null | ||
}, | ||
"Digits": { | ||
"value": 2, | ||
"type": 1, | ||
"minValue": null, | ||
"maxValue": null, | ||
"step": null | ||
} | ||
} | ||
} | ||
], | ||
"edges": [ | ||
{ | ||
"id": 2187618686032, | ||
"edgeType": 3, | ||
"source": 2187663569552, | ||
"target": 2187631814160 | ||
}, | ||
{ | ||
"id": 2187663562448, | ||
"edgeType": 3, | ||
"source": 2187663402000, | ||
"target": 2187777699984 | ||
} | ||
], | ||
"elements": [], | ||
"simulator": { | ||
"solver": "Basic solver", | ||
"solverName": "a", | ||
"solverOptions": "", | ||
"timeStep": 1.0, | ||
"maxIterations": 1.0, | ||
"tolerance": 1.0, | ||
"finalTime": 10.0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"plugins": { | ||
"no-space-in-code": { | ||
"enabled": false | ||
}, | ||
"no-space-in-emphasis": { | ||
"enabled": false | ||
}, | ||
"line-length": { | ||
"enabled": false | ||
}, | ||
"no-duplicate-heading": { | ||
"enabled": false | ||
} | ||
} | ||
} |
14 changes: 7 additions & 7 deletions
14
requirements/packages/requirements.in → requirements/packages/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
asammdf | ||
coloredlogs | ||
npTDMS | ||
numpy | ||
pandas | ||
pyqtconsole | ||
pyqtgraph | ||
PySide6 | ||
PyYAML | ||
types-PyYAML | ||
pyqtgraph | ||
asammdf | ||
numpy | ||
pandas | ||
tables | ||
scipy | ||
npTDMS | ||
tables | ||
types-PyYAML |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
-r requirements_tests.txt | ||
bump2version | ||
pillow | ||
pip-licenses | ||
pre-commit | ||
wheel | ||
pyinstaller | ||
pip-licenses | ||
wheel |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ements/packages/requirements_packaging.in → ...ments/packages/requirements_packaging.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
-r requirements_dev.txt | ||
check-manifest | ||
pyinstaller | ||
readme_renderer | ||
twine | ||
pyinstaller |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import logging | ||
import os | ||
|
||
from lxml import etree | ||
|
||
|
||
def change_svg_properties(in_dir, out_dir, stroke_color, stroke_width): | ||
if not os.path.exists(out_dir): | ||
logging.info(f"Creating directory: {out_dir}") | ||
os.mkdir(out_dir) | ||
|
||
for f in os.listdir(in_dir): | ||
full_path = os.path.join(in_dir, f) | ||
print(in_dir + "/" + f) | ||
if f.endswith(".svg"): | ||
tree = etree.parse(full_path) | ||
root = tree.getroot() | ||
if root.get("stroke") is not stroke_color: | ||
logging.info( | ||
f"Changing stroke color from {root.get('stroke')} to {stroke_color} in {f}" | ||
) | ||
root.set("stroke", stroke_color) | ||
|
||
if root.get("stroke-width") is not stroke_width: | ||
logging.info( | ||
f"Changing stroke width from {root.get('stroke-width')} to {stroke_width} in {f}" | ||
) | ||
root.set("stroke-width", str(stroke_width)) | ||
|
||
tree.write(os.path.join(out_dir, f)) | ||
|
||
|
||
if __name__ == "__main__": | ||
change_svg_properties("white_lucide", "red_lucide", "red", 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters