mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 00:04:15 +02:00
commons
This commit is contained in:
@@ -3,12 +3,12 @@ import sys
|
|||||||
from PyQt5.QtGui import QIcon
|
from PyQt5.QtGui import QIcon
|
||||||
from PyQt5.QtWidgets import QApplication
|
from PyQt5.QtWidgets import QApplication
|
||||||
from bauh_api.abstract.controller import ApplicationContext
|
from bauh_api.abstract.controller import ApplicationContext
|
||||||
from bauh_api.util.http import HttpClient
|
from bauh_api.http import HttpClient
|
||||||
|
|
||||||
from bauh import __version__, __app_name__, app_args, ROOT_DIR
|
from bauh import __version__, __app_name__, app_args, ROOT_DIR
|
||||||
from bauh.core import resource, extensions
|
from bauh.core import extensions
|
||||||
from bauh.core.controller import GenericSoftwareManager
|
from bauh.core.controller import GenericSoftwareManager
|
||||||
from bauh.util import util, logs
|
from bauh.util import util, logs, resource
|
||||||
from bauh.util.cache import DefaultMemoryCacheFactory, CacheCleaner
|
from bauh.util.cache import DefaultMemoryCacheFactory, CacheCleaner
|
||||||
from bauh.util.disk import DefaultDiskCacheLoaderFactory
|
from bauh.util.disk import DefaultDiskCacheLoaderFactory
|
||||||
from bauh.view.qt.systray import TrayIcon
|
from bauh.view.qt.systray import TrayIcon
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from bauh_api.abstract.controller import SoftwareManager, ApplicationContext
|
|||||||
from bauh import __app_name__
|
from bauh import __app_name__
|
||||||
from bauh.util import util
|
from bauh.util import util
|
||||||
|
|
||||||
ignore_modules = {'{}_api'.format(__app_name__)}
|
ignore_modules = {'{}_api'.format(__app_name__), '{}_commons'.format(__app_name__)}
|
||||||
ext_pattern = '{}_'.format(__app_name__)
|
ext_pattern = '{}_'.format(__app_name__)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import time
|
import time
|
||||||
from threading import Lock, Thread
|
from threading import Lock, Thread
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from bauh_api.abstract.cache import MemoryCache, MemoryCacheFactory
|
from bauh_api.abstract.cache import MemoryCache, MemoryCacheFactory
|
||||||
|
|
||||||
|
|||||||
7
bauh/util/html.py
Normal file
7
bauh/util/html.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import re
|
||||||
|
|
||||||
|
HTML_RE = re.compile(r'<[^>]+>')
|
||||||
|
|
||||||
|
|
||||||
|
def strip_html(string: str):
|
||||||
|
return HTML_RE.sub('', string)
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
import glob
|
import glob
|
||||||
import locale
|
import locale
|
||||||
|
import os
|
||||||
|
|
||||||
from bauh_api.util import system
|
from bauh import __app_name__
|
||||||
from bauh_api.util.resource import get_path
|
from bauh.util import resource
|
||||||
|
|
||||||
from bauh import ROOT_DIR, __app_name__
|
|
||||||
from bauh.core import resource
|
|
||||||
|
|
||||||
|
|
||||||
def get_locale_keys(key: str = None, locale_dir: str = resource.get_path('locale')):
|
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
|
return locale_obj
|
||||||
|
|
||||||
|
|
||||||
def notify_user(msg: str, icon_path: str = get_path('img/logo.svg', ROOT_DIR)):
|
def notify_user(msg: str, icon_path: str = resource.get_path('img/logo.svg')):
|
||||||
system.notify_user(msg=msg, app_name=__app_name__, icon_path=icon_path)
|
os.system("notify-send -a {} {} '{}'".format(__app_name__, "-i {}".format(icon_path) if icon_path else '', msg))
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from PyQt5.QtGui import QPixmap
|
|||||||
from PyQt5.QtWidgets import QVBoxLayout, QDialog, QLabel
|
from PyQt5.QtWidgets import QVBoxLayout, QDialog, QLabel
|
||||||
|
|
||||||
from bauh import __version__, __app_name__
|
from bauh import __version__, __app_name__
|
||||||
from bauh.core import resource
|
from bauh.util import resource
|
||||||
|
|
||||||
PROJECT_URL = 'https://github.com/vinifmor/' + __app_name__
|
PROJECT_URL = 'https://github.com/vinifmor/' + __app_name__
|
||||||
LICENSE_URL = 'https://raw.githubusercontent.com/vinifmor/{}/master/LICENSE'.format(__app_name__)
|
LICENSE_URL = 'https://raw.githubusercontent.com/vinifmor/{}/master/LICENSE'.format(__app_name__)
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ from PyQt5.QtWidgets import QTableWidget, QTableView, QMenu, QAction, QTableWidg
|
|||||||
QHeaderView, QLabel, QHBoxLayout, QPushButton, QToolBar
|
QHeaderView, QLabel, QHBoxLayout, QPushButton, QToolBar
|
||||||
from bauh_api.abstract.cache import MemoryCache
|
from bauh_api.abstract.cache import MemoryCache
|
||||||
from bauh_api.abstract.model import PackageStatus
|
from bauh_api.abstract.model import PackageStatus
|
||||||
from bauh_api.util.html import strip_html
|
|
||||||
|
|
||||||
from bauh.core import resource
|
from bauh.util import resource
|
||||||
|
from bauh.util.html import strip_html
|
||||||
from bauh.view.qt import dialog
|
from bauh.view.qt import dialog
|
||||||
from bauh.view.qt.view_model import PackageView, PackageViewStatus
|
from bauh.view.qt.view_model import PackageView, PackageViewStatus
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from PyQt5.QtGui import QIcon
|
|||||||
from PyQt5.QtWidgets import QMessageBox, QLabel, QWidget, QHBoxLayout
|
from PyQt5.QtWidgets import QMessageBox, QLabel, QWidget, QHBoxLayout
|
||||||
from bauh_api.abstract.view import MessageType
|
from bauh_api.abstract.view import MessageType
|
||||||
|
|
||||||
from bauh.core import resource
|
from bauh.util import resource
|
||||||
|
|
||||||
MSG_TYPE_MAP = {
|
MSG_TYPE_MAP = {
|
||||||
MessageType.ERROR: QMessageBox.Critical,
|
MessageType.ERROR: QMessageBox.Critical,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from PyQt5.QtWidgets import QDialog, QVBoxLayout, QGroupBox, \
|
|||||||
QLineEdit, QLabel, QGridLayout, QPushButton, QPlainTextEdit, QToolBar
|
QLineEdit, QLabel, QGridLayout, QPushButton, QPlainTextEdit, QToolBar
|
||||||
from bauh_api.abstract.cache import MemoryCache
|
from bauh_api.abstract.cache import MemoryCache
|
||||||
|
|
||||||
from bauh_api.util.html import strip_html
|
from bauh.util.html import strip_html
|
||||||
|
|
||||||
IGNORED_ATTRS = {'name', '__app__'}
|
IGNORED_ATTRS = {'name', '__app__'}
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,8 @@ from PyQt5.QtWidgets import QSystemTrayIcon, QMenu
|
|||||||
from bauh_api.abstract.model import PackageUpdate
|
from bauh_api.abstract.model import PackageUpdate
|
||||||
|
|
||||||
from bauh import __app_name__
|
from bauh import __app_name__
|
||||||
from bauh.core import resource
|
|
||||||
from bauh_api.abstract.controller import SoftwareManager
|
from bauh_api.abstract.controller import SoftwareManager
|
||||||
from bauh.util import util
|
from bauh.util import util, resource
|
||||||
from bauh.view.qt.about import AboutDialog
|
from bauh.view.qt.about import AboutDialog
|
||||||
from bauh.view.qt.window import ManageWindow
|
from bauh.view.qt.window import ManageWindow
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ from bauh_api.abstract.controller import SoftwareManager
|
|||||||
from bauh_api.abstract.model import SoftwarePackage, PackageAction
|
from bauh_api.abstract.model import SoftwarePackage, PackageAction
|
||||||
from bauh_api.abstract.view import MessageType
|
from bauh_api.abstract.view import MessageType
|
||||||
|
|
||||||
from bauh.core import resource
|
from bauh.util import util, resource
|
||||||
from bauh.util import util
|
|
||||||
from bauh.view.qt import dialog, commons
|
from bauh.view.qt import dialog, commons
|
||||||
from bauh.view.qt.about import AboutDialog
|
from bauh.view.qt.about import AboutDialog
|
||||||
from bauh.view.qt.apps_table import AppsTable, UpdateToggleButton
|
from bauh.view.qt.apps_table import AppsTable, UpdateToggleButton
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
pyqt5>=5.12
|
pyqt5>=5.12
|
||||||
bauh_api==0.1.0
|
bauh_api>=0.1.0<0.2
|
||||||
Reference in New Issue
Block a user