Sunday, 24 June 2012

Coding Practice: Staying Classy

There have been two EnCharter developments this weekend so far, one totally invisible to the user and one that is extremely useful to the user.

The invisible one is the change from having each stitch hardcoded as a very tenuous list structure to having a class called 'Stitch' which contains the name of the stitch and all the attributes, including the method of drawing it. This will eventually allow for the user to define their own stitches by how many loops go in and how many come out, so all my favourite crazy Estonian lace stitches will be representable. This class structure will also allow the automatic creation of stitch keys and technique descriptions when you make the final chart, all of which is terribly exciting. Oh, and I fixed the stitch logic checker so that it'll work again. Your lace will never come up short again!

The extremely useful change is that you can now export your  patterns as a pdf. This is something that I've been really wanting to get sorted so that I can start working on my other knitcoding project (Morphic: a fitted cardigan pattern distributed as software that generates a customised pattern based on user inputted measurements)

I could probably start letting people have a go at playing with EnCharter soon, so that I can see exactly how it is possible to break it.

ETA: Would you like to play with the current EnCharter alpha? I'm going to make it into an .exe so it can be distributed.

ETA2: Ok, so making EnCharter a single file executable for Windows or Mac isn't actually working at all well. In lieu of actually producing a playable alpha, I've added save and load functions and tried to do something about that damned resize bug. With limited effect.

Monday, 18 June 2012

Coding Practice: SPLITTERS!

No, not the People's Front of Judea, but the kind of splitters that allow you to waggle the widgets around automagically on the UI window. 

If you look closely at the new screenshot, you'll see the three little dots between the chart and row numbers and between the row numbers and the right hand controls. You drag those about to make the various bits of the thing bigger. It's... not quite right at the moment, I think I need to basically get the chart and row numbers to sit within the same splitter frame so they can resize together while leaving the right hand controls as they are.

Other small improvements:
- left clicking advances the stitch in the box, right clicking reverses it
- chart squares are always square

Coming soon:
- separating out the stitch palette from the grid
- changing how the handling of the stitches works so that we can have more than k2tog & yo
- row numbers
- telling you exactly where in the repeat things have gone wrong
- fixing the keyboard controls
- highlighting sections 
- making each splitter resize politely and automatically when the grid size changes

Friday, 15 June 2012

Coding Practice: Creative Destruction

EnCharter was working so well that it was clearly time to attempt something that could potentially break the lot. 

I've added more stitches! Take a look!

So, now you can do ssk, k2tog, m1, yo, plus PURL as well as knit. I haven't figured out how to display the en-dash that I'd like instead of the hyphen to represent the purl, but details, details.

The stitch count logic has totally broken, because I was handling it in a daft hardcoded way, but the beginnings of the way to make it work again are already in place.

I've also decided to keep the chart squares square, which has caused more problems. Previously, the size of the squares was just 'whatever it has to be to fit it in the widget', but I'd rather have them square. Forcing them to be square has overridden the 'fit in the widget' condition, so now I need to investigate how to change the size of the widget on the fly. Should be fine.

(Also, should probably work out how to size text to fit nicely in the row count and stitch boxes)

Wednesday, 13 June 2012

Coding Practice: Now With Row Numbers

And now, EnCharter provides you with row numbering next to your chart. I've done it in such a manner that it's taught me a lot about signals and slots, but not so that it'll actually produce useful output when I sort out the printing. Silly me.

I also fixed the keyboard controls by fixing a stupid bug in the selected cell handling.

Coming soon:
- changing how the handling of the stitches works so that we can have more than k2tog & yo
- row numbers
- telling you exactly where in the repeat things have gone wrong
- fixing the keyboard controls
- separating out the stitch palette from the grid
- highlighting sections 

Saturday, 9 June 2012

Coding Practice: EnCharter post 2

EnCharter approaches adequate levels of usability!

Introduced since the last post:
- a clear all command
- visual feedback that tells you if the repeat works out or not (which took a surprising amount of doing)
- preparation for PDF export/print commands

Coming soon:
- changing how the handling of the stitches works so that we can have more than k2tog & yo
- row numbers
- telling you exactly where in the repeat things have gone wrong
- fixing the keyboard controls
- separating out the stitch palette from the grid

Thursday, 7 June 2012

Coding Practice: EnCharter

I've been meaning to start learning Python for a while, but as I've been short of an idea for something that I actually wanted to code, it's been very difficult getting past the initial "Hello World!" stage. That all changed recently - I realised that what I would like to make is some charting software for lace. So far the ideal feature list is a bit ambitious (especially when compared with what I've actually managed to do) and I am not entirely sure if there's actually any call for it outside my personal use. So, here's what I've managed to get so far:

  • A grid that you can resize to represent the size of a charted lace repeat
  • When you click on grid squares they cycle from blank to 'INC' to 'DEC' (placeholder graphics at the moment though)
  • A UI window that has the grid resize controls on it and a button called 'evaluate' that doesn't do anything (yet)
Things that still need to go in before I can declare it EnCharter v0.1:
  • The logic that computes whether your repeat obeys loop conservation logic (ie, does the lace pattern have the correct number of stitches per row to make it actually knittable)
  • More types of increase and decrease and their appropriate symbols
  • A way to display row-by-row stitch counts and any possible conflicts generated by the entered stitch pattern.
You're not getting any screenshots of it in action until it looks less like arse.

ETA: Some graphical work just got done. So proud.

ETA2: I think that'll do for now. I've been working on the loop conservation logic, which is causing me to rethink the chart square addressing and how I'm handing what properties stitch types have (at the moment they've just got a position in a vector which is used to determine their loop number) 

Also, the keyboard control for changing stitches doesn't work any more. When I introduced the controls for resizing the repeat grid, some priority thing went wrong so you can never get into keyboard control mode. Bum.