Fixed default color in checkerboard extension

This commit is contained in:
leyghisbb 2020-08-30 11:24:48 +02:00
parent bd584e6b13
commit 6202a68d26
2 changed files with 35 additions and 47 deletions

View File

@ -1,47 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Checkerboard</name> <name>Checkerboard</name>
<id>fablabchemnitz.de.checkerboard</id> <id>fablabchemnitz.de.checkerboard</id>
<param name="tab" type="notebook"> <param name="tab" type="notebook">
<page name="params" gui-text="Params"> <page name="params" gui-text="Params">
<param name="size" type="string" gui-text="Cell size">50</param> <param name="size" type="string" gui-text="Cell size">50</param>
<param name="rows" type="int" min="0" max="1000" gui-text="Rows">10</param> <param name="rows" type="int" min="0" max="1000" gui-text="Rows">10</param>
<param name="cols" type="int" min="0" max="1000" gui-text="Columns">10</param> <param name="cols" type="int" min="0" max="1000" gui-text="Columns">10</param>
<param name="layer" type="bool" gui-text="Create in current layer">true</param> <param name="layer" type="bool" gui-text="Create in current layer">true</param>
</page> </page>
<page name="color1" gui-text="1st color"> <page name="color1" gui-text="1st color">
<param name="color1" type="color" gui-text="Color 1">#000000ff</param> <param name="color1" type="color" gui-text="Color 1">4286282751</param>
</page> </page>
<page name="color2" gui-text="2nd color"> <page name="color2" gui-text="2nd color">
<param name="color2" type="color" gui-text="Color 2">#ffffffff</param> <param name="color2" type="color" gui-text="Color 2">8092671</param>
</page> </page>
<page name="help" gui-text="Help"> <page name="help" gui-text="Help">
<param name="help_text" type="description">Create a checkerboard <label>1. On the Params tab, choose the cell size (size of the constituent squares), number of rows and columns, and whether to add the checkerboard to the current layer (if unchecked, the checkerboard will be added to the root layer)</label>
<label>2. On the 1st color and 2nd color tabs, select the colors for the two sets of squares</label>
1. On the Params tab, choose the cell size <label>3. Click Apply</label>
(size of the constituent squares), number <label>More information and source code:</label>
of rows and columns, and whether to add <label appearance="url">https://github.com/jeffkayser/inkscape-checkerboard</label>
the checkerboard to the current layer </page>
(if unchecked, the checkerboard will be </param>
added to the root layer) <effect>
2. On the 1st color and 2nd color tabs, <object-type>all</object-type>
select the colors for the two sets of <effects-menu>
squares
3. Click Apply
More information and source code:
https://github.com/jeffkayser/inkscape-checkerboard</param>
</page>
</param>
<effect>
<object-type>all</object-type>
<effects-menu>
<submenu name="FabLab Chemnitz"> <submenu name="FabLab Chemnitz">
<submenu name="Grids/Guides"/> <submenu name="Grids/Guides"/>
</submenu> </submenu>
</effects-menu> </effects-menu>
</effect> </effect>
<script> <script>
<command location="inx" interpreter="python">fablabchemnitz_checkerboard.py</command> <command location="inx" interpreter="python">fablabchemnitz_checkerboard.py</command>
</script> </script>
</inkscape-extension> </inkscape-extension>

View File

@ -21,7 +21,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
""" """
from gettext import gettext as _
import inkex import inkex
from lxml import etree from lxml import etree
import re import re
@ -66,8 +65,8 @@ class Checkerboard(inkex.Effect):
def __init__(self): def __init__(self):
inkex.Effect.__init__(self) inkex.Effect.__init__(self)
self.arg_parser.add_argument("--tab") self.arg_parser.add_argument("--tab")
self.arg_parser.add_argument("--color1", type=Color) self.arg_parser.add_argument("--color1", type=Color, default=4286282751)
self.arg_parser.add_argument("--color2", type=Color) self.arg_parser.add_argument("--color2", type=Color, default=8092671)
self.arg_parser.add_argument("--size") self.arg_parser.add_argument("--size")
self.arg_parser.add_argument("--rows", type=int) self.arg_parser.add_argument("--rows", type=int)
self.arg_parser.add_argument("--cols", type=int) self.arg_parser.add_argument("--cols", type=int)
@ -90,5 +89,4 @@ class Checkerboard(inkex.Effect):
x, y = self.svg.namedview.center[0] - cols * size / 2, self.svg.namedview.center[1] - rows * size / 2 x, y = self.svg.namedview.center[0] - cols * size / 2, self.svg.namedview.center[1] - rows * size / 2
draw_grid(x, y, rows, cols, size, color1, color2, group) draw_grid(x, y, rows, cols, size, color1, color2, group)
if __name__ == '__main__': Checkerboard().run()
Checkerboard().run()