Check-in [4c1a26da5e]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | fix generator for inx |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
4c1a26da5edd7d4750e73188e63823e0 |
| User & Date: | mario 2025-06-16 00:27:51 |
Context
|
2025-06-16
| ||
| 00:28 | updated description without utf-8 symbols check-in: fd98f78747 user: mario tags: trunk | |
| 00:27 | fix generator for inx check-in: 4c1a26da5e user: mario tags: trunk | |
| 00:20 | fix unicode and deprecated flags check-in: 8f32b150fe user: mario tags: trunk | |
Changes
Changes to inkscape/pmd2inks.
1 2 3 4 5 6 7 8 | #!/usr/bin/env python3 # encoding: utf-8 # api: python ##type: cli # category: convert # title: plugin meta to .inx # description: Convert plugin description to Inkscape .inx # license: PD | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #!/usr/bin/env python3 # encoding: utf-8 # api: python ##type: cli # category: convert # title: plugin meta to .inx # description: Convert plugin description to Inkscape .inx # license: PD # version: 0.8 # state: beta # depends: pluginconf (== 0.7.6) # config: - # pylint: disable=missing-docstring, invalid-name, no-else-return # doc: https://gitlab.com/inkscape/extensions/-/blob/master/inkscape.extension.rng # # Quickly converts a PMD comment block to .inx descriptor. # Mapping some types and modes. # |
| ︙ | ︙ | |||
27 28 29 30 31 32 33 |
import pluginconf
meta = {}
xml_template = """<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>{name}</name>
| | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
import pluginconf
meta = {}
xml_template = """<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>{name}</name>
<!--description>{desc}</description-->
<!--<schema:softwareVersion xmlns:schema="https://schema.org/">{version}</schema:softwareVersion>-->
<!--category>{submenu}</category-->
<id>{id}</id>
<dependency type="executable" location="inx">{fn}</dependency>
<label appearance="header">{header}</label>
{params}
<effect needs-live-preview="false">
<object-type>all</object-type>
<effects-menu>
|
| ︙ | ︙ | |||
68 69 70 71 72 73 74 |
"text": "string",
"tab": "notebook",
"group": "optiongroup",
"label": "label",
"notebook": "notebook",
},
"mode": {
| | | | | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
"text": "string",
"tab": "notebook",
"group": "optiongroup",
"label": "label",
"notebook": "notebook",
},
"mode": {
#"bool": "checkbox",
#"color": "color",
"range": "slider",
#"float": "float",
},
"appearance": {
"text": "multiline",
"range": "full",
"enum": "combo",
"select": "combo",
},
|
| ︙ | ︙ | |||
181 182 183 184 185 186 187 |
</param>
"""
elif _type == "notebook":
notebook = new_notebook(_name, o)
yield f"""
<param name="{_name}" type="{_type}" {_add} gui-text="{_desc}">
"""
| | > > > > | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
</param>
"""
elif _type == "notebook":
notebook = new_notebook(_name, o)
yield f"""
<param name="{_name}" type="{_type}" {_add} gui-text="{_desc}">
"""
elif _type in ("int"):
yield f"""
<param name="{_name}" type="{_type}" min="{o.get("min",0)}" max="{o.get("max",100)}" {_add} gui-text="{_desc}">{_val}</param>
"""
elif _type in ("float"):
yield f"""
<param name="{_name}" type="{_type}" min="{o.get("min",0)}" max="{o.get("max",100)}" precision="{o.get("precision",1)}" {_add} gui-text="{_desc}">{_val}</param>
"""
else:
yield f"""
<param name="{_name}" type="{_type}" {_add} gui-text="{_desc}">{_val}</param>
"""
|
| ︙ | ︙ | |||
223 224 225 226 227 228 229 |
def generate_inx(m):
""" roughly convert builtin plugin description to .inx """
params = []
for o in m["config"]:
for line in param(o):
params.append(line)
| | | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
def generate_inx(m):
""" roughly convert builtin plugin description to .inx """
params = []
for o in m["config"]:
for line in param(o):
params.append(line)
if notebook and notebook.curr:
params = params + list(notebook.end("", True))
args = list(
filter(
None,
[add_arg(o) for o in m["config"] if o["type"] != "label"]
)
)
|
| ︙ | ︙ | |||
246 247 248 249 250 251 252 |
export=inx_export(m),
fn=re.sub(".+/", "", m["fn"]),
args="\n".join(args)
)
if len(sys.argv) == 2:
| > | > | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
export=inx_export(m),
fn=re.sub(".+/", "", m["fn"]),
args="\n".join(args)
)
if len(sys.argv) == 2:
#print(sys.argv)
meta = pluginconf.plugin_meta(fn=sys.argv[1], max_length=20486)
#print(meta)
print(
generate_inx(
meta
)
)
else:
print("Syntax: pmd2inx script.py")
|