* 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


svn: r5634
This commit is contained in:
Don Allingham 2005-12-26 05:11:37 +00:00
parent 876730d889
commit 8189db333e
5 changed files with 36 additions and 44 deletions

View File

@ -1,3 +1,9 @@
2005-12-25 Don Allingham <don@gramps-project.org>
* 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 <shura@gramps-project.org> 2005-12-25 Alex Roitman <shura@gramps-project.org>
* src/EditPlace.py: Change arguments, use correct track. * src/EditPlace.py: Change arguments, use correct track.
* src/PlaceView.py: Call EditPlace with new arguments. * src/PlaceView.py: Call EditPlace with new arguments.

View File

@ -103,7 +103,6 @@ class Bookmarks :
self.action_group.add_actions(actions) self.action_group.add_actions(actions)
self.uimanager.insert_action_group(self.action_group,1) self.uimanager.insert_action_group(self.action_group,1)
self.active = self.uimanager.add_ui_from_string(f.getvalue()) self.active = self.uimanager.add_ui_from_string(f.getvalue())
print f.getvalue()
f.close() f.close()
def add(self,person_handle): def add(self,person_handle):

View File

@ -372,7 +372,6 @@ class RecentDocsMenu:
db = GrampsDb.gramps_db_factory(dbtype)() db = GrampsDb.gramps_db_factory(dbtype)()
self.state.change_database(db) self.state.change_database(db)
self.fileopen(name) self.fileopen(name)
self.state.db.request_rebuild()
RecentFiles.recent_files(name,dbtype) RecentFiles.recent_files(name,dbtype)
self.build() self.build()

View File

@ -61,6 +61,7 @@ import Report
import Tool import Tool
import PluginMgr import PluginMgr
import GrampsDisplay 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 """Displays the dialog box that allows the user to select the
report that is desired.""" 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): button_label=None,tool_tip=None,content=REPORTS):
"""Display the dialog box, and build up the list of available """Display the dialog box, and build up the list of available
reports. This is used to build the selection tree on the left reports. This is used to build the selection tree on the left
hand side of the dailog box.""" hand side of the dailog box."""
self.parent = parent self.active = state.active
if self.parent.child_windows.has_key(msg):
self.parent.child_windows[msg].present(None)
return
self.db = db
self.active = active
self.update = None self.update = None
self.imap = {} self.imap = {}
self.msg = msg self.msg = msg
self.content = content 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 = gtk.glade.XML(const.pluginsFile,"report","gramps")
self.dialog.signal_autoconnect({ self.dialog.signal_autoconnect({
@ -106,10 +108,10 @@ class PluginDialog:
}) })
self.tree = self.dialog.get_widget("tree") 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") 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.store = gtk.TreeStore(gobject.TYPE_STRING)
self.selection = self.tree.get_selection() self.selection = self.tree.get_selection()
@ -146,29 +148,13 @@ class PluginDialog:
self.item = None self.item = None
self.build_plugin_tree(item_list,categories) self.build_plugin_tree(item_list,categories)
self.add_itself_to_menu() self.window.show()
self.top.show()
def on_delete_event(self,obj,b): def on_delete_event(self,obj,b):
self.remove_itself_from_menu() pass
def close(self,ok=0): def close(self,ok=0):
self.remove_itself_from_menu() self.window.destroy()
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()
def on_apply_clicked(self,obj): def on_apply_clicked(self,obj):
"""Execute the selected report""" """Execute the selected report"""
@ -274,14 +260,15 @@ class ReportPlugins(PluginDialog):
"""Displays the dialog box that allows the user to select the """Displays the dialog box that allows the user to select the
report that is desired.""" 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 """Display the dialog box, and build up the list of available
reports. This is used to build the selection tree on the left reports. This is used to build the selection tree on the left
hand side of the dailog box.""" hand side of the dailog box."""
PluginDialog.__init__( PluginDialog.__init__(
self,parent, self,
db, dbstate,
active, uistate,
track,
PluginMgr.report_list, PluginMgr.report_list,
Report.standalone_categories, Report.standalone_categories,
_("Report Selection"), _("Report Selection"),
@ -339,8 +326,8 @@ class PluginStatus:
import cStringIO import cStringIO
self.glade = gtk.glade.XML(const.pluginsFile,"plugstat","gramps") self.glade = gtk.glade.XML(const.pluginsFile,"plugstat","gramps")
self.top = self.glade.get_widget("plugstat") self.window = self.glade.get_widget("plugstat")
self.top.set_title("%s - GRAMPS" % _('Plugin status')) self.window.set_title("%s - GRAMPS" % _('Plugin status'))
window = self.glade.get_widget("text") window = self.glade.get_widget("text")
self.pop_button = self.glade.get_widget("pop_button") self.pop_button = self.glade.get_widget("pop_button")
self.pop_button.set_active(GrampsKeys.get_pop_plugin_status()) self.pop_button.set_active(GrampsKeys.get_pop_plugin_status())
@ -355,7 +342,7 @@ class PluginStatus:
}) })
if parent_window: if parent_window:
self.top.set_transient_for(parent_window) self.window.set_transient_for(parent_window)
info = cStringIO.StringIO() info = cStringIO.StringIO()
@ -382,7 +369,7 @@ class PluginStatus:
status_up = None status_up = None
def close(self,obj): def close(self,obj):
self.top.destroy() self.window.destroy()
status_up = None status_up = None
def help(self,obj): def help(self,obj):

