diff --git a/ChangeLog b/ChangeLog index b6c6e0abf..175fca757 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-02-12 Benny Malengier + * 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 * src/plugins/StatisticsChart.py: 0001754: Capitalization in Statistics chart diff --git a/src/DisplayModels/_BaseModel.py b/src/DisplayModels/_BaseModel.py index 830ffa898..5cd297e5b 100644 --- a/src/DisplayModels/_BaseModel.py +++ b/src/DisplayModels/_BaseModel.py @@ -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] diff --git a/src/DisplayModels/_NoteModel.py b/src/DisplayModels/_NoteModel.py index 37d769bbb..49855596c 100644 --- a/src/DisplayModels/_NoteModel.py +++ b/src/DisplayModels/_NoteModel.py @@ -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('&', '&') note = note.replace('<', '<') diff --git a/src/DisplayTabs/_EmbeddedList.py b/src/DisplayTabs/_EmbeddedList.py index acfa548a2..391a4190a 100644 --- a/src/DisplayTabs/_EmbeddedList.py +++ b/src/DisplayTabs/_EmbeddedList.py @@ -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) diff --git a/src/Editors/_EditFamily.py b/src/Editors/_EditFamily.py index 047cd627e..0390e5593 100644 --- a/src/Editors/_EditFamily.py +++ b/src/Editors/_EditFamily.py @@ -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), ]