Improved the find dialog

svn: r611
This commit is contained in:
Don Allingham 2001-12-12 01:43:53 +00:00
parent 4bdef5a7b6
commit 13bb5dd1e0
6 changed files with 200 additions and 28 deletions

View File

@ -105,6 +105,7 @@ nameof = utils.normal_name
display_attr = 0
attr_name = ""
status_bar = 0
toolbar = 2
calendar = 0
paper_preference = None
output_preference = None
@ -184,6 +185,7 @@ def loadConfig(call):
global web_dir
global db_dir
global status_bar
global toolbar
global mediaref
global globalprop
global localprop
@ -203,6 +205,11 @@ def loadConfig(call):
index_visible = get_bool("/gramps/config/IndexVisible")
show_detail = get_bool("/gramps/config/ShowDetail")
status_bar = get_int("/gramps/config/StatusBar")
t = get_int("/gramps/config/ToolBar")
if t == 0:
toolbar = 2
else:
toolbar = t-1
display_attr = get_bool("/gramps/config/DisplayAttr")
attr_name = get_string("/gramps/config/DisplayAttrName")
@ -311,6 +318,8 @@ def loadConfig(call):
show_detail = 0
if status_bar == None:
status_bar = 0
if toolbar == None:
toolbar = 2
if hide_altnames == None:
hide_altnames = 0
if dateFormat == None:
@ -422,6 +431,7 @@ def on_propertybox_apply(obj,page):
global id_edit
global index_visible
global status_bar
global toolbar
global display_attr
global attr_name
global hide_altnames
@ -461,6 +471,13 @@ def on_propertybox_apply(obj,page):
else:
status_bar = 2
if prefsTop.get_widget("tool1").get_active():
toolbar = 0
elif prefsTop.get_widget("tool2").get_active():
toolbar = 1
else:
toolbar = 2
iprefix = prefsTop.get_widget("iprefix").get_text()
if iprefix == "":
iprefix = "I"
@ -505,6 +522,7 @@ def on_propertybox_apply(obj,page):
set_bool("/gramps/config/IndexVisible",index_visible)
set_bool("/gramps/config/ShowDetail",show_detail)
set_int("/gramps/config/StatusBar",status_bar)
set_int("/gramps/config/ToolBar",toolbar+1)
set_bool("/gramps/config/DisplayAttr",display_attr)
set_string("/gramps/config/DisplayAttrName",attr_name)
set_string("/gramps/config/paperPreference",paper_preference)
@ -700,6 +718,13 @@ def display_preferences_box(db):
else:
prefsTop.get_widget("stat3").set_active(1)
if toolbar == 0:
prefsTop.get_widget("tool1").set_active(1)
elif toolbar == 1:
prefsTop.get_widget("tool2").set_active(1)
else:
prefsTop.get_widget("tool3").set_active(1)
display_attr_obj.set_active(display_attr)
prefsTop.get_widget("attr_name").set_text(attr_name)

View File

