[pygtk] Avoid interpretation of char '_' in itemfactory

Maik Hertha maik.hertha at berlin.de
Sat Mar 20 04:56:12 WST 2004


Hi there;

I have an application to manage the mapping of a real pathname to a 
logical application name. A feature is, that a list of chars are 
translated to char '_'. The result is presented in a TreeView 
(ListStore). For a quick managing I provide a Popup Menu, if the user 
right clicks on a selected row.

--- code
dl could be 'TEST_NAME' or 'V5_TEST_NAME'
        menuitems = [
            (_('/DLName "%s"' % dl), None, None, 0, '<Title>'),
            (_('/sep1'), None, None, 0, '<Separator>'),
            (_('/Namen editieren'), None, self.onPopupActivated, 1, None),
            (_('/Verzeichnis ändern'), None, self.onPopupActivated, 2, 
None),
            (_('/Eintrag löschen'), None, self.onPopupActivated, 3, None),
        ]
        item_factory = gtk.ItemFactory(gtk.Menu, '<popup>')
        item_factory.create_items(menuitems)
        item_factory.popup(int(ev.x_root), int(ev.y_root), ev.button, 0L)
--- code

Unfortunately  the itemfactory  interprets  the  char  '_'  as 
accelerator marker vor the following char.
So my question is. How could I avoid the interpretation of the char '_' 
(underscore) as accelecation marker in the  menu item ('DLName "%s"') ?
Thanks for your advice.

--maik./

-- 
Mit freundlichem Gruß /
with best regards

Maik Hertha

--------------------------------------------------------------
maik dot hertha at berlin dot de
--------------------------------------------------------------






More information about the pygtk mailing list