This commit is contained in:
Vinicius Moreira
2019-09-07 17:58:41 -03:00
parent 7123408010
commit 696b6169ac
13 changed files with 24 additions and 22 deletions

View File

@@ -1,7 +1,6 @@
import datetime
import time
from threading import Lock, Thread
from typing import List
from bauh_api.abstract.cache import MemoryCache, MemoryCacheFactory

7
bauh/util/html.py Normal file
View File

@@ -0,0 +1,7 @@
import re
HTML_RE = re.compile(r'<[^>]+>')
def strip_html(string: str):
return HTML_RE.sub('', string)

5
bauh/util/resource.py Executable file
View File

@@ -0,0 +1,5 @@
from bauh import ROOT_DIR
def get_path(resource_path):
return ROOT_DIR + '/resources/' + resource_path

View File

@@ -1,11 +1,9 @@
import glob
import locale
import os
from bauh_api.util import system
from bauh_api.util.resource import get_path
from bauh import ROOT_DIR, __app_name__
from bauh.core import resource
from bauh import __app_name__
from bauh.util import resource
def get_locale_keys(key: str = None, locale_dir: str = resource.get_path('locale')):
@@ -42,5 +40,5 @@ def get_locale_keys(key: str = None, locale_dir: str = resource.get_path('locale
return locale_obj
def notify_user(msg: str, icon_path: str = get_path('img/logo.svg', ROOT_DIR)):
system.notify_user(msg=msg, app_name=__app_name__, icon_path=icon_path)
def notify_user(msg: str, icon_path: str = resource.get_path('img/logo.svg')):
os.system("notify-send -a {} {} '{}'".format(__app_name__, "-i {}".format(icon_path) if icon_path else '', msg))