@ -32,7 +32,7 @@ import gtk
class Find:
"""Opens find person dialog for gramps"""
def __init__(self,clist,task):
def __init__(self,clist,task,plist):
"""Opens a dialog box instance that allows users to
search for a person.
@ -45,10 +45,19 @@ class Find:
self.xml.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
"on_next_clicked" : self.on_next_clicked,
"on_combo_insert_text" : utils.combo_insert_text,
"on_prev_clicked" : self.on_prev_clicked,
})
self.top = self.xml.get_widget("find")
self.entry = self.xml.get_widget("entry1")
self.combo = self.xml.get_widget("combo")
self.combo.disable_activate()
self.next = self.xml.get_widget("next")
nlist = [""]
for n in plist:
nlist.append(n.getPrimaryName().getName())
nlist.sort()
self.combo.set_popdown_strings(nlist)
self.top.editable_enters(self.entry)
def find_next(self):
@ -65,10 +74,12 @@ class Find:
gtk.gdk_beep()
return
orow = row
row = row + 1
last = self.clist.rows
person = None
while row < last:
while row != orow:
person,alt = self.clist.get_row_data(row)
if alt == 0:
name = person.getPrimaryName().getName()
@ -76,6 +87,9 @@ class Find:
self.task(person)
return
row = row + 1
if row == last:
row = 0
gtk.gdk_beep()
def find_prev(self):
@ -92,9 +106,11 @@ class Find:
gtk.gdk_beep()
return
orow = row
row = row - 1
last = self.clist.rows
person = None
while row >= 0:
while row != orow:
person,alt = self.clist.get_row_data(row)
if alt == 0:
name = person.getPrimaryName().getName()
@ -102,6 +118,8 @@ class Find:
self.task(person)
return
row = row - 1
if row < 0:
row = last
gtk.gdk_beep()

View File

@ -429,7 +429,7 @@
<widget>
<class>GtkTable</class>
<name>table21</name>
<rows>2</rows>
<rows>3</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
@ -444,8 +444,8 @@
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
@ -646,7 +646,7 @@
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>2</bottom_attach>
<bottom_attach>3</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
@ -971,6 +971,99 @@
</widget>
</widget>
</widget>
<widget>
<class>GtkFrame</class>
<name>frame17</name>
<border_width>5</border_width>
<label>Toolbar</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
<widget>
<class>GtkVBox</class>
<name>vbox35</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkRadioButton</class>
<name>tool1</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>on_object_toggled</handler>
<object>propertybox</object>
<last_modification_time>Wed, 30 May 2001 02:18:01 GMT</last_modification_time>
</signal>
<label>Display only icons</label>
<active>True</active>
<draw_indicator>True</draw_indicator>
<group>toolbar</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>tool2</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>on_object_toggled</handler>
<object>propertybox</object>
<last_modification_time>Wed, 30 May 2001 02:18:16 GMT</last_modification_time>
</signal>
<label>Display only text</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>toolbar</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>tool3</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>on_object_toggled</handler>
<object>propertybox</object>
<last_modification_time>Wed, 30 May 2001 02:18:29 GMT</last_modification_time>
</signal>
<label>Display both icons and text</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>toolbar</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
</widget>
<widget>

View File

@ -17,7 +17,7 @@
<widget>
<class>GnomeDialog</class>
<name>find</name>
<title>Gramps - Find person</title>
<title>Gramps - Find Person</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
@ -116,7 +116,7 @@
<widget>
<class>GtkLabel</class>
<name>label238</name>
<label>Find Person by Name</label>
<label>Find Person</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@ -156,20 +156,37 @@
</widget>
<widget>
<class>GtkEntry</class>
<name>entry1</name>
<width>250</width>
<can_focus>True</can_focus>
<has_focus>True</has_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<class>GtkCombo</class>
<name>combo</name>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items></items>
<child>
<padding>10</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>entry1</name>
<can_focus>True</can_focus>
<has_focus>True</has_focus>
<signal>
<name>insert_text</name>
<handler>on_combo_insert_text</handler>
<object>combo</object>
<last_modification_time>Wed, 12 Dec 2001 01:27:32 GMT</last_modification_time>
</signal>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
<widget>

View File

@ -199,12 +199,19 @@
<widget>
<class>GtkPixmapMenuItem</class>
<name>find</name>
<accelerator>
<modifiers>GDK_CONTROL_MASK</modifiers>
<key>GDK_f</key>
<signal>activate</signal>
</accelerator>
<signal>
<name>activate</name>
<handler>on_find_activate</handler>
<last_modification_time>Wed, 05 Sep 2001 02:48:31 GMT</last_modification_time>
</signal>
<stock_item>GNOMEUIINFO_MENU_FIND_ITEM</stock_item>
<label>_Find...</label>
<right_justify>False</right_justify>
<stock_icon>GNOME_STOCK_MENU_SEARCH</stock_icon>
</widget>
<widget>
@ -591,6 +598,7 @@
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
<name>button111</name>
<tooltip>Display the list of places</tooltip>
<signal>
<name>clicked</name>
<handler>on_places_activate</handler>
@ -604,6 +612,7 @@
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
<name>button145</name>
<tooltip>Display the list of media objects</tooltip>
<signal>
<name>clicked</name>
<handler>on_media_activate</handler>

View File

@ -96,6 +96,7 @@ pedigree_view = None
place_view = None
media_view = None
source_view = None
toolbar = None
bookmarks = None
topWindow = None
@ -141,7 +142,11 @@ FILTERNAME = "filter_list"
#-------------------------------------------------------------------------
def on_find_activate(obj):
"""Display the find box"""
Find.Find(person_list,find_goto_to)
Find.Find(person_list,find_goto_to,database.getPersonMap().values())
def on_findname_activate(obj):
"""Display the find box"""
pass
def find_goto_to(person):
"""Find callback to jump to the selected person"""
@ -436,6 +441,7 @@ def full_update():
place_view.load_places()
pedigree_view.load_canvas(active_person)
media_view.load_media()
toolbar.set_style(Config.toolbar)
def update_display(changed):
"""Incremental display update, update only the displayed page"""
@ -1876,7 +1882,7 @@ def main(arg):
global person_list
global topWindow, preview, merge_button
global nameArrow, dateArrow, deathArrow, idArrow, genderArrow
global cNameArrow, cDateArrow
global cNameArrow, cDateArrow, toolbar
global sort_column, sort_direct
gtk.rc_parse(const.gtkrcFile)
@ -1889,13 +1895,12 @@ def main(arg):
(sort_column,sort_direct) = Config.get_sort_cols("person",sort_column,sort_direct)
gtop = libglade.GladeXML(const.gladeFile, "gramps")
Config.loadConfig(full_update)
gtop = libglade.GladeXML(const.gladeFile, "gramps")
toolbar = gtop.get_widget("toolbar1")
toolbar.set_style(Config.toolbar)
Plugins.build_report_menu(gtop.get_widget("reports_menu"),menu_report)
Plugins.build_tools_menu(gtop.get_widget("tools_menu"),menu_tools)
Plugins.build_export_menu(gtop.get_widget("export1"),export_callback)
Plugins.build_import_menu(gtop.get_widget("import1"),import_callback)
statusbar = gtop.get_widget("statusbar")
topWindow = gtop.get_widget("gramps")
person_list = gtop.get_widget("person_list")
@ -1908,6 +1913,11 @@ def main(arg):
deathArrow = gtop.get_widget("deathSort")
merge_button= gtop.get_widget("merge")
Plugins.build_report_menu(gtop.get_widget("reports_menu"),menu_report)
Plugins.build_tools_menu(gtop.get_widget("tools_menu"),menu_tools)
Plugins.build_export_menu(gtop.get_widget("export1"),export_callback)
Plugins.build_import_menu(gtop.get_widget("import1"),import_callback)
canvas = gtop.get_widget("canvas1")
pedigree_view = PedigreeView(canvas,modify_statusbar,\
statusbar,change_active_person,\
@ -1932,7 +1942,6 @@ def main(arg):
person_list.column_titles_active()
set_sort_arrow(sort_column,sort_direct)
Config.loadConfig(full_update)
gtop.signal_autoconnect({
"delete_event" : delete_event,
@ -1975,6 +1984,7 @@ def main(arg):
"on_family1_activate" : on_family1_activate,
"on_father_next_clicked" : on_father_next_clicked,
"on_find_activate" : on_find_activate,
"on_findname_activate" : on_findname_activate,
"on_fv_prev_clicked" : on_fv_prev_clicked,
"on_home_clicked" : on_home_clicked,
"on_mother_next_clicked" : on_mother_next_clicked,