{"id":336174,"date":"2022-07-25T21:00:08","date_gmt":"2022-07-25T21:00:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=336174"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=336174","title":{"rendered":"<span>Python-\u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439 \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445. \u0413\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439. \u0414\u043b\u044f Inkscape<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0417\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e &#8212; \u0432\u0441\u0451 \u0442\u0443\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0443\u043c\u0431\u0443\u0440\u043d\u043e&#8230; <\/p>\n<p>\u0413\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 Inkscape (\u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0438 Inkscape \u043f\u043e\u0432\u0435\u0437\u0451\u0442 \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439) \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c Python-\u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0440\u0438\u0441\u0443\u044e\u0449\u0438\u0435 \u0432\u0441\u044f\u043a\u0438\u0435 \u043b\u0438\u043d\u0438\u0438, \u043a\u0440\u0443\u0433\u0438, \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u0438 \u0434\u0430\u0436\u0435 \u0442\u0435\u043a\u0441\u0442.<\/p>\n<p>\u0422\u0435\u043a\u0441\u0442 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439 \u0432 \u0434\u0432\u0443\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445 (textfa.txt \u0438 textfb.txt):<\/p>\n<pre><code class=\"python\">#!\/usr\/bin\/env python # coding=utf-8  # \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043c\u0430\u0433\u0438\u044e \u0438 \u043f\u0440\u043e\u0447\u0443\u044e \u0442\u0440\u0435\u0431\u0443\u0445\u0443 import inkex from inkex import TextElement, Group, Layer, Tspan, PathElement FntSz = 3.175    # \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442 - \u0442\u0430\u043a \u0432\u043e\u0442 \u044d\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u0442\u0435\u043a\u0441\u0442\u0430  FntHt = 1.6      # \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 FilenameA = '\/home\/user_name\/textfa.txt'    # \u0444\u0430\u0439\u043b \u043f\u0435\u0440\u0432\u044b\u0439 FilenameB = '\/home\/user_name\/textfb.txt'    # \u0444\u0430\u0439\u043b \u0432\u0442\u043e\u0440\u043e\u0439 sxA = 0       # \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 syA = 0 sxB = 1000       # \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u0438\u0437 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 syB = 0 class Comparator(inkex.EffectExtension):     # \u043d\u0443 \u0447\u0442\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c...  #--#--#-----------I want to distincs the exact \"SourceText\" in this group somehow -------------------------------  def effect(self):                # \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430 Comparator \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0418\u043d\u043a\u0441\u043a\u0435\u0439\u043f\u0430          ar23A = ['nothing','here']   # \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430     ar23B = ['nothing','here']   # \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430       Layer = self.PrepareThelayer('Habr23')  # \u043f\u0440\u0438\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u0413\u0440\u0430\u0444\u0438\u0447_\u0441\u043b\u043e\u0439 \u0434\u043b\u044f \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f      with open(FilenameA, 'r') as file:        BigTxA = file.read()                  # \u0447\u0438\u0442\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430        ar23A = BigTxA.split('\\n')           # \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438       self.drawText(Layer, sxA, syA, ar23A)   # \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0440\u043e\u043a \u0432 \u0413\u0440\u0430\u0444\u0438\u0447_\u0444\u0430\u0439\u043b      with open(FilenameB, 'r') as file:        BigTxB = file.read()                  # \u0447\u0438\u0442\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u0438\u0437 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430        ar23B = BigTxB.split('\\n')           # \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438      self.drawText(Layer, sxB, syB, ar23B)   # \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0440\u043e\u043a \u0432 \u0413\u0440\u0430\u0444\u0438\u0447_\u0444\u0430\u0439\u043b      for nA in range(0, len(ar23A)):         # \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u043e\u0431\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 \u0432 \u043f\u043e\u0438\u0441\u043a\u0430\u0445...       for nB in range(0, len(ar23B)):          if (ar23A[nA] == ar23B[nB]):       # ...\u0432 \u043f\u043e\u0438\u0441\u043a\u0430\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0441\u0442\u0440\u043e\u043a            if(len(ar23A[nA]) > 1):          # \u0438\u0437\u0431\u0435\u0433\u0430\u0435\u043c \u043f\u0443\u0441\u0442\u044b\u0445 \u0441\u0442\u0440\u043e\u043a             yA = nA * FntHt * FntSz         # \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0434\u043b\u044f \u043b\u0438\u043d\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438             yB = nB * FntHt * FntSz              self.drawLine(Layer, sxA+200,syA+yA, sxB, syB+yB)   # \u0440\u0438\u0441\u0443\u0435\u043c \u043b\u0438\u043d\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438              #--#--#---------------------------------------------------------------  def drawText(self, Layer, x, y, Tmass):         # \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0446\u0435\u0440\u0435\u043c\u043e\u043d\u0438\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442_\u0431\u043b\u043e\u043a\u0430         elem = TextElement(x=str(x), y=str(y))                  elem.style = {    # \u0437\u0430\u0434\u0430\u0451\u043c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434 \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0435\u043a\u0441\u0442_\u0431\u043b\u043e\u043a\u0430             'font-size':str(FntSz),    # \u0440\u0430\u0437\u043c\u0435\u0440 \u0448\u0440\u0438\u0444\u0442\u0430             'line-height':str(FntHt),  # \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0440\u043e\u043a             'font-family':'courier',   # \u0438 \u0442.\u0434.             '-inkscape-font-specification':'courier',             'stroke-width':'0.264583'}          # \u0435\u0449\u0451 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0446\u0435\u0440\u0435\u043c\u043e\u043d\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u043a\u043b\u0438\u043d\u0430\u043d\u0438\u0439         elem.set('xml:space',\"preserve\")         # \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442         for n in range(0, len(Tmass)):           tx23 = Tspan(Tmass[n])       # \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443           tx23.set('sodipodi:role',\"line\")  # \u043c\u0430\u0433\u0438\u044f...           tx23.set('x' ,x)           tx23.set('y' , y + (n * FntHt * FntSz))           elem.add(tx23)  # \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u044f \u043a\u0430\u0436\u0434\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043a \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c\u0443 \u0431\u043b\u043e\u043a\u0443          # \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0431\u043b\u043e\u043a \u0432 \u0413\u0440\u0430\u0444\u0438\u0447_\u0441\u043b\u043e\u0439 (\u0442\u043e \u0435\u0441\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d)         Layer.add(elem)   # \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0431\u043b\u043e\u043a \u043d\u0430 \u044d\u043a\u0440\u0430\u043d  #--#--#---------------------------------------------------------------  def PrepareThelayer(self, Lname):          # \u0441\u043f\u0435\u0440\u0432\u0430 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u0413\u0440\u0430\u0444\u0438\u0447_\u0441\u043b\u043e\u0439 \u0441 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u043c \u0438\u043c\u043c\u0435\u043d\u0435\u043c          svg = self.document.getroot()  # \u0438\u0449\u0435\u043c \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435           for g in svg.xpath('\/\/svg:g', namespaces=inkex.NSS):             if g.get(inkex.addNS('groupmode', 'inkscape')) == 'layer':               t23 = g.get(inkex.addNS('label', 'inkscape'))               if (t23 == Lname):    # \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u043b\u0438 \u0438\u043c\u044f \u0413\u0440\u0430\u0444\u0438\u0447_\u0441\u043b\u043e\u044f?                 for child in g:     # \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0439 \u0441\u043b\u043e\u0439                   g.remove(child)   # \u043e\u0447\u0438\u0449\u0430\u0435\u043c \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435                 return g          # \u0413\u0440\u0430\u0444\u0438\u0447_\u0441\u043b\u043e\u0439 \u0441 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c \u043c\u044b \u043d\u0435 \u043d\u0430\u0448\u043b\u0438          # \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u044b\u0439 \u0413\u0440\u0430\u0444\u0438\u0447_\u0441\u043b\u043e\u0439 \u0441 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c          newlayer=self.svg.add(Layer.new(Lname))             return newlayer    #--#--#---------------------------------------------------------------  def drawLine(self, layer, x0,y0, x99, y99):          # \u0440\u0438\u0441\u0443\u0435\u043c \u043b\u0438\u043d\u0438\u044e \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u044f \u0432\u0441\u0435 \u0446\u0435\u0440\u0435\u043c\u043e\u043d\u0438\u0438 \u0418\u043d\u043a\u0441\u043a\u0435\u0439\u043f\u0430          # \u0441\u043f\u0435\u0440\u0432\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043b\u0438\u043d\u0438\u044e...          line = PathElement()          line.set('fill','none')          line.set('stroke',\"#4FF\")       # \u0446\u0432\u0435\u0442          line.set('stroke-width','0.8')  # \u0442\u043e\u043b\u0449\u0438\u043d\u0443          line.set('d','M %f %f %f %f' % (x0, y0, x99, y99)) # \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b           # \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043b\u0438\u043d\u0438\u044e \u0432 \u0413\u0440\u0430\u0444\u0438\u0447_\u0441\u043b\u043e\u0439 (\u0442\u043e \u0435\u0441\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d)          layer.append(line)  # \u041f\u0438\u0442\u043e\u043d\u0441\u043a\u0430\u044f \u041e\u041e\u041f-\u043c\u0430\u0433\u0438\u044f if __name__ == '__main__':     Comparator().run()<\/code><\/pre>\n<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0443\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 Inkscape \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c Python-\u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u043d\u044e. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/227\/5de\/521\/2275de521568585d15d304d8f0954ada.jpg\" alt=\"\u041e\u043a\u043d\u043e \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 Inkscape \u043a\u0430\u043a \u0435\u0433\u043e \u0432\u0438\u0436\u0443 \u044f \u0438 \u043c\u043e\u0439 LinuxMint\" title=\"\u041e\u043a\u043d\u043e \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 Inkscape \u043a\u0430\u043a \u0435\u0433\u043e \u0432\u0438\u0436\u0443 \u044f \u0438 \u043c\u043e\u0439 LinuxMint\" width=\"855\" height=\"484\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/227\/5de\/521\/2275de521568585d15d304d8f0954ada.jpg\" data-blurred=\"true\"\/><figcaption>\u041e\u043a\u043d\u043e \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 Inkscape \u043a\u0430\u043a \u0435\u0433\u043e \u0432\u0438\u0436\u0443 \u044f \u0438 \u043c\u043e\u0439 LinuxMint<\/figcaption><\/figure>\n<p> \u0412 \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u043c\u0435\u043d\u044e \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 Inkscape \u043f\u043e\u043c\u0438\u043c\u043e \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u0438\u0445 File, Edit, View \u2013 \u0435\u0441\u0442\u044c \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u043e\u0435 \u043f\u043e\u0434\u043c\u0435\u043d\u044e Extensions (\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f) \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u0438 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443 Python-\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432.<\/p>\n<p>&#8230;\u0421\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0438 Inkscape  \u043f\u0440\u0435\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 Linux-\u043f\u043e\u043a\u043b\u043e\u043d\u043d\u0438\u043a\u0443 \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0435\u0433\u043e \u0441\u0430\u043c\u043e\u0434\u0435\u043b\u044c\u043d\u044b\u0435 Python-\u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432 \u0440\u0430\u0439\u043e\u043d\u0435 \u201c\u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0439\u201d \u043f\u0430\u043f\u043a\u0438 <strong>\u201c\/home\/<\/strong>user_name<strong>\/.config\/inkscape\/extensions\/\u201d<\/strong> (\u0434\u043b\u044f Windows-\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0442\u0430\u043c \u0447\u0442\u043e-\u0442\u043e \u0441\u0432\u043e\u0451).  <\/p>\n<p> \u0412 \u044d\u0442\u043e\u0439 \u0436\u0435 \u043f\u0430\u043f\u043a\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c *.inx<br \/> \u0412 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u044b\u043b \u0444\u0430\u0439\u043b <strong>&#171;proba01.inx&#187;<\/strong><\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?> &lt;inkscape-extension xmlns=\"http:\/\/www.inkscape.org\/namespace\/inkscape\/extension\">   &lt;_name>proba-1&lt;\/_name>     &lt;id>something12345&lt;\/id>   &lt;dependency type=\"executable\" location=\"extensions\">proba01.py&lt;\/dependency>     &lt;effect>     &lt;object-type>all&lt;\/object-type>   &lt;\/effect>   &lt;script>     &lt;command reldir=\"extensions\" interpreter=\"python\">proba01.py&lt;\/command>   &lt;\/script> &lt;\/inkscape-extension><\/code><\/pre>\n<p> \u042f \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043b \u0432 \u043f\u0430\u043f\u043a\u0435 <strong>\u201c\/home\/<\/strong>user_name<strong>\/.config\/inkscape\/extensions\/\u201d<\/strong> \u0434\u0432\u0430 \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0445 \u0444\u0430\u0439\u043b\u0430 <strong>&#171;proba01.py&#187;<\/strong> \u0438 <strong>&#171;proba01.inx&#187;<\/strong>, \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b Inkscape \u0438 \u0441 \u0440\u0430\u0434\u043e\u0441\u0442\u044c\u044e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0432 \u043f\u043e\u0434\u043c\u0435\u043d\u044e \u201cExtensions\u201d \u043f\u0443\u043d\u043a\u0442 \u201cproba-1\u201d \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b \u0441\u043a\u0440\u0438\u043f\u0442 \u201cproba01.py\u201d<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/712\/85f\/60d\/71285f60ded9f6d38e4d40b49955817c.jpg\" width=\"1503\" height=\"1099\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/712\/85f\/60d\/71285f60ded9f6d38e4d40b49955817c.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0418 \u0432\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/72a\/e19\/aba\/72ae19abaebe5bc84fb54685e0c0945d.jpg\" width=\"1527\" height=\"1047\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/72a\/e19\/aba\/72ae19abaebe5bc84fb54685e0c0945d.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412\u044b\u0433\u0434\u044f\u0434\u0438\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u0443\u043a\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e. <\/p>\n<p>\u042f \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442. \u0421 \u0440\u0430\u0434\u043e\u0441\u0442\u044c\u044e \u0432\u044b\u0441\u043b\u0443\u0448\u0430\u044e \u043c\u043d\u0435\u043d\u0438\u044f.<br \/>(\u0433\u0434\u0435 .. \u0442\u0443\u0442 \u043a\u043d\u043e\u043f\u043a\u0430 &#171;\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c&#187; ?) <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/678958\/\"> https:\/\/habr.com\/ru\/post\/678958\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0417\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e &#8212; \u0432\u0441\u0451 \u0442\u0443\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0443\u043c\u0431\u0443\u0440\u043d\u043e&#8230; <\/p>\n<p>\u0413\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 Inkscape (\u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0438 Inkscape \u043f\u043e\u0432\u0435\u0437\u0451\u0442 \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439) \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c Python-\u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0440\u0438\u0441\u0443\u044e\u0449\u0438\u0435 \u0432\u0441\u044f\u043a\u0438\u0435 \u043b\u0438\u043d\u0438\u0438, \u043a\u0440\u0443\u0433\u0438, \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u0438 \u0434\u0430\u0436\u0435 \u0442\u0435\u043a\u0441\u0442.<\/p>\n<p>\u0422\u0435\u043a\u0441\u0442 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439 \u0432 \u0434\u0432\u0443\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445 (textfa.txt \u0438 textfb.txt):<\/p>\n<pre><code class=\"python\">#!\/usr\/bin\/env python # coding=utf-8  # \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043c\u0430\u0433\u0438\u044e \u0438 \u043f\u0440\u043e\u0447\u0443\u044e \u0442\u0440\u0435\u0431\u0443\u0445\u0443 import inkex from inkex import TextElement, Group, Layer, Tspan, PathElement FntSz = 3.175    # \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442 - \u0442\u0430\u043a \u0432\u043e\u0442 \u044d\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u0442\u0435\u043a\u0441\u0442\u0430  FntHt = 1.6      # \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 FilenameA = '\/home\/user_name\/textfa.txt'    # \u0444\u0430\u0439\u043b \u043f\u0435\u0440\u0432\u044b\u0439 FilenameB = '\/home\/user_name\/textfb.txt'    # \u0444\u0430\u0439\u043b \u0432\u0442\u043e\u0440\u043e\u0439 sxA = 0       # \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 syA = 0 sxB = 1000       # \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u0438\u0437 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 syB = 0 class Comparator(inkex.EffectExtension):     # \u043d\u0443 \u0447\u0442\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c...  #--#--#-----------I want to distincs the exact \"SourceText\" in this group somehow -------------------------------  def effect(self):                # \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430 Comparator \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0418\u043d\u043a\u0441\u043a\u0435\u0439\u043f\u0430          ar23A = ['nothing','here']   # \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430     ar23B = ['nothing','here']   # \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438\u0437 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430       Layer = self.PrepareThelayer('Habr23')  # \u043f\u0440\u0438\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u0413\u0440\u0430\u0444\u0438\u0447_\u0441\u043b\u043e\u0439 \u0434\u043b\u044f \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f      with open(FilenameA, 'r') as file:        BigTxA = file.read()                  # \u0447\u0438\u0442\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430        ar23A = BigTxA.split('\\n')           # \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438       self.drawText(Layer, sxA, syA, ar23A)   # \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0440\u043e\u043a \u0432 \u0413\u0440\u0430\u0444\u0438\u0447_\u0444\u0430\u0439\u043b      with open(FilenameB, 'r') as file:        BigTxB = file.read()                  # \u0447\u0438\u0442\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u0438\u0437 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430        ar23B = BigTxB.split('\\n')           # \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438      self.drawText(Layer, sxB, syB, ar23B)   # \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0440\u043e\u043a \u0432 \u0413\u0440\u0430\u0444\u0438\u0447_\u0444\u0430\u0439\u043b      for nA in range(0, len(ar23A)):         # \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0435\u043c \u043e\u0431\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438 \u0432 \u043f\u043e\u0438\u0441\u043a\u0430\u0445...       for nB in range(0, len(ar23B)):          if (ar23A[nA] == ar23B[nB]):       # ...\u0432 \u043f\u043e\u0438\u0441\u043a\u0430\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0441\u0442\u0440\u043e\u043a            if(len(ar23A[nA]) > 1):          # \u0438\u0437\u0431\u0435\u0433\u0430\u0435\u043c \u043f\u0443\u0441\u0442\u044b\u0445 \u0441\u0442\u0440\u043e\u043a             yA = nA * FntHt * FntSz         # \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0434\u043b\u044f \u043b\u0438\u043d\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438             yB = nB * FntHt * FntSz              self.drawLine(Layer, sxA+200,syA+yA, sxB, syB+yB)   # \u0440\u0438\u0441\u0443\u0435\u043c \u043b\u0438\u043d\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438              #--#--#---------------------------------------------------------------  def drawText(self, Layer, x, y, Tmass):         # \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0446\u0435\u0440\u0435\u043c\u043e\u043d\u0438\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442_\u0431\u043b\u043e\u043a\u0430         elem = TextElement(x=str(x), y=str(y))                  elem.style = {    # \u0437\u0430\u0434\u0430\u0451\u043c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434 \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0435\u043a\u0441\u0442_\u0431\u043b\u043e\u043a\u0430             'font-size':str(FntSz),    # \u0440\u0430\u0437\u043c\u0435\u0440 \u0448\u0440\u0438\u0444\u0442\u0430             'line-height':str(FntHt),  # \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0440\u043e\u043a             'font-family':'courier',   # \u0438 \u0442.\u0434.             '-inkscape-font-specification':'courier',             'stroke-width':'0.264583'}          # \u0435\u0449\u0451 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0446\u0435\u0440\u0435\u043c\u043e\u043d\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u043a\u043b\u0438\u043d\u0430\u043d\u0438\u0439         elem.set('xml:space',\"preserve\")         # \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442         for n in range(0, len(Tmass)):           tx23 = Tspan(Tmass[n])       # \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443           tx23.set('sodipodi:role',\"line\")  # \u043c\u0430\u0433\u0438\u044f...           tx23.set('x' ,x)           tx23.set('y' , y + (n * FntHt * FntSz))           elem.add(tx23)  # \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u044f \u043a\u0430\u0436\u0434\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043a \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c\u0443 \u0431\u043b\u043e\u043a\u0443          # \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0431\u043b\u043e\u043a \u0432 \u0413\u0440\u0430\u0444\u0438\u0447_\u0441\u043b\u043e\u0439 (\u0442\u043e \u0435\u0441\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d)         Layer.add(elem)   # \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0431\u043b\u043e\u043a \u043d\u0430 \u044d\u043a\u0440\u0430\u043d  #--#--#---------------------------------------------------------------  def PrepareThelayer(self, Lname):          # \u0441\u043f\u0435\u0440\u0432\u0430 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u0413\u0440\u0430\u0444\u0438\u0447_\u0441\u043b\u043e\u0439 \u0441 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u043c \u0438\u043c\u043c\u0435\u043d\u0435\u043c          svg = self.document.getroot()  # \u0438\u0449\u0435\u043c \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435           for g in svg.xpath('\/\/svg:g', namespaces=inkex.NSS):             if g.get(inkex.addNS('groupmode', 'inkscape')) == 'layer':               t23 = g.get(inkex.addNS('label', 'inkscape'))               if (t23 == Lname):    # \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u043b\u0438 \u0438\u043c\u044f \u0413\u0440\u0430\u0444\u0438\u0447_\u0441\u043b\u043e\u044f?                 for child in g:     # \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0439 \u0441\u043b\u043e\u0439                   g.remove(child)   # \u043e\u0447\u0438\u0449\u0430\u0435\u043c \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435                 return g          # \u0413\u0440\u0430\u0444\u0438\u0447_\u0441\u043b\u043e\u0439 \u0441 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c \u043c\u044b \u043d\u0435 \u043d\u0430\u0448\u043b\u0438          # \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u044b\u0439 \u0413\u0440\u0430\u0444\u0438\u0447_\u0441\u043b\u043e\u0439 \u0441 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c          newlayer=self.svg.add(Layer.new(Lname))             return newlayer    #--#--#---------------------------------------------------------------  def drawLine(self, layer, x0,y0, x99, y99):          # \u0440\u0438\u0441\u0443\u0435\u043c \u043b\u0438\u043d\u0438\u044e \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u044f \u0432\u0441\u0435 \u0446\u0435\u0440\u0435\u043c\u043e\u043d\u0438\u0438 \u0418\u043d\u043a\u0441\u043a\u0435\u0439\u043f\u0430          # \u0441\u043f\u0435\u0440\u0432\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043b\u0438\u043d\u0438\u044e...          line = PathElement()          line.set('fill','none')          line.set('stroke',\"#4FF\")       # \u0446\u0432\u0435\u0442          line.set('stroke-width','0.8')  # \u0442\u043e\u043b\u0449\u0438\u043d\u0443          line.set('d','M %f %f %f %f' % (x0, y0, x99, y99)) # \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b           # \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043b\u0438\u043d\u0438\u044e \u0432 \u0413\u0440\u0430\u0444\u0438\u0447_\u0441\u043b\u043e\u0439 (\u0442\u043e \u0435\u0441\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d)          layer.append(line)  # \u041f\u0438\u0442\u043e\u043d\u0441\u043a\u0430\u044f \u041e\u041e\u041f-\u043c\u0430\u0433\u0438\u044f if __name__ == '__main__':     Comparator().run()<\/code><\/pre>\n<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0443\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 Inkscape \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c Python-\u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u043d\u044e. <\/p>\n<figure class=\"full-width\"><figcaption>\u041e\u043a\u043d\u043e \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 Inkscape \u043a\u0430\u043a \u0435\u0433\u043e \u0432\u0438\u0436\u0443 \u044f \u0438 \u043c\u043e\u0439 LinuxMint<\/figcaption><\/figure>\n<p> \u0412 \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u043c\u0435\u043d\u044e \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 Inkscape \u043f\u043e\u043c\u0438\u043c\u043e \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u0438\u0445 File, Edit, View \u2013 \u0435\u0441\u0442\u044c \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u043e\u0435 \u043f\u043e\u0434\u043c\u0435\u043d\u044e Extensions (\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f) \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u0438 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443 Python-\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432.<\/p>\n<p>&#8230;\u0421\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0438 Inkscape  \u043f\u0440\u0435\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 Linux-\u043f\u043e\u043a\u043b\u043e\u043d\u043d\u0438\u043a\u0443 \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0435\u0433\u043e \u0441\u0430\u043c\u043e\u0434\u0435\u043b\u044c\u043d\u044b\u0435 Python-\u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432 \u0440\u0430\u0439\u043e\u043d\u0435 \u201c\u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0439\u201d \u043f\u0430\u043f\u043a\u0438 <strong>\u201c\/home\/<\/strong>user_name<strong>\/.config\/inkscape\/extensions\/\u201d<\/strong> (\u0434\u043b\u044f Windows-\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0442\u0430\u043c \u0447\u0442\u043e-\u0442\u043e \u0441\u0432\u043e\u0451).  <\/p>\n<p> \u0412 \u044d\u0442\u043e\u0439 \u0436\u0435 \u043f\u0430\u043f\u043a\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c *.inx<br \/> \u0412 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u044b\u043b \u0444\u0430\u0439\u043b <strong>&#171;proba01.inx&#187;<\/strong><\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?> &lt;inkscape-extension xmlns=\"http:\/\/www.inkscape.org\/namespace\/inkscape\/extension\">   &lt;_name>proba-1&lt;\/_name>     &lt;id>something12345&lt;\/id>   &lt;dependency type=\"executable\" location=\"extensions\">proba01.py&lt;\/dependency>     &lt;effect>     &lt;object-type>all&lt;\/object-type>   &lt;\/effect>   &lt;script>     &lt;command reldir=\"extensions\" interpreter=\"python\">proba01.py&lt;\/command>   &lt;\/script> &lt;\/inkscape-extension><\/code><\/pre>\n<p> \u042f \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043b \u0432 \u043f\u0430\u043f\u043a\u0435 <strong>\u201c\/home\/<\/strong>user_name<strong>\/.config\/inkscape\/extensions\/\u201d<\/strong> \u0434\u0432\u0430 \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0445 \u0444\u0430\u0439\u043b\u0430 <strong>&#171;proba01.py&#187;<\/strong> \u0438 <strong>&#171;proba01.inx&#187;<\/strong>, \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b Inkscape \u0438 \u0441 \u0440\u0430\u0434\u043e\u0441\u0442\u044c\u044e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0432 \u043f\u043e\u0434\u043c\u0435\u043d\u044e \u201cExtensions\u201d \u043f\u0443\u043d\u043a\u0442 \u201cproba-1\u201d \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b \u0441\u043a\u0440\u0438\u043f\u0442 \u201cproba01.py\u201d<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0418 \u0432\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u0430:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u044b\u0433\u0434\u044f\u0434\u0438\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u0443\u043a\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e. <\/p>\n<p>\u042f \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442. \u0421 \u0440\u0430\u0434\u043e\u0441\u0442\u044c\u044e \u0432\u044b\u0441\u043b\u0443\u0448\u0430\u044e \u043c\u043d\u0435\u043d\u0438\u044f.<br \/>(\u0433\u0434\u0435 .. \u0442\u0443\u0442 \u043a\u043d\u043e\u043f\u043a\u0430 &#171;\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c&#187; ?) <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/678958\/\"> https:\/\/habr.com\/ru\/post\/678958\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-336174","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=336174"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336174\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=336174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=336174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=336174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}