From 9ad4371355821c11e2c2119ed185c36a13e5b582 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Mon, 19 Jan 2004 17:40:39 +0000 Subject: [PATCH] * src/plugins/AncestorChart2.py: Add hotkeys to check button labels. Add scale, compress, and title options support to the book dialog. * src/plugins/book.glade: Reduce minimum window height to 600 pixels. * src/plugins/WriteCD.py (on_ok_clicked): Correct indentation. * src/GrampsCfg.py (loadConfig, save_data): Correctly parse gconf key. svn: r2656 --- gramps2/ChangeLog | 7 +++ gramps2/src/GrampsCfg.py | 8 +-- gramps2/src/plugins/AncestorChart2.py | 75 +++++++++++++++++++++------ gramps2/src/plugins/WriteCD.py | 14 ++--- gramps2/src/plugins/book.glade | 4 +- 5 files changed, 80 insertions(+), 28 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index bd720ea0b..39fb28531 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,10 @@ +2004-01-19 Alex Roitman + * src/plugins/AncestorChart2.py: Add hotkeys to check button labels. + Add scale, compress, and title options support to the book dialog. + * src/plugins/book.glade: Reduce minimum window height to 600 pixels. + * src/plugins/WriteCD.py (on_ok_clicked): Correct indentation. + * src/GrampsCfg.py (loadConfig, save_data): Correctly parse gconf key. + 2004-01-17 Don Allingham * src/plugins/AncestorChart2.py: more multipage improvements * src/plugins/Makefile.am: export AncestorChart2.py diff --git a/gramps2/src/GrampsCfg.py b/gramps2/src/GrampsCfg.py index 19d491db0..c0b242dbc 100644 --- a/gramps2/src/GrampsCfg.py +++ b/gramps2/src/GrampsCfg.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2003 Donald N. Allingham +# Copyright (C) 2000-2004 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -251,7 +251,8 @@ def loadConfig(call): gnome_toolbar_str = get_string("/desktop/gnome/interface/toolbar_style","BOTH") try: - gnome_toolbar = eval("gtk.TOOLBAR_%s" % gnome_toolbar_str.upper()) + gnome_toolbar = eval("gtk.TOOLBAR_%s" % + gnome_toolbar_str.replace('-','_').upper()) except: gnome_toolbar = 2 @@ -876,7 +877,8 @@ class GrampsPreferences: save_toolbar = self.top.get_widget("tooloptmenu").get_history() gnome_toolbar_str = get_string("/desktop/gnome/interface/toolbar_style",'BOTH') try: - gnome_toolbar = eval("gtk.TOOLBAR_%s" % gnome_toolbar_str.upper()) + gnome_toolbar = eval("gtk.TOOLBAR_%s" % + gnome_toolbar_str.replace('-','_').upper()) except: gnome_toolbar = 2 diff --git a/gramps2/src/plugins/AncestorChart2.py b/gramps2/src/plugins/AncestorChart2.py index d35535a39..fe6570227 100644 --- a/gramps2/src/plugins/AncestorChart2.py +++ b/gramps2/src/plugins/AncestorChart2.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2003 Donald N. Allingham +# Copyright (C) 2000-2004 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,6 +18,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + "Graphical Reports/Ancestor Chart" #------------------------------------------------------------------------ @@ -178,8 +180,8 @@ class AncestorChart: self.start = person self.max_generations = max self.output = output - self.box_width = 0 - self.box_height = 0 + self.box_width = 0 + self.box_height = 0 self.lines = 0 self.display = display self.newpage = newpage @@ -188,8 +190,8 @@ class AncestorChart: if output: self.doc.open(output) self.standalone = output - self.font = self.doc.style_list["AC-Normal"].get_font() - self.tfont = self.doc.style_list["AC-Title"].get_font() + self.font = self.doc.style_list["AC2-Normal"].get_font() + self.tfont = self.doc.style_list["AC2-Title"].get_font() self.filter(self.start,1) @@ -318,13 +320,13 @@ class AncestorChart: g = BaseDoc.GraphicsStyle() g.set_height(self.box_height) g.set_width(self.box_width) - g.set_paragraph_style("AC-Normal") + g.set_paragraph_style("AC2-Normal") g.set_shadow(1,0.2/self.scale) g.set_fill_color((255,255,255)) self.doc.add_draw_style("box",g) g = BaseDoc.GraphicsStyle() - g.set_paragraph_style("AC-Title") + g.set_paragraph_style("AC2-Title") g.set_color((255,255,255)) g.set_fill_color((255,255,255)) g.set_line_width(0) @@ -418,7 +420,7 @@ def _make_default_style(default_style): p = BaseDoc.ParagraphStyle() p.set_font(f) p.set_description(_('The basic style used for the text display.')) - default_style.add_style("AC-Normal",p) + default_style.add_style("AC2-Normal",p) f = BaseDoc.FontStyle() f.set_size(16) @@ -427,7 +429,7 @@ def _make_default_style(default_style): p.set_font(f) p.set_alignment(BaseDoc.PARA_ALIGN_CENTER) p.set_description(_('The basic style used for the title display.')) - default_style.add_style("AC-Title",p) + default_style.add_style("AC2-Title",p) #------------------------------------------------------------------------ # @@ -446,11 +448,11 @@ class AncestorChartDialog(Report.DrawReportDialog): self.title.set_text(self.get_header(self.person.getPrimaryName().getName())) self.title.show() self.add_option(_('Title'),self.title) - self.compress = gtk.CheckButton(_('Compress chart')) + self.compress = gtk.CheckButton(_('Co_mpress chart')) self.compress.set_active(1) self.compress.show() self.add_option('',self.compress) - self.scale = gtk.CheckButton(_('Scale to fit on a single page')) + self.scale = gtk.CheckButton(_('Sc_ale to fit on a single page')) self.scale.set_active(1) self.scale.show() self.add_option('',self.scale) @@ -527,7 +529,10 @@ _style_name = "default" _person_id = "" _max_gen = 10 _disp_format = [ "$n", "%s $b" % _BORN, "%s $d" % _DIED ] -_options = ( _person_id, _max_gen, _disp_format ) +_scale = 1 +_compress = 1 +_title = None +_options = ( _person_id, _max_gen, _disp_format, _scale, _compress, _title ) #------------------------------------------------------------------------ # @@ -550,11 +555,20 @@ class AncestorChartBareDialog(Report.BareReportDialog): self.max_gen = int(self.options[1]) self.disp_format = string.join(self.options[2],'\n') + self.do_scale = int(self.options[3]) + self.do_compress = int(self.options[4]) + if self.options[5] is not None: + self.the_title = self.options[5] + else: + self.the_title = self.get_the_title() self.new_person = None self.generations_spinbox.set_value(self.max_gen) self.extra_textbox.get_buffer().set_text( self.disp_format,len(self.disp_format)) + self.scale.set_active(self.do_scale) + self.compress.set_active(self.do_compress) + self.title.set_text(self.the_title) self.window.run() @@ -563,11 +577,29 @@ class AncestorChartBareDialog(Report.BareReportDialog): # Customization hooks # #------------------------------------------------------------------------ + def add_user_options(self): + self.title=gtk.Entry() + self.title.set_text(self.get_the_title()) + self.title.show() + self.add_option(_('Title'),self.title) + self.compress = gtk.CheckButton(_('Co_mpress chart')) + self.compress.set_active(1) + self.compress.show() + self.add_option('',self.compress) + self.scale = gtk.CheckButton(_('Sc_ale to fit on a single page')) + self.scale.set_active(1) + self.scale.show() + self.add_option('',self.scale) + def get_title(self): """The window title for this dialog""" return "%s - GRAMPS Book" % (_("Ancestor Chart")) - def get_header(self, name): + def get_the_title(self): + """The header line at the top of the dialog contents.""" + return _("Ancestor Chart for %s") % self.person.getPrimaryName().getName() + + def get_header(self,name): """The header line at the top of the dialog contents""" return _("Ancestor Chart for GRAMPS Book") @@ -587,6 +619,13 @@ class AncestorChartBareDialog(Report.BareReportDialog): def make_default_style(self): _make_default_style(self.default_style) + def parse_report_options_frame (self): + # Call base class + Report.BareReportDialog.parse_report_options_frame (self) + self.do_scale = self.scale.get_active() + self.do_compress = self.compress.get_active() + self.the_title = self.title.get_text() + def on_cancel(self, obj): pass @@ -600,7 +639,8 @@ class AncestorChartBareDialog(Report.BareReportDialog): if self.new_person: self.person = self.new_person - self.options = ( self.person.getId(), self.max_gen, self.report_text ) + self.options = ( self.person.getId(), self.max_gen, self.report_text, + self.do_scale, self.do_compress, self.the_title ) self.style_name = self.selected_style.get_name() #------------------------------------------------------------------------ @@ -616,8 +656,12 @@ def write_book_item(database,person,doc,options,newpage=0): person = database.getPerson(options[0]) max_gen = int(options[1]) disp_format = options[2] + scale = int(options[3]) + compress = int(options[4]) + title = options[5] return AncestorChart(database, person, max_gen, - disp_format, doc, None, newpage ) + disp_format, doc, None, + scale, compress, title, newpage ) except Errors.ReportError, msg: (m1,m2) = msg.messages() ErrorDialog(m1,m2) @@ -799,4 +843,3 @@ register_book_item( _style_file, _make_default_style ) - diff --git a/gramps2/src/plugins/WriteCD.py b/gramps2/src/plugins/WriteCD.py index 69514db71..da7ba4675 100644 --- a/gramps2/src/plugins/WriteCD.py +++ b/gramps2/src/plugins/WriteCD.py @@ -259,13 +259,13 @@ class PackageWriter: "keep the reference to the missing file, or select a new file." ) % { 'file_name' : oldfile }, remove_clicked, leave_clicked, select_clicked) - missmedia_action = mmd.default_action - elif missmedia_action == 1: - remove_clicked() - elif missmedia_action == 2: - leave_clicked() - elif missmedia_action == 3: - select_clicked() + missmedia_action = mmd.default_action + elif missmedia_action == 1: + remove_clicked() + elif missmedia_action == 2: + leave_clicked() + elif missmedia_action == 3: + select_clicked() # Write XML now g = gnome.vfs.create('burn:///%s/data.gramps' % base,gnome.vfs.OPEN_WRITE ) diff --git a/gramps2/src/plugins/book.glade b/gramps2/src/plugins/book.glade index dbfc51250..d0732dbd2 100644 --- a/gramps2/src/plugins/book.glade +++ b/gramps2/src/plugins/book.glade @@ -6,7 +6,7 @@ 600 - 700 + 600 True Book GTK_WINDOW_TOPLEVEL @@ -410,7 +410,7 @@ True False - 8 + 2