Trees | Indices | Help |
|
---|
|
1 # 2 # Gramps - a GTK+/GNOME based genealogy program 3 # 4 # Copyright (C) 2007 Richard Taylor 5 # 6 # This program is free software; you can redistribute it and/or modify 7 # it under the terms of the GNU General Public License as published by 8 # the Free Software Foundation; either version 2 of the License, or 9 # (at your option) any later version. 10 # 11 # This program is distributed in the hope that it will be useful, 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 # GNU General Public License for more details. 15 # 16 # You should have received a copy of the GNU General Public License 17 # along with this program; if not, write to the Free Software 18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 # 20 21 # $Id:iterator.py 9912 2008-01-22 09:17:46Z acraphae $ 22 23 from gen.utils import LongOpStatus 24266528 self._db = db 29 self._cursor = cursor 30 self._status = LongOpStatus(total_steps=cursor.get_length(), 31 interval=10)32 #self._status = LongOpStatus(msg=msg) 3335 try: 36 # Emit start signal 37 self._db.emit('long-op-start', (self._status,)) 38 39 first = self._cursor.first() 40 if first: 41 yield first 42 43 next = self._cursor.next() 44 while next: 45 yield next 46 47 # check for cancel 48 #if self._status.should_cancel(): 49 # raise GrampsDbUserCancel 50 51 # emit heartbeat 52 self._status.heartbeat() 53 next = self._cursor.next() 54 55 # emit stop signal 56 self._status.end() 57 self._cursor.close() 58 raise StopIteration 59 except: 60 # Not allowed to use 'finally' because we 61 # yeild inside the try clause. 62 self._cursor.close() 63 self._status.end() 64 raise
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Mar 9 21:53:14 2008 | http://epydoc.sourceforge.net |