Skip to content

Commit

Permalink
0.8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
vinifmor authored Jan 31, 2020
2 parents c1f210f + 6c0a478 commit 86ecf43
Show file tree
Hide file tree
Showing 69 changed files with 2,279 additions and 421 deletions.
59 changes: 53 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,56 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [0.8.2] - 2020-01-31
### Features
- New **Settings** panel ( displayed when the lower **Settings** button is clicked ). It allows to change all settings.

### Improvements
- Flatpak
- configuration file ( **flatpak.yml** ) will be created during the initialization ( on **0.8.1** it would only be created during the first app installation )
- AUR
- the custom **makepkg.conf** generated at **~/.config/bauh/arch** will enable **ccache** if available on the system
- downgrading time reduced due to the fix described in ***Fixes***
- package databases synchronization once a day ( or every device reboot ) before the first package installation / upgrade / downgrade. This behavior can be disabled on **~/.config/arch.yml** / or the new settings panel
```
sync_databases: true # enabled by default
```
- Configuration ( **~/.config/bauh/config.yml** )
- new property **hdpi** allowing to disable HDPI improvements
```
ui:
hdpi: true # enabled by default
```
- new property **auto_scale** activates Qt auto screen scale factor ( **QT_AUTO_SCREEN_SCALE_FACTOR** ). It fixes scaling issues
for some desktop environments ( like Gnome ) [#1](https://github.com/vinifmor/bauh/issues/1)
```
ui:
auto_scale: false # disabled by default
```
### Fixes
- AUR
- not treating **makedepends** as a list during dependency checking ( **anbox-git** installation was crashing )
- not considering the package name itself as **provided** during dependency checking ( **anbox-git** installation was crashing )
- not pre-downloading some source files ( e.g: from **anbox-image** )
- not able to install packages based on other packages ( package name != package base ). e.g: **anbox-modules-dkms-git** > **anbox-git**
- downgrade: pre-downloading sources from the latest version instead of the older
- Flatpak
- downgrade: displaying "No Internet connection" when an error happens during commits reading
- Flatpak < 1.5: an exception happens when trying to retrieve the information from partials
- UI:
- **About** window icons scaling
- Toolbar buttons get hidden [#5](https://github.com/vinifmor/bauh/issues/5)
- not displaying icons retrieved from a HTTP redirect
- minor bug fixes
### UI
- **Style selector** and **Application types** menu action moved to the new **Settings panel**
- **About** menu action split from the **Settings** menu as a new button
- The file chooser component now has a clean button alongside
## [0.8.1] 2020-01-14
### Features:
- Flatpak:
### Features
- Flatpak
- allow the user to choose the application installation level: **user** or **system** [#47](https://github.com/vinifmor/bauh/issues/47)
- able to deal with user and system applications / runtimes [#47](https://github.com/vinifmor/bauh/issues/47)
- able to list partial updates for Flatpak >= 1.4
Expand All @@ -15,16 +62,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Improvements
- All icons are now SVG files
- HDPI support improvements ( by [octopusSD](https://github.com/octopusSD) )
- Flatpak:
- Flatpak
- the application name tooltip now displays the installation level. e.g: **gedit ( system )**
- info window displaying the installation level
- "remote not set" warning dropped in favor of the new behavior: automatically adds Flathub as the default remote at the user level
- Snap:
- Snap
- snapd checking routine refactored
- Web:
- Web
- not using HTTP sessions anymore to perform the searches. It seems to avoid URLs not being found after an internet drop event
- supporting JPEG images as custom icons
- UI:
- UI
- widgets visibility settings: the main widgets now should always be visible ( e.g: toolbar buttons )
- scaling
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ db_updater:
```
optimize: true # if 'false': disables the auto-compilation improvements
transitive_checking: true # if 'false': the dependency checking process will be faster, but the application will ask for a confirmation every time a not installed dependency is detected.
sync_databases: true # package databases synchronization once a day ( or every device reboot ) before the first package installation / upgrade / downgrade
```
- Required dependencies:
- **pacman**
Expand Down Expand Up @@ -242,6 +243,8 @@ ui:
tray: # system tray settings
default_icon: null # defines a path to a custom icon
updates_icon: null # defines a path to a custom icon indicating updates
hdpi: true # enables HDPI rendering improvements. Use 'false' to disable them if you think the interface looks strange
auto_scale: false # activates Qt auto screen scale factor (QT_AUTO_SCREEN_SCALE_FACTOR). It fixes scaling issues for some desktop environments ( like Gnome )
updates:
check_interval: 30 # the updates checking interval in SECONDS
Expand Down
2 changes: 1 addition & 1 deletion bauh/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.8.1'
__version__ = '0.8.2'
__app_name__ = 'bauh'

import os
Expand Down
4 changes: 3 additions & 1 deletion bauh/api/abstract/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ApplicationContext:

def __init__(self, disk_cache: bool, download_icons: bool, http_client: HttpClient, app_root_dir: str, i18n: I18n,
cache_factory: MemoryCacheFactory, disk_loader_factory: DiskCacheLoaderFactory,
logger: logging.Logger, file_downloader: FileDownloader, distro: str):
logger: logging.Logger, file_downloader: FileDownloader, distro: str, app_name: str):
"""
:param disk_cache: if package data should be cached to disk
:param download_icons: if packages icons should be downloaded
Expand All @@ -24,6 +24,7 @@ def __init__(self, disk_cache: bool, download_icons: bool, http_client: HttpClie
:param logger: a logger instance
:param file_downloader
:param distro
:param app_name
"""
self.disk_cache = disk_cache
self.download_icons = download_icons
Expand All @@ -38,6 +39,7 @@ def __init__(self, disk_cache: bool, download_icons: bool, http_client: HttpClie
self.distro = distro
self.default_categories = ('AudioVideo', 'Audio', 'Video', 'Development', 'Education', 'Game',
'Graphics', 'Network', 'Office', 'Science', 'Settings', 'System', 'Utility')
self.app_name = app_name

def is_system_x86_64(self):
return self.arch_x86_64
17 changes: 16 additions & 1 deletion bauh/api/abstract/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import shutil
from abc import ABC, abstractmethod
from pathlib import Path
from typing import List, Set, Type
from typing import List, Set, Type, Tuple

import yaml

from bauh.api.abstract.context import ApplicationContext
from bauh.api.abstract.disk import DiskCacheLoader
from bauh.api.abstract.handler import ProcessWatcher
from bauh.api.abstract.model import SoftwarePackage, PackageUpdate, PackageHistory, PackageSuggestion, PackageAction
from bauh.api.abstract.view import FormComponent, ViewComponent


class SearchResult:
Expand Down Expand Up @@ -272,3 +273,17 @@ def clear_data(self):
Removes all data created by the SoftwareManager instance
"""
pass

def get_settings(self, screen_width: int, screen_height: int) -> ViewComponent:
"""
:param screen_width
:param screen_height
:return: a form abstraction with all available settings
"""
pass

def save_settings(self, component: ViewComponent) -> Tuple[bool, List[str]]:
"""
:return: a tuple with a bool informing if the settings were saved and a list of error messages
"""
pass
93 changes: 83 additions & 10 deletions bauh/api/abstract/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@ def __init__(self, id_: str):
self.id = id_


class SpacerComponent(ViewComponent):

def __init__(self):
super(SpacerComponent, self).__init__(id_=None)


class PanelComponent(ViewComponent):

def __init__(self, components: List[ViewComponent], id_: str = None):
super(PanelComponent, self).__init__(id_=id_)
self.components = components
self.component_map = {c.id: c for c in components if c.id is not None} if components else None

def get_component(self, id_: str) -> ViewComponent:
if self.component_map:
return self.component_map.get(id_)


class InputViewComponent(ViewComponent):
"""
Represents an component which needs a user interaction to provide its value
Expand All @@ -38,9 +56,6 @@ def __init__(self, label: str, value: object, tooltip: str = None, icon_path: st
if not label:
raise Exception("'label' must be a not blank string")

if value is None:
raise Exception("'value' must be a not blank string")

self.id = id_
self.label = label
self.value = value
Expand All @@ -59,13 +74,16 @@ class SelectViewType(Enum):

class SingleSelectComponent(InputViewComponent):

def __init__(self, type_: SelectViewType, label: str, options: List[InputOption], default_option: InputOption = None, max_per_line: int = 1, id_: str = None):
def __init__(self, type_: SelectViewType, label: str, options: List[InputOption], default_option: InputOption = None,
max_per_line: int = 1, tooltip: str = None, max_width: int = -1, id_: str = None):
super(SingleSelectComponent, self).__init__(id_=id_)
self.type = type_
self.label = label
self.options = options
self.value = default_option
self.max_per_line = max_per_line
self.tooltip = tooltip
self.max_width = max_width

def get_selected(self):
if self.value:
Expand All @@ -74,16 +92,22 @@ def get_selected(self):

class MultipleSelectComponent(InputViewComponent):

def __init__(self, label: str, options: List[InputOption], default_options: Set[InputOption] = None, max_per_line: int = 1, id_: str = None):
def __init__(self, label: str, options: List[InputOption], default_options: Set[InputOption] = None,
max_per_line: int = 1, tooltip: str = None, spaces: bool = True, max_width: int = -1,
max_height: int = -1, id_: str = None):
super(MultipleSelectComponent, self).__init__(id_=id_)

if not options:
raise Exception("'options' cannot be None or empty")

self.options = options
self.spaces = spaces
self.label = label
self.tooltip = tooltip
self.values = default_options if default_options else set()
self.max_per_line = max_per_line
self.max_width = max_width
self.max_height = max_height

def get_selected_values(self) -> list:
selected = []
Expand All @@ -95,40 +119,89 @@ def get_selected_values(self) -> list:

class TextComponent(ViewComponent):

def __init__(self, html: str, id_: str = None):
def __init__(self, html: str, max_width: int = -1, tooltip: str = None, id_: str = None):
super(TextComponent, self).__init__(id_=id_)
self.value = html
self.max_width = max_width
self.tooltip = tooltip


class TwoStateButtonComponent(ViewComponent):

def __init__(self, label: str, tooltip: str = None, state: bool = False, id_: str = None):
super(TwoStateButtonComponent, self).__init__(id_=id_)
self.label = label
self.tooltip = tooltip
self.state = state


class TextInputComponent(ViewComponent):

def __init__(self, label: str, value: str = '', placeholder: str = None, tooltip: str = None, read_only: bool =False, id_: str = None):
def __init__(self, label: str, value: str = '', placeholder: str = None, tooltip: str = None, read_only: bool =False,
id_: str = None, only_int: bool = False, max_width: int = -1):
super(TextInputComponent, self).__init__(id_=id_)
self.label = label
self.value = value
self.tooltip = tooltip
self.placeholder = placeholder
self.read_only = read_only
self.only_int = only_int
self.max_width = max_width

def get_value(self) -> str:
if self.value is not None:
return self.value.strip()
else:
return ''

def get_int_value(self) -> int:
if self.value is not None:
return int(self.value)
return None


class FormComponent(ViewComponent):

def __init__(self, components: List[ViewComponent], label: str = None, id_: str = None):
def __init__(self, components: List[ViewComponent], label: str = None, spaces: bool = True, id_: str = None):
super(FormComponent, self).__init__(id_=id_)
self.label = label
self.spaces = spaces
self.components = components
self.component_map = {c.id: c for c in components if c.id} if components else None

def get_component(self, id_: str) -> ViewComponent:
if self.component_map:
return self.component_map.get(id_)


class FileChooserComponent(ViewComponent):

def __init__(self, allowed_extensions: Set[str] = None, label: str = None, id_: str = None):
def __init__(self, allowed_extensions: Set[str] = None, label: str = None, tooltip: str = None,
file_path: str = None, max_width: int = -1, id_: str = None):
super(FileChooserComponent, self).__init__(id_=id_)
self.label = label
self.allowed_extensions = allowed_extensions
self.file_path = None
self.file_path = file_path
self.tooltip = tooltip
self.max_width = max_width


class TabComponent(ViewComponent):

def __init__(self, label: str, content: ViewComponent, icon_path: str = None, id_: str = None):
super(TabComponent, self).__init__(id_=id_)
self.label = label
self.content = content
self.icon_path = icon_path


class TabGroupComponent(ViewComponent):

def __init__(self, tabs: List[TabComponent], id_: str = None):
super(TabGroupComponent, self).__init__(id_=id_)
self.tabs = tabs
self.tab_map = {c.id: c for c in tabs if c.id} if tabs else None

def get_tab(self, id_: str) -> TabComponent:
if self.tab_map:
return self.tab_map.get(id_)
16 changes: 12 additions & 4 deletions bauh/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from threading import Thread

import urllib3
from PyQt5.QtCore import Qt
from PyQt5.QtCore import Qt, QCoreApplication
from PyQt5.QtWidgets import QApplication

from bauh import __version__, __app_name__, app_args, ROOT_DIR
Expand Down Expand Up @@ -31,10 +31,18 @@ def main():
args = app_args.read()

logger = logs.new_logger(__app_name__, bool(args.logs))
app_args.validate(args, logger)

local_config = config.read_config(update_file=True)

if local_config['ui']['auto_scale']:
os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1'
logger.info("Auto screen scale factor activated")

if local_config['ui']['hdpi']:
logger.info("HDPI settings activated")
QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)
QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)

i18n_key, current_i18n = translation.get_locale_keys(local_config['locale'])
default_i18n = translation.get_locale_keys(DEFAULT_I18N_KEY)[1] if i18n_key != DEFAULT_I18N_KEY else {}
i18n = I18n(i18n_key, current_i18n, DEFAULT_I18N_KEY, default_i18n)
Expand All @@ -55,7 +63,8 @@ def main():
logger=logger,
distro=util.get_distro(),
file_downloader=AdaptableFileDownloader(logger, bool(local_config['download']['multithreaded']),
i18n, http_client))
i18n, http_client),
app_name=__app_name__)

managers = gems.load_managers(context=context, locale=i18n_key, config=local_config, default_locale=DEFAULT_I18N_KEY)

Expand All @@ -71,7 +80,6 @@ def main():
app.setApplicationVersion(__version__)
app_icon = util.get_default_icon()[1]
app.setWindowIcon(app_icon)
app.setAttribute(Qt.AA_UseHighDpiPixmaps) # This fix images on HDPI resolution, not tested on non HDPI

if local_config['ui']['style']:
app.setStyle(str(local_config['ui']['style']))
Expand Down
8 changes: 0 additions & 8 deletions bauh/app_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,3 @@ def read() -> Namespace:
parser.add_argument('--show-panel', action="store_true", help='Shows the management panel after the app icon is attached to the tray.')
parser.add_argument('--reset', action="store_true", help='Removes all configuration and cache files')
return parser.parse_args()


def validate(args: Namespace, logger: logging.Logger):

if args.logs == 1:
logger.info("Logs are enabled")

return args
Loading

0 comments on commit 86ecf43

Please sign in to comment.