refactoring modules structure | improving README and CHANGELOG

This commit is contained in:
Vinicius Moreira
2019-09-17 17:35:33 -03:00
parent 01ca7414e2
commit 18238eb269
49 changed files with 94 additions and 63 deletions

View File

@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Features
- Supporting AUR packages (install, uninstall, search, info, downgrade and history)
- Now it is possible to enable / disable the packaging technologies via graphical interface using the "Application types" action in the lower "Settings" menu
- Environment variables / parameters **BAUH_FLATPAK (--flatpak)** and **BAUH_SNAP (--snap)** removed in favor of the feature above
- Qt style / theme combo selector ( environment variable / parameter BAUH_THEME (--theme) removed )
- New "Launch" button: can launch application packages
- New "Installed" button: quickly retrieves the installed packages without a full refresh ( available after a search )
@@ -25,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- When a package is installed, it will be the first element of the table after refreshing
- Progress bar status can now be controlled by the software manager while an operation is being executed
- Flatpak: showing runtime branches as versions when they are not available
- small UI improvements
### UI Changes
- "Upgrade selected" and "Refresh" buttons now have text labels and new colors

View File

@@ -1,26 +1,38 @@
## bauh
Non-official graphical user interface for Flatpak / Snap application management (old **fpakman**). It is a tray icon that let the user known when new updates are available and
an application management panel where you can search, update, install and uninstall applications.
Graphical user interface to manage your Linux applications (packages) (old **fpakman**). It currently supports Flatpak, Snap and AUR packaging types. When you launch **bauh** you will see
a management panel where you can search, update, install and uninstall applications. You can also downgrade some applications depending on the package technology.
It has a **tray mode** (see **Settings** below) that attaches the application icon to the system tray providing a quick way to launch it. Also the icon will get red when updates are available.
### Developed with:
- Python3 and Qt5.
### Requirements
- libappindicator3 ( for GTK3 desktop environments )
#### Debian-based distros
- python3-venv
- **python3.5** or above
- **pip3**
#### Arch-based distros
- python
- python-requests
- python-virtualenv
- python-pip
- python-pyqt5
- **python**
- **python-requests**
- **python-pip**
- **python-pyqt5**
##### Optional
- **flatpak**: to be able to handle Flatpak applications
- **snapd**: to be able to handle Snap applications
- **git**: to be able to downgrade AUR packages
- **wget**: to be able to download and install AUR packages
- **pacman**: to be able to handle AUR packages
- **libappindicator3**: for the **tray mode** in GTK3 desktop environments
### Distribution
**PyPi**
```
sudo pip3 install bauh
pip3 install bauh (may require **sudo**)
```
**AUR**
@@ -29,13 +41,19 @@ As **bauh** package. There is also a staging version (**bauh-staging**) but is i
### Manual installation:
If you prefer a manual and isolated installation, type the following commands within the cloned project folder:
If you prefer a manual and isolated installation:
If you cloned this project, type the following commands within its folder:
```
python3 -m venv env
env/bin/pip install .
env/bin/bauh
python3 -m venv env ( creates a virtualenv in a folder called **env** )
env/bin/pip install . ( install the application code inside the **env** )
env/bin/bauh ( launch the application )
```
If you want do not want to clone / download this repository, go your Home folder and execute the commands above, but replace the second by ```env/bin/pip install bauh```.
### Autostart
In order to autostart the application, use your Desktop Environment settings to register it as a startup application / script (**bauh --tray=1**).
@@ -49,8 +67,6 @@ You can change some application settings via environment variables or arguments
- **BAUH_ICON_EXPIRATION**: define a custom expiration time in SECONDS for cached icons. Default: 300 (5 minutes).
- **BAUH_DISK_CACHE**: enables / disables disk cache. When disk cache is enabled, the installed applications data are loaded faster. Use **0** (disable) or **1** (enable, default).
- **BAUH_DOWNLOAD_ICONS**: Enables / disables app icons download. It may improve the application speed depending on how applications data are being retrieved. Use **0** (disable) or **1** (enable, default).
- **BAUH_FLATPAK**: enables / disables flatpak usage. Use **0** (disable) or **1** (enabled, default)
- **BAUH_SNAP**: enables / disables snap usage. Use **0** (disable) or **1** (enabled, default)
- **BAUH_CHECK_PACKAGING_ONCE**: If the available supported packaging types should be checked ONLY once. It improves the application speed if enabled, but can generate errors if you uninstall any packaging technology while using it, and every time a supported packaging type is installed it will only be available after a restart. Use **0** (disable, default) or **1** (enable).
- **BAUH_TRAY**: If the tray icon and update-check daemon should be created. Use **0** (disable, default) or **1** (enable).
- **BAUH_SUGGESTIONS**: If application suggestions should be displayed if no app is installed (runtimes do not count as apps). Use **0** (disable) or **1** (enable, default).
@@ -64,6 +80,16 @@ with the technology that I don't care every time an action is executed.
- If you don't mind to see the applications icons, you can set "download-icons=0" (**bauh --download-icons=0**). The application may have a slight response improvement, since it will reduce the parallelism within it.
- If you don't mind app suggestions, disable it (**bauh --sugs=0**)
### Code structure
#### Modules
**view**: code associated with the graphical interface
**gems**: code responsible to work with the different packaging technologies (every submodule deals with one or more type)
**api**: code abstractions representing the main actions that a user can do with Linux packages (search, install, ...). These abstractions are implemented by the *gems*, and
the **view** code is only attached to them (it does not know how the **gems** handle the actions)
**commons**: common code used by **gem** and **view**
### Roadmap
- Support for other packaging technologies
- Separate modules for each packaging technology

