* src/DisplayView.py: Open/OpenRecent MenuToolButton goodness :-)

* src/ViewManager.py: Open/OpenRecent MenuToolButton goodness :-)


svn: r5670
This commit is contained in:
Don Allingham 2006-01-04 21:06:28 +00:00
parent 744776903e
commit 4b545e8ad2
3 changed files with 29 additions and 4 deletions

View File

@ -1,4 +1,6 @@
2006-01-04 Don Allingham <don@gramps-project.org>
* src/DisplayView.py: Open/OpenRecent MenuToolButton goodness :-)
* src/ViewManager.py: Open/OpenRecent MenuToolButton goodness :-)
* src/FamlyView.py: enable menu buttons, siblings
* src/PageView.py: move home function into this class
* src/PersonView.py: move home function out of this class

View File

@ -353,13 +353,17 @@ import RecentFiles
import os
class RecentDocsMenu:
def __init__(self,uimanager, state, fileopen):
def __init__(self,uistate, state, fileopen):
self.action_group = gtk.ActionGroup('RecentFiles')
self.active = DISABLED
self.uimanager = uimanager
self.uistate = uistate
self.uimanager = uistate.uimanager
self.fileopen = fileopen
self.state = state
menu_item = self.uimanager.get_widget('/MenuBar/FileMenu/OpenRecent')
self.uistate.set_open_recent_menu(menu_item.get_submenu())
def load(self,item):
name = item.get_path()
dbtype = item.get_mime()
@ -403,6 +407,9 @@ class RecentDocsMenu:
self.active = self.uimanager.add_ui_from_string(f.getvalue())
f.close()
menu_item = self.uistate.uimanager.get_widget('/MenuBar/FileMenu/OpenRecent')
self.uistate.set_open_recent_menu(menu_item.get_submenu())
def make_callback(n,f):
return lambda x: f(n)
@ -529,6 +536,13 @@ class DisplayState(GrampsDb.GrampsDBCallback):
self.status_id = status.get_context_id('GRAMPS')
self.phistory = History()
self.gwm = GrampsWindowManager(uimanager)
self.widget = None
def set_open_widget(self,widget):
self.widget = widget
def set_open_recent_menu(self,menu):
self.widget.set_menu(menu)
def push_message(self, text):
self.status_text(text)

View File

@ -134,7 +134,6 @@ uidefault = '''<ui>
</menubar>
<toolbar name="ToolBar">
<toolitem action="New"/>
<toolitem action="Open"/>
<separator/>
<placeholder name="CommonNavigation"/>
<separator/>
@ -210,9 +209,17 @@ class ViewManager:
self.uistate = DisplayState.DisplayState(self.window, self.statusbar,
self.uimanager, self.state)
toolbar = self.uimanager.get_widget('/ToolBar')
openbtn = gtk.MenuToolButton(gtk.STOCK_OPEN)
openbtn.show()
openbtn.connect('clicked',self.open_activate)
openbtn.set_sensitive(False)
self.uistate.set_open_widget(openbtn)
toolbar.insert(openbtn,1)
person_nav = Navigation.PersonNavigation(self.uistate)
self.navigation_type[PageView.NAVIGATION_PERSON] = (person_nav,None)
self.recent_manager = DisplayState.RecentDocsMenu(self.uimanager,self.state,
self.recent_manager = DisplayState.RecentDocsMenu(self.uistate,self.state,
self.read_file)
self.recent_manager.build()
self.window.show()
@ -226,6 +233,7 @@ class ViewManager:
self.build_tools_menu()
self.build_report_menu()
self.fileactions.set_sensitive(True)
self.uistate.widget.set_sensitive(True)
def load_plugins(self):
self.uistate.status_text(_('Loading document formats...'))
@ -315,6 +323,7 @@ class ViewManager:
])
merge_id = self.uimanager.add_ui_from_string(uidefault)
self.uimanager.insert_action_group(self.fileactions,1)
self.uimanager.insert_action_group(self.actiongroup,1)