Collection of mostly command line tools / PHP scripts. Somewhat out of date.

⌈⌋ ⎇ branch:  scripts + snippets


Check-in [33dbf985e5]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:translatable=no for combo boxes
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 33dbf985e5a4347083212930235866ac6c86dc9d
User & Date: mario 2022-10-10 07:45:34
Context
2022-10-11
07:12
separate handler for notebook/page sectioning check-in: 6b16bde070 user: mario tags: trunk
2022-10-10
07:45
translatable=no for combo boxes check-in: 33dbf985e5 user: mario tags: trunk
2022-10-09
16:36
prepare magick v7 support, minor parameter rework, dissolve duration_arg(), experiment with more convert options check-in: af566d903e user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to inkscape/animate_yo.inx.

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
            <option value="10">10</option>
            <option value="15">15</option>
            <option value="20">20</option>
            <option value="25">25</option>
            <option value="50">50</option>
            <option value="100">100</option>
          </param>
          <param name="repeat_fill" type="optiongroup" appearance="combo" gui-description="Animation can either stay at last state, or reset to value before animation. (gif_export always reverts to previous slide state)" gui-text="fill">
            <option value="freeze">freeze</option>
            <option value="remove">remove</option>
          </param>
        </page>
        <page name="calc" gui-text="calc">
          <param name="calc_mode" type="optiongroup" appearance="combo" gui-description="Defines if values in animation are traversed in a straight from-to progression (linear), jump from start to end (discrete), slowly speed up (paced), or use a list of values/keyTimes (spline)." gui-text="calcMode">
            <option value="linear">linear</option>
            <option value="discrete">discrete</option>
            <option value="paced">paced</option>







|
|
|







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
            <option value="10">10</option>
            <option value="15">15</option>
            <option value="20">20</option>
            <option value="25">25</option>
            <option value="50">50</option>
            <option value="100">100</option>
          </param>
          <param name="repeat_fill" type="optiongroup" appearance="combo" translatable="no" gui-description="Animation can either stay at last state, or reset to value before animation. (gif_export always reverts to previous slide state)" gui-text="repeatFill">
            <option translatable="no" value="freeze">freeze</option>
            <option translatable="no" value="remove">remove</option>
          </param>
        </page>
        <page name="calc" gui-text="calc">
          <param name="calc_mode" type="optiongroup" appearance="combo" gui-description="Defines if values in animation are traversed in a straight from-to progression (linear), jump from start to end (discrete), slowly speed up (paced), or use a list of values/keyTimes (spline)." gui-text="calcMode">
            <option value="linear">linear</option>
            <option value="discrete">discrete</option>
            <option value="paced">paced</option>
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
      <param name="remove_child" type="bool" mode="checkbox" gui-description="Remove any existing ﹤animate*﹥ tags from selected object. (Else use the XML editor Ctrl+Shift+X.)" gui-text="Strip previous animation">false</param>
    </vbox>
    <image width="220" height="220">animate_yo.svg</image>
  </hbox>
  <param name="mode" type="notebook" gui-description="Animation" gui-text="Animation mode">
    <page name="style" gui-text="style">
      <param name="style" type="optiongroup" appearance="combo" translatable="no" gui-description="Can change either colors, opacity, or width." gui-text="Attribute">
        <option value="fill">fill</option>
        <option value="stroke">stroke</option>
        <option value="fill-opacity">fill-opacity</option>
        <option value="stroke-opacity">stroke-opacity</option>
        <option value="stroke-width">stroke-width</option>
      </param>
      <param name="color" type="color" mode="color" appearance="colorbutton" translatable="no" gui-description="Target color" gui-text="Color">#ff5555</param>
      <param name="style_val" type="string" gui-description="Use a fraction 0.75 for opacity. Or an integer 25 for widths." gui-text="Opacity/width"/>
    </page>
    <page name="scale" gui-text="scale">
      <param name="scale" type="string" gui-description="Scales both width and height. Specify fractions each. For example 0.0 will vanish the object, or 2.0 double it per dimension. Beware that this transform can 'scale' x= and y= positions alongside. Can also be a single value `2.5` to scale both width and height." gui-text="Scaling">1.0 1.0</param>
    </page>







