From 7ff4d55037c205a446e8f522826ff07cd20f265c Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Mon, 12 Jul 2004 21:29:15 +0000 Subject: [PATCH] * src/Exporter.py: Keep track of added extra pages. * src/plugins/WriteGedcom.py: Switch from radiobuttons to menu for the encoding choice. * src/plugins/gedcomexport.glade: Clean up interface. svn: r3267 --- gramps2/ChangeLog | 6 + gramps2/src/Exporter.py | 25 +- gramps2/src/plugins/WriteGedcom.py | 19 +- gramps2/src/plugins/gedcomexport.glade | 383 ++++++++++++------------- 4 files changed, 227 insertions(+), 206 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 88144dd7b..7e748d499 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,9 @@ +2004-07-12 Alex Roitman + * src/Exporter.py: Keep track of added extra pages. + * src/plugins/WriteGedcom.py: Switch from radiobuttons to menu + for the encoding choice. + * src/plugins/gedcomexport.glade: Clean up interface. + 2004-07-11 Don Allingham * src/FamilyView.py: handle deleting of parent properly * src/plugins/WriteGedcom.py: revert to using GRAMPS ID values diff --git a/gramps2/src/Exporter.py b/gramps2/src/Exporter.py index ba0fbf06e..fecb164c2 100644 --- a/gramps2/src/Exporter.py +++ b/gramps2/src/Exporter.py @@ -82,6 +82,7 @@ class Exporter: self.build_exports() self.confirm_label = gtk.Label() + self.extra_pages = [] self.w = gtk.Window() @@ -257,7 +258,8 @@ class Exporter: table.attach(button,0,2,2*ix,2*ix+1) label = gtk.Label(description) label.set_line_wrap(gtk.TRUE) - table.attach(label,1,2,2*ix+1,2*ix+2) + label.set_alignment(0,0.5) + table.attach(label,1,2,2*ix+1,2*ix+2,xpadding=24) box.add(table) box.show_all() @@ -265,9 +267,25 @@ class Exporter: return p def build_options(self,obj,obj2): + """ + Build an extra page with the options specific for the chosen format. + If there's already a page (or pages) for this format in + self.empty_pages then do nothing, otherwise add a page. + + If the chosen format does not have options then remove all + extra pages that are already there (from previous user passes + through the druid). + """ ix = self.get_selected_format_index() if self.exports[ix][3]: title = self.exports[ix][3][0] + for (ep_ix,ep) in self.extra_pages: + if ep_ix == ix: + return + else: + ep.destroy() + self.extra_pages.remove((ep_ix,ep)) + option_box_class = self.exports[ix][3][1] self.option_box_instance = option_box_class(self.person) @@ -277,8 +295,13 @@ class Exporter: p.set_background(self.bg_color) p.set_logo(self.logo) p.append_item("",self.option_box_instance.get_option_box(),"") + self.extra_pages.append((ix,p)) self.d.insert_page(self.file_sel_page,p) p.show_all() + else: + for (ep_ix,ep) in self.extra_pages: + ep.destroy() + self.extra_pages = [] def build_file_sel_page(self): """ diff --git a/gramps2/src/plugins/WriteGedcom.py b/gramps2/src/plugins/WriteGedcom.py index d4b70e5a9..816d837d5 100644 --- a/gramps2/src/plugins/WriteGedcom.py +++ b/gramps2/src/plugins/WriteGedcom.py @@ -379,6 +379,9 @@ class GedcomWriterOptionBox: "gnu_free" : self.gnu_free, "standard_copyright" : self.standard_copyright, "no_copyright" : self.no_copyright, + "ansel" : self.ansel, + "ansi" : self.ansi, + "unicode" : self.uncd, "on_restrict_toggled": self.on_restrict_toggled, }) @@ -434,6 +437,15 @@ class GedcomWriterOptionBox: def no_copyright(self,obj): self.copy = 2 + def ansel(self,obj): + self.cnvtxt = ansel_utf8.utf8_to_ansel + + def uncd(self,obj): + self.cnvtxt = keep_utf8 + + def ansi(self,obj): + self.cnvtxt = iso8859 + def on_restrict_toggled(self,restrict): active = restrict.get_active () map (lambda x: x.set_sensitive (active), @@ -471,13 +483,6 @@ class GedcomWriterOptionBox: self.prefix = self.target_ged.get_prefix() self.source_refs = self.target_ged.get_source_refs() - if self.topDialog.get_widget("ansel").get_active(): - self.cnvtxt = ansel_utf8.utf8_to_ansel - elif self.topDialog.get_widget("ansi").get_active(): - self.cnvtxt = iso8859 - else: - self.cnvtxt = keep_utf8 - self.nl = self.cnvtxt(self.target_ged.get_endl()) # glade_file = "%s/gedcomexport.glade" % os.path.dirname(__file__) diff --git a/gramps2/src/plugins/gedcomexport.glade b/gramps2/src/plugins/gedcomexport.glade index 97cab6926..377fdfaf1 100644 --- a/gramps2/src/plugins/gedcomexport.glade +++ b/gramps2/src/plugins/gedcomexport.glade @@ -91,14 +91,14 @@ 12 True - 12 + 10 3 False 6 12 - + True <b>Encoding</b> False @@ -121,53 +121,6 @@ - - - 2 - True - True - _ANSEL - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 1 - 3 - 1 - 2 - fill - - - - - - - 2 - True - True - _UNICODE - True - GTK_RELIEF_NORMAL - True - True - False - True - ansel - - - 1 - 3 - 2 - 3 - fill - - - - True @@ -185,33 +138,55 @@ 0 3 - 4 - 5 + 2 + 3 fill - + True - _Copyright: + _Filter: True False GTK_JUSTIFY_LEFT False False - 0.001 + 0 0.5 0 0 - copyright + filter 1 2 - 7 - 8 + 3 + 4 + fill + + + + + + + True + True + -1 + + + + True + + + + + 2 + 3 + 3 + 4 fill @@ -235,30 +210,8 @@ 1 2 - 6 - 7 - fill - - - - - - - True - True - -1 - - - - True - - - - - 2 - 3 - 5 - 6 + 4 + 5 fill @@ -287,8 +240,33 @@ 2 3 - 6 - 7 + 4 + 5 + fill + + + + + + + True + _Copyright: + True + False + GTK_JUSTIFY_LEFT + False + False + 0.001 + 0.5 + 0 + 0 + copyright + + + 1 + 2 + 5 + 6 fill @@ -304,7 +282,7 @@ - + True Standard Copyright True @@ -335,8 +313,8 @@ 2 3 - 7 - 8 + 5 + 6 fill @@ -358,8 +336,8 @@ 1 3 - 8 - 9 + 6 + 7 fill @@ -382,8 +360,8 @@ 1 3 - 9 - 10 + 7 + 8 fill @@ -398,42 +376,6 @@ 6 12 - - - True - True - Use _Living as first name - True - GTK_RELIEF_NORMAL - True - True - False - True - - - 1 - 2 - 0 - 1 - fill - - - - - - - True - - - 0 - 1 - 0 - 1 - fill - fill - - - True @@ -477,105 +419,150 @@ + + + + True + True + Use _Living as first name + True + GTK_RELIEF_NORMAL + True + True + False + True + + + 1 + 2 + 0 + 1 + fill + + + + + + + True + + + 0 + 1 + 0 + 1 + shrink|fill + fill + + 1 3 - 10 - 11 + 8 + 9 fill - + True True - Reference images from path: - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 1 - 2 - 11 - 12 - fill - - - + 0 - - - True - True - True - True - 0 - media - True - * - False + + + + + + True + _ANSEL + True + + + + + + + True + _UNICODE + True + + + + + + + True + AN_SI (ISO-8859-1) + True + + + + + 2 3 - 11 - 12 + 1 + 2 + fill - - 2 + True - True - AN_SI (ISO-8859-1) - True - GTK_RELIEF_NORMAL - True - True - False - True - ansel + False + 0 + + + + True + True + R_eference images from path: + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + True + True + 0 + media + True + * + False + + + 0 + True + True + + 1 3 - 3 - 4 + 9 + 10 fill - - - - - - - True - _Filter: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - filter - - - 1 - 2 - 5 - 6 - fill -