[reportlab-users] path error

Jose M.Allegue jmallegue at gmail.com
Mon Aug 11 04:12:00 EDT 2014


#  SECTOR SEARCH

import re
from math import tan
import tkinter
from tkinter import filedialog
from reportlab.pdfgen import canvas


ruta= tkinter.filedialog.askopenfilename()


with open(ruta,'r') as fh:
    lector = fh.read()
    match = re.search(r'First.+',lector)
    turn_direction = (match.group().split(':')[1])
    match = re.search(r'Commence.+',lector)
    initial_track = (match.group().split(':')[1])
    match = re.search(r'Leg Len.+',lector)
    long_first_track = (match.group().split(':')[1])
    long_first_track = long_first_track.replace(',','.')
    long_primera_pata = (float(long_first_track.strip()))/2
    long_primera_pata = round(long_primera_pata,1)
    match = re.search(r'Search Speed.+',lector)
    search_speed = (match.group().split(':')[1])
    radial_space = (long_primera_pata)/2
    sector_angle = 60
    pattern_radius = round(long_primera_pata*0.866,1)
    pat =
re.compile(r'((?m)^\t\s([1-9]?[0-9]\s[0-9]?[0-9]\.[0-9]{2})\s([NS])),(.+([WE]))')
    matcher=re.search(pat,lector)
    csp = matcher.group().strip().split(',')

    print('1L - START POSITION   :',csp[0],csp[1])
    print('2L - TURN DIRECTION   :',turn_direction)
    print('2R - INITIAL TRACK    :',initial_track)
    print('3L - RADIAL SPACE     :',"%.2f" %long_primera_pata)
    print('3R - SECTOR ANGLE     :',sector_angle)
    print('4L - SPEED            :',search_speed)
    print('4R - PATTERN RADIUS   :',"%.2f" %pattern_radius)



ruta = tkinter.filedialog.asksaveasfilename()+'.pdf'

c = canvas.Canvas(ruta)
from reportlab.lib.units import inch
# move the origin up and to the left
c.translate(inch,inch)
# define a large font
c.setFont("Helvetica", 80)
# choose some colors
c.setStrokeColorRGB(0.2,0.5,0.3)
c.setFillColorRGB(1,0,1)
# draw a rectangle
c.rect(inch,inch,6*inch,9*inch, fill=1)
# make text go straight up
c.rotate(90)
# change color
c.setFillColorRGB(0,0,0.77)
# say hello (note after rotate the y coord needs to be negative!)
c.drawString(3*inch, -3*inch, "1,2,3,4,5,6,")
c.showPage()
c.save()



2014-08-11 10:00 GMT+02:00 Andy Robinson <andy at reportlab.com>:

> Can please you send us a piece of code which reproduces the error?
>
> Thanks,
>
>
> --
> Andy Robinson
> Managing Director
> ReportLab Europe Ltd.
> Thornton House, Thornton Road, Wimbledon, London SW19 4NG, UK
> Tel +44-20-8405-6420
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at lists2.reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users
>



-- 
jose m allegue

jmallegue at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20140811/4297a0fa/attachment.html>


More information about the reportlab-users mailing list