2005-08-09 10:11:20 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2006-03-01 11:46:36 +05:30
|
|
|
# Copyright (C) 2000-2006 Donald N. Allingham
|
2005-08-09 10:11:20 +05:30
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Standard python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2005-12-16 03:20:14 +05:30
|
|
|
from cStringIO import StringIO
|
2006-05-18 07:09:50 +05:30
|
|
|
from gettext import gettext as _
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2006-03-05 10:15:44 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# set up logging
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import logging
|
|
|
|
log = logging.getLogger(".DisplayState")
|
|
|
|
|
2005-08-09 10:11:20 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GNOME python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import gobject
|
|
|
|
import gtk
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GRAMPS modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2005-12-21 16:57:05 +05:30
|
|
|
import GrampsDb
|
2006-03-03 05:40:52 +05:30
|
|
|
import Config
|
2005-08-09 10:11:20 +05:30
|
|
|
import NameDisplay
|
2006-01-24 03:18:34 +05:30
|
|
|
import const
|
2006-04-01 09:29:42 +05:30
|
|
|
import ManagedWindow
|
|
|
|
|
|
|
|
DISABLED = -1
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2005-08-15 09:15:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# History manager
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2005-12-21 16:57:05 +05:30
|
|
|
class History(GrampsDb.GrampsDBCallback):
|
2005-08-11 05:23:24 +05:30
|
|
|
|
|
|
|
__signals__ = {
|
|
|
|
'changed' : (list,),
|
|
|
|
'menu-changed' : (list,),
|
|
|
|
}
|
2005-08-09 10:11:20 +05:30
|
|
|
|
|
|
|
def __init__(self):
|
2005-12-21 16:57:05 +05:30
|
|
|
GrampsDb.GrampsDBCallback.__init__(self)
|
2005-08-09 10:11:20 +05:30
|
|
|
self.history = []
|
|
|
|
self.mhistory = []
|
|
|
|
self.index = -1
|
|
|
|
self.lock = False
|
|
|
|
|
|
|
|
def clear(self):
|
|
|
|
self.history = []
|
2005-12-25 09:31:47 +05:30
|
|
|
self.mhistory = []
|
2005-08-09 10:11:20 +05:30
|
|
|
self.index = -1
|
|
|
|
self.lock = False
|
|
|
|
|
|
|
|
def remove(self,person_handle,old_id=None):
|
|
|
|
"""Removes a person from the history list"""
|
|
|
|
if old_id:
|
|
|
|
del_id = old_id
|
|
|
|
else:
|
|
|
|
del_id = person_handle
|
|
|
|
|
|
|
|
hc = self.history.count(del_id)
|
|
|
|
for c in range(hc):
|
|
|
|
self.history.remove(del_id)
|
|
|
|
self.index -= 1
|
|
|
|
|
|
|
|
mhc = self.mhistory.count(del_id)
|
|
|
|
for c in range(mhc):
|
|
|
|
self.mhistory.remove(del_id)
|
2005-08-11 05:23:24 +05:30
|
|
|
self.emit('changed',(self.history,))
|
|
|
|
self.emit('menu-changed',(self.mhistory,))
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2005-08-10 19:58:16 +05:30
|
|
|
def push(self,person_handle):
|
|
|
|
self.prune()
|
|
|
|
if len(self.history) == 0 or person_handle != self.history[-1]:
|
|
|
|
self.history.append(person_handle)
|
2006-01-04 05:21:20 +05:30
|
|
|
if person_handle in self.mhistory:
|
2005-08-20 03:40:35 +05:30
|
|
|
self.mhistory.remove(person_handle)
|
2006-01-04 05:21:20 +05:30
|
|
|
self.mhistory.append(person_handle)
|
2005-08-10 19:58:16 +05:30
|
|
|
self.index += 1
|
2005-08-20 03:40:35 +05:30
|
|
|
self.emit('menu-changed',(self.mhistory,))
|
2005-08-11 05:23:24 +05:30
|
|
|
self.emit('changed',(self.history,))
|
2005-08-10 19:58:16 +05:30
|
|
|
|
|
|
|
def forward(self,step=1):
|
|
|
|
self.index += step
|
2005-08-11 05:23:24 +05:30
|
|
|
person_handle = self.history[self.index]
|
|
|
|
if person_handle not in self.mhistory:
|
|
|
|
self.mhistory.append(person_handle)
|
|
|
|
self.emit('menu-changed',(self.mhistory,))
|
2005-08-10 19:58:16 +05:30
|
|
|
return str(self.history[self.index])
|
|
|
|
|
|
|
|
def back(self,step=1):
|
|
|
|
self.index -= step
|
2005-08-11 05:23:24 +05:30
|
|
|
person_handle = self.history[self.index]
|
|
|
|
if person_handle not in self.mhistory:
|
|
|
|
self.mhistory.append(person_handle)
|
|
|
|
self.emit('menu-changed',(self.mhistory,))
|
2005-08-10 19:58:16 +05:30
|
|
|
return str(self.history[self.index])
|
|
|
|
|
|
|
|
def at_end(self):
|
|
|
|
return self.index+1 == len(self.history)
|
|
|
|
|
|
|
|
def at_front(self):
|
2005-08-11 22:49:03 +05:30
|
|
|
return self.index <= 0
|
2005-08-10 19:58:16 +05:30
|
|
|
|
|
|
|
def prune(self):
|
|
|
|
if not self.at_end():
|
|
|
|
self.history = self.history[0:self.index+1]
|
|
|
|
|
2005-12-24 05:39:04 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Recent Docs Menu
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
_rct_top = '<ui><menubar name="MenuBar"><menu action="FileMenu"><menu action="OpenRecent">'
|
|
|
|
_rct_btm = '</menu></menu></menubar></ui>'
|
|
|
|
|
|
|
|
import RecentFiles
|
|
|
|
import os
|
|
|
|
|
|
|
|
class RecentDocsMenu:
|
2006-01-05 02:36:28 +05:30
|
|
|
def __init__(self,uistate, state, fileopen):
|
2005-12-24 05:39:04 +05:30
|
|
|
self.action_group = gtk.ActionGroup('RecentFiles')
|
|
|
|
self.active = DISABLED
|
2006-01-05 02:36:28 +05:30
|
|
|
self.uistate = uistate
|
|
|
|
self.uimanager = uistate.uimanager
|
2005-12-25 00:48:18 +05:30
|
|
|
self.fileopen = fileopen
|
|
|
|
self.state = state
|
|
|
|
|
|
|
|
def load(self,item):
|
|
|
|
name = item.get_path()
|
2006-05-18 02:46:59 +05:30
|
|
|
dbtype = item.get_mime()
|
|
|
|
self.fileopen(name,dbtype)
|
2005-12-24 05:39:04 +05:30
|
|
|
|
|
|
|
def build(self):
|
|
|
|
f = StringIO()
|
|
|
|
f.write(_rct_top)
|
|
|
|
gramps_rf = RecentFiles.GrampsRecentFiles()
|
|
|
|
|
|
|
|
count = 0
|
|
|
|
|
|
|
|
if self.active != DISABLED:
|
|
|
|
self.uimanager.remove_ui(self.active)
|
|
|
|
self.uimanager.remove_action_group(self.action_group)
|
|
|
|
self.active = DISABLED
|
|
|
|
|
|
|
|
actions = []
|
2005-12-25 09:31:47 +05:30
|
|
|
rfiles = gramps_rf.gramps_recent_files
|
|
|
|
rfiles.sort(by_time)
|
2006-11-27 08:54:39 +05:30
|
|
|
|
|
|
|
new_menu = gtk.Menu()
|
|
|
|
|
2005-12-25 09:31:47 +05:30
|
|
|
for item in rfiles:
|
2005-12-24 05:39:04 +05:30
|
|
|
try:
|
|
|
|
filename = os.path.basename(item.get_path()).replace('_','__')
|
|
|
|
action_id = "RecentMenu%d" % count
|
|
|
|
f.write('<menuitem action="%s"/>' % action_id)
|
2005-12-25 00:48:18 +05:30
|
|
|
actions.append((action_id,None,filename,None,None,
|
|
|
|
make_callback(item,self.load)))
|
2006-11-27 08:54:39 +05:30
|
|
|
mitem = gtk.MenuItem(filename)
|
|
|
|
mitem.connect('activate', make_callback(item, self.load))
|
|
|
|
mitem.show()
|
|
|
|
new_menu.append(mitem)
|
2005-12-24 05:39:04 +05:30
|
|
|
except RuntimeError:
|
|
|
|
pass # ignore no longer existing files
|
|
|
|
|
|
|
|
count +=1
|
|
|
|
f.write(_rct_btm)
|
|
|
|
self.action_group.add_actions(actions)
|
|
|
|
self.uimanager.insert_action_group(self.action_group,1)
|
2005-12-25 00:48:18 +05:30
|
|
|
self.active = self.uimanager.add_ui_from_string(f.getvalue())
|
2006-04-27 03:45:22 +05:30
|
|
|
self.uimanager.ensure_update()
|
2005-12-24 05:39:04 +05:30
|
|
|
f.close()
|
|
|
|
|
2006-11-27 08:54:39 +05:30
|
|
|
new_menu.show()
|
|
|
|
self.uistate.set_open_recent_menu(new_menu)
|
2006-01-05 02:36:28 +05:30
|
|
|
|
2005-12-25 00:48:18 +05:30
|
|
|
def make_callback(n,f):
|
|
|
|
return lambda x: f(n)
|
|
|
|
|
2005-12-25 09:31:47 +05:30
|
|
|
def by_time(a,b):
|
|
|
|
return cmp(b.get_time(),a.get_time())
|
|
|
|
|
2005-08-15 09:15:16 +05:30
|
|
|
|
2006-01-24 03:18:34 +05:30
|
|
|
from GrampsLogger import RotateHandler
|
|
|
|
|
|
|
|
class WarnHandler(RotateHandler):
|
|
|
|
def __init__(self,capacity,button):
|
|
|
|
RotateHandler.__init__(self,capacity)
|
|
|
|
self.setLevel(logging.WARN)
|
|
|
|
self.button = button
|
|
|
|
button.on_clicked(self.display)
|
2006-01-24 04:06:34 +05:30
|
|
|
self.timer = None
|
2006-01-24 03:18:34 +05:30
|
|
|
|
|
|
|
def emit(self,record):
|
2006-01-24 04:06:34 +05:30
|
|
|
if self.timer:
|
|
|
|
gobject.source_remove(self.timer)
|
|
|
|
gobject.timeout_add(180*1000,self._clear)
|
2006-01-24 03:18:34 +05:30
|
|
|
RotateHandler.emit(self,record)
|
|
|
|
self.button.show()
|
|
|
|
|
2006-01-24 04:06:34 +05:30
|
|
|
def _clear(self):
|
|
|
|
self.button.hide()
|
|
|
|
self.set_capacity(self._capacity)
|
|
|
|
self.timer = None
|
|
|
|
return False
|
|
|
|
|
2006-01-24 03:18:34 +05:30
|
|
|
def display(self,obj):
|
|
|
|
obj.hide()
|
|
|
|
g = gtk.glade.XML(const.gladeFile,'scrollmsg')
|
|
|
|
top = g.get_widget('scrollmsg')
|
|
|
|
msg = g.get_widget('msg')
|
|
|
|
buf = msg.get_buffer()
|
|
|
|
for i in self.get_formatted_log():
|
|
|
|
buf.insert_at_cursor(i + '\n')
|
2006-01-24 04:06:34 +05:30
|
|
|
self.set_capacity(self._capacity)
|
2006-01-24 03:18:34 +05:30
|
|
|
top.run()
|
2006-01-24 04:06:34 +05:30
|
|
|
top.destroy()
|
2006-01-24 03:18:34 +05:30
|
|
|
|
2005-12-21 16:57:05 +05:30
|
|
|
class DisplayState(GrampsDb.GrampsDBCallback):
|
2005-08-11 05:23:24 +05:30
|
|
|
|
|
|
|
__signals__ = {
|
2006-08-22 22:19:21 +05:30
|
|
|
'filters-changed' : (str,),
|
2006-08-26 05:16:19 +05:30
|
|
|
'nameformat-changed' : None,
|
2006-12-20 12:52:19 +05:30
|
|
|
'plugins-reloaded' : (list,list),
|
2005-08-11 05:23:24 +05:30
|
|
|
}
|
|
|
|
|
In .:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as
a constructor argument; (SearchBar.apply_filter): pass dbstate.
* src/PageView.py (BookMarkView.add_bookmark,
PersonNavView.jumpto, PersonNavView.fwd_clicked,
PersonNavView.back_clicked, ListView.build_widget): Pass dbstate.
* src/Navigation.py (BaseNavigation.__init__,
PersonNavigation.__init__): Take dbstate as a constructor argument;
(PersonNavigation.build_item_name): properly access dbstate.
* src/DisplayState.py (__init__): Do not take dbstate as a
constructor argument; Do not connect dbstate signal here (moved to
ViewManager);
(display_relationship,push_message,modify_statusbar): Make dbstate
an argument.
* src/plugins/Checkpoint.py (run_tool): Pass dbstate.
* src/ViewManager.py (_build_main_window): Do not pass dbstate to
uistate DisplayState constructor; connect dbstate signal handler;
pass dbstate to Navigation; (keypress): Pass dbstate;
(statusbar_key_update): Pass dbstate;
(do_load_plugins): Pass dbstate;
(ViewManager.add_bookmark): Pass dbstate.
* src/DataViews/_RelationView.py (shade_update): Pass dbstate.
* src/DataViews/_PersonView.py (build_widget,_goto,
key_goto_home_person, key_edit_selected_person): Pass dbstate.
* src/Filters/Makefile.am (pkgdata_PYTHON): Remove obsolete file.
* src/Filters/__init__.py: Remove importing obsolete module.
* src/Filters/_FilterWidget.py: Remove obsolete module.
In po:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* POTFILES.in: Remove obsolete file.
svn: r7104
2006-08-01 10:01:10 +05:30
|
|
|
def __init__(self, window, status, progress, warnbtn, uimanager):
|
2006-05-07 04:19:51 +05:30
|
|
|
|
2005-08-11 05:23:24 +05:30
|
|
|
self.uimanager = uimanager
|
|
|
|
self.window = window
|
2005-12-21 16:57:05 +05:30
|
|
|
GrampsDb.GrampsDBCallback.__init__(self)
|
2005-08-11 05:23:24 +05:30
|
|
|
self.status = status
|
|
|
|
self.status_id = status.get_context_id('GRAMPS')
|
2006-03-01 11:46:36 +05:30
|
|
|
self.progress = progress
|
2005-08-11 05:23:24 +05:30
|
|
|
self.phistory = History()
|
2006-04-01 09:29:42 +05:30
|
|
|
self.gwm = ManagedWindow.GrampsWindowManager(uimanager)
|
2006-01-05 02:36:28 +05:30
|
|
|
self.widget = None
|
2006-01-23 09:39:20 +05:30
|
|
|
self.warnbtn = warnbtn
|
2006-01-05 02:36:28 +05:30
|
|
|
|
2006-01-24 04:06:34 +05:30
|
|
|
formatter = logging.Formatter('%(levelname)s %(name)s: %(message)s')
|
2006-01-24 03:18:34 +05:30
|
|
|
self.rh = WarnHandler(capacity=400,button=warnbtn)
|
2006-01-24 04:06:34 +05:30
|
|
|
self.rh.setFormatter(formatter)
|
2007-01-12 02:45:33 +05:30
|
|
|
self.rh.setLevel(logging.WARNING)
|
2006-01-24 03:18:34 +05:30
|
|
|
self.log = logging.getLogger()
|
|
|
|
self.log.addHandler(self.rh)
|
In .:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as
a constructor argument; (SearchBar.apply_filter): pass dbstate.
* src/PageView.py (BookMarkView.add_bookmark,
PersonNavView.jumpto, PersonNavView.fwd_clicked,
PersonNavView.back_clicked, ListView.build_widget): Pass dbstate.
* src/Navigation.py (BaseNavigation.__init__,
PersonNavigation.__init__): Take dbstate as a constructor argument;
(PersonNavigation.build_item_name): properly access dbstate.
* src/DisplayState.py (__init__): Do not take dbstate as a
constructor argument; Do not connect dbstate signal here (moved to
ViewManager);
(display_relationship,push_message,modify_statusbar): Make dbstate
an argument.
* src/plugins/Checkpoint.py (run_tool): Pass dbstate.
* src/ViewManager.py (_build_main_window): Do not pass dbstate to
uistate DisplayState constructor; connect dbstate signal handler;
pass dbstate to Navigation; (keypress): Pass dbstate;
(statusbar_key_update): Pass dbstate;
(do_load_plugins): Pass dbstate;
(ViewManager.add_bookmark): Pass dbstate.
* src/DataViews/_RelationView.py (shade_update): Pass dbstate.
* src/DataViews/_PersonView.py (build_widget,_goto,
key_goto_home_person, key_edit_selected_person): Pass dbstate.
* src/Filters/Makefile.am (pkgdata_PYTHON): Remove obsolete file.
* src/Filters/__init__.py: Remove importing obsolete module.
* src/Filters/_FilterWidget.py: Remove obsolete module.
In po:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* POTFILES.in: Remove obsolete file.
svn: r7104
2006-08-01 10:01:10 +05:30
|
|
|
# This call has been moved one level up,
|
|
|
|
# but this connection is still made!
|
|
|
|
# self.dbstate.connect('database-changed', self.db_changed)
|
2006-05-07 04:19:51 +05:30
|
|
|
|
|
|
|
def db_changed(self, db):
|
|
|
|
from PluginUtils import _PluginMgr
|
|
|
|
self.relationship = _PluginMgr.relationship_class(db)
|
|
|
|
|
In .:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as
a constructor argument; (SearchBar.apply_filter): pass dbstate.
* src/PageView.py (BookMarkView.add_bookmark,
PersonNavView.jumpto, PersonNavView.fwd_clicked,
PersonNavView.back_clicked, ListView.build_widget): Pass dbstate.
* src/Navigation.py (BaseNavigation.__init__,
PersonNavigation.__init__): Take dbstate as a constructor argument;
(PersonNavigation.build_item_name): properly access dbstate.
* src/DisplayState.py (__init__): Do not take dbstate as a
constructor argument; Do not connect dbstate signal here (moved to
ViewManager);
(display_relationship,push_message,modify_statusbar): Make dbstate
an argument.
* src/plugins/Checkpoint.py (run_tool): Pass dbstate.
* src/ViewManager.py (_build_main_window): Do not pass dbstate to
uistate DisplayState constructor; connect dbstate signal handler;
pass dbstate to Navigation; (keypress): Pass dbstate;
(statusbar_key_update): Pass dbstate;
(do_load_plugins): Pass dbstate;
(ViewManager.add_bookmark): Pass dbstate.
* src/DataViews/_RelationView.py (shade_update): Pass dbstate.
* src/DataViews/_PersonView.py (build_widget,_goto,
key_goto_home_person, key_edit_selected_person): Pass dbstate.
* src/Filters/Makefile.am (pkgdata_PYTHON): Remove obsolete file.
* src/Filters/__init__.py: Remove importing obsolete module.
* src/Filters/_FilterWidget.py: Remove obsolete module.
In po:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* POTFILES.in: Remove obsolete file.
svn: r7104
2006-08-01 10:01:10 +05:30
|
|
|
def display_relationship(self,dbstate):
|
|
|
|
default_person = dbstate.db.get_default_person()
|
|
|
|
active = dbstate.get_active_person()
|
2006-05-07 04:19:51 +05:30
|
|
|
if default_person == None or active == None:
|
|
|
|
return u''
|
|
|
|
|
|
|
|
pname = NameDisplay.displayer.display(default_person)
|
|
|
|
(name,plist) = self.relationship.get_relationship(
|
|
|
|
default_person,active)
|
|
|
|
|
|
|
|
if name:
|
|
|
|
if plist == None:
|
|
|
|
return name
|
|
|
|
return _("%(relationship)s of %(person)s") % {
|
|
|
|
'relationship' : name, 'person' : pname }
|
|
|
|
else:
|
|
|
|
return u""
|
2006-01-24 03:18:34 +05:30
|
|
|
|
2006-02-10 11:06:32 +05:30
|
|
|
def clear_history(self):
|
|
|
|
self.phistory.clear()
|
|
|
|
|
2006-02-02 22:30:37 +05:30
|
|
|
def set_busy_cursor(self,value):
|
|
|
|
if value:
|
|
|
|
self.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
|
|
|
|
else:
|
|
|
|
self.window.window.set_cursor(None)
|
|
|
|
while gtk.events_pending():
|
|
|
|
gtk.main_iteration()
|
|
|
|
|
2006-01-05 02:36:28 +05:30
|
|
|
def set_open_widget(self,widget):
|
|
|
|
self.widget = widget
|
|
|
|
|
|
|
|
def set_open_recent_menu(self,menu):
|
|
|
|
self.widget.set_menu(menu)
|
2005-08-11 05:23:24 +05:30
|
|
|
|
In .:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as
a constructor argument; (SearchBar.apply_filter): pass dbstate.
* src/PageView.py (BookMarkView.add_bookmark,
PersonNavView.jumpto, PersonNavView.fwd_clicked,
PersonNavView.back_clicked, ListView.build_widget): Pass dbstate.
* src/Navigation.py (BaseNavigation.__init__,
PersonNavigation.__init__): Take dbstate as a constructor argument;
(PersonNavigation.build_item_name): properly access dbstate.
* src/DisplayState.py (__init__): Do not take dbstate as a
constructor argument; Do not connect dbstate signal here (moved to
ViewManager);
(display_relationship,push_message,modify_statusbar): Make dbstate
an argument.
* src/plugins/Checkpoint.py (run_tool): Pass dbstate.
* src/ViewManager.py (_build_main_window): Do not pass dbstate to
uistate DisplayState constructor; connect dbstate signal handler;
pass dbstate to Navigation; (keypress): Pass dbstate;
(statusbar_key_update): Pass dbstate;
(do_load_plugins): Pass dbstate;
(ViewManager.add_bookmark): Pass dbstate.
* src/DataViews/_RelationView.py (shade_update): Pass dbstate.
* src/DataViews/_PersonView.py (build_widget,_goto,
key_goto_home_person, key_edit_selected_person): Pass dbstate.
* src/Filters/Makefile.am (pkgdata_PYTHON): Remove obsolete file.
* src/Filters/__init__.py: Remove importing obsolete module.
* src/Filters/_FilterWidget.py: Remove obsolete module.
In po:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* POTFILES.in: Remove obsolete file.
svn: r7104
2006-08-01 10:01:10 +05:30
|
|
|
def push_message(self, dbstate, text):
|
2005-12-23 11:05:32 +05:30
|
|
|
self.status_text(text)
|
In .:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as
a constructor argument; (SearchBar.apply_filter): pass dbstate.
* src/PageView.py (BookMarkView.add_bookmark,
PersonNavView.jumpto, PersonNavView.fwd_clicked,
PersonNavView.back_clicked, ListView.build_widget): Pass dbstate.
* src/Navigation.py (BaseNavigation.__init__,
PersonNavigation.__init__): Take dbstate as a constructor argument;
(PersonNavigation.build_item_name): properly access dbstate.
* src/DisplayState.py (__init__): Do not take dbstate as a
constructor argument; Do not connect dbstate signal here (moved to
ViewManager);
(display_relationship,push_message,modify_statusbar): Make dbstate
an argument.
* src/plugins/Checkpoint.py (run_tool): Pass dbstate.
* src/ViewManager.py (_build_main_window): Do not pass dbstate to
uistate DisplayState constructor; connect dbstate signal handler;
pass dbstate to Navigation; (keypress): Pass dbstate;
(statusbar_key_update): Pass dbstate;
(do_load_plugins): Pass dbstate;
(ViewManager.add_bookmark): Pass dbstate.
* src/DataViews/_RelationView.py (shade_update): Pass dbstate.
* src/DataViews/_PersonView.py (build_widget,_goto,
key_goto_home_person, key_edit_selected_person): Pass dbstate.
* src/Filters/Makefile.am (pkgdata_PYTHON): Remove obsolete file.
* src/Filters/__init__.py: Remove importing obsolete module.
* src/Filters/_FilterWidget.py: Remove obsolete module.
In po:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* POTFILES.in: Remove obsolete file.
svn: r7104
2006-08-01 10:01:10 +05:30
|
|
|
gobject.timeout_add(5000,self.modify_statusbar,dbstate)
|
2005-12-23 11:05:32 +05:30
|
|
|
|
In .:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as
a constructor argument; (SearchBar.apply_filter): pass dbstate.
* src/PageView.py (BookMarkView.add_bookmark,
PersonNavView.jumpto, PersonNavView.fwd_clicked,
PersonNavView.back_clicked, ListView.build_widget): Pass dbstate.
* src/Navigation.py (BaseNavigation.__init__,
PersonNavigation.__init__): Take dbstate as a constructor argument;
(PersonNavigation.build_item_name): properly access dbstate.
* src/DisplayState.py (__init__): Do not take dbstate as a
constructor argument; Do not connect dbstate signal here (moved to
ViewManager);
(display_relationship,push_message,modify_statusbar): Make dbstate
an argument.
* src/plugins/Checkpoint.py (run_tool): Pass dbstate.
* src/ViewManager.py (_build_main_window): Do not pass dbstate to
uistate DisplayState constructor; connect dbstate signal handler;
pass dbstate to Navigation; (keypress): Pass dbstate;
(statusbar_key_update): Pass dbstate;
(do_load_plugins): Pass dbstate;
(ViewManager.add_bookmark): Pass dbstate.
* src/DataViews/_RelationView.py (shade_update): Pass dbstate.
* src/DataViews/_PersonView.py (build_widget,_goto,
key_goto_home_person, key_edit_selected_person): Pass dbstate.
* src/Filters/Makefile.am (pkgdata_PYTHON): Remove obsolete file.
* src/Filters/__init__.py: Remove importing obsolete module.
* src/Filters/_FilterWidget.py: Remove obsolete module.
In po:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* POTFILES.in: Remove obsolete file.
svn: r7104
2006-08-01 10:01:10 +05:30
|
|
|
def modify_statusbar(self,dbstate,active=None):
|
2005-08-09 10:11:20 +05:30
|
|
|
self.status.pop(self.status_id)
|
In .:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as
a constructor argument; (SearchBar.apply_filter): pass dbstate.
* src/PageView.py (BookMarkView.add_bookmark,
PersonNavView.jumpto, PersonNavView.fwd_clicked,
PersonNavView.back_clicked, ListView.build_widget): Pass dbstate.
* src/Navigation.py (BaseNavigation.__init__,
PersonNavigation.__init__): Take dbstate as a constructor argument;
(PersonNavigation.build_item_name): properly access dbstate.
* src/DisplayState.py (__init__): Do not take dbstate as a
constructor argument; Do not connect dbstate signal here (moved to
ViewManager);
(display_relationship,push_message,modify_statusbar): Make dbstate
an argument.
* src/plugins/Checkpoint.py (run_tool): Pass dbstate.
* src/ViewManager.py (_build_main_window): Do not pass dbstate to
uistate DisplayState constructor; connect dbstate signal handler;
pass dbstate to Navigation; (keypress): Pass dbstate;
(statusbar_key_update): Pass dbstate;
(do_load_plugins): Pass dbstate;
(ViewManager.add_bookmark): Pass dbstate.
* src/DataViews/_RelationView.py (shade_update): Pass dbstate.
* src/DataViews/_PersonView.py (build_widget,_goto,
key_goto_home_person, key_edit_selected_person): Pass dbstate.
* src/Filters/Makefile.am (pkgdata_PYTHON): Remove obsolete file.
* src/Filters/__init__.py: Remove importing obsolete module.
* src/Filters/_FilterWidget.py: Remove obsolete module.
In po:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* POTFILES.in: Remove obsolete file.
svn: r7104
2006-08-01 10:01:10 +05:30
|
|
|
if dbstate.active == None:
|
2005-08-09 10:11:20 +05:30
|
|
|
self.status.push(self.status_id,"")
|
|
|
|
else:
|
In .:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as
a constructor argument; (SearchBar.apply_filter): pass dbstate.
* src/PageView.py (BookMarkView.add_bookmark,
PersonNavView.jumpto, PersonNavView.fwd_clicked,
PersonNavView.back_clicked, ListView.build_widget): Pass dbstate.
* src/Navigation.py (BaseNavigation.__init__,
PersonNavigation.__init__): Take dbstate as a constructor argument;
(PersonNavigation.build_item_name): properly access dbstate.
* src/DisplayState.py (__init__): Do not take dbstate as a
constructor argument; Do not connect dbstate signal here (moved to
ViewManager);
(display_relationship,push_message,modify_statusbar): Make dbstate
an argument.
* src/plugins/Checkpoint.py (run_tool): Pass dbstate.
* src/ViewManager.py (_build_main_window): Do not pass dbstate to
uistate DisplayState constructor; connect dbstate signal handler;
pass dbstate to Navigation; (keypress): Pass dbstate;
(statusbar_key_update): Pass dbstate;
(do_load_plugins): Pass dbstate;
(ViewManager.add_bookmark): Pass dbstate.
* src/DataViews/_RelationView.py (shade_update): Pass dbstate.
* src/DataViews/_PersonView.py (build_widget,_goto,
key_goto_home_person, key_edit_selected_person): Pass dbstate.
* src/Filters/Makefile.am (pkgdata_PYTHON): Remove obsolete file.
* src/Filters/__init__.py: Remove importing obsolete module.
* src/Filters/_FilterWidget.py: Remove obsolete module.
In po:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* POTFILES.in: Remove obsolete file.
svn: r7104
2006-08-01 10:01:10 +05:30
|
|
|
person = dbstate.get_active_person()
|
2006-06-17 02:56:44 +05:30
|
|
|
if person:
|
2006-06-07 10:13:18 +05:30
|
|
|
pname = NameDisplay.displayer.display(person)
|
|
|
|
name = "[%s] %s" % (person.get_gramps_id(),pname)
|
2006-06-20 13:06:41 +05:30
|
|
|
if Config.get(Config.STATUSBAR) > 1:
|
In .:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as
a constructor argument; (SearchBar.apply_filter): pass dbstate.
* src/PageView.py (BookMarkView.add_bookmark,
PersonNavView.jumpto, PersonNavView.fwd_clicked,
PersonNavView.back_clicked, ListView.build_widget): Pass dbstate.
* src/Navigation.py (BaseNavigation.__init__,
PersonNavigation.__init__): Take dbstate as a constructor argument;
(PersonNavigation.build_item_name): properly access dbstate.
* src/DisplayState.py (__init__): Do not take dbstate as a
constructor argument; Do not connect dbstate signal here (moved to
ViewManager);
(display_relationship,push_message,modify_statusbar): Make dbstate
an argument.
* src/plugins/Checkpoint.py (run_tool): Pass dbstate.
* src/ViewManager.py (_build_main_window): Do not pass dbstate to
uistate DisplayState constructor; connect dbstate signal handler;
pass dbstate to Navigation; (keypress): Pass dbstate;
(statusbar_key_update): Pass dbstate;
(do_load_plugins): Pass dbstate;
(ViewManager.add_bookmark): Pass dbstate.
* src/DataViews/_RelationView.py (shade_update): Pass dbstate.
* src/DataViews/_PersonView.py (build_widget,_goto,
key_goto_home_person, key_edit_selected_person): Pass dbstate.
* src/Filters/Makefile.am (pkgdata_PYTHON): Remove obsolete file.
* src/Filters/__init__.py: Remove importing obsolete module.
* src/Filters/_FilterWidget.py: Remove obsolete module.
In po:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* POTFILES.in: Remove obsolete file.
svn: r7104
2006-08-01 10:01:10 +05:30
|
|
|
if person.handle != dbstate.db.get_default_handle():
|
|
|
|
msg = self.display_relationship(dbstate)
|
2006-06-20 13:06:41 +05:30
|
|
|
if msg:
|
2006-07-02 10:41:47 +05:30
|
|
|
name = "%s (%s)" % (name,msg.strip())
|
2006-06-07 10:13:18 +05:30
|
|
|
else:
|
|
|
|
name = _("No active person")
|
2005-08-09 10:11:20 +05:30
|
|
|
self.status.push(self.status_id,name)
|
|
|
|
|
|
|
|
while gtk.events_pending():
|
|
|
|
gtk.main_iteration()
|
|
|
|
|
2006-03-01 11:46:36 +05:30
|
|
|
def pulse_progressbar(self,value):
|
|
|
|
self.progress.set_fraction(min(value/100.0,1.0))
|
|
|
|
self.progress.set_text("%d%%" % value)
|
|
|
|
while gtk.events_pending():
|
|
|
|
gtk.main_iteration()
|
|
|
|
|
2005-08-09 10:11:20 +05:30
|
|
|
def status_text(self,text):
|
|
|
|
self.status.pop(self.status_id)
|
|
|
|
self.status.push(self.status_id,text)
|
|
|
|
while gtk.events_pending():
|
|
|
|
gtk.main_iteration()
|
2006-01-23 09:39:20 +05:30
|
|
|
|
2006-01-24 03:18:34 +05:30
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
|
|
|
import GrampsWidgets
|
|
|
|
|
|
|
|
rh = WarnHandler(capacity=400,button=GrampsWidgets.WarnButton())
|
|
|
|
log = logging.getLogger()
|
|
|
|
log.setLevel(logging.WARN)
|
|
|
|
log.addHandler(rh)
|