View File

@@ -9,7 +9,7 @@ if system_locale == 'pt':
comment = "Gerencie seus aplicativos Flatpak / Snap / AUR "
tray = 'bandeja'
elif system_locale == 'es':
comment = "Administre sus aplicaciones Flatpak / Snap / AUR"
comment = "Administre sus aplicativos Flatpak / Snap / AUR"
tray = 'bandeja'
else:
comment = "Manage your Flatpak / Snap / AUR applications"

View File

@@ -6,13 +6,13 @@ from PyQt5.QtWidgets import QApplication
from bauh import __version__, __app_name__, app_args, ROOT_DIR
from bauh.api.abstract.controller import ApplicationContext
from bauh.api.http import HttpClient
from bauh.core import gems, config
from bauh.core.controller import GenericSoftwareManager
from bauh.util import util, logs, resource
from bauh.util.cache import DefaultMemoryCacheFactory, CacheCleaner
from bauh.util.disk import DefaultDiskCacheLoaderFactory
from bauh.view.core import gems, config
from bauh.view.core.controller import GenericSoftwareManager
from bauh.view.util import util, logs, resource
from bauh.view.qt.systray import TrayIcon
from bauh.view.qt.window import ManageWindow
from bauh.view.util.cache import CacheCleaner, DefaultMemoryCacheFactory
from bauh.view.util.disk import DefaultDiskCacheLoaderFactory
args = app_args.read()
logger = logs.new_logger(__app_name__, bool(args.logs))

View File

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

View File

@@ -1,11 +1,11 @@
import inspect
import os
import pkgutil
from typing import List, Type
from typing import List
from bauh import ROOT_DIR
from bauh.api.abstract.controller import SoftwareManager, ApplicationContext
from bauh.util import util
from bauh.view.util import util
def find_manager(member):

View File

