* src/DisplayState.py: recent file support
* src/ViewManager.py: recent file support * src/DisplayState.py: recent file support * src/EditPerson.py: Window management * src/EditSource.py: Window management * src/EventEdit.py: Window management * src/ListBox.py: Window management * src/Sources.py: Window management * src/UrlEdit.py: Window management * src/ViewManager.py: Window management svn: r5631
This commit is contained in:
parent
b7040cb2e3
commit
8cb5f9673e
20
ChangeLog
20
ChangeLog
@ -1,12 +1,16 @@
|
|||||||
|
2005-12-24 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/DisplayState.py: recent file support
|
||||||
|
* src/ViewManager.py: recent file support
|
||||||
|
|
||||||
2005-12-23 Don Allingham <don@gramps-project.org>
|
2005-12-23 Don Allingham <don@gramps-project.org>
|
||||||
* DisplayState.py: recent file support
|
* src/DisplayState.py: recent file support
|
||||||
* EditPerson.py: Window management
|
* src/EditPerson.py: Window management
|
||||||
* EditSource.py: Window management
|
* src/EditSource.py: Window management
|
||||||
* EventEdit.py: Window management
|
* src/EventEdit.py: Window management
|
||||||
* ListBox.py: Window management
|
* src/ListBox.py: Window management
|
||||||
* Sources.py: Window management
|
* src/Sources.py: Window management
|
||||||
* UrlEdit.py: Window management
|
* src/UrlEdit.py: Window management
|
||||||
* ViewManager.py: Window management
|
* src/ViewManager.py: Window management
|
||||||
|
|
||||||
2005-12-23 Alex Roitman <shura@gramps-project.org>
|
2005-12-23 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/EditPerson.py: Swap menu/submenu labels.
|
* src/EditPerson.py: Swap menu/submenu labels.
|
||||||
|
@ -358,10 +358,24 @@ except:
|
|||||||
from gnome.vfs import get_mime_type
|
from gnome.vfs import get_mime_type
|
||||||
|
|
||||||
class RecentDocsMenu:
|
class RecentDocsMenu:
|
||||||
def __init__(self,uimanager):
|
def __init__(self,uimanager, state, fileopen):
|
||||||
self.action_group = gtk.ActionGroup('RecentFiles')
|
self.action_group = gtk.ActionGroup('RecentFiles')
|
||||||
self.active = DISABLED
|
self.active = DISABLED
|
||||||
self.uimanager = uimanager
|
self.uimanager = uimanager
|
||||||
|
self.fileopen = fileopen
|
||||||
|
self.state = state
|
||||||
|
|
||||||
|
def load(self,item):
|
||||||
|
print item
|
||||||
|
name = item.get_path()
|
||||||
|
dbtype = item.get_mime()
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
f = StringIO()
|
f = StringIO()
|
||||||
@ -382,7 +396,8 @@ class RecentDocsMenu:
|
|||||||
filetype = get_mime_type(item.get_path())
|
filetype = get_mime_type(item.get_path())
|
||||||
action_id = "RecentMenu%d" % count
|
action_id = "RecentMenu%d" % count
|
||||||
f.write('<menuitem action="%s"/>' % action_id)
|
f.write('<menuitem action="%s"/>' % action_id)
|
||||||
actions.append((action_id,None,filename,None,None,None))
|
actions.append((action_id,None,filename,None,None,
|
||||||
|
make_callback(item,self.load)))
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
pass # ignore no longer existing files
|
pass # ignore no longer existing files
|
||||||
|
|
||||||
@ -390,9 +405,12 @@ class RecentDocsMenu:
|
|||||||
f.write(_rct_btm)
|
f.write(_rct_btm)
|
||||||
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.action = self.uimanager.add_ui_from_string(f.getvalue())
|
self.active = self.uimanager.add_ui_from_string(f.getvalue())
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
def make_callback(n,f):
|
||||||
|
return lambda x: f(n)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Gramps Managed Window class
|
# Gramps Managed Window class
|
||||||
|
@ -61,6 +61,7 @@ import PageView
|
|||||||
import Navigation
|
import Navigation
|
||||||
import TipOfDay
|
import TipOfDay
|
||||||
import Bookmarks
|
import Bookmarks
|
||||||
|
import RecentFiles
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -204,7 +205,7 @@ class ViewManager:
|
|||||||
|
|
||||||
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.recent_manager = DisplayState.RecentDocsMenu(self.uimanager,self.state,self.read_file)
|
||||||
self.recent_manager.build()
|
self.recent_manager.build()
|
||||||
self.window.show()
|
self.window.show()
|
||||||
|
|
||||||
@ -568,8 +569,8 @@ class ViewManager:
|
|||||||
self.state.db.request_rebuild()
|
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)
|
||||||
#self.parent.build_recent_menu()
|
self.recent_manager.build()
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
choose.destroy()
|
choose.destroy()
|
||||||
@ -613,10 +614,10 @@ class ViewManager:
|
|||||||
self.state.db.request_rebuild()
|
self.state.db.request_rebuild()
|
||||||
self.change_page(None,None)
|
self.change_page(None,None)
|
||||||
|
|
||||||
#if success:
|
if success:
|
||||||
# Add the file to the recent items
|
# Add the file to the recent items
|
||||||
#RecentFiles.recent_files(filename,filetype)
|
RecentFiles.recent_files(filename,filetype)
|
||||||
#parent.build_recent_menu()
|
self.recent_manager.build()
|
||||||
|
|
||||||
return success
|
return success
|
||||||
|
|
||||||
@ -642,6 +643,7 @@ class ViewManager:
|
|||||||
'to the selected file.'))
|
'to the selected file.'))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
print self.load_database, filename, callback, mode
|
||||||
if self.load_database(filename,callback,mode=mode):
|
if self.load_database(filename,callback,mode=mode):
|
||||||
if filename[-1] == '/':
|
if filename[-1] == '/':
|
||||||
filename = filename[:-1]
|
filename = filename[:-1]
|
||||||
|
Loading…
Reference in New Issue
Block a user