Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
b704e27a
by Philipp Hörist at 2019-03-06T22:03:45Z
3 changed files:
Changes:
| ... | ... | @@ -56,6 +56,7 @@ from gajim.common import configpaths |
| 56 | 56 |
from gajim.common.i18n import Q_
|
| 57 | 57 |
from gajim.common.i18n import _
|
| 58 | 58 |
from gajim.common.i18n import ngettext
|
| 59 |
+from gajim.common.const import ShowConstant
|
|
| 59 | 60 |
|
| 60 | 61 |
log = logging.getLogger('gajim.c.helpers')
|
| 61 | 62 |
|
| ... | ... | @@ -246,6 +247,9 @@ def get_uf_show(show, use_mnemonic=False): |
| 246 | 247 |
If use_mnemonic is True, it adds _ so GUI should call with True for
|
| 247 | 248 |
accessibility issues
|
| 248 | 249 |
"""
|
| 250 |
+ if isinstance(show, ShowConstant):
|
|
| 251 |
+ show = show.name.lower()
|
|
| 252 |
+ |
|
| 249 | 253 |
if show == 'dnd':
|
| 250 | 254 |
if use_mnemonic:
|
| 251 | 255 |
uf_show = _('_Busy')
|
| ... | ... | @@ -25,6 +25,7 @@ from gajim.common import app |
| 25 | 25 |
from gajim.common.i18n import _
|
| 26 | 26 |
from gajim.common.nec import NetworkEvent
|
| 27 | 27 |
from gajim.common.const import KindConstant
|
| 28 |
+from gajim.common.const import ShowConstant
|
|
| 28 | 29 |
from gajim.common.helpers import prepare_and_validate_gpg_keyID
|
| 29 | 30 |
|
| 30 | 31 |
log = logging.getLogger('gajim.c.m.presence')
|
| ... | ... | @@ -236,11 +237,9 @@ class Presence: |
| 236 | 237 |
if not app.config.should_log(self._account, properties.jid.getBare()):
|
| 237 | 238 |
return
|
| 238 | 239 |
|
| 239 |
- # TODO: Refactor
|
|
| 240 |
+ show = ShowConstant[properties.show.name]
|
|
| 240 | 241 |
if properties.type.is_unavailable:
|
| 241 |
- show = 'offline'
|
|
| 242 |
- else:
|
|
| 243 |
- show = properties.show.value
|
|
| 242 |
+ show = ShowConstant.OFFLINE
|
|
| 244 | 243 |
|
| 245 | 244 |
app.logger.insert_into_logs(self._account,
|
| 246 | 245 |
properties.jid.getBare(),
|
| ... | ... | @@ -50,6 +50,7 @@ from gajim.common.i18n import _ |
| 50 | 50 |
from gajim.common.const import StyleAttr
|
| 51 | 51 |
from gajim.common.const import JIDConstant
|
| 52 | 52 |
from gajim.common.const import KindConstant
|
| 53 |
+from gajim.common.const import ShowConstant
|
|
| 53 | 54 |
|
| 54 | 55 |
def is_standalone():
|
| 55 | 56 |
# Determine if we are in standalone mode
|
| ... | ... | @@ -398,7 +399,8 @@ class HistoryManager: |
| 398 | 399 |
message = ''
|
| 399 | 400 |
else:
|
| 400 | 401 |
message = ' : ' + message
|
| 401 |
- message = helpers.get_uf_show(show) + message
|
|
| 402 |
+ |
|
| 403 |
+ message = helpers.get_uf_show(ShowConstant(show)) + message
|
|
| 402 | 404 |
|
| 403 | 405 |
message_ = '<span'
|
| 404 | 406 |
if color:
|