2008-02-12 Benny Malengier <benny.malengier@gramps-project.org>

* src/Editors/_EditFamily.py: popup: edit child at top, add images.
	* src/DisplayTabs/_EmbeddedList.py: allow popup with image/custom text
	* src/DisplayModels/_BaseModel.py: add comment to function
	* src/DisplayModels/_NoteModel.py: test, UTF-8 for preview



svn: r10020
This commit is contained in:
Benny Malengier 2008-02-12 12:17:58 +00:00
parent 60b7f5e04d
commit 3dbfd6cbac
5 changed files with 36 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2008-02-12 Benny Malengier <benny.malengier@gramps-project.org>
* src/Editors/_EditFamily.py: popup: edit child at top, add images.
* src/DisplayTabs/_EmbeddedList.py: allow popup with image/custom text
* src/DisplayModels/_BaseModel.py: add comment to function
* src/DisplayModels/_NoteModel.py: test, UTF-8 for preview
2008-02-11 Brian Matherly <brian@gramps-project.org>
* src/plugins/StatisticsChart.py:
0001754: Capitalization in Statistics chart

View File

@ -164,6 +164,7 @@ class BaseModel(gtk.GenericTreeModel):
self.rebuild_data = self._rebuild_filter
else:
if search[1]:
# we have search[1] = (index, text_unicode, inversion)
col = search[1][0]
text = search[1][1]
inv = search[1][2]

View File

@ -100,7 +100,7 @@ class NoteModel(BaseModel):
return unicode(str(temp))
def column_preview(self,data):
note = " ".join(data[2].split())
note = " ".join(data[2].encode('utf-8').split())
note = re.sub(r'(<.*?>)', '', note)
note = note.replace('&amp;', '&')
note = note.replace('&lt;', '<')

View File

@ -96,6 +96,16 @@ class EmbeddedList(ButtonTab):
self.right_click(obj, event)
def get_popup_menu_items(self):
"""
Create the list needed to populate the right popup action
An entry is
( needs_write_access, image, title, function)
If image == False, then only text label with title is shown
If image == True, and image is a tuple (stock_id, text), the image
of the stock id (eg 'gramps-family') is shown, and the label text
If image is not a tuple, then it should be a stock_id, and the
image is shown, with label the default stock_id label.
"""
if self.share_btn:
itemlist = [
(True, True, gtk.STOCK_ADD, self.add_button_clicked),
@ -112,11 +122,21 @@ class EmbeddedList(ButtonTab):
return itemlist
def right_click(self, obj, event):
"""
On right click show a popup menu.
This is populated with get_popup_menu_items
"""
menu = gtk.Menu()
for (needs_write_access, image, title, func) in self.get_popup_menu_items():
if image:
item = gtk.ImageMenuItem(stock_id=title)
if isinstance(title, tuple):
img_stock, txt = title
item = gtk.ImageMenuItem(txt)
img = gtk.Image()
img.set_from_stock(img_stock, gtk.ICON_SIZE_MENU)
item.set_image(img)
else:
item = gtk.ImageMenuItem(stock_id=title)
else:
item = gtk.MenuItem(title)
item.connect('activate', func)

View File

@ -115,10 +115,13 @@ class ChildEmbedList(EmbeddedList):
def get_popup_menu_items(self):
return [
(False, True, (gtk.STOCK_EDIT, _('Edit child')),
self.edit_child_button_clicked),
(True, True, gtk.STOCK_ADD, self.add_button_clicked),
(True, False, _('Add an existing child'), self.share_button_clicked),
(False,True, _('Edit relationship'), self.edit_button_clicked),
(False,True, _('Edit child'), self.edit_child_button_clicked),
(True, False, _('Add an existing child'),
self.share_button_clicked),
(False, True, (gtk.STOCK_EDIT, _('Edit relationship')),
self.edit_button_clicked),
(True, True, gtk.STOCK_REMOVE, self.del_button_clicked),
]