mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-28 21:46:13 +02:00
Gets rid of colorama
This commit is contained in:
parent
c10cc1fee4
commit
9d352b4bad
7 changed files with 8 additions and 21 deletions
|
@ -21,11 +21,6 @@ try:
|
|||
except ImportError:
|
||||
crypto_installed = False
|
||||
import hashlib
|
||||
try:
|
||||
import colorama
|
||||
colorama.init()
|
||||
except ImportError:
|
||||
colorama = None
|
||||
import plistlib
|
||||
import pytz
|
||||
import uuid
|
||||
|
@ -57,12 +52,6 @@ class Journal(object):
|
|||
"""Returns the number of entries"""
|
||||
return len(self.entries)
|
||||
|
||||
def _colorize(self, string):
|
||||
if colorama:
|
||||
return colorama.Fore.CYAN + string + colorama.Fore.RESET
|
||||
else:
|
||||
return string
|
||||
|
||||
def _decrypt(self, cipher):
|
||||
"""Decrypts a cipher string using self.key as the key and the first 16 byte of the cipher as the IV"""
|
||||
if not crypto_installed:
|
||||
|
@ -174,11 +163,11 @@ class Journal(object):
|
|||
for tag in self.search_tags:
|
||||
tagre = re.compile(re.escape(tag), re.IGNORECASE)
|
||||
pp = re.sub(tagre,
|
||||
lambda match: self._colorize(match.group(0)),
|
||||
lambda match: util.colorize(match.group(0)),
|
||||
pp, re.UNICODE)
|
||||
else:
|
||||
pp = re.sub(r"(?u)([{tags}]\w+)".format(tags=self.config['tagsymbols']),
|
||||
lambda match: self._colorize(match.group(0)),
|
||||
lambda match: util.colorize(match.group(0)),
|
||||
pp)
|
||||
return pp
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue