knittingpattern
knittingpattern copied to clipboard
Add instrucion default to row
currently, only the color is inherited from the row. This breaks with the generality of the format.
Instead of
"id" : "A.2.1",
"color" : "mocha latte",
"instructions" : [
{},
{
"type" : "yo"
},
It should be
"id" : "A.2.1",
"instruction default" : {
"color" : "mocha latte",
},
"instructions" : [
{},
{
"type" : "yo"
},
where "instruction default" is the prototype for all instructions in that row.
Can I try to work on this issue...?
Sure! If you have questions or need some help, you can ask.
Can you please tell me how to test changes and which files except image_to_knittingpattern.py inside convert directory are needed to be updated...? It will be great help for me to get started.
I believe, there is only one test for this:
https://github.com/fossasia/knittingpattern/blob/master/knittingpattern/test/test_row_instructions.py#L264
It can be totally modified.
272 is the line with the row specification.
{
"version" : "0.1",
"type" : "knitting pattern",
"comment" : {
"markdown" : "This pattern is taken from [garnstudio](http://www.garnstudio.com/pattern.php?id=7350&cid=19).",
"picture" : {
"type" : "url",
"url" : "http://www.garnstudio.com/drops/mag/167/17/17-lp.jpg"
}
},
"patterns" : [
{
"name" : "all-instructions",
"id" : "A.2",
"rows" : [
{
"id" : 1,
"instructions-default": {
"color": "#0000ff"
},
"instructions" : [
{"type" : "bo"},
{"type" : "cdd"},
{"type" : "co"},
{"type" : "default-unknown"},
{"type" : "k2tog"},
{"type" : "knit"},
{"type" : "purl"},
{"type" : "skp"},
{"type" : "yo"}
]
}
],
"connections" : [
]
}
]
}
Is this structure good to work upon...?
It looks good to me!