kopia lustrzana https://github.com/inkstitch/inkstitch
add quick access methods for commands
rodzic
e29096ee13
commit
1f4bc62d96
lib/elements
|
@ -210,6 +210,22 @@ class EmbroideryElement(object):
|
|||
def commands(self):
|
||||
return find_commands(self.node)
|
||||
|
||||
@cache
|
||||
def get_commands(self, command):
|
||||
return [c for c in self.commands if c.command == command]
|
||||
|
||||
@cache
|
||||
def get_command(self, command):
|
||||
commands = self.get_commands(command)
|
||||
|
||||
if len(commands) == 1:
|
||||
return commands[0]
|
||||
elif len(commands) > 1:
|
||||
raise ValueError(_("%(id)s has more than one command of type '%(command)s' linked to it") %
|
||||
dict(id=self.node.get(id), command=command))
|
||||
else:
|
||||
return None
|
||||
|
||||
def strip_control_points(self, subpath):
|
||||
return [point for control_before, point, control_after in subpath]
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2018-06-16 22:33-0400\n"
|
||||
"POT-Creation-Date: 2018-06-22 22:19-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -47,6 +47,10 @@ msgstr ""
|
|||
msgid "Expand"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "%(id)s has more than one command of type '%(command)s' linked to it"
|
||||
msgstr ""
|
||||
|
||||
msgid "TRIM after"
|
||||
msgstr ""
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue