* 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> 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/FamlyView.py: enable menu buttons, siblings
* src/PageView.py: move home function into this class * src/PageView.py: move home function into this class
* src/PersonView.py: move home function out of this class * src/PersonView.py: move home function out of this class

View File

@ -353,13 +353,17 @@ import RecentFiles
import os import os
class RecentDocsMenu: class RecentDocsMenu:
def __init__(self,uimanager, state, fileopen): def __init__(self,uistate, state, fileopen):
self.action_group = gtk.ActionGroup('RecentFiles') self.action_group = gtk.ActionGroup('RecentFiles')
self.active = DISABLED self.active = DISABLED
self.uimanager = uimanager self.uistate = uistate
self.uimanager = uistate.uimanager
self.fileopen = fileopen self.fileopen = fileopen
self.state = state 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): def load(self,item):
name = item.get_path() name = item.get_path()
dbtype = item.get_mime() dbtype = item.get_mime()
@ -403,6 +407,9 @@ class RecentDocsMenu:
self.active = self.uimanager.add_ui_from_string(f.getvalue()) self.active = self.uimanager.add_ui_from_string(f.getvalue())
f.close() 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): def make_callback(n,f):
return lambda x: f(n) return lambda x: f(n)
@ -529,6 +536,13 @@ class DisplayState(GrampsDb.GrampsDBCallback):
self.status_id = status.get_context_id('GRAMPS') self.status_id = status.get_context_id('GRAMPS')
self.phistory = History() self.phistory = History()
self.gwm = GrampsWindowManager(uimanager) 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): def push_message(self, text):
self.status_text(text) self.status_text(text)

View File

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