-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work on documentation and the Inkscape extension.
- Loading branch information
Showing
3 changed files
with
129 additions
and
6 deletions.
There are no files selected for viewing
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,40 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Read in tiling.inx.in input file and inject Tessagon tiling types | ||
(to stdout). | ||
""" | ||
import os | ||
import sys | ||
|
||
THIS_DIR = os.path.dirname(os.path.realpath(__file__)) | ||
sys.path.append(THIS_DIR + '/../..') | ||
|
||
from tessagon.core.tessagon_discovery import TessagonDiscovery # noqa E402 | ||
|
||
|
||
class InxGenerate: | ||
def run(self): | ||
with open(THIS_DIR + '/tiling.inx.in') as f: | ||
for line in f: | ||
sys.stdout.write(line) | ||
if "Autogenerated tiling types start" in line: | ||
self.dump_tilings() | ||
|
||
def dump_tilings(self): | ||
# Create tiling menu with items in nice order | ||
find_tilings = TessagonDiscovery() | ||
tilings = find_tilings.with_classification('regular').to_list() + \ | ||
find_tilings.with_classification('archimedean').to_list() + \ | ||
find_tilings.with_classification('laves').to_list() + \ | ||
find_tilings.with_classification('non_edge').to_list() + \ | ||
find_tilings.with_classification('non_convex').to_list() | ||
|
||
template = ' <option value="{}">{}</option>\n' | ||
for tiling_class in tilings: | ||
metadata = tiling_class.metadata | ||
sys.stdout.write(template.format(tiling_class.__name__, | ||
metadata.name)) | ||
|
||
|
||
if __name__ == "__main__": | ||
InxGenerate().run() |
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,82 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> | ||
<name>Tiling</name> | ||
<id>math.tiling</id> | ||
<param name="tab" type="notebook"> | ||
|
||
<page name="basic" gui-text="Main options"> | ||
<param name="class_name" type="optiongroup" appearance="combo" | ||
gui-text="Tiling type:"> | ||
<!-- Autogenerated tiling types start --> | ||
<!-- Autogenerated tiling types end --> | ||
</param> | ||
<param name="x_num" type="int" min="1" max="10000" | ||
gui-text="Number of tiles in the X direction:">4</param> | ||
<param name="y_num" type="int" min="1" max="10000" | ||
gui-text="Number of tiles in the Y direction:">4</param> | ||
<param name="x_min" type="float" min="0.0" max="10000" | ||
gui-text="Lower X bounding box:">50.0</param> | ||
<param name="x_max" type="float" min="0.0" max="10000" | ||
gui-text="Upper X bounding box:">150.0</param> | ||
<param name="y_min" type="float" min="0.0" max="10000" | ||
gui-text="Lower Y bounding box:">50.0</param> | ||
<param name="y_max" type="float" min="0.0" max="10000" | ||
gui-text="Upper Y bounding box:">150.0</param> | ||
</page> | ||
|
||
<page name="stroke_options" gui-text="Stroke Options"> | ||
<param name="stroke_type_unit" type="optiongroup" | ||
appearance="combo" | ||
gui-text="Stroke Type / Unit:"> | ||
<option translatable="no" value="px">px</option> | ||
<option translatable="no" value="mm">mm</option> | ||
<option translatable="no" value="cm">cm</option> | ||
<option translatable="no" value="in">in</option> | ||
<option translatable="no" value="none">None</option> | ||
</param> | ||
<param name="stroke_width" type="float" min="0" max="1000" | ||
gui-text="Stroke Width:">1</param> | ||
<param name="stroke_color" type="color" appearance="colorbutton" | ||
gui-text="Stroke Color:">0x000000FF</param> | ||
</page> | ||
|
||
<page name="fill_options" gui-text="Fill Options"> | ||
<param name="fill_type" type="optiongroup" | ||
appearance="combo" | ||
gui-text="Fill Type:"> | ||
<option translatable="no" value="none">None</option> | ||
<option translatable="no" value="color">Single color (Color 1)</option> | ||
<option translatable="no" value="pattern">Color Pattern</option> | ||
</param> | ||
|
||
<param name="color_pattern" type="int" min="1" max="10" | ||
gui-text="Which color pattern to use:">1</param> | ||
|
||
<param name="color_1" type="color" appearance="colorbutton" | ||
gui-text="Color 1:">0xD7E3F4FF</param> | ||
<param name="color_2" type="color" appearance="colorbutton" | ||
gui-text="Color 2:">0xAFC6E9FF</param> | ||
<param name="color_3" type="color" appearance="colorbutton" | ||
gui-text="Color 3:">0x87AADEFF</param> | ||
<param name="color_4" type="color" appearance="colorbutton" | ||
gui-text="Color 4:">0x5F8DD3FF</param> | ||
<param name="color_5" type="color" appearance="colorbutton" | ||
gui-text="Color 5:">0x3771C8FF</param> | ||
<param name="color_6" type="color" appearance="colorbutton" | ||
gui-text="Color 6:">0x2C5AA0FF</param> | ||
<param name="color_7" type="color" appearance="colorbutton" | ||
gui-text="Color 7:">0x214478FF</param> | ||
<param name="color_8" type="color" appearance="colorbutton" | ||
gui-text="Color 8:">0x162D50FF</param> | ||
</page> | ||
</param> | ||
<effect> | ||
<object-type>all</object-type> | ||
<effects-menu> | ||
<submenu name="Render"/> | ||
</effects-menu> | ||
</effect> | ||
<script> | ||
<command location="inx" interpreter="python">tiling.py</command> | ||
</script> | ||
</inkscape-extension> |