perfectboundcover.py revision ebec12b4b95f988402206c7a42ecb6a949c177f3
'''
Copyright (C) 2007 John Bintz, jcoswell@cosellproductions.org
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
def caliper_to_ppi(caliper):
return 2 / caliper
def points_to_ppi(points):
help="cover width (in)")
help="cover height (in)")
help="number of pages")
help="paper thickness measurement")
help="paper thickness")
help="cover thickness measurement")
help="cover thickness")
help="cover bleed (in)")
help="remove guides")
help="dummy")
help="dummy")
help="dummy")
help="dummy")
switch = {
"ppi": lambda x: x,
"caliper": lambda x: caliper_to_ppi(x),
"bond_weight": lambda x: bond_weight_to_ppi(x),
"points": lambda x: points_to_ppi(x),
"width": lambda x: x
}
else:
paper_spine = self.options.pages / switch[self.options.paperthicknessmeasurement](self.options.paperthickness)
else:
paper_spine = 0
else:
else:
cover_spine = 0
guides = []
if namedview:
'''
for id, node in self.selected.iteritems():
if node.tag == inkex.addNS('path','svg'):
p = cubicsuperpath.parsePath(node.get('d'))
#lens, total = csplength(p)
#avg = total/numlengths(lens)
#inkex.debug("average segment length: %s" % avg)
new = []
for sub in p:
new.append([sub[0][:]])
i = 1
while i <= len(sub)-1:
length = cspseglength(new[-1][-1], sub[i])
if length > self.options.max:
splits = math.ceil(length/self.options.max)
for s in xrange(int(splits),1,-1):
new[-1][-1], next, sub[i] = cspbezsplitatlength(new[-1][-1], sub[i], 1.0/s)
new[-1].append(next[:])
new[-1].append(sub[i])
i+=1
node.set('d',cubicsuperpath.formatPath(new))
'''
e = PerfectBoundCover()
e.affect()