@@ -3,7 +3,7 @@ from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QVBoxLayout, QDialog, QLabel
from bauh import __version__, __app_name__
from bauh.util import resource
from bauh.view.util import resource
PROJECT_URL = 'https://github.com/vinifmor/' + __app_name__
LICENSE_URL = 'https://raw.githubusercontent.com/vinifmor/{}/master/LICENSE'.format(__app_name__)
@@ -30,7 +30,7 @@ class AboutDialog(QDialog):
layout.addWidget(QLabel(''))
line_desc = QLabel(self)
line_desc.setStyleSheet('font-size: 10px; font-weight: bold;')
line_desc.setStyleSheet('font-size: 11px; font-weight: bold;')
line_desc.setText(locale_keys['about.info.desc'])
line_desc.setAlignment(Qt.AlignCenter)
line_desc.setMinimumWidth(400)
@@ -39,14 +39,14 @@ class AboutDialog(QDialog):
layout.addWidget(QLabel(''))
label_more_info = QLabel()
label_more_info.setStyleSheet('font-size: 9px;')
label_more_info.setStyleSheet('font-size: 10px;')
label_more_info.setText(locale_keys['about.info.link'] + ": <a href='{url}'>{url}</a>".format(url=PROJECT_URL))
label_more_info.setOpenExternalLinks(True)
label_more_info.setAlignment(Qt.AlignCenter)
layout.addWidget(label_more_info)
label_license = QLabel()
label_license.setStyleSheet('font-size: 9px;')
label_license.setStyleSheet('font-size: 10px;')
label_license.setText("<a href='{}'>{}</a>".format(LICENSE_URL, locale_keys['about.info.license']))
label_license.setOpenExternalLinks(True)
label_license.setAlignment(Qt.AlignCenter)
@@ -55,7 +55,7 @@ class AboutDialog(QDialog):
layout.addWidget(QLabel(''))
label_rate = QLabel()
label_rate.setStyleSheet('font-size: 9px; font-weight: bold;')
label_rate.setStyleSheet('font-size: 10px; font-weight: bold;')
label_rate.setText(locale_keys['about.info.rate'] + ' :)')
label_rate.setOpenExternalLinks(True)
label_rate.setAlignment(Qt.AlignCenter)

View File

@@ -10,8 +10,8 @@ from PyQt5.QtWidgets import QTableWidget, QTableView, QMenu, QAction, QTableWidg
from bauh.api.abstract.cache import MemoryCache
from bauh.api.abstract.model import PackageStatus
from bauh.util import resource
from bauh.util.html import strip_html
from bauh.commons.html import strip_html
from bauh.view.util import resource
from bauh.view.qt import dialog
from bauh.view.qt.components import IconButton
from bauh.view.qt.view_model import PackageView, PackageViewStatus
@@ -385,13 +385,13 @@ class AppsTable(QTableWidget):
def get_info():
self.window.get_app_info(pkg)
item.addWidget(IconButton(icon_path=resource.get_path('img/app_info.svg'), action=get_info, background='#2E68D3'))
item.addWidget(IconButton(icon_path=resource.get_path('img/app_info.svg'), action=get_info, background='#2E68D3', tooltip=self.i18n['action.info.tooltip']))
def handle_click():
self.show_pkg_settings(pkg)
if self.has_any_settings(pkg):
bt = IconButton(icon_path=resource.get_path('img/app_settings.svg'), action=handle_click, background='#12ABAB')
bt = IconButton(icon_path=resource.get_path('img/app_settings.svg'), action=handle_click, background='#12ABAB', tooltip=self.i18n['action.settings.tooltip'])
item.addWidget(bt)
self.setCellWidget(idx, col, item)

View File

