Commit c5f90e9b authored by nkour's avatar nkour

get_uf_show can return strings with mnemonics

parent 8f3dafa9
......@@ -82,25 +82,48 @@ def convert_bytes(string):
suffix = _('%s B')
return suffix % unicode(bytes)
def get_uf_show(show):
def get_uf_show(show, use_mnemonic = False):
'''returns a userfriendly string for dnd/xa/chat
and makes all strings translatable'''
and makes all strings translatable
if use_mnemonic is True, it adds _ so GUI should call with True
for accessibility issues'''
if show == 'dnd':
uf_show = _('Busy')
if use_mnemonic:
uf_show = _('_Busy')
else:
uf_show = _('Busy')
elif show == 'xa':
uf_show = _('Not Available')
if use_mnemonic:
uf_show = _('_Not Available')
else:
uf_show = _('Not Available')
elif show == 'chat':
uf_show = _('Free for Chat')
if use_mnemonic:
uf_show = _('_Free for Chat')
else:
uf_show = _('Free for Chat')
elif show == 'online':
uf_show = _('Available')
if use_mnemonic:
uf_show = _('_Available')
else:
uf_show = _('Available')
elif show == 'connecting':
uf_show = _('Connecting')
uf_show = _('Connecting')
elif show == 'away':
uf_show = _('Away')
if use_mnemonic:
uf_show = _('A_way')
else:
uf_show = _('Away')
elif show == 'offline':
uf_show = _('Offline')
if use_mnemonic:
uf_show = _('_Offline')
else:
uf_show = _('Offline')
elif show == 'invisible':
uf_show = _('Invisible')
if use_mnemonic:
uf_show = _('_Invisible')
else:
uf_show = _('Invisible')
elif show == 'not in the roster':
uf_show = _('Not in the roster')
elif show == 'requested':
......
......@@ -1046,7 +1046,8 @@ class RosterWindow:
status_menuitem.set_submenu(sub_menu)
for show in ['online', 'chat', 'away', 'xa', 'dnd', 'invisible']:
item = gtk.ImageMenuItem(helpers.get_uf_show(show))
uf_show = helpers.get_uf_show(show, use_mnemonic = True)
item = gtk.ImageMenuItem(uf_show)
icon = state_images[show]
item.set_image(icon)
sub_menu.append(item)
......@@ -1055,7 +1056,7 @@ class RosterWindow:
item = gtk.SeparatorMenuItem()
sub_menu.append(item)
item = gtk.MenuItem(_('Change status message'))
item = gtk.MenuItem(_('_Change status message'))
sub_menu.append(item)
item.connect('activate', self.change_status_message, account)
if gajim.connections[account].connected < 2:
......@@ -1064,7 +1065,8 @@ class RosterWindow:
item = gtk.SeparatorMenuItem()
sub_menu.append(item)
item = gtk.ImageMenuItem(helpers.get_uf_show('offline'))
uf_show = helpers.get_uf_show('offline', use_mnemonic = True)
item = gtk.ImageMenuItem(uf_show)
icon = state_images['offline']
item.set_image(icon)
sub_menu.append(item)
......
......@@ -132,7 +132,7 @@ class Systray:
state_images = self.plugin.roster.load_iconset(path)
for show in ['online', 'chat', 'away', 'xa', 'dnd', 'invisible']:
uf_show = helpers.get_uf_show(show)
uf_show = helpers.get_uf_show(show, use_mnemonic = True)
item = gtk.ImageMenuItem(uf_show)
item.set_image(state_images[show])
sub_menu.append(item)
......@@ -141,7 +141,7 @@ class Systray:
item = gtk.SeparatorMenuItem()
sub_menu.append(item)
item = gtk.MenuItem(_('Change status message'))
item = gtk.MenuItem(_('_Change status message'))
sub_menu.append(item)
item.connect('activate', self.on_change_status_message_activate)
if not helpers.one_account_connected():
......@@ -150,7 +150,7 @@ class Systray:
item = gtk.SeparatorMenuItem()
sub_menu.append(item)
uf_show = helpers.get_uf_show('offline')
uf_show = helpers.get_uf_show('offline', use_mnemonic = True)
item = gtk.ImageMenuItem(uf_show)
item.set_image(state_images['offline'])
sub_menu.append(item)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment