Draft: Remove Python 2 type support

This commit is contained in:
marioalexis
2022-03-28 18:02:23 -03:00
parent 5a0bcbbb9c
commit 79b7bfd5d0
6 changed files with 8 additions and 56 deletions

View File

@@ -33,7 +33,6 @@ like Wire, BSpline, and BezCurve.
## \addtogroup draftguitools
# @{
import sys
from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD as App
@@ -76,9 +75,6 @@ class Line(gui_base_original.Creator):
self.ui.wireUi(title=translate("draft", self.featureName), icon=icon)
else:
self.ui.lineUi(title=translate("draft", self.featureName), icon=icon)
if sys.version_info.major < 3:
if isinstance(self.featureName, unicode):
self.featureName = self.featureName.encode("utf8")
self.obj = self.doc.addObject("Part::Feature", self.featureName)
gui_utils.format_object(self.obj)

View File

@@ -38,7 +38,6 @@ They are more complex that simple text annotations.
## \addtogroup draftguitools
# @{
from PySide.QtCore import QT_TRANSLATE_NOOP
import sys
import FreeCAD as App
import FreeCADGui as Gui
@@ -105,13 +104,7 @@ class ShapeString(gui_base_original.Creator):
# + str(type(self.SString)))
dquote = '"'
if sys.version_info.major < 3:
# Python2, string needs to be converted to unicode
String = ('u' + dquote
+ self.SString.encode('unicode_escape') + dquote)
else:
# Python3, string is already unicode
String = dquote + self.SString + dquote
String = dquote + self.SString + dquote
# Size and tracking are numbers;
# they are ASCII so this conversion should always work