diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 1204858cf..6e8338222 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,9 @@ +2005-12-25 Don Allingham + * src/Bookmarks.py: remove debugging statements + * src/DisplayState.py: remove extra rebuild request + * src/Plugins.py: start support of Report menu + * src/ViewManager.py: tie in report support + 2005-12-25 Alex Roitman * src/EditPlace.py: Change arguments, use correct track. * src/PlaceView.py: Call EditPlace with new arguments. diff --git a/gramps2/src/Bookmarks.py b/gramps2/src/Bookmarks.py index 30eedcc85..4ebe5e685 100644 --- a/gramps2/src/Bookmarks.py +++ b/gramps2/src/Bookmarks.py @@ -103,7 +103,6 @@ class Bookmarks : self.action_group.add_actions(actions) self.uimanager.insert_action_group(self.action_group,1) self.active = self.uimanager.add_ui_from_string(f.getvalue()) - print f.getvalue() f.close() def add(self,person_handle): diff --git a/gramps2/src/DisplayState.py b/gramps2/src/DisplayState.py index e3b36a2bc..1b4b24bf1 100644 --- a/gramps2/src/DisplayState.py +++ b/gramps2/src/DisplayState.py @@ -372,7 +372,6 @@ class RecentDocsMenu: db = GrampsDb.gramps_db_factory(dbtype)() self.state.change_database(db) self.fileopen(name) - self.state.db.request_rebuild() RecentFiles.recent_files(name,dbtype) self.build() diff --git a/gramps2/src/Plugins.py b/gramps2/src/Plugins.py index f179a2743..017591463 100644 --- a/gramps2/src/Plugins.py +++ b/gramps2/src/Plugins.py @@ -61,6 +61,7 @@ import Report import Tool import PluginMgr import GrampsDisplay +import DisplayState #------------------------------------------------------------------------- # @@ -77,26 +78,27 @@ UNSUPPORTED = _("Unsupported") # #------------------------------------------------------------------------- -class PluginDialog: +class PluginDialog(DisplayState.ManagedWindow): """Displays the dialog box that allows the user to select the report that is desired.""" - def __init__(self,parent,db,active,item_list,categories,msg,label=None, + def __init__(self,state, uistate, track, item_list,categories,msg,label=None, button_label=None,tool_tip=None,content=REPORTS): """Display the dialog box, and build up the list of available reports. This is used to build the selection tree on the left hand side of the dailog box.""" - self.parent = parent - if self.parent.child_windows.has_key(msg): - self.parent.child_windows[msg].present(None) - return - self.db = db - self.active = active + self.active = state.active self.update = None self.imap = {} self.msg = msg self.content = content + + DisplayState.ManagedWindow.__init__(self, uistate, [], None) + if self.already_exist: + return + self.state = state + self.uistate = uistate self.dialog = gtk.glade.XML(const.pluginsFile,"report","gramps") self.dialog.signal_autoconnect({ @@ -106,10 +108,10 @@ class PluginDialog: }) self.tree = self.dialog.get_widget("tree") - self.top = self.dialog.get_widget("report") + self.window = self.dialog.get_widget("report") self.title = self.dialog.get_widget("title") - Utils.set_titles(self.top, self.title, msg ) + Utils.set_titles(self.window, self.title, msg ) self.store = gtk.TreeStore(gobject.TYPE_STRING) self.selection = self.tree.get_selection() @@ -146,29 +148,13 @@ class PluginDialog: self.item = None self.build_plugin_tree(item_list,categories) - self.add_itself_to_menu() - self.top.show() + self.window.show() def on_delete_event(self,obj,b): - self.remove_itself_from_menu() + pass def close(self,ok=0): - self.remove_itself_from_menu() - self.top.destroy() - - def add_itself_to_menu(self): - self.parent.child_windows[self.msg] = self - self.win_menu_item = gtk.MenuItem(self.msg) - self.win_menu_item.connect("activate",self.present) - self.win_menu_item.show() - self.parent.winsmenu.append(self.win_menu_item) - - def remove_itself_from_menu(self): - del self.parent.child_windows[self.msg] - self.win_menu_item.destroy() - - def present(self,obj): - self.top.present() + self.window.destroy() def on_apply_clicked(self,obj): """Execute the selected report""" @@ -274,14 +260,15 @@ class ReportPlugins(PluginDialog): """Displays the dialog box that allows the user to select the report that is desired.""" - def __init__(self,parent,db,active): + def __init__(self,dbstate,uistate,track): """Display the dialog box, and build up the list of available reports. This is used to build the selection tree on the left hand side of the dailog box.""" PluginDialog.__init__( - self,parent, - db, - active, + self, + dbstate, + uistate, + track, PluginMgr.report_list, Report.standalone_categories, _("Report Selection"), @@ -339,8 +326,8 @@ class PluginStatus: import cStringIO self.glade = gtk.glade.XML(const.pluginsFile,"plugstat","gramps") - self.top = self.glade.get_widget("plugstat") - self.top.set_title("%s - GRAMPS" % _('Plugin status')) + self.window = self.glade.get_widget("plugstat") + self.window.set_title("%s - GRAMPS" % _('Plugin status')) window = self.glade.get_widget("text") self.pop_button = self.glade.get_widget("pop_button") self.pop_button.set_active(GrampsKeys.get_pop_plugin_status()) @@ -355,7 +342,7 @@ class PluginStatus: }) if parent_window: - self.top.set_transient_for(parent_window) + self.window.set_transient_for(parent_window) info = cStringIO.StringIO() @@ -382,7 +369,7 @@ class PluginStatus: status_up = None def close(self,obj): - self.top.destroy() + self.window.destroy() status_up = None def help(self,obj): diff --git a/gramps2/src/ViewManager.py b/gramps2/src/ViewManager.py index 9c1689671..26960943c 100644 --- a/gramps2/src/ViewManager.py +++ b/gramps2/src/ViewManager.py @@ -267,7 +267,7 @@ class ViewManager: ('FastMerge', None, '_Fast merge'), ('ScratchPad', gtk.STOCK_PASTE, '_ScratchPad', None, None, self.scratchpad), ('Import', gtk.STOCK_CONVERT, '_Import', None, None, self.import_data), - ('Reports', gtk.STOCK_DND_MULTIPLE, '_Reports'), + ('Reports', gtk.STOCK_DND_MULTIPLE, '_Reports', None, None, self.reports_clicked), ('Tools', gtk.STOCK_EXECUTE, '_Tools'), ('EditMenu', None, '_Edit'), ('GoMenu', None, '_Go'), @@ -567,7 +567,6 @@ class ViewManager: pass self.state.change_database(GrampsDb.gramps_db_factory(const.app_gramps)()) self.read_file(filename) - self.state.db.request_rebuild() self.change_page(None,None) # Add the file to the recent items RecentFiles.recent_files(filename,const.app_gramps) @@ -601,18 +600,15 @@ class ViewManager: gtk.main_iteration() success = self.read_file(filename,update_msg) - self.state.db.request_rebuild() self.change_page(None,None) msg_top.destroy() elif filetype == const.app_gramps_xml: self.state.change_database(GrampsDb.gramps_db_factory(db_type = const.app_gramps_xml)()) success = self.read_file(filename) - self.state.db.request_rebuild() self.change_page(None,None) elif filetype == const.app_gedcom: self.state.change_database(GrampsDb.gramps_db_factory(db_type = const.app_gedcom)()) success = self.read_file(filename) - self.state.db.request_rebuild() self.change_page(None,None) if success: @@ -683,6 +679,7 @@ class ViewManager: return self.post_load(name,callback) def post_load(self,name,callback=None): + self.state.db.request_rebuild() if not self.state.db.version_supported(): raise Errors.FileVersionError( "The database version is not supported by this " @@ -731,6 +728,10 @@ class ViewManager: def on_edit_bookmarks_activate(self,obj): self.bookmarks.edit() + + def reports_clicked(self,obj): + import Plugins + Plugins.ReportPlugins(self.state,self.uistate,[]) def find_initial_person(self): person = self.state.db.get_default_person()