From dfedd10f3d039e54ccfa89cc0fc794cbc70f3061 Mon Sep 17 00:00:00 2001 From: vocx-fc Date: Fri, 28 Feb 2020 11:43:07 -0600 Subject: [PATCH] Draft: importSVG.py, FreeCADGui with interface only Also small fixes in imports and spacing --- src/Mod/Draft/importSVG.py | 68 ++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/src/Mod/Draft/importSVG.py b/src/Mod/Draft/importSVG.py index 6faf63e82333..d7605520624f 100644 --- a/src/Mod/Draft/importSVG.py +++ b/src/Mod/Draft/importSVG.py @@ -1,23 +1,3 @@ -## @package importSVG -# \ingroup DRAFT -# \brief SVG file importer & exporter -'''@package importSVG -\ingroup DRAFT -\brief SVG file importer & exporter - -This module provides support for importing and exporting SVG files. It -enables importing/exporting objects directly to/from the 3D document, but -doesn't handle the SVG output from the Drawing and TechDraw modules. - -Currently it only reads the following entities: -* paths, lines, circular arcs, rects, circles, ellipses, polygons, polylines. - -Currently unsupported: -* use, image. -''' -# Check code with -# flake8 --ignore=E226,E266,E401,W503 - # *************************************************************************** # * Copyright (c) 2009 Yorik van Havre * # * * @@ -38,12 +18,29 @@ # * USA * # * * # *************************************************************************** +"""Provides support for importing and exporting SVG files. + +It enables importing/exporting objects directly to/from the 3D document +but doesn't handle the SVG output from the Drawing and TechDraw modules. + +Currently it only reads the following entities: +* paths, lines, circular arcs, rects, circles, ellipses, polygons, polylines. + +Currently unsupported: +* use, image. +""" +## @package importSVG +# \ingroup DRAFT +# \brief SVG file importer and exporter + +# Check code with +# flake8 --ignore=E226,E266,E401,W503 __title__ = "FreeCAD Draft Workbench - SVG importer/exporter" __author__ = "Yorik van Havre, Sebastian Hoogen" __url__ = "https://www.freecadweb.org" -# ToDo: +# TODO: # ignoring CDATA # handle image element (external references and inline base64) # debug Problem with 'Sans' font from Inkscape @@ -51,27 +48,28 @@ # implement inheriting fill style from group # handle relative units -import xml.sax, FreeCAD, os, math, re, Draft, DraftVecUtils +import math +import os +import re +import xml.sax + +import FreeCAD +import Draft +import DraftVecUtils from FreeCAD import Vector from FreeCAD import Console as FCC +from draftutils.translate import translate if FreeCAD.GuiUp: - from DraftTools import translate from PySide import QtGui -else: - def translate(context, txt): - return txt - -try: import FreeCADGui -except ImportError: - gui = False -else: gui = True - -try: - draftui = FreeCADGui.draftToolBar -except AttributeError: + try: + draftui = FreeCADGui.draftToolBar + except AttributeError: + draftui = None +else: + gui = False draftui = None # Save the native open function to avoid collisions