nb-sdouglas

cadnano/


grids

2016-05-04
Attachments:

Snap-to-Grid

Before users jump into free-form editing in cadnano 2.5, it would probably be nice to start with a reference grid that looks similar to previous cadnano versions.

Grid appearance mockups


For appearance, Nick favors lines or points over circles. We should be able to offer all of the above.

Grid icons

Started with creating three versions of the reference grid from the mockup above.


I duplicated an existing SVG icon, copied the grid and rescaled it based on a few trials of exporting as 20x20 png. Then I displayed only the circle, line, or point grids in serial and exported each separately.

the icons

Integrating new icons into into mainwindow.ui

First, before you can use new icons in the UI file, they need to be saved into the qrc file. Qt asset management is super clunky and seems to require 10 more steps than should really be necessary.

The both ui and qrc files can be opened in Qt Creator. In the qrc file, I select the "prefix" which is just a group or pseudo-folder inside the qrc. In this case it's "/slicetools".

add icon to .qrc

Now editing the mainwindow.ui, new "actions" are created inside the action editor.

||| |:-:|:-:| |new action dialog|choose icon|

Compile for use in PyQt

``` mainwindow/images/grid-circles.png mainwindow/images/grid-points.png mainwindow/images/grid-lines.png ```

The last step is to update the Makefile for PyQt to build the python versions of the ui and qrc files. Append the relative paths of the new icons to the IMAGES variable in cadnano/gui/ui/Makefile, and then run make from inside the same directory.

PyQt displays .qrc PNGs, but not SVGs

I tried saving the SVGs directly into the qrc file. They display fine in Qt Creator, but do not work in when launching cadnano (only the text appeared). Maybe something worth revisiting with PyQt in the future, but for now I'm just exporting as PNGs like usual. Here's what it looks like in cadnano when it works. I didn't take a screenshot, but when it doens't work it looks similar but the icons are missing.


Future

This is just to get stuff working. Ultimately, the grid visibility should just be toggled with a single button. The grid layout (honeycomb vs square, etc.) can be a part property, per Nick's suggestion. Then, the grid appearance (line vs circle vs point) can be specified. For the sake of convenience, maybe all grid parameters should just be a part properties. (Then we can see which appearances people prefer based on how they save the files?)