|
|
|
|
|







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
      <param name="remove_child" type="bool" mode="checkbox" gui-description="Remove any existing ﹤animate*﹥ tags from selected object. (Else use the XML editor Ctrl+Shift+X.)" gui-text="Strip previous animation">false</param>
    </vbox>
    <image width="220" height="220">animate_yo.svg</image>
  </hbox>
  <param name="mode" type="notebook" gui-description="Animation" gui-text="Animation mode">
    <page name="style" gui-text="style">
      <param name="style" type="optiongroup" appearance="combo" translatable="no" gui-description="Can change either colors, opacity, or width." gui-text="Attribute">
        <option translatable="no" value="fill">fill</option>
        <option translatable="no" value="stroke">stroke</option>
        <option translatable="no" value="fill-opacity">fill-opacity</option>
        <option translatable="no" value="stroke-opacity">stroke-opacity</option>
        <option translatable="no" value="stroke-width">stroke-width</option>
      </param>
      <param name="color" type="color" mode="color" appearance="colorbutton" translatable="no" gui-description="Target color" gui-text="Color">#ff5555</param>
      <param name="style_val" type="string" gui-description="Use a fraction 0.75 for opacity. Or an integer 25 for widths." gui-text="Opacity/width"/>
    </page>
    <page name="scale" gui-text="scale">
      <param name="scale" type="string" gui-description="Scales both width and height. Specify fractions each. For example 0.0 will vanish the object, or 2.0 double it per dimension. Beware that this transform can 'scale' x= and y= positions alongside. Can also be a single value `2.5` to scale both width and height." gui-text="Scaling">1.0 1.0</param>
    </page>
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
    <command location="inx" interpreter="python">animate_yo.py</command>
  </script>
  <!--
        pars.add_argument("-"+"-general", type=str, dest="general", default="time", help="Timing and control settings")
        pars.add_argument("-"+"-start", type=str, dest="start", default="0s", help="Start time")
        pars.add_argument("-"+"-duration", type=str, dest="duration", default="5s", help="Duration")
        pars.add_argument("-"+"-repeat_count", type=str, dest="repeat_count", default="style", help="repeatCount")
        pars.add_argument("-"+"-repeat_fill", type=str, dest="repeat_fill", default="freeze", help="fill")
        pars.add_argument("-"+"-calc_mode", type=str, dest="calc_mode", default="linear", help="calcMode")
        pars.add_argument("-"+"-key_values", type=str, dest="key_values", default="", help="(key)values")
        pars.add_argument("-"+"-key_times", type=str, dest="key_times", default="", help="keyTimes")
        pars.add_argument("-"+"-key_splines", type=str, dest="key_splines", default="", help="keySplines")
        pars.add_argument("-"+"-set_id", type=str, dest="set_id", default="", help="Assign #id")
        pars.add_argument("-"+"-remove_child", type=inkex.Boolean, dest="remove_child", default=False, help="Strip previous animation")
        pars.add_argument("-"+"-mode", type=str, dest="mode", default="style", help="Animation mode")







|







103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
    <command location="inx" interpreter="python">animate_yo.py</command>
  </script>
  <!--
        pars.add_argument("-"+"-general", type=str, dest="general", default="time", help="Timing and control settings")
        pars.add_argument("-"+"-start", type=str, dest="start", default="0s", help="Start time")
        pars.add_argument("-"+"-duration", type=str, dest="duration", default="5s", help="Duration")
        pars.add_argument("-"+"-repeat_count", type=str, dest="repeat_count", default="style", help="repeatCount")
        pars.add_argument("-"+"-repeat_fill", type=str, dest="repeat_fill", default="freeze", help="repeatFill")
        pars.add_argument("-"+"-calc_mode", type=str, dest="calc_mode", default="linear", help="calcMode")
        pars.add_argument("-"+"-key_values", type=str, dest="key_values", default="", help="(key)values")
        pars.add_argument("-"+"-key_times", type=str, dest="key_times", default="", help="keyTimes")
        pars.add_argument("-"+"-key_splines", type=str, dest="key_splines", default="", help="keySplines")
        pars.add_argument("-"+"-set_id", type=str, dest="set_id", default="", help="Assign #id")
        pars.add_argument("-"+"-remove_child", type=inkex.Boolean, dest="remove_child", default=False, help="Strip previous animation")
        pars.add_argument("-"+"-mode", type=str, dest="mode", default="style", help="Animation mode")

Changes to inkscape/animate_yo.py.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# pylint: disable=line-too-long, missing-module-docstring, bad-whitespace
# config:
#    {  xml: <hbox><vbox> }
#    { name: general, type: notebook, value: time, description: Timing and control settings }
#    { class: timing, name: start, type: str, value: "0s", description: Start time, help: "Can be a numeric `1s` or an expression and reference events `click + 1s` or other animations `animXY.end - 1s`." }
#    { class: timing, name: duration, type: str, value: "5s", description: Duration, help: "Static value or expression again." }
#    { class: repeat, name: repeat_count, type: select, select: "indefinite|0|1|2|3|4|5|10|15|20|25|50|100", value: style, description: repeatCount, help: "How often this animation loops. (Ignored by gif_export, where animations are generally per-frame.)" }
#    { class: repeat, name: repeat_fill, type: select, select: "freeze|remove", value: freeze, description: fill, help: "Animation can either stay at last state, or reset to value before animation. (gif_export always reverts to previous slide state)" }
#    { class: calc, name: calc_mode, type: select, select: "linear|discrete|paced|spline", value: "linear", description: "calcMode", help: "Defines if values in animation are traversed in a straight from-to progression (linear), jump from start to end (discrete), slowly speed up (paced), or use a list of values/keyTimes (spline)." }
#    { class: calc, name: key_values, type: str, value: "", description: "(key)values", help: "Spline mode: Instead of a single to= attribute, can give a list of values `12px;20px;50px` or `#f33;#77cc99;#03F` for use with keyTimes/Splines." }
#    { class: calc, name: key_times, type: str, value: "", description: "keyTimes", help: "Spline mode: Lists the time lapse positions `0.0; 0.3; 0.9; 1.0` when point in values= list should be approached." }
#    { class: calc, name: key_splines, type: str, value: "", description: "keySplines", help: "Spline mode: defines bezier curves for use with keyTimes. (Ignored by gif_export)" }
#    { class: id, name: set_id, type: str, value: "", description: "Assign #id", help: "Animation itself can have an #id for referencing." }
#    {  xml: </page></param> }
#    { name: remove_child, type: bool, value: 0, description: "Strip previous animation", help: "Remove any existing ﹤animate*﹥ tags from selected object. (Else use the XML editor Ctrl+Shift+X.)" }







