From f1c3795edfef43c2719b45177a5f924b9a0d1239 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Wed, 26 Apr 2006 05:03:56 +0000 Subject: [PATCH] 2006-04-25 Alex Roitman * src/plugins/EventCmp.py (DisplayChart.on_write_table): Use FileChooser dialog. * src/plugins/eventcmp.glade: remove unused dialog. svn: r6447 --- ChangeLog | 5 ++ src/plugins/EventCmp.py | 47 ++++++----- src/plugins/eventcmp.glade | 166 +++++-------------------------------- 3 files changed, 52 insertions(+), 166 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6945e7085..96d9fd2f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-04-25 Alex Roitman + * src/plugins/EventCmp.py (DisplayChart.on_write_table): Use + FileChooser dialog. + * src/plugins/eventcmp.glade: remove unused dialog. + 2006-04-25 Don Allingham * src/Bookmarks.py: Don't use goto submenu * src/GrampsCfg/py: move and rename tabs, change Prefixes for Formats diff --git a/src/plugins/EventCmp.py b/src/plugins/EventCmp.py index a550cf2c1..ea25563f4 100644 --- a/src/plugins/EventCmp.py +++ b/src/plugins/EventCmp.py @@ -371,34 +371,35 @@ class DisplayChart(ManagedWindow.ManagedWindow): return [_("Person"),_("Birth"),_("Death")] + sort_list def on_write_table(self,obj): - self.form = gtk.glade.XML(self.glade_file,"dialog1","gramps") - self.form.signal_autoconnect({ - "on_save_clicked" : self.on_save_clicked, - "destroy_passed_object" : self.close, - }) - self.save_form = self.form.get_widget("dialog1") - self.save_form.show_all() + f = gtk.FileChooserDialog(_("Select filename"), + action=gtk.FILE_CHOOSER_ACTION_SAVE, + buttons=(gtk.STOCK_CANCEL, + gtk.RESPONSE_CANCEL, + gtk.STOCK_OPEN, + gtk.RESPONSE_OK)) - def on_save_clicked(self,obj): - - name = unicode(self.form.get_widget("filename").get_text()) + f.set_current_folder(os.getcwd()) + status = f.run() + name = unicode(f.get_filename()) + f.destroy() - pstyle = BaseDoc.PaperStyle("junk",10,10) - doc = OpenSpreadSheet.OpenSpreadSheet(pstyle,BaseDoc.PAPER_PORTRAIT) - doc.creator(self.db.get_researcher().get_name()) - spreadsheet = TableReport(name,doc) - spreadsheet.initialize(len(self.event_titles)) + if status == gtk.RESPONSE_OK: + pstyle = BaseDoc.PaperStyle("junk",10,10) + doc = OpenSpreadSheet.OpenSpreadSheet(pstyle, + BaseDoc.PAPER_PORTRAIT) + doc.creator(self.db.get_researcher().get_name()) + spreadsheet = TableReport(name,doc) + spreadsheet.initialize(len(self.event_titles)) - spreadsheet.write_table_head(self.event_titles) + spreadsheet.write_table_head(self.event_titles) - index = 0 - for top in self.row_data: - spreadsheet.set_row(index%2) - index = index + 1 - spreadsheet.write_table_data(top) + index = 0 + for top in self.row_data: + spreadsheet.set_row(index%2) + index = index + 1 + spreadsheet.write_table_data(top) - spreadsheet.finalize() - Utils.destroy_passed_object(obj) + spreadsheet.finalize() #------------------------------------------------------------------------ # diff --git a/src/plugins/eventcmp.glade b/src/plugins/eventcmp.glade index e63fa0333..c588915d2 100644 --- a/src/plugins/eventcmp.glade +++ b/src/plugins/eventcmp.glade @@ -4,149 +4,6 @@ - - True - Save as a Spreadsheet - GRAMPS - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - False - - - - True - False - 8 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - 0 - - - - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - 0 - - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - 2 - 3 - False - 6 - 6 - - - - True - <b>_File name</b> - True - True - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - filename - - - 0 - 3 - 0 - 1 - 6 - fill - - - - - - - True - table_data - 10 - Save Data - False - False - False - GTK_FILE_CHOOSER_ACTION_OPEN - - - - True - Select file to save OpenOffice.org spreadsheet - True - True - True - 0 - - True - * - False - - - - - 1 - 3 - 1 - 2 - 6 - - - - - - 6 - True - True - - - - - - True @@ -162,6 +19,8 @@ False GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST + True + False False @@ -248,6 +107,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -276,6 +139,9 @@ True False True + False + False + False @@ -311,6 +177,8 @@ False GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST + True + False False @@ -399,6 +267,10 @@ 5 0 filter_list + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0 @@ -423,6 +295,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 1 @@ -489,6 +365,10 @@ 0.5 0 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 0