kopia lustrzana https://github.com/inkstitch/inkstitch
				
				
				
			add 'Add Commands' extension
							rodzic
							
								
									7f9208ae2a
								
							
						
					
					
						commit
						53f92df056
					
				|  | @ -31,11 +31,12 @@ COMMANDS = { | |||
|     N_("origin"): N_("Origin for exported embroidery files"), | ||||
| 
 | ||||
|     # L10N command that affects entire document | ||||
|     N_("stop_point"): N_("Jump destination for Stop commands (a.k.a. \"Frame Out position\")."), | ||||
|     N_("stop_position"): N_("Jump destination for Stop commands (a.k.a. \"Frame Out position\")."), | ||||
| } | ||||
| 
 | ||||
| OBJECT_COMMANDS = ["fill_start", "fill_end", "stop", "trim", "ignore_object"] | ||||
| LAYER_COMMANDS = ["ignore_layer"] | ||||
| GLOBAL_COMMANDS = ["origin", "stop_position"] | ||||
| 
 | ||||
| 
 | ||||
| class CommandParseError(Exception): | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ from zip import Zip | |||
| from flip import Flip | ||||
| from object_commands import ObjectCommands | ||||
| from layer_commands import LayerCommands | ||||
| from global_commands import GlobalCommands | ||||
| from convert_to_satin import ConvertToSatin | ||||
| 
 | ||||
| __all__ = extensions = [Embroider, | ||||
|  | @ -22,4 +23,5 @@ __all__ = extensions = [Embroider, | |||
|                         Flip, | ||||
|                         ObjectCommands, | ||||
|                         LayerCommands, | ||||
|                         GlobalCommands, | ||||
|                         ConvertToSatin] | ||||
|  |  | |||
|  | @ -0,0 +1,14 @@ | |||
| import inkex | ||||
| 
 | ||||
| from .layer_commands import LayerCommands | ||||
| from ..commands import GLOBAL_COMMANDS | ||||
| 
 | ||||
| 
 | ||||
| # It's a bit weird subclassing this from LayerCommands, but global commands | ||||
| # must still be placed in a layer.  That means the two extensions | ||||
| # do the same thing and the code is the same.  We keep this as separate | ||||
| # extensions because we want the user to understand that global commands | ||||
| # affect the entire document, not just the current layer. | ||||
| 
 | ||||
| class GlobalCommands(LayerCommands): | ||||
|     COMMANDS = GLOBAL_COMMANDS | ||||
|  | @ -3,7 +3,7 @@ import pyembroidery | |||
| from .utils import build_environment, write_inx_file | ||||
| from .outputs import pyembroidery_output_formats | ||||
| from ..extensions import extensions, Input, Output | ||||
| from ..commands import LAYER_COMMANDS, OBJECT_COMMANDS, COMMANDS | ||||
| from ..commands import LAYER_COMMANDS, OBJECT_COMMANDS, GLOBAL_COMMANDS, COMMANDS | ||||
| 
 | ||||
| 
 | ||||
| def layer_commands(): | ||||
|  | @ -13,6 +13,10 @@ def layer_commands(): | |||
|     return [(command, COMMANDS[command]) for command in LAYER_COMMANDS] | ||||
| 
 | ||||
| 
 | ||||
| def global_commands(): | ||||
|     return [(command, COMMANDS[command]) for command in GLOBAL_COMMANDS] | ||||
| 
 | ||||
| 
 | ||||
| def object_commands(): | ||||
|     return [(command, COMMANDS[command]) for command in OBJECT_COMMANDS] | ||||
| 
 | ||||
|  | @ -35,4 +39,5 @@ def generate_extension_inx_files(): | |||
|         write_inx_file(name, template.render(formats=pyembroidery_output_formats(), | ||||
|                                              debug_formats=pyembroidery_debug_formats(), | ||||
|                                              layer_commands=layer_commands(), | ||||
|                                              object_commands=object_commands())) | ||||
|                                              object_commands=object_commands(), | ||||
|                                              global_commands=global_commands())) | ||||
|  |  | |||
							
								
								
									
										29
									
								
								messages.po
								
								
								
								
							
							
						
						
									
										29
									
								
								messages.po
								
								
								
								
							|  | @ -82,14 +82,14 @@ msgstr "" | |||
| 
 | ||||
| #. command that affects entire document | ||||
| #: lib/commands.py:34 | ||||
| msgid "stop_point" | ||||
| msgid "stop_position" | ||||
| msgstr "" | ||||
| 
 | ||||
| #: lib/commands.py:34 | ||||
| msgid "Jump destination for Stop commands (a.k.a. \"Frame Out position\")." | ||||
| msgstr "" | ||||
| 
 | ||||
