diff --git a/extensions/fablabchemnitz_path_intersections.py b/extensions/fablabchemnitz_path_intersections.py
index 6d493c89..b15a9de9 100644
--- a/extensions/fablabchemnitz_path_intersections.py
+++ b/extensions/fablabchemnitz_path_intersections.py
@@ -17,6 +17,8 @@
# please, stick to pep8 formatting for this file
+# seems to be lost in year 2016 https://wiki.inkscape.org/wiki/index.php?title=Inkscape_Extensions&oldid=99881
+
"""
Migrator: Mario Voigt / FabLab Chemnitz
Mail: mario.voigt@stadtfabrikanten.org
@@ -307,13 +309,6 @@ class ErrorVisualization(object):
attrs = {"id": group_id, "style": "opacity:.5", inkex.addNS("label", "inkscape"): "Precut Errors"}
self.g = etree.SubElement(parent, inkex.addNS("g", "svg"), attrs)
- def getColorString(self, pickerColor):
- longcolor = int(pickerColor)
- if longcolor < 0:
- longcolor = longcolor & 0xFFFFFFFF
- return '#' + format(longcolor >> 8, '06X')
-
-
def fmt_point(self, point):
return "%s %s" % point
@@ -330,7 +325,7 @@ class ErrorVisualization(object):
path.append("M%s" % self.fmt_point(head))
for point in tail:
path.append("L%s" % self.fmt_point(point))
- attrs = {"d": " ".join(path), "style": "stroke:%s;stroke-width:5px;" % self.getColorString(self.color)}
+ attrs = {"d": " ".join(path), "style": "stroke:%s;stroke-width:5px;" % self.color}
etree.SubElement(self.g, inkex.addNS("path", "svg"), attrs)
def vis_point(geom):
diff --git a/extensions/fablabchemnitz_render_sudoku.inx b/extensions/fablabchemnitz_render_sudoku.inx
index a417ef59..c3a46026 100644
--- a/extensions/fablabchemnitz_render_sudoku.inx
+++ b/extensions/fablabchemnitz_render_sudoku.inx
@@ -26,11 +26,11 @@
1
- 0
- -1
- 0
- 0
- -791621617
+ 255
+ 4243148799
+ 2290779647
+ 3298820351
+ 1923076095
diff --git a/extensions/fablabchemnitz_render_sudoku.py b/extensions/fablabchemnitz_render_sudoku.py
index 9eaeecf5..4e23bf30 100644
--- a/extensions/fablabchemnitz_render_sudoku.py
+++ b/extensions/fablabchemnitz_render_sudoku.py
@@ -27,6 +27,7 @@ __version__ = "0.1"
import inkex
import subprocess
from lxml import etree
+from inkex import Color
class SVGSudoku (inkex.Effect):
@@ -38,19 +39,13 @@ class SVGSudoku (inkex.Effect):
self.arg_parser.add_argument("--cols", type=int, default=1, help='Number of puzzle columns.')
self.arg_parser.add_argument("--puzzle_size", type=int, default=6, help='The width & height of each puzzle.')
self.arg_parser.add_argument("--puzzle_gap", type=int, default=1, help='The space between puzzles.')
- self.arg_parser.add_argument("--color_text", type=int, default=0, help='Color for given numbers.')
- self.arg_parser.add_argument("--color_bkgnd", type=int, default=-1, help='Color for the puzzle background.')
- self.arg_parser.add_argument("--color_puzzle",default=0, help='Border color for the puzzles.')
- self.arg_parser.add_argument("--color_boxes", default=0, help='Border color for puzzle boxes.')
- self.arg_parser.add_argument("--color_cells", default=-1061109505, help='Border color for the puzzle cells.')
+ self.arg_parser.add_argument("--color_text", type=Color, default=255, help='Color for given numbers.')
+ self.arg_parser.add_argument("--color_bkgnd", type=Color, default=4243148799, help='Color for the puzzle background.')
+ self.arg_parser.add_argument("--color_puzzle",type=Color, default=2290779647, help='Border color for the puzzles.')
+ self.arg_parser.add_argument("--color_boxes", type=Color, default=3298820351, help='Border color for puzzle boxes.')
+ self.arg_parser.add_argument("--color_cells", type=Color, default=1923076095, help='Border color for the puzzle cells.')
self.arg_parser.add_argument("--units", help="The unit of the dimensions")
- def getColorString(self, pickerColor):
- longcolor = int(pickerColor)
- if longcolor < 0:
- longcolor = longcolor & 0xFFFFFFFF
- return '#' + format(longcolor >> 8, '06X')
-
def draw_grid(self, g_puz, x, y):
bkgnd_style = {'stroke':'none', 'stroke-width':'2', 'fill':self.options.color_bkgnd }
puzzle_style = {'stroke':self.options.color_puzzle, 'stroke-width':'2', 'fill':'none' }
@@ -97,15 +92,7 @@ class SVGSudoku (inkex.Effect):
args.extend(["--difficulty", self.options.difficulty])
data = subprocess.Popen(args, stdout=subprocess.PIPE).communicate()[0].splitlines()
#inkex.utils.debug(data)
- #
- # convert colors
- #inkex.utils.debug("%s"%(self.options.color_cells))
- self.options.color_text = self.getColorString(self.options.color_text)
- self.options.color_bkgnd = self.getColorString(self.options.color_bkgnd)
- self.options.color_puzzle = self.getColorString(self.options.color_puzzle)
- self.options.color_boxes = self.getColorString(self.options.color_boxes)
- self.options.color_cells = self.getColorString(self.options.color_cells)
- #
+
parent = self.document.getroot()
self.doc_w = self.svg.unittouu(parent.get('width'))
self.doc_h = self.svg.unittouu(parent.get('height'))
diff --git a/extensions/fablabchemnitz_sheet_conus.inx b/extensions/fablabchemnitz_sheet_conus.inx
index ab1dd6d1..0edf4b11 100644
--- a/extensions/fablabchemnitz_sheet_conus.inx
+++ b/extensions/fablabchemnitz_sheet_conus.inx
@@ -17,7 +17,7 @@
Constructs a flat pattern projection (sheet cutting layout)
that can be rolled or bent into a cone or frustum (truncated cone).
If Cut diameter=0 then cone will not be truncated.
- 0
+ 255
all
diff --git a/extensions/fablabchemnitz_sheet_conus.py b/extensions/fablabchemnitz_sheet_conus.py
index bd8aa77c..e4068c59 100644
--- a/extensions/fablabchemnitz_sheet_conus.py
+++ b/extensions/fablabchemnitz_sheet_conus.py
@@ -7,6 +7,7 @@ import inkex
from copy import deepcopy
from lxml import etree
from inkex.transforms import Transform
+from inkex import Color
# Helper functions
def calc_angle_between_points(p1, p2):
@@ -56,24 +57,15 @@ class SheetMetalConus(inkex.Effect):
'marker-end' : 'url(#ArrowDIN-end)' }
def __init__(self):
- """ Parses the command line options ( Base diameter, cut diameter and height of cone).
- """
inkex.Effect.__init__(self) # Call the base class constructor.
- # Describe parameters
self.arg_parser.add_argument('-b', '--diaBase', type = float, dest = 'diaBase', default = 300.0, help = 'The diameter of the cones base.')
self.arg_parser.add_argument('-c', '--diaCut', type = float, default = 100.0, help = 'The diameter of cones cut (0.0 if cone is not cut.')
self.arg_parser.add_argument('-l', '--heightCone', type = float, default = 200.0, help = 'The height of the (cut) cone.')
self.arg_parser.add_argument('-u', '--units', default = 'mm', help = 'The units in which the cone values are given. mm or in for real objects')
self.arg_parser.add_argument('-w', '--strokeWidth', type = float, default = 0.3, help = 'The line thickness in given unit. For laser cutting it should be rather small.')
- self.arg_parser.add_argument('-f', '--strokeColour', default = 896839168, help = 'The line colour.')
+ self.arg_parser.add_argument('-f', '--strokeColour', type=Color, default = 255, help = 'The line colour.')
self.arg_parser.add_argument('-d', '--verbose', type = inkex.Boolean, default = False, help = 'Enable verbose output of calculated parameters. Used for debugging or is someone needs the calculated values.')
- def getColorString(self, pickerColor):
- longcolor = int(pickerColor)
- if longcolor < 0:
- longcolor = longcolor & 0xFFFFFFFF
- return '#' + format(longcolor >> 8, '06X')
-
# Marker arrows
def makeMarkerstyle(self, name, rotate):
" Markers added to defs for reuse "
@@ -229,9 +221,7 @@ class SheetMetalConus(inkex.Effect):
- Overrides base class' method and draws rolled out sheet metal cone into SVG document.
"""
# calc scene scale
- convFactor = self.svg.unittouu("1" + self.options.units)
- # convert color
- self.options.strokeColour = self.getColorString(self.options.strokeColour)
+ convFactor = self.svg.unittouu("1" + self.options.units)
# Store all the relevants values in a dictionary for easy access
dictCone={'diaBase': self.options.diaBase,
'diaCut': self.options.diaCut,
@@ -437,6 +427,4 @@ class SheetMetalConus(inkex.Effect):
text.text = "%4.3f" %(base_dia)
text.transform = Transform(frustrum_repos) * text.transform
-# Create effect instance and apply it.
-effect = SheetMetalConus()
-effect.run()
\ No newline at end of file
+SheetMetalConus().run()
\ No newline at end of file