diff options
| author | Sebastian Wüst <sebi@timewaster.de> | 2013-11-13 20:55:31 +0000 |
|---|---|---|
| committer | Sebastian Wüst <sebi@timewaster.de> | 2013-11-13 20:55:31 +0000 |
| commit | 694ff84d613639d2a62b6fc2b822b12627d8fea9 (patch) | |
| tree | 0a288dd72fd444bf5e27a1652046a1a1a38ac169 | |
| parent | fix warning (diff) | |
| download | inkscape-694ff84d613639d2a62b6fc2b822b12627d8fea9.tar.gz inkscape-694ff84d613639d2a62b6fc2b822b12627d8fea9.zip | |
renamed some methods + removed unnecessary text + and fixed start option
(bzr r12812)
| -rw-r--r-- | share/extensions/hpgl_encoder.py | 24 | ||||
| -rw-r--r-- | share/extensions/plotter.inx | 2 |
2 files changed, 13 insertions, 13 deletions
diff --git a/share/extensions/hpgl_encoder.py b/share/extensions/hpgl_encoder.py index f6ad13f60..3a0523391 100644 --- a/share/extensions/hpgl_encoder.py +++ b/share/extensions/hpgl_encoder.py @@ -91,7 +91,7 @@ class hpglEncoder: groupmat = [[self.mirrorX * self.scaleX * self.viewBoxTransformX, 0.0, 0.0], [0.0, self.mirrorY * self.scaleY * self.viewBoxTransformY, 0.0]] groupmat = simpletransform.composeTransform(groupmat, simpletransform.parseTransform('rotate(' + self.options.orientation + ')')) self.vData = [['', -1.0, -1.0], ['', -1.0, -1.0], ['', -1.0, -1.0], ['', -1.0, -1.0]] - self.process_groups(self.doc, groupmat) + self.processGroups(self.doc, groupmat) if self.divergenceX == 'False' or self.divergenceY == 'False' or self.sizeX == 'False' or self.sizeY == 'False': raise Exception('NO_PATHS') # live run @@ -110,17 +110,17 @@ class hpglEncoder: self.hpgl = 'IN;SP%d' % self.options.pen # add precut if self.options.useToolOffset and self.options.precut: - self.calcOffset('PU', 0, 0) - self.calcOffset('PD', 0, self.options.toolOffset * 8) + self.processOffset('PU', 0, 0) + self.processOffset('PD', 0, self.options.toolOffset * 8) # start conversion - self.process_groups(self.doc, groupmat) + self.processGroups(self.doc, groupmat) # shift an empty node in in order to process last node in cache - self.calcOffset('PU', 0, 0) + self.processOffset('PU', 0, 0) # add return to zero point self.hpgl += ';PU0,0;' return self.hpgl - def process_groups(self, doc, groupmat): + def processGroups(self, doc, groupmat): # flatten groups to avoid recursion paths = [] for node in doc: @@ -139,7 +139,7 @@ class hpglEncoder: paths[i][0] = '' for node in paths: if node[0] == inkex.addNS('path', 'svg'): - self.process_path(node[1], node[2]) + self.processPath(node[1], node[2]) def mergeTransform(self, doc, matrix): # get and merge two matrixes into one @@ -157,7 +157,7 @@ class hpglEncoder: return False return True - def process_path(self, node, mat): + def processPath(self, node, mat): # process path paths = node.get('d') if paths: @@ -175,7 +175,7 @@ class hpglEncoder: posX, posY = singlePathPoint[1] # check if point is repeating, if so, ignore if posX != oldPosX or posY != oldPosY: - self.calcOffset(cmd, posX, posY) + self.processOffset(cmd, posX, posY) cmd = 'PD' oldPosX = posX oldPosY = posY @@ -192,10 +192,10 @@ class hpglEncoder: overcutLength += self.getLength(oldPosX, oldPosY, posX, posY) if overcutLength >= self.options.overcut: newLength = self.changeLength(oldPosX, oldPosY, posX, posY, - (overcutLength - self.options.overcut)) - self.calcOffset(cmd, newLength[0], newLength[1]) + self.processOffset(cmd, newLength[0], newLength[1]) break else: - self.calcOffset(cmd, posX, posY) + self.processOffset(cmd, posX, posY) oldPosX = posX oldPosY = posY @@ -220,7 +220,7 @@ class hpglEncoder: temp2 = 2 * math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2) * math.sqrt((x3 - x2) ** 2 + (y3 - y2) ** 2) return math.acos(max(min(temp1 / temp2, 1.0), -1.0)) - def calcOffset(self, cmd, posX, posY): + def processOffset(self, cmd, posX, posY): # calculate offset correction (or dont) if not self.options.useToolOffset or self.dryRun: self.storePoint(cmd, posX, posY) diff --git a/share/extensions/plotter.inx b/share/extensions/plotter.inx index 49bcf837e..f33e3088b 100644 --- a/share/extensions/plotter.inx +++ b/share/extensions/plotter.inx @@ -11,6 +11,7 @@ <page name="misc" _gui-text="Connection"> <param name="serialPort" type="string" _gui-text="Serial Port" _gui-description="The port of your serial connection, on Windows something like 'COM1', on Linux something like: '/dev/ttyUSB0' (Default: COM1)">COM1</param> <param name="serialBaudRate" type="optiongroup" appearance="minimal" _gui-text="Serial Baud rate" _gui-description="The Baud rate of your serial connection (Default: 9600)"> + <option value="9600">9600</option> <option value="110">110</option> <option value="300">300</option> <option value="600">600</option> @@ -39,7 +40,6 @@ <param name="space" type="description"> </param> <_param name="serialHelp" type="description">This can be a physical serial connection or a USB-to-Serial bridge. Ask your plotter manufacturer for drivers if needed.</_param> <_param name="parallelHelp" type="description">Please note that Parallel (LPT) connections are not supported.</_param> - <_param name="hpglNote" type="description">Please note that only the HPGL command language is supported at the moment.</_param> </page> <page name="plotter" _gui-text="Plotter Settings"> <param name="pen" type="int" min="0" max="99" _gui-text="Pen number" _gui-description="The number of the pen (tool) to use, on most plotters 1 (Standard: '1')">1</param> |