| #: lib/commands.py:189 | ||||
| #: lib/commands.py:190 | ||||
| #, python-format | ||||
| msgid "" | ||||
| "Error: there is more than one %(command)s command in the document, but " | ||||
|  | @ -101,7 +101,7 @@ msgstr "" | |||
| #. command name to them.  Contents of %(description)s are in a separate | ||||
| #. translation | ||||
| #. string. | ||||
| #: lib/commands.py:196 | ||||
| #: lib/commands.py:197 | ||||
| #, python-format | ||||
| msgid "%(command)s: %(description)s" | ||||
| msgstr "" | ||||
|  | @ -1176,9 +1176,10 @@ msgstr "" | |||
| #. to your language's word for its language, e.g. "Español" for the spanish | ||||
| #. translation. | ||||
| #: templates/convert_to_satin.inx:12 templates/embroider.inx:24 | ||||
| #: templates/flip.inx:12 templates/install.inx:12 | ||||
| #: templates/layer_commands.inx:16 templates/object_commands.inx:15 | ||||
| #: templates/params.inx:12 templates/print.inx:12 templates/simulate.inx:12 | ||||
| #: templates/flip.inx:12 templates/global_commands.inx:16 | ||||
| #: templates/install.inx:12 templates/layer_commands.inx:16 | ||||
| #: templates/object_commands.inx:15 templates/params.inx:12 | ||||
| #: templates/print.inx:12 templates/simulate.inx:12 | ||||
| msgid "English" | ||||
| msgstr "" | ||||
| 
 | ||||
|  | @ -1224,6 +1225,20 @@ msgstr "" | |||
| msgid "Flip Satin Columns" | ||||
| msgstr "" | ||||
| 
 | ||||
| #: templates/global_commands.inx:3 | ||||
| msgid "Add Commands" | ||||
| msgstr "" | ||||
| 
 | ||||
| #: templates/global_commands.inx:7 | ||||
| msgid "These commands affect the entire embroidery design." | ||||
| msgstr "" | ||||
| 
 | ||||
| #. Inkscape submenu under Extensions -> Ink/Stitch | ||||
| #: templates/global_commands.inx:18 templates/layer_commands.inx:17 | ||||
| #: templates/object_commands.inx:16 | ||||
| msgid "Commands" | ||||
| msgstr "" | ||||
| 
 | ||||
| #: templates/input.inx:11 | ||||
| #, python-format | ||||
| msgid "convert %(file_extension)s file to Ink/Stitch manual-stitch paths" | ||||
|  | @ -1242,7 +1257,7 @@ msgid "Commands will be added to the currently-selected layer." | |||
| msgstr "" | ||||
| 
 | ||||
| #: templates/object_commands.inx:3 | ||||
| msgid "Attach Commands" | ||||
| msgid "Attach Commands to Selected Objects" | ||||
| msgstr "" | ||||
| 
 | ||||
| #: templates/output.inx:11 | ||||
|  |  | |||
|  | @ -0,0 +1,26 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> | ||||
|     <name>{% trans %}Add Commands{% endtrans %}</name> | ||||
|     <id>org.inkstitch.global_commands.{{ locale }}</id> | ||||
|     <dependency type="executable" location="extensions">inkstitch.py</dependency> | ||||
|     <dependency type="executable" location="extensions">inkex.py</dependency> | ||||
|     <param name="description" type="description">{% trans %}These commands affect the entire embroidery design.{% endtrans %}</param> | ||||
|     {% for command, description in global_commands %} | ||||
|     <param name="{{ command }}" type="boolean" _gui-text="{{ _(description) }}">false</param> | ||||
|     {% endfor %} | ||||
|     <param name="extension" type="string" gui-hidden="true">global_commands</param> | ||||
|     <effect> | ||||
|         <object-type>all</object-type> | ||||
|         <effects-menu> | ||||
|             <submenu name="Ink/Stitch"> | ||||
|                 <submenu name="{% trans %}English{% endtrans %}"> | ||||
|                     {# L10N Inkscape submenu under Extensions -> Ink/Stitch #} | ||||
|                     <submenu name="{% trans %}Commands{% endtrans %}" /> | ||||
|                 </submenu> | ||||
|             </submenu> | ||||
|         </effects-menu> | ||||
|     </effect> | ||||
|     <script> | ||||
|         <command reldir="extensions" interpreter="python">inkstitch.py</command> | ||||
|     </script> | ||||
| </inkscape-extension> | ||||
|  | @ -13,7 +13,9 @@ | |||
|         <object-type>all</object-type> | ||||
|         <effects-menu> | ||||
|             <submenu name="Ink/Stitch"> | ||||
|                 <submenu name="{% trans %}English{% endtrans %}" /> | ||||
|                 <submenu name="{% trans %}English{% endtrans %}"> | ||||
|                     <submenu name="{% trans %}Commands{% endtrans %}" /> | ||||
|                 </submenu> | ||||
|             </submenu> | ||||
|         </effects-menu> | ||||
|     </effect> | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> | ||||
|     <name>{% trans %}Attach Commands{% endtrans %}</name> | ||||
|     <name>{% trans %}Attach Commands to Selected Objects{% endtrans %}</name> | ||||
|     <id>org.inkstitch.commands.{{ locale }}</id> | ||||
|     <dependency type="executable" location="extensions">inkstitch.py</dependency> | ||||
|     <dependency type="executable" location="extensions">inkex.py</dependency> | ||||
|  | @ -12,7 +12,9 @@ | |||
|         <object-type>all</object-type> | ||||
|         <effects-menu> | ||||
|             <submenu name="Ink/Stitch"> | ||||
|                 <submenu name="{% trans %}English{% endtrans %}" /> | ||||
|                 <submenu name="{% trans %}English{% endtrans %}"> | ||||
|                     <submenu name="{% trans %}Commands{% endtrans %}" /> | ||||
|                 </submenu> | ||||
|             </submenu> | ||||
|         </effects-menu> | ||||
|     </effect> | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Lex Neva
						Lex Neva