From 18454e96b536fbdcecdd12383aaadd014b7504fa Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Fri, 29 Aug 2003 03:08:02 +0000 Subject: [PATCH] * src/docgen/LaTeXDoc.py: Do not register as a book format (have to support both text and graphics). * src/plugins/AncestorChart.py: Minor code cleanup. * src/plugins/BookReport.py: Add context menus to the dialog. * src/FamilyView.py: Properly refer to gtk stock items. * src/gramps_main.py: Likewise. svn: r2056 --- ChangeLog | 8 +++++ src/FamilyView.py | 36 +++++++++---------- src/docgen/LaTeXDoc.py | 13 ++----- src/gramps_main.py | 10 +++--- src/plugins/AncestorChart.py | 3 +- src/plugins/BookReport.py | 70 +++++++++++++++++++++++++++++++++--- 6 files changed, 100 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 53b2a0fa6..935fd4502 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-08-28 Alex Roitman + * src/docgen/LaTeXDoc.py: Do not register as a book format (have to + support both text and graphics). + * src/plugins/AncestorChart.py: Minor code cleanup. + * src/plugins/BookReport.py: Add context menus to the dialog. + * src/FamilyView.py: Properly refer to gtk stock items. + * src/gramps_main.py: Likewise. + 2003-08-27 Don Allingham * src/FamilyView.py: don't add columns to family view items if they have already be added. diff --git a/src/FamilyView.py b/src/FamilyView.py index 4821e7473..35fba0a92 100644 --- a/src/FamilyView.py +++ b/src/FamilyView.py @@ -197,9 +197,9 @@ class FamilyView: back_sensitivity = self.parent.hindex > 0 fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history) entries = [ - ('gtk-go-back',self.parent.back_clicked,back_sensitivity), - ('gtk-go-forward',self.parent.fwd_clicked,fwd_sensitivity), - ('gtk-home',self.parent.on_home_clicked,1), + (gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity), + (gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity), + (gtk.STOCK_HOME,self.parent.on_home_clicked,1), (_("Add Bookmark"),self.parent.on_add_bookmark_activate,1), ] menu = gtk.Menu() @@ -219,9 +219,9 @@ class FamilyView: back_sensitivity = self.parent.hindex > 0 fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history) entries = [ - ('gtk-go-back',self.parent.back_clicked,back_sensitivity), - ('gtk-go-forward',self.parent.fwd_clicked,fwd_sensitivity), - ('gtk-home',self.parent.on_home_clicked,1), + (gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity), + (gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity), + (gtk.STOCK_HOME,self.parent.on_home_clicked,1), ] menu = gtk.Menu() menu.set_title(_('People Menu')) @@ -255,9 +255,9 @@ class FamilyView: back_sensitivity = self.parent.hindex > 0 fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history) nav_entries = [ - ('gtk-go-back',self.parent.back_clicked,back_sensitivity), - ('gtk-go-forward',self.parent.fwd_clicked,fwd_sensitivity), - ('gtk-home',self.parent.on_home_clicked,1), + (gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity), + (gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity), + (gtk.STOCK_HOME,self.parent.on_home_clicked,1), (None,None,0), ] for stock_id,callback,sensitivity in nav_entries: @@ -307,9 +307,9 @@ class FamilyView: back_sensitivity = self.parent.hindex > 0 fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history) nav_entries = [ - ('gtk-go-back',self.parent.back_clicked,back_sensitivity), - ('gtk-go-forward',self.parent.fwd_clicked,fwd_sensitivity), - ('gtk-home',self.parent.on_home_clicked,1), + (gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity), + (gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity), + (gtk.STOCK_HOME,self.parent.on_home_clicked,1), (None,None,0), ] for stock_id,callback,sensitivity in nav_entries: @@ -756,9 +756,9 @@ class FamilyView: back_sensitivity = self.parent.hindex > 0 fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history) nav_entries = [ - ('gtk-go-back',self.parent.back_clicked,back_sensitivity), - ('gtk-go-forward',self.parent.fwd_clicked,fwd_sensitivity), - ('gtk-home',self.parent.on_home_clicked,1), + (gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity), + (gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity), + (gtk.STOCK_HOME,self.parent.on_home_clicked,1), (None,None,0), ] for stock_id,callback,sensitivity in nav_entries: @@ -785,9 +785,9 @@ class FamilyView: back_sensitivity = self.parent.hindex > 0 fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history) nav_entries = [ - ('gtk-go-back',self.parent.back_clicked,back_sensitivity), - ('gtk-go-forward',self.parent.fwd_clicked,fwd_sensitivity), - ('gtk-home',self.parent.on_home_clicked,1), + (gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity), + (gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity), + (gtk.STOCK_HOME,self.parent.on_home_clicked,1), (None,None,0), ] for stock_id,callback,sensitivity in nav_entries: diff --git a/src/docgen/LaTeXDoc.py b/src/docgen/LaTeXDoc.py index d106bdfd0..831d73d22 100644 --- a/src/docgen/LaTeXDoc.py +++ b/src/docgen/LaTeXDoc.py @@ -1,10 +1,10 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000 Donald N. Allingham +# Copyright (C) 2000-2003 Donald N. Allingham # # Modifications and feature additions: -# 2002 Donald A. Peterson +# 2002-2003 Donald A. Peterson # # 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 @@ -418,12 +418,3 @@ Plugins.register_text_doc( style=0, ext=".tex" ) - -Plugins.register_book_doc( - name=_("LaTeX"), - classref=LaTeXDoc, - table=1, - paper=1, - style=0, - ext=".tex" - ) diff --git a/src/gramps_main.py b/src/gramps_main.py index e3a0b8369..1e796be1f 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -629,13 +629,13 @@ class Gramps: back_sensitivity = self.hindex > 0 fwd_sensitivity = self.hindex + 1 < len(self.history) entries = [ - ('gtk-go-back',self.back_clicked,back_sensitivity), - ('gtk-go-forward',self.fwd_clicked,fwd_sensitivity), - ('gtk-home',self.on_home_clicked,1), + (gtk.STOCK_GO_BACK,self.back_clicked,back_sensitivity), + (gtk.STOCK_GO_FORWARD,self.fwd_clicked,fwd_sensitivity), + (gtk.STOCK_HOME,self.on_home_clicked,1), (_("Add Bookmark"),self.on_add_bookmark_activate,1), (None,None,0), - ('gtk-add', self.add_button_clicked,1), - ('gtk-remove', self.remove_button_clicked,1), + (gtk.STOCK_ADD, self.add_button_clicked,1), + (gtk.STOCK_REMOVE, self.remove_button_clicked,1), (_("Edit"), self.edit_button_clicked,1), ] diff --git a/src/plugins/AncestorChart.py b/src/plugins/AncestorChart.py index 01b0f3b89..94b2e9fb2 100644 --- a/src/plugins/AncestorChart.py +++ b/src/plugins/AncestorChart.py @@ -135,7 +135,6 @@ class AncestorChart: generation = generation + 3 if self.standalone: self.doc.close() - #self.doc.close() def calc(self): """ @@ -248,7 +247,7 @@ class AncestorChartDialog(Report.DrawReportDialog): def get_stylesheet_savefile(self): """Where to save user defined styles for this report.""" - return "ancestor_chart.xml" + return _style_file def get_report_generations(self): """Default to 10 generations, no page breaks.""" diff --git a/src/plugins/BookReport.py b/src/plugins/BookReport.py index 3865e8e0d..c706b3b95 100644 --- a/src/plugins/BookReport.py +++ b/src/plugins/BookReport.py @@ -575,8 +575,8 @@ class BookReportSelector: self.avail_tree = self.xml.get_widget("avail_tree") self.book_tree = self.xml.get_widget("book_tree") - self.avail_tree.connect('button-press-event',self.av_double_click) - self.book_tree.connect('button-press-event',self.bk_double_click) + self.avail_tree.connect('button-press-event',self.av_button_press) + self.book_tree.connect('button-press-event',self.bk_button_press) title_label = self.xml.get_widget('title') Utils.set_titles(self.top,title_label,_('Book Report')) @@ -753,19 +753,79 @@ class BookReportSelector: item.set_style_name(opt_dlg.style_name) self.book.set_item(row,item) - def bk_double_click(self,obj,event): + def bk_button_press(self,obj,event): """ Double-click on the current book selection is the same as setup. + Right click evokes the context menu. """ if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: self.on_setup_clicked(obj) + elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: + self.build_bk_context_menu() - def av_double_click(self,obj,event): + def av_button_press(self,obj,event): """ Double-click on the available selection is the same as add. + Right click evokes the context menu. """ if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: self.on_add_clicked(obj) + elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: + self.build_av_context_menu() + + def build_bk_context_menu(self): + """Builds the menu with item-centered and book-centered options.""" + + store,iter = self.bk_model.get_selected() + if iter: + sensitivity = 1 + else: + sensitivity = 0 + entries = [ + (gtk.STOCK_GO_UP, self.on_up_clicked, sensitivity), + (gtk.STOCK_GO_DOWN, self.on_down_clicked, sensitivity), + (_("Setup"), self.on_setup_clicked, sensitivity), + (gtk.STOCK_REMOVE, self.on_remove_clicked, sensitivity), + (None,None,0), + (gtk.STOCK_CLEAR, self.on_clear_clicked, 1), + (gtk.STOCK_SAVE, self.on_save_clicked, 1), + (gtk.STOCK_OPEN, self.on_open_clicked, 1), + (_("Edit"), self.on_edit_clicked,1 ), + ] + + menu = gtk.Menu() + menu.set_title(_('Book Menu')) + for stock_id,callback,sensitivity in entries: + item = gtk.ImageMenuItem(stock_id) + if callback: + item.connect("activate",callback) + item.set_sensitive(sensitivity) + item.show() + menu.append(item) + menu.popup(None,None,None,0,0) + + def build_av_context_menu(self): + """Builds the menu with the single Add option.""" + + store,iter = self.av_model.get_selected() + if iter: + sensitivity = 1 + else: + sensitivity = 0 + entries = [ + (gtk.STOCK_ADD, self.on_add_clicked, sensitivity), + ] + + menu = gtk.Menu() + menu.set_title(_('Available Items Menu')) + for stock_id,callback,sensitivity in entries: + item = gtk.ImageMenuItem(stock_id) + if callback: + item.connect("activate",callback) + item.set_sensitive(sensitivity) + item.show() + menu.append(item) + menu.popup(None,None,None,0,0) def on_book_ok_clicked(self,obj): """ @@ -843,6 +903,8 @@ class BookReportDialog(Report.ReportDialog): self.selected_style.add_style( this_style_name,style_sheet.get_style(this_style_name)) + print self.selected_style.get_names() + def setup_style_frame(self): pass def setup_report_options_frame(self): pass def setup_other_frames(self): pass