mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 05:54:15 +02:00
Arch gem is not enabled by default
This commit is contained in:
@@ -226,3 +226,9 @@ class SoftwareManager(ABC):
|
||||
:return: if the action resulted in success
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def is_default_enabled(self) -> bool:
|
||||
"""
|
||||
:return: if the instance is enabled by default when there is no user settings defining which gems are enabled.
|
||||
"""
|
||||
|
||||
@@ -81,3 +81,7 @@ def main():
|
||||
cache_cleaner.start()
|
||||
|
||||
sys.exit(app.exec_())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -7,7 +7,7 @@ from bauh import __app_name__, __version__
|
||||
|
||||
|
||||
def read() -> Namespace:
|
||||
parser = argparse.ArgumentParser(prog=__app_name__, description="GUI for Linux packages management")
|
||||
parser = argparse.ArgumentParser(prog=__app_name__, description="GUI for Linux package management")
|
||||
parser.add_argument('-v', '--version', action='version', version='%(prog)s {}'.format(__version__))
|
||||
parser.add_argument('-e', '--cache-exp', action="store",
|
||||
default=int(os.getenv('BAUH_CACHE_EXPIRATION', 60 * 60)), type=int,
|
||||
|
||||
@@ -577,3 +577,6 @@ class ArchManager(SoftwareManager):
|
||||
res.append(PackageSuggestion(self.mapper.map_api_data(pkg, {}), suggestions.ALL.get(pkg['Name'])))
|
||||
|
||||
return res
|
||||
|
||||
def is_default_enabled(self) -> bool:
|
||||
return False
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
gem.arch.label=Arch ( AUR )
|
||||
gem.arch.info=AUR packages are maintained by an independent user community. There is no warranty that they will work or not harm you system.
|
||||
arch.install.conflict.popup.title=Conflict detected
|
||||
arch.install.conflict.popup.body=The applications {} are in conflict. You must uninstall one to install the other. Continue ?
|
||||
arch.missing_deps.title=Missing dependencies
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
gem.arch.label=Arch ( AUR )
|
||||
gem.arch.info=Los paquetes AUR son mantenidos por una comunidad de usuarios independiente. No hay garantía de que funcionen o que no dañen su sistema.
|
||||
aur.info.architecture=arquitectura
|
||||
aur.info.architecture.any=cualquier
|
||||
aur.info.build date=fecha de construcción
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
gem.arch.label=Arch ( AUR )
|
||||
gem.arch.info=Pacotes do AUR são mantidos por uma comunidade de usuários independente. Não há garantia que funcionarão ou que não prejudicarão o seus sistema.
|
||||
aur.info.architecture=arquitetura
|
||||
aur.info.architecture.any=qualquer
|
||||
aur.info.build date=data de construção
|
||||
|
||||
@@ -206,3 +206,6 @@ class FlatpakManager(SoftwareManager):
|
||||
break
|
||||
|
||||
return res
|
||||
|
||||
def is_default_enabled(self) -> bool:
|
||||
return True
|
||||
|
||||
@@ -170,3 +170,6 @@ class SnapManager(SoftwareManager):
|
||||
t.join()
|
||||
|
||||
return res
|
||||
|
||||
def is_default_enabled(self) -> bool:
|
||||
return True
|
||||
|
||||
@@ -313,3 +313,6 @@ class GenericSoftwareManager(SoftwareManager):
|
||||
|
||||
if man:
|
||||
return exec('man.{}(pkg=pkg, root_password=root_password, watcher=watcher)'.format(action.manager_method))
|
||||
|
||||
def is_default_enabled(self) -> bool:
|
||||
return True
|
||||
|
||||
@@ -37,8 +37,10 @@ def load_managers(locale: str, context: ApplicationContext, enabled_gems: List[s
|
||||
|
||||
man = manager_class(context=context)
|
||||
|
||||
if enabled_gems is not None and f.name not in enabled_gems:
|
||||
man.set_enabled(False)
|
||||
if enabled_gems is None:
|
||||
man.set_enabled(man.is_default_enabled())
|
||||
else:
|
||||
man.set_enabled(f.name in enabled_gems)
|
||||
|
||||
managers.append(man)
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtGui import QIcon, QPixmap
|
||||
from PyQt5.QtWidgets import QRadioButton, QGroupBox, QCheckBox, QComboBox, QGridLayout, QWidget, \
|
||||
QLabel, QSizePolicy, QLineEdit, QToolButton, QHBoxLayout
|
||||
|
||||
from bauh.api.abstract.view import SingleSelectComponent, InputOption, MultipleSelectComponent, SelectViewType
|
||||
from bauh.view.util import resource
|
||||
|
||||
|
||||
class RadioButtonQt(QRadioButton):
|
||||
@@ -122,6 +123,15 @@ class MultipleSelectQt(QGroupBox):
|
||||
self.setLayout(self._layout)
|
||||
|
||||
line, col = 0, 0
|
||||
|
||||
pixmap_help = QPixmap()
|
||||
|
||||
for op in model.options: # loads the help icon if at least one option has a tooltip
|
||||
if op.tooltip:
|
||||
with open(resource.get_path('img/help.png'), 'rb') as f:
|
||||
pixmap_help.loadFromData(f.read())
|
||||
break
|
||||
|
||||
for op in model.options:
|
||||
comp = CheckboxQt(op, model, callback)
|
||||
|
||||
@@ -129,7 +139,17 @@ class MultipleSelectQt(QGroupBox):
|
||||
self.value = comp
|
||||
comp.setChecked(True)
|
||||
|
||||
self._layout.addWidget(comp, line, col)
|
||||
widget = QWidget()
|
||||
widget.setLayout(QHBoxLayout())
|
||||
widget.layout().addWidget(comp)
|
||||
|
||||
if op.tooltip:
|
||||
help_icon = QLabel()
|
||||
help_icon.setPixmap(pixmap_help)
|
||||
help_icon.setToolTip(op.tooltip)
|
||||
widget.layout().addWidget(help_icon)
|
||||
|
||||
self._layout.addWidget(widget, line, col)
|
||||
|
||||
if col + 1 == self.model.max_per_line:
|
||||
line += 1
|
||||
|
||||
@@ -37,19 +37,26 @@ class GemSelectorPanel(QWidget):
|
||||
|
||||
self.gem_map = {}
|
||||
gem_options = []
|
||||
current_enabled = set()
|
||||
|
||||
for m in manager.managers:
|
||||
if m.can_work():
|
||||
modname = m.__module__.split('.')[-2]
|
||||
gem_options.append(InputOption(label=i18n.get('gem.{}.label'.format(modname), modname.capitalize()),
|
||||
value=modname,
|
||||
icon_path='{r}/gems/{n}/resources/img/{n}.png'.format(r=ROOT_DIR, n=modname)))
|
||||
op = InputOption(label=i18n.get('gem.{}.label'.format(modname), modname.capitalize()),
|
||||
tooltip=i18n.get('gem.{}.info'.format(modname)),
|
||||
value=modname,
|
||||
icon_path='{r}/gems/{n}/resources/img/{n}.png'.format(r=ROOT_DIR, n=modname))
|
||||
|
||||
gem_options.append(op)
|
||||
self.gem_map[modname] = m
|
||||
|
||||
if m.is_enabled():
|
||||
current_enabled.add(op)
|
||||
|
||||
if self.config.enabled_gems:
|
||||
default_ops = {o for o in gem_options if o.value in self.config.enabled_gems}
|
||||
else:
|
||||
default_ops = set(gem_options)
|
||||
default_ops = current_enabled
|
||||
|
||||
self.bt_proceed.setEnabled(bool(default_ops))
|
||||
|
||||
|
||||
BIN
bauh/view/resources/img/help.png
Normal file
BIN
bauh/view/resources/img/help.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 782 B |
Reference in New Issue
Block a user