|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# pylint: disable=line-too-long, missing-module-docstring, bad-whitespace
# config:
#    {  xml: <hbox><vbox> }
#    { name: general, type: notebook, value: time, description: Timing and control settings }
#    { class: timing, name: start, type: str, value: "0s", description: Start time, help: "Can be a numeric `1s` or an expression and reference events `click + 1s` or other animations `animXY.end - 1s`." }
#    { class: timing, name: duration, type: str, value: "5s", description: Duration, help: "Static value or expression again." }
#    { class: repeat, name: repeat_count, type: select, select: "indefinite|0|1|2|3|4|5|10|15|20|25|50|100", value: style, description: repeatCount, help: "How often this animation loops. (Ignored by gif_export, where animations are generally per-frame.)" }
#    { class: repeat, name: repeat_fill, type: select, select: "freeze|remove", value: freeze, translatable: no, description: repeatFill, help: "Animation can either stay at last state, or reset to value before animation. (gif_export always reverts to previous slide state)" }
#    { class: calc, name: calc_mode, type: select, select: "linear|discrete|paced|spline", value: "linear", description: "calcMode", help: "Defines if values in animation are traversed in a straight from-to progression (linear), jump from start to end (discrete), slowly speed up (paced), or use a list of values/keyTimes (spline)." }
#    { class: calc, name: key_values, type: str, value: "", description: "(key)values", help: "Spline mode: Instead of a single to= attribute, can give a list of values `12px;20px;50px` or `#f33;#77cc99;#03F` for use with keyTimes/Splines." }
#    { class: calc, name: key_times, type: str, value: "", description: "keyTimes", help: "Spline mode: Lists the time lapse positions `0.0; 0.3; 0.9; 1.0` when point in values= list should be approached." }
#    { class: calc, name: key_splines, type: str, value: "", description: "keySplines", help: "Spline mode: defines bezier curves for use with keyTimes. (Ignored by gif_export)" }
#    { class: id, name: set_id, type: str, value: "", description: "Assign #id", help: "Animation itself can have an #id for referencing." }
#    {  xml: </page></param> }
#    { name: remove_child, type: bool, value: 0, description: "Strip previous animation", help: "Remove any existing ﹤animate*﹥ tags from selected object. (Else use the XML editor Ctrl+Shift+X.)" }

Changes to inkscape/pmd2inks.

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
}
bool_true_match = re.compile(r"^(1|yes|true)", re.I).match

class state:
    tab = ""
    page = ""

def enum_item(k, v, xml="option"):
    return f"""<{xml} value="{k}">{v}</{xml}>"""

def param(o):
    # arguments
    raw_type = o.get("type")
    _type = raw_type or "str"
    _type = map["type"].get(_type, "string")
    _name = o.get("name", "_0")







|
|







98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
}
bool_true_match = re.compile(r"^(1|yes|true)", re.I).match

class state:
    tab = ""
    page = ""

def enum_item(k, v, _add="", xml="option"):
    return f"""<{xml} {_add} value="{k}">{v}</{xml}>"""

def param(o):
    # arguments
    raw_type = o.get("type")
    _type = raw_type or "str"
    _type = map["type"].get(_type, "string")
    _name = o.get("name", "_0")
146
147
148
149
150
151
152

153
154
155
156
157
158
159
160
            text = meta[re.sub(r"^[#{$]+|[:}$]*$", "", text)] # in-place reference
        return f"""
            {_prefix}
            <label {_add}>{text}</label>
        """
    # variants
    elif _type == "select":

        ls = "\n            ".join([enum_item(k, v) for k, v in o.get("select", {}).items()])
        return f"""
            {_prefix}
            <param name="{_name}" type="optiongroup" {_add} gui-text="{_desc}">
            {ls}
            </param>
        """
    elif _type == "notebook":







>
|







146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
            text = meta[re.sub(r"^[#{$]+|[:}$]*$", "", text)] # in-place reference
        return f"""
            {_prefix}
            <label {_add}>{text}</label>
        """
    # variants
    elif _type == "select":
        _option_add = 'translatable="no" ' if not bool_true_match(o.get("translatable", "yes")) else ''
        ls = "\n            ".join([enum_item(k, v, _option_add) for k, v in o.get("select", {}).items()])
        return f"""
            {_prefix}
            <param name="{_name}" type="optiongroup" {_add} gui-text="{_desc}">
            {ls}
            </param>
        """
    elif _type == "notebook":