@@ -4,7 +4,7 @@ from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QMessageBox, QLabel, QWidget, QHBoxLayout
from bauh.api.abstract.view import MessageType
from bauh.util import resource
from bauh.view.util import resource
from bauh.view.qt import css
MSG_TYPE_MAP = {

View File

@@ -4,9 +4,9 @@ from PyQt5.QtWidgets import QWidget, QLabel, QGridLayout, QPushButton
from bauh import ROOT_DIR
from bauh.api.abstract.view import MultipleSelectComponent, InputOption
from bauh.commons import resource
from bauh.core.config import Configuration, save
from bauh.core.controller import GenericSoftwareManager
from bauh.view.core.config import Configuration, save
from bauh.view.core.controller import GenericSoftwareManager
from bauh.view.util import resource
from bauh.view.qt import qt_utils, css
from bauh.view.qt.components import MultipleSelectQt, CheckboxQt, new_spacer
@@ -19,7 +19,7 @@ class GemSelectorPanel(QWidget):
self.manager = manager
self.config = config
self.setLayout(QGridLayout())
self.setWindowIcon(QIcon(resource.get_path('img/logo.svg', ROOT_DIR)))
self.setWindowIcon(QIcon(resource.get_path('img/logo.svg')))
self.setWindowTitle(i18n['gem_selector.title'])
self.resize(400, 400)
self.show_panel_after_restart = show_panel_after_restart

View File

@@ -3,8 +3,7 @@ from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QGroupBox, \
QLineEdit, QLabel, QGridLayout, QPushButton, QPlainTextEdit, QToolBar
from bauh.api.abstract.cache import MemoryCache
from bauh.util.html import strip_html
from bauh.commons.html import strip_html
IGNORED_ATTRS = {'name', '__app__'}

View File

@@ -5,9 +5,8 @@ import subprocess
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QInputDialog, QLineEdit
from bauh import ROOT_DIR
from bauh.api.abstract.view import MessageType
from bauh.commons import resource
from bauh.view.util import resource
from bauh.view.qt.dialog import show_message
@@ -20,7 +19,7 @@ def ask_root_password(locale_keys: dict):
diag = QInputDialog()
diag.setInputMode(QInputDialog.TextInput)
diag.setTextEchoMode(QLineEdit.Password)
diag.setWindowIcon(QIcon(resource.get_path('img/lock.svg', ROOT_DIR)))
diag.setWindowIcon(QIcon(resource.get_path('img/lock.svg')))
diag.setWindowTitle(locale_keys['popup.root.title'])
diag.setLabelText(locale_keys['popup.root.password'] + ':')
diag.setCancelButtonText(locale_keys['popup.button.cancel'])

View File

@@ -2,8 +2,8 @@ from PyQt5.QtWidgets import QComboBox, QStyleFactory, QWidget, QApplication
from bauh import __app_name__
from bauh.commons.html import bold
from bauh.core import config
from bauh.util import util
from bauh.view.core import config
from bauh.view.util import util
from bauh.view.qt import dialog

View File

@@ -9,7 +9,7 @@ from PyQt5.QtWidgets import QSystemTrayIcon, QMenu
from bauh import __app_name__
from bauh.api.abstract.controller import SoftwareManager
from bauh.api.abstract.model import PackageUpdate
from bauh.util import util, resource
from bauh.view.util import util, resource
from bauh.view.qt.about import AboutDialog
from bauh.view.qt.window import ManageWindow

View File

@@ -6,15 +6,15 @@ from PyQt5.QtCore import QEvent, Qt, QSize, pyqtSignal
from PyQt5.QtGui import QIcon, QWindowStateChangeEvent, QPixmap, QCursor
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QCheckBox, QHeaderView, QToolBar, \
QLabel, QPlainTextEdit, QLineEdit, QProgressBar, QPushButton, QComboBox, QMenu, QAction, QApplication
from pip._internal.configuration import Configuration
from bauh.api.abstract.cache import MemoryCache
from bauh.api.abstract.context import ApplicationContext
from bauh.api.abstract.controller import SoftwareManager
from bauh.api.abstract.model import SoftwarePackage, PackageAction
from bauh.api.abstract.view import MessageType
from bauh.core.config import Configuration
from bauh.core.controller import GenericSoftwareManager
from bauh.util import util, resource
from bauh.view.core.controller import GenericSoftwareManager
from bauh.view.util import util, resource
from bauh.view.qt import dialog, commons, qt_utils
from bauh.view.qt.about import AboutDialog
from bauh.view.qt.apps_table import AppsTable, UpdateToggleButton
@@ -242,7 +242,10 @@ class ManageWindow(QWidget):
self.combo_styles.setStyleSheet('QComboBox {font-size: 12px;}')
self.ref_combo_styles = self.toolbar_bottom.addWidget(self.combo_styles)
bt_settings = IconButton(icon_path=resource.get_path('img/app_settings.svg'), action=self._show_settings_menu, background='#12ABAB')
bt_settings = IconButton(icon_path=resource.get_path('img/app_settings.svg'),
action=self._show_settings_menu,
background='#12ABAB',
tooltip=self.i18n['manage_window.bt_settings.tooltip'])
self.ref_bt_settings = self.toolbar_bottom.addWidget(bt_settings)
self.layout.addWidget(self.toolbar_bottom)

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 283 B

After

Width:  |  Height:  |  Size: 283 B

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 820 B

After

Width:  |  Height:  |  Size: 820 B

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@@ -47,6 +47,8 @@ tray.action.manage=Manage applications
tray.action.exit=Quit
tray.action.about=About
tray.action.refreshing=Refreshing
action.info.tooltip=Click here to see information about this application
action.settings.tooltip=Click here to open extra actions
notification.new_updates=Updates
notification.update_selected.success=app(s) updated successfully
notification.update_selected.failed=Update failed
@@ -111,4 +113,5 @@ exit=exit
manage_window.settings.gems=Application types
style=style
style.change.title=Style change
style.change.question=To change the current style is necessary to restart {}. Proceed ?
style.change.question=To change the current style is necessary to restart {}. Proceed ?
manage_window.bt_settings.tooltip=Click here to open extra actions

View File

@@ -49,6 +49,8 @@ tray.action.manage=Administrar aplicativos
tray.action.exit=Cerrar
tray.action.about=Sobre
tray.action.refreshing=Recargando
action.info.tooltip=Haga clic aquí para ver informaciones sobre este aplicativo
action.settings.tooltip=Haga clic aquí para abrir acciones adicionales
notification.new_updates=Actualizaciones
notification.update_selected.success=aplicativo(s) actualizado(s) con éxito
notification.update_selected.failed=La actualización falló
@@ -113,4 +115,5 @@ exit=salir
manage_window.settings.gems=Tipos de aplicativos
style=estilo
style.change.title=Cambio de estilo
style.change.question=Para cambiar el estilo actual es necesario reiniciar {}. ¿Proceder?
style.change.question=Para cambiar el estilo actual es necesario reiniciar {}. ¿Proceder?
manage_window.bt_settings.tooltip=Haga clic aquí para abrir acciones adicionales

View File

@@ -99,6 +99,8 @@ ask.continue=Continuar ?
cancel=cancelar
status.caching_data=Cacheando dados de {} para o disco
action.run.tooltip=Clique aqui para iniciar esse aplicativo
action.info.tooltip=Clique aqui para ver informações sobre este aplicativo
action.settings.tooltip=Clique aqui para abrir ações adicionais
any=qualquer
manage_window.name_filter.tooltip=Digite aqui para filtrar aplicativos pelo nome
manage_window.name_filter.placeholder=Filtrar por nome
@@ -113,4 +115,5 @@ exit=sair
manage_window.settings.gems=Tipos de aplicativos
style=estilo
style.change.title=Mudança de estilo
style.change.question=Para alterar o estilo atual é necessário reiniciar o {}. Continuar ?
style.change.question=Para alterar o estilo atual é necessário reiniciar o {}. Continuar ?
manage_window.bt_settings.tooltip=Clique aqui para abrir ações adicionais

View File

@@ -2,4 +2,4 @@ from bauh import ROOT_DIR
def get_path(resource_path):
return ROOT_DIR + '/resources/' + resource_path
return ROOT_DIR + '/view/resources/' + resource_path

View File

@@ -7,7 +7,7 @@ import sys
from PyQt5.QtCore import QCoreApplication
from bauh import __app_name__
from bauh.util import resource
from bauh.view.util import resource
def get_locale_keys(key: str = None, locale_dir: str = resource.get_path('locale')):

View File

@@ -31,7 +31,7 @@ setup(
python_requires=">=3.5",
url=URL,
packages=find_packages(),
package_data={NAME: ["resources/locale/*", "resources/img/*", "gems/*/resources/img/*", "gems/*/resources/locale/*"]},
package_data={NAME: ["view/resources/locale/*", "view/resources/img/*", "gems/*/resources/img/*", "gems/*/resources/locale/*"]},
install_requires=requirements,
entry_points={
"console_scripts": [