* src/EditPerson.py: move strip_id from Utils

* src/GrampsCfg.py: use ComboBox for toolbar selection
* src/Sources.py: switch to ComboBoxes from OptionMenus
* src/Utils.py: removed unused functions
* src/gramps.glade: switch to ComboBoxes


svn: r3856
This commit is contained in:
Don Allingham 2005-01-02 05:16:25 +00:00
parent f39ce71b38
commit f4f8bc672d
6 changed files with 91 additions and 259 deletions

View File

@ -1,3 +1,10 @@
2005-01-01 Don Allingham <dallingham@users.sourceforge.net>
* src/EditPerson.py: move strip_id from Utils
* src/GrampsCfg.py: use ComboBox for toolbar selection
* src/Sources.py: switch to ComboBoxes from OptionMenus
* src/Utils.py: removed unused functions
* src/gramps.glade: switch to ComboBoxes
2005-01-01 Alex Roitman <shura@alex.neuro.umn.edu>
* src/plugins/DetAncestralReport.py: Minor cleanup.
* src/plugins/DetDescendantReport.py: Convert to new scheme.

View File

@ -1001,8 +1001,8 @@ class EditPerson:
bplace_text = unicode(self.bplace.get_text())
dplace_text = unicode(self.dplace.get_text())
prev_btext = Utils.strip_id(bplace_text)
prev_dtext = Utils.strip_id(dplace_text)
prev_btext = self.strip_id(bplace_text)
prev_dtext = self.strip_id(dplace_text)
# Update birth with new values, make sure death values don't change
if self.update_birth:
@ -1016,6 +1016,13 @@ class EditPerson:
self.update_death_info()
self.bplace.set_text(prev_btext)
def strip_id(self,text):
index = text.rfind('[')
if (index > 0):
text = text[:index]
text = text.rstrip()
return text
def on_add_addr_clicked(self,obj):
"""Invokes the address editor to add a new address"""
import AddrEdit

View File

@ -234,9 +234,10 @@ class GrampsPreferences:
lambda obj: GrampsGconfKeys.save_statusbar(2-obj.get_active()))
toolbarmenu = self.top.get_widget("tooloptmenu")
toolbarmenu.set_history(GrampsGconfKeys.get_toolbar())
toolbarmenu.set_active(GrampsGconfKeys.get_toolbar()-1)
print GrampsGconfKeys.get_toolbar()
toolbarmenu.connect('changed',
lambda obj: GrampsGconfKeys.save_toolbar(obj.get_history()))
lambda obj: GrampsGconfKeys.save_toolbar(obj.get_active()+1))
pvbutton = self.top.get_widget('pvbutton')
fvbutton = self.top.get_widget('fvbutton')

View File

