From 038875f876d79d0f1e971886fe42f5bee4f9f31e Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 21 Aug 2018 20:32:50 -0400 Subject: autopep8 --- lib/extensions/__init__.py | 2 +- lib/extensions/base.py | 12 +++--- lib/extensions/convert_to_satin.py | 27 ++++++------ lib/extensions/flip.py | 1 + lib/extensions/input.py | 11 +++-- lib/extensions/install.py | 16 ++++---- lib/extensions/layer_commands.py | 20 ++++----- lib/extensions/object_commands.py | 58 +++++++++++++------------- lib/extensions/output.py | 1 + lib/extensions/print_pdf.py | 84 +++++++++++++++++++------------------- 10 files changed, 116 insertions(+), 116 deletions(-) (limited to 'lib/extensions') diff --git a/lib/extensions/__init__.py b/lib/extensions/__init__.py index 1606795c..b865db4c 100644 --- a/lib/extensions/__init__.py +++ b/lib/extensions/__init__.py @@ -19,4 +19,4 @@ for item in locals().values(): if inspect.isclass(item) and \ issubclass(item, InkstitchExtension) and \ item is not InkstitchExtension: - extensions.append(item) + extensions.append(item) diff --git a/lib/extensions/base.py b/lib/extensions/base.py index 1794b68c..07eaa40c 100644 --- a/lib/extensions/base.py +++ b/lib/extensions/base.py @@ -109,11 +109,11 @@ class InkstitchExtension(inkex.Effect): g.set("style", "display:none") def no_elements_error(self): - if self.selected: - inkex.errormsg(_("No embroiderable paths selected.")) - else: - inkex.errormsg(_("No embroiderable paths found in document.")) - inkex.errormsg(_("Tip: use Path -> Object to Path to convert non-paths.")) + if self.selected: + inkex.errormsg(_("No embroiderable paths selected.")) + else: + inkex.errormsg(_("No embroiderable paths found in document.")) + inkex.errormsg(_("Tip: use Path -> Object to Path to convert non-paths.")) def descendants(self, node, selected=False): nodes = [] @@ -176,7 +176,6 @@ class InkstitchExtension(inkex.Effect): return classes - def get_elements(self): self.elements = [] for node in self.get_nodes(): @@ -212,7 +211,6 @@ class InkstitchExtension(inkex.Effect): return svg_filename - def parse(self): """Override inkex.Effect to add Ink/Stitch xml namespace""" diff --git a/lib/extensions/convert_to_satin.py b/lib/extensions/convert_to_satin.py index dd5a9bc2..d27e42cc 100644 --- a/lib/extensions/convert_to_satin.py +++ b/lib/extensions/convert_to_satin.py @@ -51,7 +51,9 @@ class ConvertToSatin(InkstitchExtension): try: rails, rungs = self.path_to_satin(path, element.stroke_width, style_args) except SelfIntersectionError: - inkex.errormsg(_("Cannot convert %s to a satin column because it intersects itself. Try breaking it up into multiple paths.") % element.node.get('id')) + inkex.errormsg( + _("Cannot convert %s to a satin column because it intersects itself. Try breaking it up into multiple paths.") % + element.node.get('id')) # revert any changes we've made self.document = deepcopy(self.original_document) @@ -84,7 +86,7 @@ class ConvertToSatin(InkstitchExtension): """Convert svg line join style to shapely parallel offset arguments.""" args = { - 'join_style': shgeo.JOIN_STYLE.round + 'join_style': shgeo.JOIN_STYLE.round } element_join_style = element.get_style('stroke-linejoin') @@ -113,7 +115,7 @@ class ConvertToSatin(InkstitchExtension): # path intersects itself, when taking its stroke width into consideration. See # the last example for parallel_offset() in the Shapely documentation: # https://shapely.readthedocs.io/en/latest/manual.html#object.parallel_offset - raise SelfIntersectionError() + raise SelfIntersectionError() # for whatever reason, shapely returns a right-side offset's coordinates in reverse left_rail = list(left_rail.coords) @@ -244,7 +246,7 @@ class ConvertToSatin(InkstitchExtension): # millimeters before this one. if last_rung_center is not None and \ (rung_center - last_rung_center).length() < 2 * PIXELS_PER_MM: - continue + continue else: last_rung_center = rung_center @@ -269,7 +271,6 @@ class ConvertToSatin(InkstitchExtension): return rungs - def satin_to_svg_node(self, rails, rungs, correction_transform): d = "" for path in chain(rails, rungs): @@ -279,11 +280,11 @@ class ConvertToSatin(InkstitchExtension): d += " " return inkex.etree.Element(SVG_PATH_TAG, - { - "id": self.uniqueId("path"), - "style": "stroke:#000000;stroke-width:1px;fill:none", - "transform": correction_transform, - "d": d, - "embroider_satin_column": "true", - } - ) + { + "id": self.uniqueId("path"), + "style": "stroke:#000000;stroke-width:1px;fill:none", + "transform": correction_transform, + "d": d, + "embroider_satin_column": "true", + } + ) diff --git a/lib/extensions/flip.py b/lib/extensions/flip.py index d8d78cb5..5bea510f 100644 --- a/lib/extensions/flip.py +++ b/lib/extensions/flip.py @@ -7,6 +7,7 @@ from .base import InkstitchExtension from ..i18n import _ from ..elements import SatinColumn + class Flip(InkstitchExtension): def subpath_to_linestring(self, subpath): return shgeo.LineString() diff --git a/lib/extensions/input.py b/lib/extensions/input.py index cb5ac452..e450bef6 100644 --- a/lib/extensions/input.py +++ b/lib/extensions/input.py @@ -28,12 +28,11 @@ class Input(object): trim=(command == pyembroidery.TRIM)) extents = stitch_plan.extents - svg = etree.Element("svg", nsmap=inkex.NSS, attrib= - { - "width": str(extents[0] * 2), - "height": str(extents[1] * 2), - "viewBox": "0 0 %s %s" % (extents[0] * 2, extents[1] * 2), - }) + svg = etree.Element("svg", nsmap=inkex.NSS, attrib={ + "width": str(extents[0] * 2), + "height": str(extents[1] * 2), + "viewBox": "0 0 %s %s" % (extents[0] * 2, extents[1] * 2), + }) render_stitch_plan(svg, stitch_plan) # rename the Stitch Plan layer so that it doesn't get overwritten by Embroider diff --git a/lib/extensions/install.py b/lib/extensions/install.py index 42a92113..2863bef0 100644 --- a/lib/extensions/install.py +++ b/lib/extensions/install.py @@ -28,22 +28,21 @@ class InstallerFrame(wx.Frame): text_sizer = wx.BoxSizer(wx.HORIZONTAL) text = _('Ink/Stitch can install files ("add-ons") that make it easier to use Inkscape to create machine embroidery designs. These add-ons will be installed:') + \ - "\n\n • " + _("thread manufacturer color palettes") + \ - "\n • " + _("Ink/Stitch visual commands (Object -> Symbols...)") + "\n\n • " + _("thread manufacturer color palettes") + "\n • " + _("Ink/Stitch visual commands (Object -> Symbols...)") static_text = wx.StaticText(panel, label=text) font = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL) static_text.SetFont(font) - text_sizer.Add(static_text, proportion=0, flag=wx.ALL|wx.EXPAND, border=10) - sizer.Add(text_sizer, proportion=3, flag=wx.ALL|wx.EXPAND, border=0) + text_sizer.Add(static_text, proportion=0, flag=wx.ALL | wx.EXPAND, border=10) + sizer.Add(text_sizer, proportion=3, flag=wx.ALL | wx.EXPAND, border=0) buttons_sizer = wx.BoxSizer(wx.HORIZONTAL) install_button = wx.Button(panel, wx.ID_ANY, _("Install")) install_button.SetBitmap(wx.ArtProvider.GetBitmap(wx.ART_TICK_MARK)) - buttons_sizer.Add(install_button, proportion=0, flag=wx.ALIGN_RIGHT|wx.ALL, border=5) + buttons_sizer.Add(install_button, proportion=0, flag=wx.ALIGN_RIGHT | wx.ALL, border=5) cancel_button = wx.Button(panel, wx.ID_CANCEL, _("Cancel")) - buttons_sizer.Add(cancel_button, proportion=0, flag=wx.ALIGN_RIGHT|wx.ALL, border=5) - sizer.Add(buttons_sizer, proportion=1, flag=wx.ALIGN_RIGHT|wx.ALIGN_BOTTOM) + buttons_sizer.Add(cancel_button, proportion=0, flag=wx.ALIGN_RIGHT | wx.ALL, border=5) + sizer.Add(buttons_sizer, proportion=1, flag=wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM) panel.SetSizer(sizer) panel.Layout() @@ -63,7 +62,7 @@ class InstallerFrame(wx.Frame): try: self.install_addons('palettes') self.install_addons('symbols') - except Exception, e: + except Exception as e: wx.MessageDialog(self, _('Inkscape add-on installation failed') + ': \n' + traceback.format_exc(), _('Installation Failed'), @@ -97,6 +96,7 @@ class InstallerFrame(wx.Frame): for palette_file in files: shutil.copy(palette_file, dest) + class Install(inkex.Effect): def effect(self): app = wx.App() diff --git a/lib/extensions/layer_commands.py b/lib/extensions/layer_commands.py index 576af044..b9be2b27 100644 --- a/lib/extensions/layer_commands.py +++ b/lib/extensions/layer_commands.py @@ -36,15 +36,15 @@ class LayerCommands(CommandsExtension): self.ensure_symbol(command) node = inkex.etree.SubElement(self.current_layer, SVG_USE_TAG, - { - "id": self.uniqueId("use"), - INKSCAPE_LABEL: _("Ink/Stitch Command") + ": %s" % get_command_description(command), - XLINK_HREF: "#inkstitch_%s" % command, - "height": "100%", - "width": "100%", - "x": str(i * 20), - "y": "-10", - "transform": correction_transform - }) + { + "id": self.uniqueId("use"), + INKSCAPE_LABEL: _("Ink/Stitch Command") + ": %s" % get_command_description(command), + XLINK_HREF: "#inkstitch_%s" % command, + "height": "100%", + "width": "100%", + "x": str(i * 20), + "y": "-10", + "transform": correction_transform + }) namedview = self.document.xpath("//sodipodi:namedview", namespaces=inkex.NSS) diff --git a/lib/extensions/object_commands.py b/lib/extensions/object_commands.py index e9ee6063..483f2a0a 100644 --- a/lib/extensions/object_commands.py +++ b/lib/extensions/object_commands.py @@ -24,18 +24,18 @@ class ObjectCommands(CommandsExtension): end_pos = element.shape.centroid path = inkex.etree.Element(SVG_PATH_TAG, - { - "id": self.uniqueId("connector"), - "d": "M %s,%s %s,%s" % (start_pos[0], start_pos[1], end_pos.x, end_pos.y), - "style": "stroke:#000000;stroke-width:1px;stroke-opacity:0.5;fill:none;", - CONNECTION_START: "#%s" % symbol.get('id'), - CONNECTION_END: "#%s" % element.node.get('id'), - CONNECTOR_TYPE: "polyline", - - # l10n: the name of the line that connects a command to the object it applies to - INKSCAPE_LABEL: _("connector") - } - ) + { + "id": self.uniqueId("connector"), + "d": "M %s,%s %s,%s" % (start_pos[0], start_pos[1], end_pos.x, end_pos.y), + "style": "stroke:#000000;stroke-width:1px;stroke-opacity:0.5;fill:none;", + CONNECTION_START: "#%s" % symbol.get('id'), + CONNECTION_END: "#%s" % element.node.get('id'), + CONNECTOR_TYPE: "polyline", + + # l10n: the name of the line that connects a command to the object it applies to + INKSCAPE_LABEL: _("connector") + } + ) symbol.getparent().insert(0, path) @@ -75,26 +75,26 @@ class ObjectCommands(CommandsExtension): pos = self.get_command_pos(element, i, len(commands)) group = inkex.etree.SubElement(element.node.getparent(), SVG_GROUP_TAG, - { - "id": self.uniqueId("group"), - INKSCAPE_LABEL: _("Ink/Stitch Command") + ": %s" % get_command_description(command), - "transform": get_correction_transform(element.node) - } + { + "id": self.uniqueId("group"), + INKSCAPE_LABEL: _("Ink/Stitch Command") + ": %s" % get_command_description(command), + "transform": get_correction_transform(element.node) + } ) symbol = inkex.etree.SubElement(group, SVG_USE_TAG, - { - "id": self.uniqueId("use"), - XLINK_HREF: "#inkstitch_%s" % command, - "height": "100%", - "width": "100%", - "x": str(pos.x), - "y": str(pos.y), - - # l10n: the name of a command symbol (example: scissors icon for trim command) - INKSCAPE_LABEL: _("command marker"), - } - ) + { + "id": self.uniqueId("use"), + XLINK_HREF: "#inkstitch_%s" % command, + "height": "100%", + "width": "100%", + "x": str(pos.x), + "y": str(pos.y), + + # l10n: the name of a command symbol (example: scissors icon for trim command) + INKSCAPE_LABEL: _("command marker"), + } + ) self.add_connector(symbol, element) diff --git a/lib/extensions/output.py b/lib/extensions/output.py index f3bb0a80..090cd3a9 100644 --- a/lib/extensions/output.py +++ b/lib/extensions/output.py @@ -11,6 +11,7 @@ from ..stitch_plan import patches_to_stitch_plan from ..svg import render_stitch_plan, PIXELS_PER_MM from ..utils.io import save_stdout + class Output(InkstitchExtension): def __init__(self, *args, **kwargs): InkstitchExtension.__init__(self) diff --git a/lib/extensions/print_pdf.py b/lib/extensions/print_pdf.py index 6e2eff58..ee3dc316 100644 --- a/lib/extensions/print_pdf.py +++ b/lib/extensions/print_pdf.py @@ -44,7 +44,7 @@ def load_defaults(): with open(defaults_path(), 'r') as defaults_file: defaults = json.load(defaults_file) return defaults - except: + except BaseException: return {} @@ -196,11 +196,11 @@ class PrintPreviewServer(Thread): threads = [] for color_block in self.stitch_plan: threads.append({ - 'hex': color_block.color.hex_digits, - 'name': color_block.color.name, - 'manufacturer': color_block.color.manufacturer, - 'number': color_block.color.number, - }) + 'hex': color_block.color.hex_digits, + 'name': color_block.color.name, + 'manufacturer': color_block.color.manufacturer, + 'number': color_block.color.number, + }) return jsonify(threads) @@ -225,10 +225,10 @@ class PrintPreviewServer(Thread): break if self.last_request_time is not None and \ - (time.time() - self.last_request_time) > 3: - self.stop() - break - except: + (time.time() - self.last_request_time) > 3: + self.stop() + break + except BaseException: # seems like sometimes this thread blows up during shutdown pass @@ -244,7 +244,7 @@ class PrintPreviewServer(Thread): while True: try: self.app.run(self.host, self.port, threaded=True) - except socket.error, e: + except socket.error as e: if e.errno == errno.EADDRINUSE: self.port += 1 continue @@ -265,11 +265,11 @@ class PrintInfoFrame(wx.Frame): text = wx.StaticText(panel, label=_("A print preview has been opened in your web browser. This window will stay open in order to communicate with the JavaScript code running in your browser.\n\nThis window will close after you close the print preview in your browser, or you can close it manually if necessary.")) font = wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.NORMAL) text.SetFont(font) - sizer.Add(text, proportion=1, flag=wx.ALL|wx.EXPAND, border=20) + sizer.Add(text, proportion=1, flag=wx.ALL | wx.EXPAND, border=20) stop_button = wx.Button(panel, id=wx.ID_CLOSE) stop_button.Bind(wx.EVT_BUTTON, self.close_button_clicked) - sizer.Add(stop_button, proportion=0, flag=wx.ALIGN_CENTER|wx.ALL, border=10) + sizer.Add(stop_button, proportion=0, flag=wx.ALIGN_CENTER | wx.ALL, border=10) panel.SetSizer(sizer) panel.Layout() @@ -289,13 +289,13 @@ class PrintInfoFrame(wx.Frame): class Print(InkstitchExtension): def build_environment(self): - if getattr( sys, 'frozen', False ) : + if getattr(sys, 'frozen', False): template_dir = os.path.join(sys._MEIPASS, "print", "templates") else: template_dir = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..", "print", "templates")) env = Environment( - loader = FileSystemLoader(template_dir), + loader=FileSystemLoader(template_dir), autoescape=select_autoescape(['html', 'xml']), extensions=['jinja2.ext.i18n'] ) @@ -308,8 +308,8 @@ class Print(InkstitchExtension): def strip_namespaces(self, svg): # namespace prefixes seem to trip up HTML, so get rid of them for element in svg.iter(): - if element.tag[0]=='{': - element.tag = element.tag[element.tag.index('}',1) + 1:] + if element.tag[0] == '{': + element.tag = element.tag[element.tag.index('}', 1) + 1:] def render_svgs(self, stitch_plan, realistic=False): svg = deepcopy(self.document).getroot() @@ -352,25 +352,25 @@ class Print(InkstitchExtension): template = env.get_template('index.html') return template.render( - view = {'client_overview': False, 'client_detailedview': False, 'operator_overview': True, 'operator_detailedview': True}, - logo = {'src' : '', 'title' : 'LOGO'}, - date = date.today(), - client = "", - job = { - 'title': '', - 'num_colors': stitch_plan.num_colors, - 'num_color_blocks': len(stitch_plan), - 'num_stops': stitch_plan.num_stops, - 'num_trims': stitch_plan.num_trims, - 'dimensions': stitch_plan.dimensions_mm, - 'num_stitches': stitch_plan.num_stitches, - 'estimated_time': '', # TODO - 'estimated_thread': '', # TODO - }, - svg_overview = overview_svg, - color_blocks = stitch_plan.color_blocks, - palettes = ThreadCatalog().palette_names(), - selected_palette = selected_palette, + view={'client_overview': False, 'client_detailedview': False, 'operator_overview': True, 'operator_detailedview': True}, + logo={'src': '', 'title': 'LOGO'}, + date=date.today(), + client="", + job={ + 'title': '', + 'num_colors': stitch_plan.num_colors, + 'num_color_blocks': len(stitch_plan), + 'num_stops': stitch_plan.num_stops, + 'num_trims': stitch_plan.num_trims, + 'dimensions': stitch_plan.dimensions_mm, + 'num_stitches': stitch_plan.num_stitches, + 'estimated_time': '', # TODO + 'estimated_thread': '', # TODO + }, + svg_overview=overview_svg, + color_blocks=stitch_plan.color_blocks, + palettes=ThreadCatalog().palette_names(), + selected_palette=selected_palette, ) def effect(self): @@ -396,12 +396,12 @@ class Print(InkstitchExtension): html = self.render_html(stitch_plan, overview_svg, palette) print_server = PrintPreviewServer( - html=html, - metadata=self.get_inkstitch_metadata(), - stitch_plan=stitch_plan, - realistic_overview_svg=realistic_overview_svg, - realistic_color_block_svgs=realistic_color_block_svgs - ) + html=html, + metadata=self.get_inkstitch_metadata(), + stitch_plan=stitch_plan, + realistic_overview_svg=realistic_overview_svg, + realistic_color_block_svgs=realistic_color_block_svgs + ) print_server.start() time.sleep(1) -- cgit v1.3.1 From 94f391ab4262b5e1c8dace0263467a0ec1f17058 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 21 Aug 2018 20:50:14 -0400 Subject: more pep8 fixes --- lib/elements/fill.py | 3 +- lib/elements/satin_column.py | 5 ++- lib/elements/stroke.py | 4 +- lib/extensions/install.py | 6 ++- lib/extensions/print_pdf.py | 5 ++- lib/stitch_plan/stitch_plan.py | 4 +- lib/stitches/fill.py | 2 +- messages.po | 96 +++++++++++++++++++++--------------------- stub.py | 3 +- 9 files changed, 69 insertions(+), 59 deletions(-) (limited to 'lib/extensions') diff --git a/lib/elements/fill.py b/lib/elements/fill.py index 672f4db8..77284414 100644 --- a/lib/elements/fill.py +++ b/lib/elements/fill.py @@ -44,7 +44,8 @@ class Fill(EmbroideryElement): @param( 'flip', _('Flip fill (start right-to-left)'), - tooltip=_('The flip option can help you with routing your stitch path. When you enable flip, stitching goes from right-to-left instead of left-to-right.'), + tooltip=_('The flip option can help you with routing your stitch path. ' + 'When you enable flip, stitching goes from right-to-left instead of left-to-right.'), type='boolean', default=False) def flip(self): diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py index e13e1118..9927a606 100644 --- a/lib/elements/satin_column.py +++ b/lib/elements/satin_column.py @@ -42,7 +42,8 @@ class SatinColumn(EmbroideryElement): @param( 'pull_compensation_mm', _('Pull compensation'), - tooltip=_('Satin stitches pull the fabric together, resulting in a column narrower than you draw in Inkscape. This setting expands each pair of needle penetrations outward from the center of the satin column.'), + tooltip=_('Satin stitches pull the fabric together, resulting in a column narrower than you draw in Inkscape. ' + 'This setting expands each pair of needle penetrations outward from the center of the satin column.'), unit='mm', type='float', default=0) @@ -174,7 +175,7 @@ class SatinColumn(EmbroideryElement): # handle null intersections here? linestrings = shops.split(rail, rungs) - #print >> dbg, "rails and rungs", [str(rail) for rail in rails], [str(rung) for rung in rungs] + # print >> dbg, "rails and rungs", [str(rail) for rail in rails], [str(rung) for rung in rungs] if len(linestrings.geoms) < len(rungs.geoms) + 1: self.fatal(_("satin column: One or more of the rungs doesn't intersect both rails.") + " " + _("Each rail should intersect both rungs once.")) diff --git a/lib/elements/stroke.py b/lib/elements/stroke.py index 183ef23b..3ae2b143 100644 --- a/lib/elements/stroke.py +++ b/lib/elements/stroke.py @@ -41,7 +41,9 @@ class Stroke(EmbroideryElement): @param( 'bean_stitch_repeats', _('Bean stitch number of repeats'), - tooltip=_('Backtrack each stitch this many times. A value of 1 would triple each stitch (forward, back, forward). A value of 2 would quintuple each stitch, etc. Only applies to running stitch.'), + tooltip=_('Backtrack each stitch this many times. ' + 'A value of 1 would triple each stitch (forward, back, forward). ' + 'A value of 2 would quintuple each stitch, etc. Only applies to running stitch.'), type='int', default=0, sort_index=2) diff --git a/lib/extensions/install.py b/lib/extensions/install.py index 2863bef0..0745eddc 100644 --- a/lib/extensions/install.py +++ b/lib/extensions/install.py @@ -27,8 +27,10 @@ class InstallerFrame(wx.Frame): text_sizer = wx.BoxSizer(wx.HORIZONTAL) - text = _('Ink/Stitch can install files ("add-ons") that make it easier to use Inkscape to create machine embroidery designs. These add-ons will be installed:') + \ - "\n\n • " + _("thread manufacturer color palettes") + "\n • " + _("Ink/Stitch visual commands (Object -> Symbols...)") + text = (_('Ink/Stitch can install files ("add-ons") that make it easier to use Inkscape to create machine embroidery designs. ' + 'These add-ons will be installed:') + + "\n\n • " + _("thread manufacturer color palettes") + + "\n • " + _("Ink/Stitch visual commands (Object -> Symbols...)")) static_text = wx.StaticText(panel, label=text) font = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL) diff --git a/lib/extensions/print_pdf.py b/lib/extensions/print_pdf.py index ee3dc316..90ca83ae 100644 --- a/lib/extensions/print_pdf.py +++ b/lib/extensions/print_pdf.py @@ -262,7 +262,10 @@ class PrintInfoFrame(wx.Frame): panel = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) - text = wx.StaticText(panel, label=_("A print preview has been opened in your web browser. This window will stay open in order to communicate with the JavaScript code running in your browser.\n\nThis window will close after you close the print preview in your browser, or you can close it manually if necessary.")) + message = _("A print preview has been opened in your web browser. " + "This window will stay open in order to communicate with the JavaScript code running in your browser.\n\n" + "This window will close after you close the print preview in your browser, or you can close it manually if necessary.") + text = wx.StaticText(panel, label=message) font = wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.NORMAL) text.SetFont(font) sizer.Add(text, proportion=1, flag=wx.ALL | wx.EXPAND, border=20) diff --git a/lib/stitch_plan/stitch_plan.py b/lib/stitch_plan/stitch_plan.py index 682ea09f..c713b42e 100644 --- a/lib/stitch_plan/stitch_plan.py +++ b/lib/stitch_plan/stitch_plan.py @@ -209,8 +209,8 @@ class ColorBlock(object): # Don't consider jumps, stops, color changes, or trims as candidates for filtering pass else: - l = (stitch - stitches[-1]).length() - if l <= 0.1 * PIXELS_PER_MM: + length = (stitch - stitches[-1]).length() + if length <= 0.1 * PIXELS_PER_MM: # duplicate stitch, skip this one continue diff --git a/lib/stitches/fill.py b/lib/stitches/fill.py index ac8b52ee..b6b97e1b 100644 --- a/lib/stitches/fill.py +++ b/lib/stitches/fill.py @@ -120,7 +120,7 @@ def intersect_region_with_grating(shape, angle, row_spacing, end_row_spacing=Non height = abs(end - start) - #print >> dbg, "grating:", start, end, height, row_spacing, end_row_spacing + # print >> dbg, "grating:", start, end, height, row_spacing, end_row_spacing # offset start slightly so that rows are always an even multiple of # row_spacing_px from the origin. This makes it so that abutting diff --git a/messages.po b/messages.po index a5abfb66..94de4c34 100644 --- a/messages.po +++ b/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-08-21 20:32-0400\n" +"POT-Creation-Date: 2018-08-21 20:50-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -156,35 +156,35 @@ msgid "" "enable flip, stitching goes from right-to-left instead of left-to-right." msgstr "" -#: lib/elements/fill.py:55 +#: lib/elements/fill.py:56 msgid "Spacing between rows" msgstr "" -#: lib/elements/fill.py:56 +#: lib/elements/fill.py:57 msgid "Distance between rows of stitches." msgstr "" -#: lib/elements/fill.py:69 +#: lib/elements/fill.py:70 msgid "Maximum fill stitch length" msgstr "" -#: lib/elements/fill.py:70 +#: lib/elements/fill.py:71 msgid "" "The length of each stitch in a row. Shorter stitch may be used at the " "start or end of a row." msgstr "" -#: lib/elements/fill.py:79 +#: lib/elements/fill.py:80 msgid "Stagger rows this many times before repeating" msgstr "" -#: lib/elements/fill.py:80 +#: lib/elements/fill.py:81 msgid "" "Setting this dictates how many rows apart the stitches will be before " "they fall in the same column position." msgstr "" -#: lib/elements/fill.py:113 +#: lib/elements/fill.py:114 #, python-format msgid "" "shape %s is so small that it cannot be filled with stitches. Please make" @@ -203,7 +203,7 @@ msgstr "" msgid "\"E\" stitch" msgstr "" -#: lib/elements/satin_column.py:32 lib/elements/stroke.py:53 +#: lib/elements/satin_column.py:32 lib/elements/stroke.py:55 msgid "Zig-zag spacing (peak-to-peak)" msgstr "" @@ -222,93 +222,93 @@ msgid "" "penetrations outward from the center of the satin column." msgstr "" -#: lib/elements/satin_column.py:56 +#: lib/elements/satin_column.py:57 msgid "Contour underlay" msgstr "" -#: lib/elements/satin_column.py:56 lib/elements/satin_column.py:63 -#: lib/elements/satin_column.py:72 +#: lib/elements/satin_column.py:57 lib/elements/satin_column.py:64 +#: lib/elements/satin_column.py:73 msgid "Contour Underlay" msgstr "" -#: lib/elements/satin_column.py:63 lib/elements/satin_column.py:87 +#: lib/elements/satin_column.py:64 lib/elements/satin_column.py:88 msgid "Stitch length" msgstr "" -#: lib/elements/satin_column.py:69 +#: lib/elements/satin_column.py:70 msgid "Contour underlay inset amount" msgstr "" -#: lib/elements/satin_column.py:70 +#: lib/elements/satin_column.py:71 msgid "" "Shrink the outline, to prevent the underlay from showing around the " "outside of the satin column." msgstr "" -#: lib/elements/satin_column.py:80 +#: lib/elements/satin_column.py:81 msgid "Center-walk underlay" msgstr "" -#: lib/elements/satin_column.py:80 lib/elements/satin_column.py:87 +#: lib/elements/satin_column.py:81 lib/elements/satin_column.py:88 msgid "Center-Walk Underlay" msgstr "" -#: lib/elements/satin_column.py:92 +#: lib/elements/satin_column.py:93 msgid "Zig-zag underlay" msgstr "" -#: lib/elements/satin_column.py:92 lib/elements/satin_column.py:101 -#: lib/elements/satin_column.py:112 +#: lib/elements/satin_column.py:93 lib/elements/satin_column.py:102 +#: lib/elements/satin_column.py:113 msgid "Zig-zag Underlay" msgstr "" -#: lib/elements/satin_column.py:98 +#: lib/elements/satin_column.py:99 msgid "Zig-Zag spacing (peak-to-peak)" msgstr "" -#: lib/elements/satin_column.py:99 +#: lib/elements/satin_column.py:100 msgid "Distance between peaks of the zig-zags." msgstr "" -#: lib/elements/satin_column.py:109 +#: lib/elements/satin_column.py:110 msgid "Inset amount" msgstr "" -#: lib/elements/satin_column.py:110 +#: lib/elements/satin_column.py:111 msgid "default: half of contour underlay inset" msgstr "" -#: lib/elements/satin_column.py:147 +#: lib/elements/satin_column.py:148 #, python-format msgid "satin column: %(id)s: at least two subpaths required (%(num)d found)" msgstr "" -#: lib/elements/satin_column.py:172 +#: lib/elements/satin_column.py:173 msgid "" "One or more rails crosses itself, and this is not allowed. Please split " "into multiple satin columns." msgstr "" -#: lib/elements/satin_column.py:179 +#: lib/elements/satin_column.py:180 msgid "satin column: One or more of the rungs doesn't intersect both rails." msgstr "" -#: lib/elements/satin_column.py:180 lib/elements/satin_column.py:183 +#: lib/elements/satin_column.py:181 lib/elements/satin_column.py:184 msgid "Each rail should intersect both rungs once." msgstr "" -#: lib/elements/satin_column.py:182 +#: lib/elements/satin_column.py:183 msgid "" "satin column: One or more of the rungs intersects the rails more than " "once." msgstr "" -#: lib/elements/satin_column.py:223 +#: lib/elements/satin_column.py:224 #, python-format msgid "satin column: object %s has a fill (but should not)" msgstr "" -#: lib/elements/satin_column.py:227 +#: lib/elements/satin_column.py:228 #, python-format msgid "" "satin column: object %(id)s has two paths with an unequal number of " @@ -338,29 +338,29 @@ msgid "" "stitch, etc. Only applies to running stitch." msgstr "" -#: lib/elements/stroke.py:54 +#: lib/elements/stroke.py:56 msgid "Length of stitches in zig-zag mode." msgstr "" -#: lib/elements/stroke.py:65 +#: lib/elements/stroke.py:67 msgid "Repeats" msgstr "" -#: lib/elements/stroke.py:66 +#: lib/elements/stroke.py:68 msgid "Defines how many times to run down and back along the path." msgstr "" -#: lib/elements/stroke.py:90 +#: lib/elements/stroke.py:92 msgid "Manual stitch placement" msgstr "" -#: lib/elements/stroke.py:91 +#: lib/elements/stroke.py:93 msgid "" "Stitch every node in the path. Stitch length and zig-zag spacing are " "ignored." msgstr "" -#: lib/elements/stroke.py:125 +#: lib/elements/stroke.py:127 msgid "" "Legacy running stitch setting detected!\n" "\n" @@ -416,45 +416,45 @@ msgid "" "installed:" msgstr "" -#: lib/extensions/install.py:31 +#: lib/extensions/install.py:32 msgid "thread manufacturer color palettes" msgstr "" -#: lib/extensions/install.py:31 +#: lib/extensions/install.py:33 msgid "Ink/Stitch visual commands (Object -> Symbols...)" msgstr "" -#: lib/extensions/install.py:40 +#: lib/extensions/install.py:42 msgid "Install" msgstr "" -#: lib/extensions/install.py:43 lib/extensions/params.py:380 +#: lib/extensions/install.py:45 lib/extensions/params.py:380 msgid "Cancel" msgstr "" -#: lib/extensions/install.py:57 +#: lib/extensions/install.py:59 msgid "Choose Inkscape directory" msgstr "" -#: lib/extensions/install.py:67 +#: lib/extensions/install.py:69 msgid "Inkscape add-on installation failed" msgstr "" -#: lib/extensions/install.py:68 +#: lib/extensions/install.py:70 msgid "Installation Failed" msgstr "" -#: lib/extensions/install.py:72 +#: lib/extensions/install.py:74 msgid "" "Inkscape add-on files have been installed. Please restart Inkscape to " "load the new add-ons." msgstr "" -#: lib/extensions/install.py:73 +#: lib/extensions/install.py:75 msgid "Installation Completed" msgstr "" -#: lib/extensions/install.py:103 +#: lib/extensions/install.py:105 msgid "Ink/Stitch Add-ons Installer" msgstr "" @@ -596,7 +596,7 @@ msgid "" " or you can close it manually if necessary." msgstr "" -#: lib/extensions/print_pdf.py:411 +#: lib/extensions/print_pdf.py:414 msgid "Ink/Stitch Print" msgstr "" diff --git a/stub.py b/stub.py index 6daaf5ae..3d873196 100644 --- a/stub.py +++ b/stub.py @@ -36,7 +36,8 @@ try: stdout, stderr = extension.communicate() except BaseException: print >> sys.stderr, "Unexpected error launching Ink/Stitch." - print >> sys.stderr, "If you're having trouble, please file an issue here, including the text below: https://github.com/inkstitch/inkstitch/issues\n" + print >> sys.stderr, "If you're having trouble, please file an issue here, including the text below:" + print >> sys.stderr, " https://github.com/inkstitch/inkstitch/issues\n" print >> sys.stderr, "Tried to launch:", binary_path print >> sys.stderr, "Arguments:", args print >> sys.stderr, "Debugging information:\n" -- cgit v1.3.1 From 908f2cd7727e939b87e3f57c1d3a189705de4c94 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 21 Aug 2018 21:43:09 -0400 Subject: pyflakes fixes --- lib/elements/element.py | 2 -- lib/elements/fill.py | 2 +- lib/elements/polyline.py | 3 +- lib/extensions/base.py | 4 +-- lib/extensions/commands.py | 1 - lib/extensions/convert_to_satin.py | 1 + lib/extensions/embroider.py | 3 -- lib/extensions/flip.py | 1 - lib/extensions/input.py | 6 +--- lib/extensions/install.py | 9 ++---- lib/extensions/layer_commands.py | 8 ++--- lib/extensions/object_commands.py | 8 +---- lib/extensions/output.py | 5 +-- lib/extensions/print_pdf.py | 6 ++-- lib/extensions/zip.py | 5 +-- lib/inx/generate.py | 4 +-- lib/inx/utils.py | 2 +- lib/stitches/auto_fill.py | 3 -- lib/stitches/fill.py | 5 +-- lib/svg/path.py | 1 - lib/svg/realistic_rendering.py | 2 +- lib/svg/units.py | 1 + lib/threads/palette.py | 7 ++-- lib/utils/geometry.py | 2 +- messages.po | 66 +++++++++++++++++++------------------- 25 files changed, 59 insertions(+), 98 deletions(-) (limited to 'lib/extensions') diff --git a/lib/elements/element.py b/lib/elements/element.py index 5ca70cf6..4edb00c0 100644 --- a/lib/elements/element.py +++ b/lib/elements/element.py @@ -1,6 +1,5 @@ import sys from copy import deepcopy -from shapely import geometry as shgeo from ..i18n import _ from ..utils import cache @@ -8,7 +7,6 @@ from ..svg import PIXELS_PER_MM, convert_length, get_doc_size, apply_transforms from ..commands import find_commands # inkscape-provided utilities -import simpletransform import simplestyle import cubicsuperpath from cspsubdiv import cspsubdiv diff --git a/lib/elements/fill.py b/lib/elements/fill.py index 77284414..626573e6 100644 --- a/lib/elements/fill.py +++ b/lib/elements/fill.py @@ -5,7 +5,7 @@ from .element import param, EmbroideryElement, Patch from ..i18n import _ from ..svg import PIXELS_PER_MM from ..utils import cache -from ..stitches import running_stitch, auto_fill, legacy_fill +from ..stitches import legacy_fill class Fill(EmbroideryElement): diff --git a/lib/elements/polyline.py b/lib/elements/polyline.py index d3242795..5bfe5022 100644 --- a/lib/elements/polyline.py +++ b/lib/elements/polyline.py @@ -1,7 +1,6 @@ from shapely import geometry as shgeo -from .element import param, EmbroideryElement, Patch -from ..i18n import _ +from .element import EmbroideryElement, Patch from ..utils.geometry import Point from ..utils import cache diff --git a/lib/extensions/base.py b/lib/extensions/base.py index 07eaa40c..22bc82db 100644 --- a/lib/extensions/base.py +++ b/lib/extensions/base.py @@ -5,10 +5,10 @@ from copy import deepcopy from collections import MutableMapping from stringcase import snakecase -from ..svg.tags import * +from ..svg.tags import SVG_GROUP_TAG, INKSCAPE_GROUPMODE, SVG_DEFS_TAG, EMBROIDERABLE_TAGS, SVG_POLYLINE_TAG from ..elements import AutoFill, Fill, Stroke, SatinColumn, Polyline, EmbroideryElement -from ..utils import cache from ..commands import is_command, layer_commands +from ..i18n import _ SVG_METADATA_TAG = inkex.addNS("metadata", "svg") diff --git a/lib/extensions/commands.py b/lib/extensions/commands.py index e3bfabfe..fb6f7874 100644 --- a/lib/extensions/commands.py +++ b/lib/extensions/commands.py @@ -1,5 +1,4 @@ import os -import sys import inkex from copy import deepcopy diff --git a/lib/extensions/convert_to_satin.py b/lib/extensions/convert_to_satin.py index d27e42cc..ef4ac557 100644 --- a/lib/extensions/convert_to_satin.py +++ b/lib/extensions/convert_to_satin.py @@ -11,6 +11,7 @@ from ..svg.tags import SVG_PATH_TAG from ..svg import get_correction_transform, PIXELS_PER_MM from ..elements import Stroke from ..utils import Point +from ..i18n import _ class SelfIntersectionError(Exception): diff --git a/lib/extensions/embroider.py b/lib/extensions/embroider.py index 1e994e27..921201d6 100644 --- a/lib/extensions/embroider.py +++ b/lib/extensions/embroider.py @@ -1,7 +1,4 @@ -import sys -import traceback import os -import inkex from .base import InkstitchExtension from ..i18n import _ diff --git a/lib/extensions/flip.py b/lib/extensions/flip.py index 5bea510f..65dbdc1f 100644 --- a/lib/extensions/flip.py +++ b/lib/extensions/flip.py @@ -1,4 +1,3 @@ -import sys import inkex import cubicsuperpath from shapely import geometry as shgeo diff --git a/lib/extensions/input.py b/lib/extensions/input.py index e450bef6..975ba838 100644 --- a/lib/extensions/input.py +++ b/lib/extensions/input.py @@ -1,15 +1,11 @@ import os -from os.path import realpath, dirname, join as path_join -import sys from inkex import etree import inkex import pyembroidery from ..svg import PIXELS_PER_MM, render_stitch_plan from ..svg.tags import INKSCAPE_LABEL -from ..i18n import _ -from ..stitch_plan import StitchPlan, ColorBlock -from ..utils.io import save_stdout +from ..stitch_plan import StitchPlan class Input(object): diff --git a/lib/extensions/install.py b/lib/extensions/install.py index 0745eddc..314843f4 100644 --- a/lib/extensions/install.py +++ b/lib/extensions/install.py @@ -3,17 +3,12 @@ import sys import traceback import os -from os.path import realpath, dirname from glob import glob -from threading import Thread -import socket -import errno -import time -import logging import wx import inkex from ..utils import guess_inkscape_config_path, get_bundled_dir +from ..i18n import _ class InstallerFrame(wx.Frame): @@ -64,7 +59,7 @@ class InstallerFrame(wx.Frame): try: self.install_addons('palettes') self.install_addons('symbols') - except Exception as e: + except Exception: wx.MessageDialog(self, _('Inkscape add-on installation failed') + ': \n' + traceback.format_exc(), _('Installation Failed'), diff --git a/lib/extensions/layer_commands.py b/lib/extensions/layer_commands.py index b9be2b27..8210c7c6 100644 --- a/lib/extensions/layer_commands.py +++ b/lib/extensions/layer_commands.py @@ -1,11 +1,9 @@ -import os -import sys import inkex from .commands import CommandsExtension from ..commands import LAYER_COMMANDS, get_command_description from ..i18n import _ -from ..svg.tags import * +from ..svg.tags import SVG_USE_TAG, INKSCAPE_LABEL, XLINK_HREF from ..svg import get_correction_transform @@ -35,7 +33,7 @@ class LayerCommands(CommandsExtension): for i, command in enumerate(commands): self.ensure_symbol(command) - node = inkex.etree.SubElement(self.current_layer, SVG_USE_TAG, + inkex.etree.SubElement(self.current_layer, SVG_USE_TAG, { "id": self.uniqueId("use"), INKSCAPE_LABEL: _("Ink/Stitch Command") + ": %s" % get_command_description(command), @@ -46,5 +44,3 @@ class LayerCommands(CommandsExtension): "y": "-10", "transform": correction_transform }) - - namedview = self.document.xpath("//sodipodi:namedview", namespaces=inkex.NSS) diff --git a/lib/extensions/object_commands.py b/lib/extensions/object_commands.py index 483f2a0a..e678890d 100644 --- a/lib/extensions/object_commands.py +++ b/lib/extensions/object_commands.py @@ -1,16 +1,10 @@ -import os -import sys import inkex -import simpletransform -import cubicsuperpath from random import random -from shapely import geometry as shgeo from .commands import CommandsExtension from ..commands import OBJECT_COMMANDS, get_command_description from ..i18n import _ -from ..elements import SatinColumn -from ..svg.tags import * +from ..svg.tags import SVG_PATH_TAG, CONNECTION_START, CONNECTION_END, CONNECTOR_TYPE, INKSCAPE_LABEL, SVG_GROUP_TAG, SVG_USE_TAG, XLINK_HREF from ..svg import get_correction_transform diff --git a/lib/extensions/output.py b/lib/extensions/output.py index 090cd3a9..9ffa82a3 100644 --- a/lib/extensions/output.py +++ b/lib/extensions/output.py @@ -1,15 +1,12 @@ import sys -import traceback import os -import inkex import tempfile from .base import InkstitchExtension from ..i18n import _ from ..output import write_embroidery_file from ..stitch_plan import patches_to_stitch_plan -from ..svg import render_stitch_plan, PIXELS_PER_MM -from ..utils.io import save_stdout +from ..svg import PIXELS_PER_MM class Output(InkstitchExtension): diff --git a/lib/extensions/print_pdf.py b/lib/extensions/print_pdf.py index 90ca83ae..47b89061 100644 --- a/lib/extensions/print_pdf.py +++ b/lib/extensions/print_pdf.py @@ -1,5 +1,4 @@ import sys -import traceback import os from threading import Thread import socket @@ -13,15 +12,14 @@ import json import inkex from jinja2 import Environment, FileSystemLoader, select_autoescape from datetime import date -import base64 from flask import Flask, request, Response, send_from_directory, jsonify import webbrowser import requests from .base import InkstitchExtension from ..i18n import _, translation as inkstitch_translation -from ..svg import PIXELS_PER_MM, render_stitch_plan -from ..svg.tags import SVG_GROUP_TAG, INKSCAPE_GROUPMODE +from ..svg import render_stitch_plan +from ..svg.tags import INKSCAPE_GROUPMODE from ..stitch_plan import patches_to_stitch_plan from ..threads import ThreadCatalog diff --git a/lib/extensions/zip.py b/lib/extensions/zip.py index 02f29e8a..2376f79a 100644 --- a/lib/extensions/zip.py +++ b/lib/extensions/zip.py @@ -1,7 +1,5 @@ import sys -import traceback import os -import inkex import tempfile from zipfile import ZipFile import pyembroidery @@ -10,8 +8,7 @@ from .base import InkstitchExtension from ..i18n import _ from ..output import write_embroidery_file from ..stitch_plan import patches_to_stitch_plan -from ..svg import render_stitch_plan, PIXELS_PER_MM -from ..utils.io import save_stdout +from ..svg import PIXELS_PER_MM class Zip(InkstitchExtension): diff --git a/lib/inx/generate.py b/lib/inx/generate.py index 1cf347f2..941596de 100644 --- a/lib/inx/generate.py +++ b/lib/inx/generate.py @@ -1,9 +1,7 @@ -import os - from .inputs import generate_input_inx_files from .outputs import generate_output_inx_files from .extensions import generate_extension_inx_files -from .utils import iterate_inx_locales, inx_path +from .utils import iterate_inx_locales def generate_inx_files(): diff --git a/lib/inx/utils.py b/lib/inx/utils.py index 6670cfcb..8dd3fdf8 100644 --- a/lib/inx/utils.py +++ b/lib/inx/utils.py @@ -3,7 +3,7 @@ import gettext from os.path import dirname from jinja2 import Environment, FileSystemLoader -from ..i18n import translation as default_translation, locale_dir, _, N_ +from ..i18n import translation as default_translation, locale_dir, N_ _top_path = dirname(dirname(dirname(os.path.realpath(__file__)))) diff --git a/lib/stitches/auto_fill.py b/lib/stitches/auto_fill.py index e777d026..e732c940 100644 --- a/lib/stitches/auto_fill.py +++ b/lib/stitches/auto_fill.py @@ -1,14 +1,12 @@ import sys import shapely import networkx -import math from itertools import groupby, izip from collections import deque from .fill import intersect_region_with_grating, row_num, stitch_row from .running_stitch import running_stitch from ..i18n import _ -from ..svg import PIXELS_PER_MM from ..utils.geometry import Point as InkstitchPoint, cut @@ -367,7 +365,6 @@ def find_stitch_path(graph, segments, starting_point=None, ending_point=None): the order of most-recently-visited first. """ - original_graph = graph graph = graph.copy() num_segments = len(segments) segments_visited = 0 diff --git a/lib/stitches/fill.py b/lib/stitches/fill.py index b6b97e1b..af0a8403 100644 --- a/lib/stitches/fill.py +++ b/lib/stitches/fill.py @@ -1,6 +1,5 @@ import shapely import math -import sys from ..svg import PIXELS_PER_MM from ..utils import cache, Point as InkstitchPoint @@ -167,9 +166,7 @@ def intersect_region_with_grating(shape, angle, row_spacing, end_row_spacing=Non def section_to_stitches(group_of_segments, angle, row_spacing, max_stitch_length, staggers): stitches = [] - first_segment = True swap = False - last_end = None for segment in group_of_segments: (beg, end) = segment @@ -240,7 +237,7 @@ def pull_runs(rows, shape, row_spacing): # print >> sys.stderr, len(run) runs.append(run) - rows = [row for row in rows if len(row) > 0] + rows = [r for r in rows if len(r) > 0] count += 1 diff --git a/lib/svg/path.py b/lib/svg/path.py index 51100e38..4502b2ea 100644 --- a/lib/svg/path.py +++ b/lib/svg/path.py @@ -1,5 +1,4 @@ import simpletransform -import cubicsuperpath from .units import get_viewbox_transform diff --git a/lib/svg/realistic_rendering.py b/lib/svg/realistic_rendering.py index 5af7e9a6..73da3a09 100644 --- a/lib/svg/realistic_rendering.py +++ b/lib/svg/realistic_rendering.py @@ -2,7 +2,7 @@ import simplepath import math from .units import PIXELS_PER_MM -from ..utils import cache, Point +from ..utils import Point # The stitch vector path looks like this: # _______ diff --git a/lib/svg/units.py b/lib/svg/units.py index 585afab4..c4ec82a0 100644 --- a/lib/svg/units.py +++ b/lib/svg/units.py @@ -1,6 +1,7 @@ import simpletransform from ..utils import cache +from ..i18n import _ # modern versions of Inkscape use 96 pixels per inch as per the CSS standard PIXELS_PER_MM = 96 / 25.4 diff --git a/lib/threads/palette.py b/lib/threads/palette.py index 785fb082..654c43e5 100644 --- a/lib/threads/palette.py +++ b/lib/threads/palette.py @@ -41,8 +41,11 @@ class ThreadPalette(Set): if self.name.lower().startswith('name: ink/stitch: '): self.name = self.name[18:] - columns_line = palette.readline() - headers_line = palette.readline() + # number of columns + palette.readline() + + # headers + palette.readline() for line in palette: fields = line.split("\t", 3) diff --git a/lib/utils/geometry.py b/lib/utils/geometry.py index eb1a28fa..ef5f12b5 100644 --- a/lib/utils/geometry.py +++ b/lib/utils/geometry.py @@ -80,7 +80,7 @@ class Point: if isinstance(other, (int, float)): return self * (1.0 / other) else: - raise ValueErorr("cannot divide Point by %s" % type(other)) + raise ValueError("cannot divide Point by %s" % type(other)) def __repr__(self): return "Point(%s,%s)" % (self.x, self.y) diff --git a/messages.po b/messages.po index 94de4c34..3f5a5041 100644 --- a/messages.po +++ b/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-08-21 20:50-0400\n" +"POT-Creation-Date: 2018-08-21 21:43-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -119,7 +119,7 @@ msgid "" "shapes." msgstr "" -#: lib/elements/element.py:232 +#: lib/elements/element.py:230 #, python-format msgid "%(id)s has more than one command of type '%(command)s' linked to it" msgstr "" @@ -381,106 +381,106 @@ msgstr "" msgid "Tip: use Path -> Object to Path to convert non-paths." msgstr "" -#: lib/extensions/convert_to_satin.py:28 +#: lib/extensions/convert_to_satin.py:29 msgid "Please select at least one line to convert to a satin column." msgstr "" #. : Convert To Satin extension, user selected one or more objects that were #. not lines. -#: lib/extensions/convert_to_satin.py:33 +#: lib/extensions/convert_to_satin.py:34 msgid "Only simple lines may be converted to satin columns." msgstr "" -#: lib/extensions/convert_to_satin.py:55 +#: lib/extensions/convert_to_satin.py:56 #, python-format msgid "" "Cannot convert %s to a satin column because it intersects itself. Try " "breaking it up into multiple paths." msgstr "" -#: lib/extensions/embroider.py:41 +#: lib/extensions/embroider.py:38 msgid "" "\n" "\n" "Seeing a 'no such option' message? Please restart Inkscape to fix." msgstr "" -#: lib/extensions/flip.py:36 +#: lib/extensions/flip.py:35 msgid "Please select one or more satin columns to flip." msgstr "" -#: lib/extensions/install.py:30 +#: lib/extensions/install.py:25 msgid "" "Ink/Stitch can install files (\"add-ons\") that make it easier to use " "Inkscape to create machine embroidery designs. These add-ons will be " "installed:" msgstr "" -#: lib/extensions/install.py:32 +#: lib/extensions/install.py:27 msgid "thread manufacturer color palettes" msgstr "" -#: lib/extensions/install.py:33 +#: lib/extensions/install.py:28 msgid "Ink/Stitch visual commands (Object -> Symbols...)" msgstr "" -#: lib/extensions/install.py:42 +#: lib/extensions/install.py:37 msgid "Install" msgstr "" -#: lib/extensions/install.py:45 lib/extensions/params.py:380 +#: lib/extensions/install.py:40 lib/extensions/params.py:380 msgid "Cancel" msgstr "" -#: lib/extensions/install.py:59 +#: lib/extensions/install.py:54 msgid "Choose Inkscape directory" msgstr "" -#: lib/extensions/install.py:69 +#: lib/extensions/install.py:64 msgid "Inkscape add-on installation failed" msgstr "" -#: lib/extensions/install.py:70 +#: lib/extensions/install.py:65 msgid "Installation Failed" msgstr "" -#: lib/extensions/install.py:74 +#: lib/extensions/install.py:69 msgid "" "Inkscape add-on files have been installed. Please restart Inkscape to " "load the new add-ons." msgstr "" -#: lib/extensions/install.py:75 +#: lib/extensions/install.py:70 msgid "Installation Completed" msgstr "" -#: lib/extensions/install.py:105 +#: lib/extensions/install.py:100 msgid "Ink/Stitch Add-ons Installer" msgstr "" -#: lib/extensions/layer_commands.py:29 +#: lib/extensions/layer_commands.py:27 msgid "Please choose one or more commands to add." msgstr "" -#: lib/extensions/layer_commands.py:41 lib/extensions/object_commands.py:80 +#: lib/extensions/layer_commands.py:39 lib/extensions/object_commands.py:74 msgid "Ink/Stitch Command" msgstr "" #. : the name of the line that connects a command to the object it applies to -#: lib/extensions/object_commands.py:36 +#: lib/extensions/object_commands.py:30 msgid "connector" msgstr "" #. : the name of a command symbol (example: scissors icon for trim command) -#: lib/extensions/object_commands.py:95 +#: lib/extensions/object_commands.py:89 msgid "command marker" msgstr "" -#: lib/extensions/object_commands.py:106 +#: lib/extensions/object_commands.py:100 msgid "Please select one or more objects to which to attach commands." msgstr "" -#: lib/extensions/object_commands.py:114 +#: lib/extensions/object_commands.py:108 msgid "Please choose one or more commands to attach." msgstr "" @@ -578,15 +578,15 @@ msgid "" "\"Overwrite\"" msgstr "" -#: lib/extensions/print_pdf.py:134 +#: lib/extensions/print_pdf.py:132 msgid "Closing..." msgstr "" -#: lib/extensions/print_pdf.py:134 +#: lib/extensions/print_pdf.py:132 msgid "It is safe to close this window now." msgstr "" -#: lib/extensions/print_pdf.py:265 +#: lib/extensions/print_pdf.py:263 msgid "" "A print preview has been opened in your web browser. This window will " "stay open in order to communicate with the JavaScript code running in " @@ -596,7 +596,7 @@ msgid "" " or you can close it manually if necessary." msgstr "" -#: lib/extensions/print_pdf.py:414 +#: lib/extensions/print_pdf.py:412 msgid "Ink/Stitch Print" msgstr "" @@ -604,7 +604,7 @@ msgstr "" msgid "Embroidery Simulation" msgstr "" -#: lib/extensions/zip.py:52 +#: lib/extensions/zip.py:49 msgid "No embroidery file formats selected." msgstr "" @@ -663,13 +663,13 @@ msgstr "" msgid "Stitch #" msgstr "" -#: lib/stitches/auto_fill.py:169 +#: lib/stitches/auto_fill.py:167 msgid "" "Unable to autofill. This most often happens because your shape is made " "up of multiple sections that aren't connected." msgstr "" -#: lib/stitches/auto_fill.py:398 +#: lib/stitches/auto_fill.py:395 msgid "" "Unexpected error while generating fill stitches. Please send your SVG " "file to lexelby@github." @@ -679,12 +679,12 @@ msgstr "" msgid "Stitch Plan" msgstr "" -#: lib/svg/units.py:45 +#: lib/svg/units.py:46 #, python-format msgid "parseLengthWithUnits: unknown unit %s" msgstr "" -#: lib/svg/units.py:77 +#: lib/svg/units.py:78 #, python-format msgid "Unknown unit: %s" msgstr "" -- cgit v1.3.1 From f53fe0520098d26e65d89adcf1580b36433c4927 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 21 Aug 2018 21:57:15 -0400 Subject: a few more fixups --- lib/extensions/layer_commands.py | 20 ++++++++++---------- lib/extensions/output.py | 1 - lib/extensions/print_pdf.py | 2 +- lib/simulator.py | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) (limited to 'lib/extensions') diff --git a/lib/extensions/layer_commands.py b/lib/extensions/layer_commands.py index 8210c7c6..dbafc39f 100644 --- a/lib/extensions/layer_commands.py +++ b/lib/extensions/layer_commands.py @@ -34,13 +34,13 @@ class LayerCommands(CommandsExtension): self.ensure_symbol(command) inkex.etree.SubElement(self.current_layer, SVG_USE_TAG, - { - "id": self.uniqueId("use"), - INKSCAPE_LABEL: _("Ink/Stitch Command") + ": %s" % get_command_description(command), - XLINK_HREF: "#inkstitch_%s" % command, - "height": "100%", - "width": "100%", - "x": str(i * 20), - "y": "-10", - "transform": correction_transform - }) + { + "id": self.uniqueId("use"), + INKSCAPE_LABEL: _("Ink/Stitch Command") + ": %s" % get_command_description(command), + XLINK_HREF: "#inkstitch_%s" % command, + "height": "100%", + "width": "100%", + "x": str(i * 20), + "y": "-10", + "transform": correction_transform + }) diff --git a/lib/extensions/output.py b/lib/extensions/output.py index 9ffa82a3..26fd4f2e 100644 --- a/lib/extensions/output.py +++ b/lib/extensions/output.py @@ -3,7 +3,6 @@ import os import tempfile from .base import InkstitchExtension -from ..i18n import _ from ..output import write_embroidery_file from ..stitch_plan import patches_to_stitch_plan from ..svg import PIXELS_PER_MM diff --git a/lib/extensions/print_pdf.py b/lib/extensions/print_pdf.py index 47b89061..d2e2365d 100644 --- a/lib/extensions/print_pdf.py +++ b/lib/extensions/print_pdf.py @@ -107,7 +107,7 @@ class PrintPreviewServer(Thread): else: self.resources_path = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..', 'print', 'resources')) - def __setup_app(self): + def __setup_app(self): # noqa: C901 self.__set_resources_path() self.app = Flask(__name__) diff --git a/lib/simulator.py b/lib/simulator.py index 5620f65b..3df72a08 100644 --- a/lib/simulator.py +++ b/lib/simulator.py @@ -5,7 +5,7 @@ import colorsys from itertools import izip from .svg import PIXELS_PER_MM, color_block_to_point_lists - +from .i18n import _ class EmbroiderySimulator(wx.Frame): def __init__(self, *args, **kwargs): -- cgit v1.3.1