Additional Find dialog boxes
svn: r853
This commit is contained in:
parent
6b921b3d97
commit
c63c61be7e
@ -39,6 +39,7 @@ import Utils
|
||||
import Date
|
||||
import RelLib
|
||||
|
||||
from DateEdit import DateEdit
|
||||
from intl import gettext
|
||||
_ = gettext
|
||||
|
||||
@ -101,6 +102,8 @@ class AddressEditor:
|
||||
else:
|
||||
self.srcreflist = []
|
||||
|
||||
self.date_check = DateEdit(self.addr_start,self.top.get_widget("date_stat"))
|
||||
|
||||
self.top.signal_autoconnect({
|
||||
"destroy_passed_object" : Utils.destroy_passed_object,
|
||||
"on_addr_edit_ok_clicked" : self.ok_clicked,
|
||||
|
@ -423,7 +423,7 @@
|
||||
<class>GtkTable</class>
|
||||
<name>table17</name>
|
||||
<rows>2</rows>
|
||||
<columns>4</columns>
|
||||
<columns>5</columns>
|
||||
<homogeneous>False</homogeneous>
|
||||
<row_spacing>0</row_spacing>
|
||||
<column_spacing>0</column_spacing>
|
||||
@ -556,6 +556,36 @@
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button126</name>
|
||||
<border_width>1</border_width>
|
||||
<tooltip>Invoke death event editor</tooltip>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>on_edit_death_clicked</handler>
|
||||
<object>editPerson</object>
|
||||
<last_modification_time>Tue, 02 Oct 2001 22:28:47 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Edit</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<child>
|
||||
<left_attach>4</left_attach>
|
||||
<right_attach>5</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>3</xpad>
|
||||
<ypad>3</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkCombo</class>
|
||||
<name>dpcombo</name>
|
||||
@ -568,7 +598,7 @@
|
||||
<items></items>
|
||||
<child>
|
||||
<left_attach>2</left_attach>
|
||||
<right_attach>4</right_attach>
|
||||
<right_attach>5</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>3</xpad>
|
||||
@ -594,32 +624,21 @@
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button126</name>
|
||||
<border_width>1</border_width>
|
||||
<tooltip>Invoke death event editor</tooltip>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>on_edit_death_clicked</handler>
|
||||
<object>editPerson</object>
|
||||
<last_modification_time>Tue, 02 Oct 2001 22:28:47 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Edit</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<class>GnomePixmap</class>
|
||||
<name>death_stat</name>
|
||||
<child>
|
||||
<left_attach>3</left_attach>
|
||||
<right_attach>4</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>3</xpad>
|
||||
<ypad>3</ypad>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
<yfill>True</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -6571,6 +6590,16 @@
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomePixmap</class>
|
||||
<name>date_stat</name>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>calendar</name>
|
||||
|
@ -607,6 +607,7 @@ class EditPerson:
|
||||
self.ddate.set_text(self.death.getDate())
|
||||
self.dplace.set_text(self.death.getPlaceName())
|
||||
self.bplace.set_text(prev_btext)
|
||||
self.ddate_check = DateEdit(self.ddate,self.get_widget("death_stat"))
|
||||
|
||||
def on_add_addr_clicked(self,obj):
|
||||
"""Invokes the address editor to add a new address"""
|
||||
|
@ -39,6 +39,7 @@ import Utils
|
||||
import GrampsCfg
|
||||
import AutoComp
|
||||
|
||||
from DateEdit import DateEdit
|
||||
from Date import compare_dates
|
||||
from RelLib import *
|
||||
from intl import gettext
|
||||
@ -121,6 +122,7 @@ class EventEditor:
|
||||
else:
|
||||
if (def_placename):
|
||||
self.place_field.set_text(def_placename)
|
||||
self.date_check = DateEdit(self.date_field,self.top.get_widget("date_stat"))
|
||||
|
||||
if not read_only:
|
||||
self.name_field.select_region(0, -1)
|
||||
|
@ -31,10 +31,10 @@ import AutoComp
|
||||
from intl import gettext
|
||||
_ = gettext
|
||||
|
||||
class Find:
|
||||
class FindBase:
|
||||
"""Opens find person dialog for gramps"""
|
||||
|
||||
def __init__(self,clist,task,plist):
|
||||
def __init__(self,clist,task,name):
|
||||
"""Opens a dialog box instance that allows users to
|
||||
search for a person.
|
||||
|
||||
@ -42,13 +42,14 @@ class Find:
|
||||
task - function to call to change the active person"""
|
||||
|
||||
self.clist = clist
|
||||
self.nlist = []
|
||||
self.task = task
|
||||
title = "%s - GRAMPS" % _("Find Person")
|
||||
title = "%s - GRAMPS" % name
|
||||
self.top = GnomeDialog(title,STOCK_BUTTON_PREV,
|
||||
STOCK_BUTTON_NEXT,STOCK_BUTTON_CLOSE)
|
||||
self.top.set_policy(0,1,0)
|
||||
self.top.vbox.set_spacing(5)
|
||||
self.top.vbox.pack_start(gtk.GtkLabel(_("Find Person")),0,0,5)
|
||||
self.top.vbox.pack_start(gtk.GtkLabel(name),0,0,5)
|
||||
self.top.vbox.pack_start(gtk.GtkHSeparator(),0,0,0)
|
||||
self.entry = gtk.GtkEntry()
|
||||
self.top.vbox.pack_start(self.entry,0,0,25)
|
||||
@ -61,13 +62,51 @@ class Find:
|
||||
self.top.editable_enters(self.entry)
|
||||
self.entry.grab_focus()
|
||||
|
||||
self.nlist = []
|
||||
for n in plist:
|
||||
self.nlist.append(n.getPrimaryName().getName())
|
||||
|
||||
def enable_autocomp(self):
|
||||
if GrampsCfg.autocomp:
|
||||
self.comp = AutoComp.AutoEntry(self.entry,self.nlist)
|
||||
|
||||
def advance(self,func):
|
||||
pass
|
||||
|
||||
def forward(self):
|
||||
self.row = self.row + 1
|
||||
if self.row == self.clist.rows:
|
||||
self.row = 0
|
||||
|
||||
def backward(self):
|
||||
self.row = self.row - 1
|
||||
if self.row < 0:
|
||||
self.row = self.clist.rows
|
||||
|
||||
def on_close_clicked(self,obj):
|
||||
self.top.destroy()
|
||||
|
||||
def on_next_clicked(self,obj):
|
||||
"""Advances to the next person that matches the dialog text"""
|
||||
self.advance(self.forward)
|
||||
|
||||
def on_prev_clicked(self,obj):
|
||||
"""Advances to the previous person that matches the dialog text"""
|
||||
self.advance(self.backward)
|
||||
|
||||
|
||||
|
||||
class FindPerson(FindBase):
|
||||
"""Opens a Find Person dialog for GRAMPS"""
|
||||
|
||||
def __init__(self,clist,task,plist):
|
||||
"""Opens a dialog box instance that allows users to
|
||||
search for a person.
|
||||
|
||||
clist - GtkCList containing the people information
|
||||
task - function to call to change the active person"""
|
||||
|
||||
FindBase.__init__(self,clist,task,_("Find Person"))
|
||||
for n in plist:
|
||||
self.nlist.append(n.getPrimaryName().getName())
|
||||
self.enable_autocomp()
|
||||
|
||||
def advance(self,func):
|
||||
try:
|
||||
self.row = self.clist.selection[0]
|
||||
@ -96,25 +135,135 @@ class Find:
|
||||
func()
|
||||
gtk.gdk_beep()
|
||||
|
||||
def forward(self):
|
||||
self.row = self.row + 1
|
||||
if self.row == self.clist.rows:
|
||||
self.row = 0
|
||||
class FindPlace(FindBase):
|
||||
"""Opens a Find Place dialog for GRAMPS"""
|
||||
|
||||
def __init__(self,clist,task,plist):
|
||||
"""Opens a dialog box instance that allows users to
|
||||
search for a place.
|
||||
|
||||
clist - GtkCList containing the people information
|
||||
task - function to call to change the active person"""
|
||||
|
||||
FindBase.__init__(self,clist,task,_("Find Place"))
|
||||
for n in plist:
|
||||
self.nlist.append(n.get_title())
|
||||
self.enable_autocomp()
|
||||
|
||||
def advance(self,func):
|
||||
try:
|
||||
self.row = self.clist.selection[0]
|
||||
except IndexError:
|
||||
gtk.gdk_beep()
|
||||
return
|
||||
|
||||
text = self.entry.get_text()
|
||||
if self.row == None or text == "":
|
||||
gtk.gdk_beep()
|
||||
return
|
||||
orow = self.row
|
||||
func()
|
||||
place = None
|
||||
while self.row != orow:
|
||||
value = self.clist.get_row_data(self.row)
|
||||
if value == None:
|
||||
func()
|
||||
continue
|
||||
name = value.get_title()
|
||||
if string.find(string.upper(name),string.upper(text)) >= 0:
|
||||
self.task(self.row)
|
||||
return
|
||||
func()
|
||||
gtk.gdk_beep()
|
||||
|
||||
class FindSource(FindBase):
|
||||
"""Opens a Find Place dialog for GRAMPS"""
|
||||
|
||||
def __init__(self,clist,task,plist):
|
||||
"""Opens a dialog box instance that allows users to
|
||||
search for a place.
|
||||
|
||||
clist - GtkCList containing the people information
|
||||
task - function to call to change the active person"""
|
||||
|
||||
FindBase.__init__(self,clist,task,_("Find Source"))
|
||||
for n in plist:
|
||||
self.nlist.append(n.getTitle())
|
||||
self.enable_autocomp()
|
||||
|
||||
def advance(self,func):
|
||||
try:
|
||||
self.row = self.clist.selection[0]
|
||||
except IndexError:
|
||||
gtk.gdk_beep()
|
||||
return
|
||||
|
||||
text = self.entry.get_text()
|
||||
if self.row == None or text == "":
|
||||
gtk.gdk_beep()
|
||||
return
|
||||
orow = self.row
|
||||
func()
|
||||
place = None
|
||||
while self.row != orow:
|
||||
value = self.clist.get_row_data(self.row)
|
||||
if value == None:
|
||||
func()
|
||||
continue
|
||||
name = value.getTitle()
|
||||
if string.find(string.upper(name),string.upper(text)) >= 0:
|
||||
self.task(self.row)
|
||||
return
|
||||
func()
|
||||
gtk.gdk_beep()
|
||||
|
||||
class FindMedia(FindBase):
|
||||
"""Opens a Find Media Object dialog for GRAMPS"""
|
||||
|
||||
def __init__(self,clist,task,plist):
|
||||
"""Opens a dialog box instance that allows users to
|
||||
search for a place.
|
||||
|
||||
clist - GtkCList containing the people information
|
||||
task - function to call to change the active person"""
|
||||
|
||||
FindBase.__init__(self,clist,task,_("Find Media Object"))
|
||||
for n in plist:
|
||||
self.nlist.append(n.getDescription())
|
||||
self.enable_autocomp()
|
||||
|
||||
def advance(self,func):
|
||||
try:
|
||||
self.row = self.clist.selection[0]
|
||||
except IndexError:
|
||||
gtk.gdk_beep()
|
||||
return
|
||||
|
||||
text = self.entry.get_text()
|
||||
if self.row == None or text == "":
|
||||
gtk.gdk_beep()
|
||||
return
|
||||
orow = self.row
|
||||
func()
|
||||
place = None
|
||||
while self.row != orow:
|
||||
value = self.clist.get_row_data(self.row)
|
||||
if value == None:
|
||||
func()
|
||||
continue
|
||||
name = value.getDescription()
|
||||
if string.find(string.upper(name),string.upper(text)) >= 0:
|
||||
self.task(self.row)
|
||||
return
|
||||
func()
|
||||
gtk.gdk_beep()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def backward(self):
|
||||
self.row = self.row - 1
|
||||
if self.row < 0:
|
||||
self.row = self.clist.rows
|
||||
|
||||
def on_close_clicked(self,obj):
|
||||
self.top.destroy()
|
||||
|
||||
def on_next_clicked(self,obj):
|
||||
"""Advances to the next person that matches the dialog text"""
|
||||
self.advance(self.forward)
|
||||
|
||||
def on_prev_clicked(self,obj):
|
||||
"""Advances to the previous person that matches the dialog text"""
|
||||
self.advance(self.backward)
|
||||
|
||||
|
||||
|
@ -83,6 +83,11 @@ class MediaView:
|
||||
self.media_list.set_sort_column(self.sort_map[self.sort_col])
|
||||
self.set_arrow(self.sort_col)
|
||||
|
||||
def moveto(self,row):
|
||||
self.media_list.unselect_all()
|
||||
self.media_list.select_row(row,0)
|
||||
self.media_list.moveto(row)
|
||||
|
||||
def set_arrow(self,column):
|
||||
for a in self.sort_arrow:
|
||||
a.hide()
|
||||
|
@ -224,6 +224,11 @@ class PlaceView:
|
||||
def on_add_place_clicked(self,obj):
|
||||
EditPlace.EditPlace(Place(),self.db,self.new_place_after_edit)
|
||||
|
||||
def moveto(self,row):
|
||||
self.place_list.unselect_all()
|
||||
self.place_list.select_row(row,0)
|
||||
self.place_list.moveto(row)
|
||||
|
||||
def on_delete_place_clicked(self,obj):
|
||||
if len(obj.selection) == 0:
|
||||
return
|
||||
|
@ -77,6 +77,11 @@ class SourceView:
|
||||
self.source_list.set_sort_column(self.sort_map[self.sort_col])
|
||||
self.set_arrow(self.sort_col)
|
||||
|
||||
def moveto(self,row):
|
||||
self.source_list.unselect_all()
|
||||
self.source_list.select_row(row,0)
|
||||
self.source_list.moveto(row)
|
||||
|
||||
def set_arrow(self,column):
|
||||
|
||||
for a in self.sort_arrow:
|
||||
|
@ -483,6 +483,17 @@
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomePixmap</class>
|
||||
<name>date_stat</name>
|
||||
<width>10</width>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>calendar</name>
|
||||
|
@ -3,10 +3,13 @@
|
||||
import traceback
|
||||
import intl
|
||||
import os
|
||||
import GdkImlib
|
||||
import gtk
|
||||
import gnome.ui
|
||||
import gnome.config
|
||||
import locale
|
||||
import gramps_main
|
||||
import sys
|
||||
|
||||
if os.environ.has_key("GRAMPSI18N"):
|
||||
loc = os.environ["GRAMPSI18N"]
|
||||
@ -18,10 +21,6 @@ intl.bindtextdomain("gramps",loc)
|
||||
|
||||
locale.setlocale(locale.LC_NUMERIC,"C")
|
||||
|
||||
import gramps_main
|
||||
import sys
|
||||
import locale
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
arg = sys.argv[1]
|
||||
else:
|
||||
|
@ -318,8 +318,18 @@ class Gramps:
|
||||
|
||||
def on_find_activate(self,obj):
|
||||
"""Display the find box"""
|
||||
Find.Find(self.person_list,self.find_goto_to,
|
||||
self.database.getPersonMap().values())
|
||||
if self.notebook.get_current_page() == 4:
|
||||
Find.FindPlace(self.place_view.place_list,self.find_goto_place,
|
||||
self.database.getPlaceMap().values())
|
||||
elif self.notebook.get_current_page() == 3:
|
||||
Find.FindSource(self.source_view.source_list,self.find_goto_source,
|
||||
self.database.getSourceMap().values())
|
||||
elif self.notebook.get_current_page() == 5:
|
||||
Find.FindMedia(self.media_view.media_list,self.find_goto_media,
|
||||
self.database.getObjectMap().values())
|
||||
else:
|
||||
Find.FindPerson(self.person_list,self.find_goto_to,
|
||||
self.database.getPersonMap().values())
|
||||
|
||||
def on_findname_activate(self,obj):
|
||||
"""Display the find box"""
|
||||
@ -331,6 +341,18 @@ class Gramps:
|
||||
self.goto_active_person()
|
||||
self.update_display(0)
|
||||
|
||||
def find_goto_place(self,row):
|
||||
"""Find callback to jump to the selected place"""
|
||||
self.place_view.moveto(row)
|
||||
|
||||
def find_goto_source(self,row):
|
||||
"""Find callback to jump to the selected source"""
|
||||
self.source_view.moveto(row)
|
||||
|
||||
def find_goto_media(self,row):
|
||||
"""Find callback to jump to the selected media"""
|
||||
self.media_view.moveto(row)
|
||||
|
||||
def on_gramps_home_page_activate(self,obj):
|
||||
import gnome.url
|
||||
gnome.url.show("http://gramps.sourceforge.net")
|
||||
|
Loading…
Reference in New Issue
Block a user