Handle formats without an extension type

svn: r1608
This commit is contained in:
Don Allingham 2003-05-31 01:56:21 +00:00
parent 61fe51b5a7
commit 37ee8a3449
3 changed files with 64 additions and 1 deletions

View File

@ -161,6 +161,9 @@ class DrawDoc:
def end_page(self):
pass
def draw_arc(self,style,x1,y1,x2,y2,angle,extent):
pass
def draw_path(self,style,path):
pass
@ -179,3 +182,15 @@ class DrawDoc:
def draw_line(self,style,x1,y1,x2,y2):
pass
def start_path(self,style,x,y):
pass
def line_to(self,x,y):
pass
def arc_to(self,x,y):
pass
def end_path(self):
pass

View File

@ -454,7 +454,10 @@ class ReportDialog:
if not self.get_target_is_directory():
fname = self.target_fileentry.get_full_path(0)
(path,ext) = os.path.splitext(fname)
fname = path + obj.get_data('ext')
ext_val = obj.get_data('ext')
if ext_val:
fname = path + ext_val
self.target_fileentry.set_filename(fname)
# Does this report format use styles?

View File

@ -152,6 +152,49 @@ class PdfDrawDoc(DrawDoc.DrawDoc):
else:
self.f.drawPath(p,stroke=1,fill=0)
def start_path(self,style,x,y):
self.active_path = self.f.beginPath()
self.active_path.move_to(x+self.lmargin,y=self.tmargin)
self.active_style = style
def line_to(self,x,y):
self.active_path.line_to(x+self.lmargin,y+self.tmargin)
def arc_to(self,x,y):
self.active_path.arc_to(x+self.lmargin,y+self.tmargin)
def end_path(self):
self.f.draw_path(self.active_path,stroke=1,fill=1)
def draw_arc(self,style,x1,y1,x2,y2,angle,extent):
x1 += self.lmargin
y1 += self.tmargin
x2 += self.lmargin
y2 += self.tmargin
stype = self.draw_styles[style]
if stype.get_line_style() == DrawDoc.SOLID:
self.f.setDash([],0)
else:
self.f.setDash([2,4],0)
self.f.setLineWidth(stype.get_line_width())
color = stype.get_fill_color()
self.f.setFillColor((float(color[0])/255.0,float(color[1])/255.0,float(color[2])/255.0))
p = self.f.beginPath()
p.arc(x1*cm,y1*cm,x2*cm,y2*cm,angle,extent)
fill = stype.get_color()
print x1*cm,y1*cm,x2*cm,y2*cm,angle,extent
self.f.drawPath(p,stroke=1,fill=0)
# if fill[0] == 0:
# self.f.drawPath(p,stroke=1,fill=1)
# else:
# self.f.drawPath(p,stroke=1,fill=0)
def draw_box(self,style,text,x,y):
x = x + self.lmargin
y = y + self.tmargin
@ -247,4 +290,6 @@ def make_color(c):
# Register the document class
#
#-------------------------------------------------------------------------
Plugins.register_draw_doc(_("PDF"),PdfDrawDoc,1,1,".pdf");