From d2ef898a2d54a3c22037f4bfac74784192dcdfad Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sat, 8 Feb 2003 17:28:41 +0000 Subject: [PATCH] Report updates svn: r1288 --- gramps2/src/AddMedia.py | 5 +- gramps2/src/Plugins.py | 36 ++-- gramps2/src/docgen/OpenDrawDoc.py | 50 ++++- gramps2/src/docgen/PSDrawDoc.py | 4 +- gramps2/src/docgen/PdfDrawDoc.py | 10 +- gramps2/src/plugins.glade | 221 ++++++++++++++++++--- gramps2/src/plugins/AncestorChart.py | 4 +- gramps2/src/plugins/AncestorReport.py | 4 +- gramps2/src/plugins/DesGraph.py | 4 +- gramps2/src/plugins/DescendReport.py | 4 +- gramps2/src/plugins/DetAncestralReport.py | 4 +- gramps2/src/plugins/DetDescendantReport.py | 4 +- gramps2/src/plugins/GraphViz.py | 4 +- gramps2/src/plugins/IndivSummary.py | 5 +- 14 files changed, 295 insertions(+), 64 deletions(-) diff --git a/gramps2/src/AddMedia.py b/gramps2/src/AddMedia.py index d5d7006fe..c8be20d8b 100644 --- a/gramps2/src/AddMedia.py +++ b/gramps2/src/AddMedia.py @@ -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) diff --git a/gramps2/src/Plugins.py b/gramps2/src/Plugins.py index 1606193a5..e7525bbd2 100644 --- a/gramps2/src/Plugins.py +++ b/gramps2/src/Plugins.py @@ -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): diff --git a/gramps2/src/docgen/OpenDrawDoc.py b/gramps2/src/docgen/OpenDrawDoc.py index 5d6ce2674..4a2d86a27 100644 --- a/gramps2/src/docgen/OpenDrawDoc.py +++ b/gramps2/src/docgen/OpenDrawDoc.py @@ -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('\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('\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('\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 diff --git a/gramps2/src/docgen/PSDrawDoc.py b/gramps2/src/docgen/PSDrawDoc.py index 4c37427fc..4fe05517b 100644 --- a/gramps2/src/docgen/PSDrawDoc.py +++ b/gramps2/src/docgen/PSDrawDoc.py @@ -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') diff --git a/gramps2/src/docgen/PdfDrawDoc.py b/gramps2/src/docgen/PdfDrawDoc.py index 209b89b8a..ca7d194ac 100644 --- a/gramps2/src/docgen/PdfDrawDoc.py +++ b/gramps2/src/docgen/PdfDrawDoc.py @@ -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 diff --git a/gramps2/src/plugins.glade b/gramps2/src/plugins.glade index 3d8947f2c..2a97c191e 100644 --- a/gramps2/src/plugins.glade +++ b/gramps2/src/plugins.glade @@ -173,27 +173,6 @@ - - - True - - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 10 - - - 0 - False - True - - - True @@ -216,14 +195,17 @@ - - True - True - 0 + + 3 + 3 + False + 0 + 0 - Report Status + True + Status False False GTK_JUSTIFY_CENTER @@ -235,9 +217,12 @@ 3 - 0 - True - True + 0 + 1 + 0 + 1 + fill + @@ -247,7 +232,126 @@ False False - GTK_JUSTIFY_CENTER + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 5 + 0 + + + 2 + 3 + 0 + 1 + + + + + + + True + Author + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 3 + 3 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + Author's Email + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 3 + 3 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 5 + 0 + + + 2 + 3 + 1 + 2 + fill + + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 5 + 0 + + + 2 + 3 + 2 + 3 + fill + + + + + + + True + : + False + False + GTK_JUSTIFY_LEFT False False 0 @@ -256,9 +360,60 @@ 0 - 0 - True - True + 1 + 2 + 0 + 1 + fill + + + + + + + True + : + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 1 + 2 + 1 + 2 + fill + + + + + + + True + : + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 1 + 2 + 2 + 3 + fill + diff --git a/gramps2/src/plugins/AncestorChart.py b/gramps2/src/plugins/AncestorChart.py index ba4fb63b4..609c68f5b 100644 --- a/gramps2/src/plugins/AncestorChart.py +++ b/gramps2/src/plugins/AncestorChart.py @@ -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" ) diff --git a/gramps2/src/plugins/AncestorReport.py b/gramps2/src/plugins/AncestorReport.py index 45a756bda..d65df33a1 100644 --- a/gramps2/src/plugins/AncestorReport.py +++ b/gramps2/src/plugins/AncestorReport.py @@ -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" ) diff --git a/gramps2/src/plugins/DesGraph.py b/gramps2/src/plugins/DesGraph.py index 0f00ba2fb..cfe44a873 100644 --- a/gramps2/src/plugins/DesGraph.py +++ b/gramps2/src/plugins/DesGraph.py @@ -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" ) diff --git a/gramps2/src/plugins/DescendReport.py b/gramps2/src/plugins/DescendReport.py index eb6ce81ea..932eaa785 100644 --- a/gramps2/src/plugins/DescendReport.py +++ b/gramps2/src/plugins/DescendReport.py @@ -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" ) diff --git a/gramps2/src/plugins/DetAncestralReport.py b/gramps2/src/plugins/DetAncestralReport.py index dc684acce..391c97590 100644 --- a/gramps2/src/plugins/DetAncestralReport.py +++ b/gramps2/src/plugins/DetAncestralReport.py @@ -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" ) diff --git a/gramps2/src/plugins/DetDescendantReport.py b/gramps2/src/plugins/DetDescendantReport.py index 80e6582e5..035dd0af9 100644 --- a/gramps2/src/plugins/DetDescendantReport.py +++ b/gramps2/src/plugins/DetDescendantReport.py @@ -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" ) diff --git a/gramps2/src/plugins/GraphViz.py b/gramps2/src/plugins/GraphViz.py index 0065e0a81..d0ac2f982 100644 --- a/gramps2/src/plugins/GraphViz.py +++ b/gramps2/src/plugins/GraphViz.py @@ -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" ) diff --git a/gramps2/src/plugins/IndivSummary.py b/gramps2/src/plugins/IndivSummary.py index 4cca6bfa3..cb23245db 100644 --- a/gramps2/src/plugins/IndivSummary.py +++ b/gramps2/src/plugins/IndivSummary.py @@ -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" + )