Report updates

svn: r1288
This commit is contained in:
Don Allingham 2003-02-08 17:28:41 +00:00
parent fce3b7b75c
commit d2ef898a2d
14 changed files with 295 additions and 64 deletions

View File

@ -145,7 +145,6 @@ class AddMediaObject:
if type[0:5] == "image":
image = RelImage.scale_image(filename,const.thumbScale)
self.image.set_from_pixbuf(image)
else:
i = gtk.gdk.pixbuf_new_from_file(Utils.find_icon(type))
self.image.set_from_pixbuf(i)
image = gtk.gdk.pixbuf_new_from_file(Utils.find_icon(type))
self.image.set_from_pixbuf(image)

View File

@ -128,8 +128,10 @@ class PluginDialog:
self.img = self.dialog.get_widget("image")
self.description = self.dialog.get_widget("description")
self.status = self.dialog.get_widget("report_status")
self.label = self.dialog.get_widget("report_label")
self.title = self.dialog.get_widget("title")
self.author_name = self.dialog.get_widget("author_name")
self.author_email = self.dialog.get_widget("author_email")
self.statbox = self.dialog.get_widget("statbox")
self.run_tool = None
self.build_tree(list)
@ -153,7 +155,9 @@ class PluginDialog:
store,iter = self.selection.get_selected()
path = store.get_path(iter)
if not iter or not self.imap.has_key(path):
self.statbox.hide()
return
self.statbox.show()
data = self.imap[path]
title = data[0]
@ -161,16 +165,16 @@ class PluginDialog:
doc = data[2]
xpm = data[3]
status = data[4]
author = data[5]
email = data[6]
#st = string.join(xpm,'\n')
#image = gtk.gdk.pixbuf_new_from_inline(len(st),st,0)
self.description.set_text(doc)
self.status.set_text(": %s" % status)
self.label.show()
#self.img.set_from_pixbuf(image)
self.status.set_text(status)
self.title.set_text(title)
self.author_name.set_text(author)
self.author_email.set_text(email)
self.dialog.get_widget("title").set_text(title)
self.title.set_text(title)
self.run_tool = task
def build_tree(self,list):
@ -178,7 +182,7 @@ class PluginDialog:
in the lists. The list must consist of a tuples with the following
format:
(task_to_call, category, report name, description, image, status)
(task_to_call, category, report name, description, image, status, author_name, author_email)
Items in the same category are grouped under the same submen. The
task_to_call is bound to the 'select' callback of the menu entry."""
@ -188,7 +192,7 @@ class PluginDialog:
# build the tree items and group together based on the category name
item_hash = {}
for report in list:
t = (report[2],report[0],report[3],report[4],report[5])
t = (report[2],report[0],report[3],report[4],report[5],report[6],report[7])
if item_hash.has_key(report[1]):
item_hash[report[1]].append(t)
else:
@ -397,22 +401,28 @@ def register_report(task, name,
category=_("Uncategorized"),
description=_unavailable,
xpm=None,
status=_("Unknown")):
status=_("Unknown"),
author_name=_("Unknown"),
author_email=_("Unknown")
):
"""Register a report with the plugin system"""
if xpm == None:
xpm = no_image()
_reports.append((task, category, name, description, xpm, status))
_reports.append((task, category, name, description, xpm, status, author_name, author_email))
def register_tool(task, name,
category=_("Uncategorized"),
description=_unavailable,
xpm=None,
status=_("Unknown")):
status=_("Unknown"),
author_name=_("Unknown"),
author_email=_("Unknown")
):
"""Register a tool with the plugin system"""
if xpm == None:
xpm = no_image()
_tools.append((task, category, name, description, xpm, status))
_tools.append((task, category, name, description, xpm, status, author_name, author_name))
def register_text_doc(name,classref, table, paper, style):

View File

@ -143,7 +143,7 @@ class OpenDrawDoc(DrawDoc.DrawDoc):
self._write_meta_file()
self._write_zip()
except:
Errors.ReportError("Could not create %s" % self.filename)
raise Errors.ReportError("Could not create %s" % self.filename)
def _write_zip(self):
@ -244,7 +244,14 @@ class OpenDrawDoc(DrawDoc.DrawDoc):
self.f.write('" style:family="graphics" ')
self.f.write('style:parent-style-name="standard">\n')
self.f.write('<style:properties ')
self.f.write('draw:fill-color="#%02x%02x%02x" ' % style.get_color())
if style.color[0] == 0 and style.color[1] == 0 and style.color[2] == 0:
self.f.write('draw:fill="solid" ')
else:
self.f.write('draw:fill="none" ')
if style.get_line_style() == DrawDoc.DASHED:
self.f.write('draw:color="#cccccc" ')
if style.get_line_width():
self.f.write('draw:stroke="solid" ')
else:
@ -422,17 +429,54 @@ class OpenDrawDoc(DrawDoc.DrawDoc):
def end_page(self):
self.f.write('</draw:page>\n')
def draw_path(self,style,path):
stype = self.draw_styles[style]
minx = 9e12
miny = 9e12
maxx = 0
maxy = 0
for point in path:
minx = min(point[0],minx)
miny = min(point[1],miny)
maxx = max(point[0],maxx)
maxy = max(point[1],maxy)
self.f.write('<draw:polygon draw:style-name="%s" draw:layer="layout" ' % style)
x = int((minx+self.lmargin)*1000)
y = int((miny+self.tmargin)*1000)
self.f.write('svg:x="%d" svg:y="%d" ' % (x,y))
self.f.write('svg:viewBox="0 0 %d %d" ' % (int(maxx-minx)*1000,int(maxy-miny)*1000))
self.f.write('svg:width="%.4fcm" ' % (maxx-minx))
self.f.write('svg:height="%.4fcm" ' % (maxy-miny))
point = path[0]
x1 = int((point[0]-minx)*1000)
y1 = int((point[1]-miny)*1000)
self.f.write('draw:points="%d,%d' % (x1,y1))
for point in path[1:]:
x1 = int((point[0]-minx)*1000)
y1 = int((point[1]-miny)*1000)
self.f.write(' %d,%d' % (x1,y1))
self.f.write('"/>\n')
def draw_line(self,style,x1,y1,x2,y2):
x1 = x1 + self.lmargin
x2 = x2 + self.lmargin
y1 = y1 + self.tmargin
y2 = y2 + self.tmargin
box_style = self.draw_styles[style]
self.f.write('<draw:line draw:style="')
self.f.write(style)
self.f.write('" svg:x1="%.3fcm" ' % x1)
self.f.write('svg:y1="%.3fcm" ' % y1)
self.f.write('svg:x2="%.3fcm" ' % x2)
self.f.write('svg:y2="%.3fcm"/>\n' % y2)
self.f.write('svg:y2="%.3fcm" ' % y2)
self.f.write('/>\n')
def draw_text(self,style,text,x,y):
x = x + self.lmargin

View File

@ -126,7 +126,7 @@ class PSDrawDoc(DrawDoc.DrawDoc):
self.f.write('(%s) show\n' % text)
self.f.write('grestore\n')
def draw_path(self,style,path,fill):
def draw_path(self,style,path):
stype = self.draw_styles[style]
self.f.write('gsave\n')
self.f.write('newpath\n')
@ -146,7 +146,7 @@ class PSDrawDoc(DrawDoc.DrawDoc):
y1 = point[1]+self.tmargin
self.f.write('%f cm %f cm lineto\n' % self.translate(x1,y1))
self.f.write('closepath\n')
if fill:
if self.color[0] == 0:
self.f.write('fill\n')
else:
self.f.write('stroke\n')

View File

@ -103,7 +103,7 @@ class PdfDrawDoc(DrawDoc.DrawDoc):
self.f.setLineWidth(stype.get_line_width())
self.f.rect(x1*cm,y1*cm,(x2-x1)*cm,(y2-y1)*cm,fill=0,stroke=1)
def draw_path(self,style,path,fill):
def draw_path(self,style,path):
stype = self.draw_styles[style]
if stype.get_line_style() == DrawDoc.SOLID:
self.f.setDash([],0)
@ -117,7 +117,13 @@ class PdfDrawDoc(DrawDoc.DrawDoc):
for point in path[1:]:
p.lineTo((point[0]+self.lmargin)*cm,(point[1]+self.tmargin)*cm)
p.close()
self.f.drawPath(p,stroke=1,fill=fill)
fill = stype.get_color()
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

View File

@ -173,27 +173,6 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="label62">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">10</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="description">
<property name="visible">True</property>
@ -216,14 +195,17 @@
</child>
<child>
<widget class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">0</property>
<widget class="GtkTable" id="statbox">
<property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">0</property>
<property name="column_spacing">0</property>
<child>
<widget class="GtkLabel" id="report_label">
<property name="label" translatable="yes">Report Status</property>
<property name="visible">True</property>
<property name="label" translatable="yes">Status</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
@ -235,9 +217,12 @@
<property name="ypad">3</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
@ -247,7 +232,126 @@
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">5</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label64">
<property name="visible">True</property>
<property name="label" translatable="yes">Author</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">1</property>
<property name="yalign">0.5</property>
<property name="xpad">3</property>
<property name="ypad">3</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label65">
<property name="visible">True</property>
<property name="label" translatable="yes">Author's Email</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">1</property>
<property name="yalign">0.5</property>
<property name="xpad">3</property>
<property name="ypad">3</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="author_name">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">5</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="author_email">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">5</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label68">
<property name="visible">True</property>
<property name="label" translatable="yes">:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
@ -256,9 +360,60 @@
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label69">
<property name="visible">True</property>
<property name="label" translatable="yes">:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label70">
<property name="visible">True</property>
<property name="label" translatable="yes">:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>

View File

@ -425,6 +425,8 @@ register_report(
category=_("Graphical Reports"),
status=(_("Beta")),
description=_("Produces a graphical ancestral tree graph"),
xpm=get_xpm_image()
xpm=get_xpm_image(),
author_name="Donald N. Allingham",
author_email="dallingham@users.sourceforge.net"
)

View File

@ -385,6 +385,8 @@ register_report(
category=_("Text Reports"),
status=(_("Beta")),
description= _("Produces a textual ancestral report"),
xpm=get_xpm_image()
xpm=get_xpm_image(),
author_name="Donald N. Allingham",
author_email="dallingham@users.sourceforge.net"
)

View File

@ -459,6 +459,8 @@ register_report(
category=_("Graphical Reports"),
description=_("Generates a list of descendants of the active person"),
status=(_("Alpha")),
xpm=get_xpm_image()
xpm=get_xpm_image(),
author_name="Donald N. Allingham",
author_email="dallingham@users.sourceforge.net"
)

View File

@ -281,6 +281,8 @@ register_report(
category=_("Text Reports"),
status=(_("Beta")),
description=_("Generates a list of descendants of the active person"),
xpm=get_xpm_image()
xpm=get_xpm_image(),
author_name="Donald N. Allingham",
author_email="dallingham@users.sourceforge.net"
)

View File

@ -826,7 +826,9 @@ register_report(
status=(_("Beta")),
category=_("Text Reports"),
description= _("Produces a detailed ancestral report"),
xpm= get_xpm_image()
xpm= get_xpm_image(),
author_name="Bruce DeGrasse",
author_email="bdegrasse1@attbi.com"
)

View File

@ -899,7 +899,9 @@ register_report(
status=(_("Beta")),
category=_("Text Reports"),
description= _("Produces a detailed descendant report"),
xpm= get_xpm_image()
xpm= get_xpm_image(),
author_name="Bruce DeGrasse",
author_email="bdegrasse1@attbi.com"
)

View File

@ -446,6 +446,8 @@ register_report(
_("Relationship Graph"),
status=(_("Beta")),
category=_("Graphical Reports"),
description=get_description()
description=get_description(),
author_name="Donald N. Allingham",
author_email="dallingham@users.sourceforge.net"
)

View File

@ -496,7 +496,10 @@ register_report(
status=(_("Beta")),
category=_("Text Reports"),
description=_("Produces a detailed report on the selected person."),
xpm=get_xpm_image()
xpm=get_xpm_image(),
author_name="Donald N. Allingham",
author_email="dallingham@users.sourceforge.net"
)