View File

@ -267,7 +267,7 @@ class ViewManager:
('FastMerge', None, '_Fast merge'), ('FastMerge', None, '_Fast merge'),
('ScratchPad', gtk.STOCK_PASTE, '_ScratchPad', None, None, self.scratchpad), ('ScratchPad', gtk.STOCK_PASTE, '_ScratchPad', None, None, self.scratchpad),
('Import', gtk.STOCK_CONVERT, '_Import', None, None, self.import_data), ('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'), ('Tools', gtk.STOCK_EXECUTE, '_Tools'),
('EditMenu', None, '_Edit'), ('EditMenu', None, '_Edit'),
('GoMenu', None, '_Go'), ('GoMenu', None, '_Go'),
@ -567,7 +567,6 @@ class ViewManager:
pass pass
self.state.change_database(GrampsDb.gramps_db_factory(const.app_gramps)()) self.state.change_database(GrampsDb.gramps_db_factory(const.app_gramps)())
self.read_file(filename) self.read_file(filename)
self.state.db.request_rebuild()
self.change_page(None,None) self.change_page(None,None)
# Add the file to the recent items # Add the file to the recent items
RecentFiles.recent_files(filename,const.app_gramps) RecentFiles.recent_files(filename,const.app_gramps)
@ -601,18 +600,15 @@ class ViewManager:
gtk.main_iteration() gtk.main_iteration()
success = self.read_file(filename,update_msg) success = self.read_file(filename,update_msg)
self.state.db.request_rebuild()
self.change_page(None,None) self.change_page(None,None)
msg_top.destroy() msg_top.destroy()
elif filetype == const.app_gramps_xml: elif filetype == const.app_gramps_xml:
self.state.change_database(GrampsDb.gramps_db_factory(db_type = const.app_gramps_xml)()) self.state.change_database(GrampsDb.gramps_db_factory(db_type = const.app_gramps_xml)())
success = self.read_file(filename) success = self.read_file(filename)
self.state.db.request_rebuild()
self.change_page(None,None) self.change_page(None,None)
elif filetype == const.app_gedcom: elif filetype == const.app_gedcom:
self.state.change_database(GrampsDb.gramps_db_factory(db_type = const.app_gedcom)()) self.state.change_database(GrampsDb.gramps_db_factory(db_type = const.app_gedcom)())
success = self.read_file(filename) success = self.read_file(filename)
self.state.db.request_rebuild()
self.change_page(None,None) self.change_page(None,None)
if success: if success:
@ -683,6 +679,7 @@ class ViewManager:
return self.post_load(name,callback) return self.post_load(name,callback)
def post_load(self,name,callback=None): def post_load(self,name,callback=None):
self.state.db.request_rebuild()
if not self.state.db.version_supported(): if not self.state.db.version_supported():
raise Errors.FileVersionError( raise Errors.FileVersionError(
"The database version is not supported by this " "The database version is not supported by this "
@ -731,6 +728,10 @@ class ViewManager:
def on_edit_bookmarks_activate(self,obj): def on_edit_bookmarks_activate(self,obj):
self.bookmarks.edit() self.bookmarks.edit()
def reports_clicked(self,obj):
import Plugins
Plugins.ReportPlugins(self.state,self.uistate,[])
def find_initial_person(self): def find_initial_person(self):
person = self.state.db.get_default_person() person = self.state.db.get_default_person()