diff options
| author | Nicolas Dufour <nicoduf@yahoo.fr> | 2009-12-03 15:13:26 +0000 |
|---|---|---|
| committer | JazzyNico <nicoduf@yahoo.fr> | 2009-12-03 15:13:26 +0000 |
| commit | 77163369317023d0442f835f04d75ea27fd9e58d (patch) | |
| tree | 52c97241b1a908ea9ae2741dadd1ff40769763b3 | |
| parent | inkscape.pot and French translation updates (diff) | |
| download | inkscape-77163369317023d0442f835f04d75ea27fd9e58d.tar.gz inkscape-77163369317023d0442f835f04d75ea27fd9e58d.zip | |
New conversion factors added to inkex.py (ft, yd, m and km).
Measure path extension now uses inkex.py conversion factors.
(bzr r8860)
| -rwxr-xr-x | share/extensions/inkex.py | 3 | ||||
| -rw-r--r-- | share/extensions/measure.py | 23 |
2 files changed, 3 insertions, 23 deletions
diff --git a/share/extensions/inkex.py b/share/extensions/inkex.py index b7e3e0e63..d36820692 100755 --- a/share/extensions/inkex.py +++ b/share/extensions/inkex.py @@ -38,7 +38,8 @@ u'xml' :u'http://www.w3.org/XML/1998/namespace' } #a dictionary of unit to user unit conversion factors -uuconv = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'pc':15.0} +uuconv = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'm':3543.3070866, + 'km':3543307.0866, 'pc':15.0, 'yd':3240 , 'ft':1080} def unittouu(string): '''Returns userunits given a string representation of units in another system''' unit = re.compile('(%s)$' % '|'.join(uuconv.keys())) diff --git a/share/extensions/measure.py b/share/extensions/measure.py index 8eacd40c6..68586530b 100644 --- a/share/extensions/measure.py +++ b/share/extensions/measure.py @@ -126,28 +126,7 @@ class Length(inkex.Effect): p = cubicsuperpath.parsePath(node.get('d')) num = 1 slengths, stotal = csplength(p) - ''' Wio: Umrechnung in unit ''' - if self.options.unit=="mm": - factor=25.4/90.0 # px->mm - elif self.options.unit=="pt": - factor=0.80 # px->pt - elif self.options.unit=="cm": - factor=25.4/900.0 # px->cm - elif self.options.unit=="m": - factor=25.4/90000.0 # px->m - elif self.options.unit=="km": - factor=25.4/90000000.0 # px->km - elif self.options.unit=="in": - factor=1.0/90.0 # px->in - elif self.options.unit=="ft": - factor=1.0/90.0/12.0 # px->ft - elif self.options.unit=="yd": - factor=1.0/90.0/36.0 # px->yd - else : - ''' Default unit is px''' - factor=1 - self.options.unit="px" - + factor = 1.0/inkex.unittouu('1'+self.options.unit) # Format the length as string lenstr = locale.format("%(len)25."+str(prec)+"f",{'len':round(stotal*factor*self.options.scale,prec)}).strip() self.addTextOnPath(self.group,0, 0,lenstr+' '+self.options.unit, id, self.options.offset) |
