ArgparseEdgeType: Re-enable Inkscape format

Got dropped in ecf14540f5 while moving to
Inkscape 1.0.

Related: #369
This commit is contained in:
Florian Festi 2022-02-18 10:42:40 +01:00
parent 529574fb5d
commit ea4036b3d4
2 changed files with 6 additions and 11 deletions

View File

@ -198,9 +198,9 @@ class ArgparseEdgeType:
return """<select name="%s" size="1">\n%s</select>\n""" % (name, options)
def inx(self, name, viewname, arg):
return (' <param name="%s" type="enum" gui-text="%s" gui-description=%s>\n' %
return (' <param name="%s" type="optiongroup" appearance="combo" gui-text="%s" gui-description=%s>\n' %
(name, viewname, quoteattr(arg.help or "")) +
''.join((' <item value="%s">%s %s</item>\n' % (
''.join((' <option value="%s">%s %s</option>\n' % (
e, e, self.names.get(e, ""))
for e in self.edges)) +
' </param>\n')

View File

@ -46,18 +46,14 @@ class Boxes2INX:
if prefix and name.startswith(prefix + '_'):
viewname = name[len(prefix)+1:]
#returns old enum type. disabled
#if (isinstance(a, argparse._StoreAction) and hasattr(a.type, "inx")):
#return a.type.inx(name, viewname, a) #see boxes.__init__.py
#elif a.dest == "layout": # XXX
if a.dest == "layout": # XXX
if (isinstance(a, argparse._StoreAction) and hasattr(a.type, "inx")):
return a.type.inx(name, viewname, a) #see boxes.__init__.py
elif a.dest == "layout":
return ""
val = a.default.split("\n")
input = """<textarea name="%s" cols="%s" rows="%s">%s</textarea>""" % \
(name, max((len(l) for l in val))+10, len(val)+1, a.default)
elif (isinstance(a, argparse._StoreAction) and hasattr(a.type, "inx")) or a.choices:
elif a.choices:
uniqueChoices = []
for e in a.choices:
if e not in uniqueChoices:
@ -65,7 +61,6 @@ class Boxes2INX:
return (''' <param name="%s" type="optiongroup" appearance="combo" gui-text="%s" gui-description=%s>\n'''
% (name, viewname, quoteattr(a.help or viewname)) +
"".join(' <option value="%s">%s</option>\n' % (e, e) for e in uniqueChoices) + ' </param>\n')
else:
default = a.default
if isinstance(a.type, boxes.BoolArg):