Commit 39b4b8fc authored by Philipp Hörist's avatar Philipp Hörist

Remove Fuzzy Clock

I consider this feature bloat
parent e5ac5e9b
......@@ -112,7 +112,6 @@ class Config:
'ignore_incoming_xhtml': [opt_bool, False, ],
'speller_language': [opt_str, '', _('Language used for spell checking.')],
'print_time': [opt_str, 'always', _('\'always\' - print time for every message.\n\'sometimes\' - print time every print_ichat_every_foo_minutes minute.\n\'never\' - never print time.')],
'print_time_fuzzy': [opt_int, 0, _('Print time in chats using Fuzzy Clock. Value of fuzziness from 1 to 4, or 0 to disable Fuzzy Clock. 1 is the most precise clock, 4 the least precise one. This is used only if \'print_time\' is \'sometimes\'.')],
'emoticons_theme': [opt_str, 'noto-emoticons', '', True],
'ascii_emoticons': [opt_bool, True, _('When enabled, ASCII emojis will be converted to graphical emojis.'), True],
'ascii_formatting': [opt_bool, True,
......
# Copyright (C) 2006 Christoph Neuroth <delmonico AT gmx.net>
# Copyright (C) 2006-2014 Yann Leboulanger <asterix AT lagaule.org>
# Copyright (C) 2007 Jean-Marie Traissard <jim AT lapin.org>
# Copyright (C) 2009 Benjamin Richter <br AT waldteufel-online.net>
#
# This file is part of Gajim.
#
# Gajim is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation; version 3 only.
#
# Gajim is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
"""
Python class to show a "fuzzy clock".
Homepage of the original: http://home.gna.org/fuzzyclock/
Project Page of the original: http://gna.org/projects/fuzzyclock
The class is based on a port from PHP code by
Henrique Recidive <henrique at recidive.com> which was
in turn based on the Fuzzy Clock Applet of Frerich Raabe (KDE).
So most of the credit goes to this guys, thanks :-)
"""
from gajim.common.i18n import _
class FuzzyClock:
HOUR_NAMES = [
_('twelve'), _('one'), _('two'), _('three'), _('four'),
_('five'), _('six'), _('seven'), _('eight'), _('nine'), _('ten'),
_('eleven')
]
# Strings to use for the output. %(0)s will be replaced with
# the preceding hour (e.g. "x PAST %(0)s"), %(1)s with the coming hour
# (e.g. "x TO %(0)s")
FUZZY_TIME = [
_("%(0)s o'clock"),
_('five past %(0)s'),
_('ten past %(0)s'),
_('quarter past %(0)s'),
_('twenty past %(0)s'),
_('twenty five past %(0)s'),
_('half past %(0)s'),
_('twenty five to %(1)s'),
_('twenty to %(1)s'),
_('quarter to %(1)s'),
_('ten to %(1)s'),
_('five to %(1)s'),
_("%(1)s o'clock")
]
FUZZY_DAYTIME = [
_('Night'),
_('Early morning'),
_('Morning'),
_('Almost noon'),
_('Noon'),
_('Afternoon'),
_('Evening'),
_('Late evening'),
_('Night')
]
FUZZY_WEEK = [
_('Start of week'),
_('Middle of week'),
_('Middle of week'),
_('Middle of week'),
_('End of week'),
_('Weekend!'),
_('Weekend!')
]
def fuzzy_time(self, fuzzyness, now):
if fuzzyness in (1, 2):
if fuzzyness == 1:
sector = int(round(now.tm_min / 5.0))
else:
sector = int(round(now.tm_min / 15.0)) * 3
return self.FUZZY_TIME[sector] % {
'0': self.HOUR_NAMES[now.tm_hour % 12],
'1': self.HOUR_NAMES[(now.tm_hour + 1) % 12]}
if fuzzyness == 3:
return self.FUZZY_DAYTIME[int(round(now.tm_hour / 3.0))]
return self.FUZZY_WEEK[now.tm_wday]
......@@ -41,7 +41,6 @@ from gajim.common import helpers
from gajim.common import i18n
from gajim.common.i18n import _
from gajim.common.helpers import AdditionalDataDict
from gajim.common.fuzzyclock import FuzzyClock
from gajim.common.const import StyleAttr
from gajim.common.const import Trust
from gajim.common.helpers import to_user_string
......@@ -188,7 +187,6 @@ class ConversationTextview(GObject.GObject):
self.line = 0
self._message_list = []
self.corrected_text_list = {}
self.fc = FuzzyClock()
# no need to inherit TextView, use it as atrribute is safer
self.tv = HtmlTextView(account)
......@@ -1198,11 +1196,7 @@ class ConversationTextview(GObject.GObject):
seconds_passed = tim - self.last_time_printout
if seconds_passed > every_foo_seconds:
self.last_time_printout = tim
if app.config.get('print_time_fuzzy') > 0:
tim_format = self.fc.fuzzy_time(
app.config.get('print_time_fuzzy'), local_tim)
else:
tim_format = self.get_time_to_show(local_tim, direction_mark)
tim_format = self.get_time_to_show(local_tim, direction_mark)
buffer_.insert_with_tags_by_name(iter_, tim_format + '\n',
'time_sometimes')
......
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