@ -321,7 +321,6 @@ class SourceEditor:
_('Source Information'))
self.showSource.signal_autoconnect({
"on_source_changed" : self.on_source_changed,
"on_add_src_clicked" : self.add_src_clicked,
"on_help_srcDisplay_clicked" : self.on_help_clicked,
"on_ok_srcDisplay_clicked" : self.on_sourceok_clicked,
@ -329,17 +328,17 @@ class SourceEditor:
"on_sourceDisplay_delete_event" : self.on_delete_event,
})
self.source_field = self.get_widget("sourceList")
# setup menu
self.title_menu = self.get_widget("source_title")
self.title_menu.set_data("o",self)
cell = gtk.CellRendererText()
self.title_menu.pack_start(cell,True)
self.title_menu.add_attribute(cell,'text',0)
self.title_menu.connect('changed',self.on_source_changed)
self.conf_menu = self.get_widget("conf")
self.private = self.get_widget("priv")
self.ok = self.get_widget("ok")
Utils.build_confidence_menu(self.conf_menu)
self.conf_menu.set_history(srcref.get_confidence_level())
self.list = []
self.title_menu.list.select_item(0)
self.title_menu.list.remove_items(self.title_menu.list.get_selection())
self.conf_menu.set_active(srcref.get_confidence_level())
self.author_field = self.get_widget("sauthor")
self.pub_field = self.get_widget("spubinfo")
@ -347,7 +346,8 @@ class SourceEditor:
self.date_entry_field = self.get_widget("sdate")
if self.source_ref:
self.active_source = self.db.get_source_from_handle(self.source_ref.get_base_handle())
handle = self.source_ref.get_base_handle()
self.active_source = self.db.get_source_from_handle(handle)
self.date_obj = self.source_ref.get_date()
self.date_entry_field.set_text(DateHandler.displayer.display(self.date_obj))
self.private.set_active(self.source_ref.get_privacy())
@ -425,7 +425,6 @@ class SourceEditor:
return self.showSource.get_widget(name)
def draw(self,sel = None):
self.title_menu.list.remove_items(self.list)
if self.source_ref:
spage = self.get_widget("spage")
spage.get_buffer().set_text(self.source_ref.get_page())
@ -447,27 +446,28 @@ class SourceEditor:
keys = self.db.get_source_handles()
keys.sort(self.db._sortbysource)
store = gtk.ListStore(gobject.TYPE_STRING)
sel_child = None
self.list = []
self.active_source = sel
index = 0
sel_index = 0
self.handle_list = []
for src_id in keys:
src = self.db.get_source_from_handle(src_id)
l = gtk.Label("%s [%s]" % (src.get_title(),src.get_gramps_id()))
l.show()
l.set_alignment(0,0.5)
c = gtk.ListItem()
c.add(l)
c.set_data("s",src)
c.show()
self.list.append(c)
if self.active_source == src:
sel_child = c
title = src.get_title()
gid = src.get_gramps_id()
handle = src.get_handle()
store.append(row=["%s [%s]" % (title,gid)])
self.handle_list.append(handle)
if sel and sel.get_handle() == src_id:
sel_index = index
index += 1
self.title_menu.set_model(store)
if len(self.list) > 0:
self.title_menu.list.append_items(self.list)
if index > 0:
self.title_menu.set_sensitive(1)
if sel_child:
self.title_menu.list.select_child(sel_child)
self.title_menu.set_active(sel_index)
else:
self.title_menu.set_sensitive(0)
@ -476,7 +476,7 @@ class SourceEditor:
if self.active_source != self.db.get_source_from_handle(self.source_ref.get_base_handle()):
self.source_ref.set_base_handle(self.active_source.get_handle())
conf = self.get_widget("conf").get_menu().get_active().get_data('a')
conf = self.get_widget("conf").get_active()
buf = self.get_widget("scomment").get_buffer()
comments = unicode(buf.get_text(buf.get_start_iter(),
@ -503,14 +503,11 @@ class SourceEditor:
self.close(obj)
def on_source_changed(self,obj):
sel = obj.list.get_selection()
if sel:
self.active_source = sel[0].get_data("s")
if self.active_source:
self.author_field.set_text(self.active_source.get_author())
self.pub_field.set_text(self.active_source.get_publication_info())
self.set_button()
handle = self.handle_list[obj.get_active()]
self.active_source = self.db.get_source_from_handle(handle)
self.author_field.set_text(self.active_source.get_author())
self.pub_field.set_text(self.active_source.get_publication_info())
self.set_button()
def update_display(self,source):
self.db.add_source(source)

View File

@ -161,22 +161,6 @@ def get_detail_text(obj,priv=1):
details = "%s, %s" % (details,_("Private"))
return details
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def build_confidence_menu(menu):
myMenu = gtk.Menu()
index = 0
for name in const.confidence:
item = gtk.MenuItem(name)
item.set_data("a",index)
item.show()
myMenu.append(item)
index = index + 1
menu.set_menu(myMenu)
#-------------------------------------------------------------------------
#
#
@ -239,18 +223,6 @@ def view_photo(photo):
if os.fork() == 0:
os.execvp(args[0],args)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def strip_id(text):
index = text.rfind('[')
if (index > 0):
text = text[:index]
text = text.rstrip()
return text
def nautilus_icon(icon,mime_type):
import GrampsGconfKeys

View File

@ -5524,9 +5524,6 @@ Other</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">source_title</property>
<accessibility>
<atkrelation target="source_title" type="label-for"/>
</accessibility>
</widget>
<packing>
<property name="left_attach">0</property>
@ -18075,62 +18072,13 @@ Other</property>
</child>
<child>
<widget class="GtkOptionMenu" id="tooloptmenu">
<widget class="GtkComboBox" id="tooloptmenu">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">0</property>
<signal name="changed" handler="on_object_toggled" object="propertybox" last_modification_time="Thu, 16 Oct 2003 16:14:49 GMT"/>
<child>
<widget class="GtkMenu" id="menu3">
<child>
<widget class="GtkMenuItem" id="menuitem9">
<property name="visible">True</property>
<property name="label" translatable="yes">Icons Only</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="menuitem10">
<property name="visible">True</property>
<property name="label" translatable="yes">Text Only</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="menuitem7">
<property name="visible">True</property>
<property name="label" translatable="yes">Text Below Icons</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="menuitem8">
<property name="visible">True</property>
<property name="label" translatable="yes">Text Beside Icons</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="menuitem11">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="menuitem12">
<property name="visible">True</property>
<property name="label" translatable="yes">GNOME Settings</property>
<property name="use_underline">True</property>
</widget>
</child>
</widget>
</child>
<property name="items" translatable="yes">Icons Only
Text Only
Text Below Icons
Text Beside Icons
GNOME Settings</property>
</widget>
<packing>
<property name="left_attach">1</property>
@ -18138,7 +18086,7 @@ Other</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
<property name="y_options">fill</property>
</packing>
</child>
</widget>
@ -19462,9 +19410,6 @@ Other</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">conf</property>
<accessibility>
<atkrelation target="conf" type="label-for"/>
</accessibility>
</widget>
<packing>
<property name="left_attach">1</property>
@ -19644,10 +19589,6 @@ Other</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">source</property>
<accessibility>
<atkrelation target="source_title" type="label-for"/>
</accessibility>
</widget>
<packing>
<property name="left_attach">1</property>
@ -19659,70 +19600,6 @@ Other</property>
</packing>
</child>
<child>
<widget class="GtkCombo" id="source_title">
<property name="visible">True</property>
<property name="value_in_list">True</property>
<property name="allow_empty">False</property>
<property name="case_sensitive">False</property>
<property name="enable_arrow_keys">True</property>
<property name="enable_arrows_always">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="source">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Selects an existing source from the Source View</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="editable">False</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
<signal name="changed" handler="on_source_changed" object="source_title"/>
</widget>
</child>
<child internal-child="list">
<widget class="GtkList" id="convertwidget1">
<property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
<child>
<widget class="GtkListItem" id="convertwidget2">
<property name="visible">True</property>
<child>
<widget class="GtkLabel" id="convertwidget3">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="sauthor">
<property name="visible">True</property>
@ -19858,68 +19735,6 @@ Other</property>
</packing>
</child>
<child>
<widget class="GtkOptionMenu" id="conf">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">0</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget8">
<property name="visible">True</property>
<child>
<widget class="GtkMenuItem" id="convertwidget9">
<property name="visible">True</property>
<property name="label" translatable="yes">Very Low</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="convertwidget10">
<property name="visible">True</property>
<property name="label" translatable="yes">Low</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="convertwidget11">
<property name="visible">True</property>
<property name="label" translatable="yes">Normal</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="convertwidget12">
<property name="visible">True</property>
<property name="label" translatable="yes">High</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="convertwidget13">
<property name="visible">True</property>
<property name="label" translatable="yes">Very High</property>
<property name="use_underline">True</property>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">4</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow21">
<property name="visible">True</property>
@ -20088,6 +19903,39 @@ Other</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="conf">
<property name="visible">True</property>
<property name="items" translatable="yes">Very Low
Low
Normal
High
Very High</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">4</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="source_title">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>