get_uf_show can return strings with mnemonics
This commit is contained in:
parent
8f3dafa920
commit
c5f90e9bc6
|
@ -82,24 +82,47 @@ def convert_bytes(string):
|
||||||
suffix = _('%s B')
|
suffix = _('%s B')
|
||||||
return suffix % unicode(bytes)
|
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
|
'''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':
|
if show == 'dnd':
|
||||||
|
if use_mnemonic:
|
||||||
|
uf_show = _('_Busy')
|
||||||
|
else:
|
||||||
uf_show = _('Busy')
|
uf_show = _('Busy')
|
||||||
elif show == 'xa':
|
elif show == 'xa':
|
||||||
|
if use_mnemonic:
|
||||||
|
uf_show = _('_Not Available')
|
||||||
|
else:
|
||||||
uf_show = _('Not Available')
|
uf_show = _('Not Available')
|
||||||
elif show == 'chat':
|
elif show == 'chat':
|
||||||
|
if use_mnemonic:
|
||||||
|
uf_show = _('_Free for Chat')
|
||||||
|
else:
|
||||||
uf_show = _('Free for Chat')
|
uf_show = _('Free for Chat')
|
||||||
elif show == 'online':
|
elif show == 'online':
|
||||||
|
if use_mnemonic:
|
||||||
|
uf_show = _('_Available')
|
||||||
|
else:
|
||||||
uf_show = _('Available')
|
uf_show = _('Available')
|
||||||
elif show == 'connecting':
|
elif show == 'connecting':
|
||||||
uf_show = _('Connecting')
|
uf_show = _('Connecting')
|
||||||
elif show == 'away':
|
elif show == 'away':
|
||||||
|
if use_mnemonic:
|
||||||
|
uf_show = _('A_way')
|
||||||
|
else:
|
||||||
uf_show = _('Away')
|
uf_show = _('Away')
|
||||||
elif show == 'offline':
|
elif show == 'offline':
|
||||||
|
if use_mnemonic:
|
||||||
|
uf_show = _('_Offline')
|
||||||
|
else:
|
||||||
uf_show = _('Offline')
|
uf_show = _('Offline')
|
||||||
elif show == 'invisible':
|
elif show == 'invisible':
|
||||||
|
if use_mnemonic:
|
||||||
|
uf_show = _('_Invisible')
|
||||||
|
else:
|
||||||
uf_show = _('Invisible')
|
uf_show = _('Invisible')
|
||||||
elif show == 'not in the roster':
|
elif show == 'not in the roster':
|
||||||
uf_show = _('Not in the roster')
|
uf_show = _('Not in the roster')
|
||||||
|
|
|
@ -1046,7 +1046,8 @@ class RosterWindow:
|
||||||
status_menuitem.set_submenu(sub_menu)
|
status_menuitem.set_submenu(sub_menu)
|
||||||
|
|
||||||
for show in ['online', 'chat', 'away', 'xa', 'dnd', 'invisible']:
|
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]
|
icon = state_images[show]
|
||||||
item.set_image(icon)
|
item.set_image(icon)
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
|
@ -1055,7 +1056,7 @@ class RosterWindow:
|
||||||
item = gtk.SeparatorMenuItem()
|
item = gtk.SeparatorMenuItem()
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
|
|
||||||
item = gtk.MenuItem(_('Change status message'))
|
item = gtk.MenuItem(_('_Change status message'))
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
item.connect('activate', self.change_status_message, account)
|
item.connect('activate', self.change_status_message, account)
|
||||||
if gajim.connections[account].connected < 2:
|
if gajim.connections[account].connected < 2:
|
||||||
|
@ -1064,7 +1065,8 @@ class RosterWindow:
|
||||||
item = gtk.SeparatorMenuItem()
|
item = gtk.SeparatorMenuItem()
|
||||||
sub_menu.append(item)
|
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']
|
icon = state_images['offline']
|
||||||
item.set_image(icon)
|
item.set_image(icon)
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
|
|
|
@ -132,7 +132,7 @@ class Systray:
|
||||||
state_images = self.plugin.roster.load_iconset(path)
|
state_images = self.plugin.roster.load_iconset(path)
|
||||||
|
|
||||||
for show in ['online', 'chat', 'away', 'xa', 'dnd', 'invisible']:
|
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 = gtk.ImageMenuItem(uf_show)
|
||||||
item.set_image(state_images[show])
|
item.set_image(state_images[show])
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
|
@ -141,7 +141,7 @@ class Systray:
|
||||||
item = gtk.SeparatorMenuItem()
|
item = gtk.SeparatorMenuItem()
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
|
|
||||||
item = gtk.MenuItem(_('Change status message'))
|
item = gtk.MenuItem(_('_Change status message'))
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
item.connect('activate', self.on_change_status_message_activate)
|
item.connect('activate', self.on_change_status_message_activate)
|
||||||
if not helpers.one_account_connected():
|
if not helpers.one_account_connected():
|
||||||
|
@ -150,7 +150,7 @@ class Systray:
|
||||||
item = gtk.SeparatorMenuItem()
|
item = gtk.SeparatorMenuItem()
|
||||||
sub_menu.append(item)
|
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 = gtk.ImageMenuItem(uf_show)
|
||||||
item.set_image(state_images['offline'])
|
item.set_image(state_images['offline'])
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
|
|
Loading…
Reference in New Issue