Skip to content

Commit

Permalink
Draft: importSVG.py, FreeCADGui with interface only
Browse files Browse the repository at this point in the history
Also small fixes in imports and spacing
  • Loading branch information
vocx-fc authored and yorikvanhavre committed Apr 7, 2020
1 parent 691a3cd commit dfedd10
Showing 1 changed file with 33 additions and 35 deletions.
68 changes: 33 additions & 35 deletions 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 <yorik@uncreated.net> *
# * *
Expand All @@ -38,40 +18,58 @@
# * 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
# debug Problem with fill color
# 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
Expand Down

0 comments on commit dfedd10

Please sign in to comment.