Draft: move the convertDraftTexts function to make_text
The old `convertDraftTexts` function was moved from the `Draft.py` module to the `draftutils.utils` module; however, here it is not possible to use because the `makeText` function is not accessible. Therefore, the function is moved to `draftmake.make_text`.
This commit is contained in:
@@ -1146,38 +1146,6 @@ def is_closed_edge(edge_index, object):
|
||||
isClosedEdge = is_closed_edge
|
||||
|
||||
|
||||
def convert_draft_texts(textslist=[]):
|
||||
"""
|
||||
converts the given Draft texts (or all that is found
|
||||
in the active document) to the new object
|
||||
This function was already present at splitting time during v 0.19
|
||||
"""
|
||||
if not isinstance(textslist,list):
|
||||
textslist = [textslist]
|
||||
if not textslist:
|
||||
for o in App.ActiveDocument.Objects:
|
||||
if o.TypeId == "App::Annotation":
|
||||
textslist.append(o)
|
||||
todelete = []
|
||||
for o in textslist:
|
||||
l = o.Label
|
||||
o.Label = l+".old"
|
||||
obj = makeText(o.LabelText,point=o.Position)
|
||||
obj.Label = l
|
||||
todelete.append(o.Name)
|
||||
for p in o.InList:
|
||||
if p.isDerivedFrom("App::DocumentObjectGroup"):
|
||||
if o in p.Group:
|
||||
g = p.Group
|
||||
g.append(obj)
|
||||
p.Group = g
|
||||
for n in todelete:
|
||||
App.ActiveDocument.removeObject(n)
|
||||
|
||||
|
||||
convertDraftTexts = convert_draft_texts
|
||||
|
||||
|
||||
def utf8_decode(text):
|
||||
r"""Decode the input string and return a unicode string.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user