mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-08 12:04:16 +02:00
[ui][settings] more improvements and settings
This commit is contained in:
@@ -110,6 +110,15 @@ class TextComponent(ViewComponent):
|
|||||||
self.value = html
|
self.value = html
|
||||||
|
|
||||||
|
|
||||||
|
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):
|
class TextInputComponent(ViewComponent):
|
||||||
|
|
||||||
def __init__(self, label: str, value: str = '', placeholder: str = None, tooltip: str = None, read_only: bool =False, id_: str = None, only_int: bool = False):
|
def __init__(self, label: str, value: str = '', placeholder: str = None, tooltip: str = None, read_only: bool =False, id_: str = None, only_int: bool = False):
|
||||||
@@ -139,7 +148,7 @@ class FormComponent(ViewComponent):
|
|||||||
super(FormComponent, self).__init__(id_=id_)
|
super(FormComponent, self).__init__(id_=id_)
|
||||||
self.label = label
|
self.label = label
|
||||||
self.components = components
|
self.components = components
|
||||||
self.component_map = {c.id : c for c in components if c.id} if components else None
|
self.component_map = {c.id: c for c in components if c.id} if components else None
|
||||||
|
|
||||||
def get_component(self, id_: str) -> ViewComponent:
|
def get_component(self, id_: str) -> ViewComponent:
|
||||||
if self.component_map:
|
if self.component_map:
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ appimage.downgrade.uninstall_current_version=No s’ha pogut desinstal·lar la v
|
|||||||
appimage.downgrade.install_version=No s’ha pogut instal·lar la versió {} ({})
|
appimage.downgrade.install_version=No s’ha pogut instal·lar la versió {} ({})
|
||||||
appimage.install.download.error=No s’ha pogut baixar el fitxer {}. El servidor del fitxer pot estar inactiu.
|
appimage.install.download.error=No s’ha pogut baixar el fitxer {}. El servidor del fitxer pot estar inactiu.
|
||||||
appimage.install.appimagelauncher.error = {appimgl} no permet la instal·lació de {app}. Desinstal·leu {appimgl}, reinicieu el sistema i torneu a provar d’instal·lar {app}.
|
appimage.install.appimagelauncher.error = {appimgl} no permet la instal·lació de {app}. Desinstal·leu {appimgl}, reinicieu el sistema i torneu a provar d’instal·lar {app}.
|
||||||
appimage.config.db_updates=Actualització de la base de dades
|
appimage.config.db_updates=Database update
|
||||||
appimage.config.db_updates.activated=activada
|
appimage.config.db_updates.activated=activated
|
||||||
appimage.config.db_updates.activated.tip={app} és capaç de verificar si hi ha actualitzacions de les aplicacions instal·lades
|
appimage.config.db_updates.activated.tip={app} is able to verify if there are updates for your installed applications
|
||||||
appimage.config.db_updates.interval.tip=Interval d'actualització a SECONDS
|
appimage.config.db_updates.interval.tip=Update interval in SECONDS
|
||||||
@@ -17,7 +17,7 @@ appimage.error.uninstall_current_version=Deinstallation der aktuellen Version vo
|
|||||||
appimage.downgrade.install_version=Die Installation der Version {} ({}) war nicht möglich
|
appimage.downgrade.install_version=Die Installation der Version {} ({}) war nicht möglich
|
||||||
appimage.install.download.error=Das Herunterladen der Datei {} ist fehlgeschlagen. Eventuell ist der Server nicht verfügbar
|
appimage.install.download.error=Das Herunterladen der Datei {} ist fehlgeschlagen. Eventuell ist der Server nicht verfügbar
|
||||||
appimage.install.appimagelauncher.error={appimgl} verhindert die installation von {app}. Deinstalliere {appimgl}, starte deinen Computer neu und versuche die installation von {app} erneut.
|
appimage.install.appimagelauncher.error={appimgl} verhindert die installation von {app}. Deinstalliere {appimgl}, starte deinen Computer neu und versuche die installation von {app} erneut.
|
||||||
appimage.config.db_updates=Datenbankaktualisierung
|
appimage.config.db_updates=Database update
|
||||||
appimage.config.db_updates.activated=aktiviert
|
appimage.config.db_updates.activated=activated
|
||||||
appimage.config.db_updates.activated.tip={app} kann überprüfen, ob Aktualisierungen für Ihre installierten Anwendungen vorhanden sind
|
appimage.config.db_updates.activated.tip={app} is able to verify if there are updates for your installed applications
|
||||||
appimage.config.db_updates.interval.tip=Aktualisierungsintervall in SEKUNDEN
|
appimage.config.db_updates.interval.tip=Update interval in SECONDS
|
||||||
@@ -17,8 +17,8 @@ appimage.error.uninstall_current_version = Non è stato possibile disinstallare
|
|||||||
appimage.downgrade.install_version=Non è stato possibile installare la versione {} ({})
|
appimage.downgrade.install_version=Non è stato possibile installare la versione {} ({})
|
||||||
appimage.install.download.error=Non è stato possibile scaricare il file {}. Il file server può essere inattivo.
|
appimage.install.download.error=Non è stato possibile scaricare il file {}. Il file server può essere inattivo.
|
||||||
appimage.install.appimagelauncher.error={appimgl} non consente l'installazione di {app}. Disinstallare {appimgl}, riavviare il sistema e provare a installare nuovamente {app}.
|
appimage.install.appimagelauncher.error={appimgl} non consente l'installazione di {app}. Disinstallare {appimgl}, riavviare il sistema e provare a installare nuovamente {app}.
|
||||||
appimage.config.db_updates=Aggiornamento della banca dati
|
appimage.config.db_updates=Database update
|
||||||
appimage.config.db_updates.activated=attivata
|
appimage.config.db_updates.activated=activated
|
||||||
appimage.config.db_updates.activated.tip={app} è in grado di verificare se ci sono aggiornamenti per le tue applicazioni installate
|
appimage.config.db_updates.activated.tip={app} is able to verify if there are updates for your installed applications
|
||||||
appimage.config.db_updates.interval.tip=Intervallo di aggiornamento in SECONDI
|
appimage.config.db_updates.interval.tip=Update interval in SECONDS
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ arch.install.aur.unknown_key.body=Per a continuar amb la instal·lació de {} ca
|
|||||||
arch.aur.install.validity_check.title=Problemes d’integritat
|
arch.aur.install.validity_check.title=Problemes d’integritat
|
||||||
arch.aur.install.validity_check.body=Alguns dels fitxers font necessaris per a la instal·lació de {} són malmesos. La instal·lació es cancel·larà per a evitar danys al vostre sistema.
|
arch.aur.install.validity_check.body=Alguns dels fitxers font necessaris per a la instal·lació de {} són malmesos. La instal·lació es cancel·larà per a evitar danys al vostre sistema.
|
||||||
arch.makepkg.optimizing=Optimitzant la recopilació
|
arch.makepkg.optimizing=Optimitzant la recopilació
|
||||||
arch.config.optimize=optimitzar
|
arch.config.optimize=optimize
|
||||||
arch.config.trans_dep_check=verificar dependències
|
arch.config.trans_dep_check=check dependencies
|
||||||
arch.config.optimize.tip=La configuració optimitzada s'utilitzarà per fer més ràpida la instal·lació dels paquets, en cas contrari s'utilitzarà la configuració del sistema
|
arch.config.optimize.tip=Optimized settings will be used in order to make the packages installation faster, otherwise the system settings will be used
|
||||||
arch.config.trans_dep_check.tip=Si totes les dependències del paquet s’han de verificar abans de començar la instal·lació. En cas contrari, es descobriran durant la instal·lació
|
arch.config.trans_dep_check.tip=If all the package dependencies should be verified before the installation starts. Otherwise they will be discovered during the installation
|
||||||
@@ -102,7 +102,7 @@ aur.info.options=Optionen
|
|||||||
aur.info.provides=stellt bereit
|
aur.info.provides=stellt bereit
|
||||||
aur.info.conflicts with=Konflikt mit
|
aur.info.conflicts with=Konflikt mit
|
||||||
arch.makepkg.optimizing=Optimiert die Zusammenstellung
|
arch.makepkg.optimizing=Optimiert die Zusammenstellung
|
||||||
arch.config.optimize=optimieren
|
arch.config.optimize=optimize
|
||||||
arch.config.trans_dep_check=Um Abhängigkeiten zu verifizieren
|
arch.config.trans_dep_check=check dependencies
|
||||||
arch.config.optimize.tip=Optimierte Einstellungen werden verwendet, um die Paketinstallation zu beschleunigen, andernfalls werden die Systemeinstellungen verwendet
|
arch.config.optimize.tip=Optimized settings will be used in order to make the packages installation faster, otherwise the system settings will be used
|
||||||
arch.config.trans_dep_check.tip=Wenn alle Paketabhängigkeiten überprüft werden sollen, bevor die Installation beginnt. Andernfalls werden sie während der Installation erkannt
|
arch.config.trans_dep_check.tip=If all the package dependencies should be verified before the installation starts. Otherwise they will be discovered during the installation
|
||||||
@@ -70,7 +70,7 @@ arch.aur.install.unknown_key.receive_error=Impossibile ricevere la chiave pubbli
|
|||||||
arch.aur.install.validity_check.title=Problemi di integrità
|
arch.aur.install.validity_check.title=Problemi di integrità
|
||||||
arch.aur.install.validity_check.body=Alcuni dei file di origine necessari per l'installazione di {} non sono integri. L'installazione verrà annullata per evitare danni al sistema.
|
arch.aur.install.validity_check.body=Alcuni dei file di origine necessari per l'installazione di {} non sono integri. L'installazione verrà annullata per evitare danni al sistema.
|
||||||
arch.makepkg.optimizing=Ottimizzando la compilazione
|
arch.makepkg.optimizing=Ottimizzando la compilazione
|
||||||
arch.config.optimize=ottimizzare
|
arch.config.optimize=optimize
|
||||||
arch.config.trans_dep_check=verificare dipendenze
|
arch.config.trans_dep_check=check dependencies
|
||||||
arch.config.optimize.tip=Le impostazioni ottimizzate verranno utilizzate per rendere l'installazione dei pacchetti più veloce, altrimenti verranno utilizzate le impostazioni di sistema
|
arch.config.optimize.tip=Optimized settings will be used in order to make the packages installation faster, otherwise the system settings will be used
|
||||||
arch.config.trans_dep_check.tip=Se tutte le dipendenze del pacchetto devono essere verificate prima dell'inizio dell'installazione. Altrimenti verranno scoperti durante l'installazione
|
arch.config.trans_dep_check.tip=If all the package dependencies should be verified before the installation starts. Otherwise they will be discovered during the installation
|
||||||
@@ -46,10 +46,10 @@ flatpak.install.install_level.title=Tipus d'instal·lació
|
|||||||
flatpak.install.install_level.body=S'ha d'instal·lar {} per a tots els usuaris del dispositiu ( sistema ) ?
|
flatpak.install.install_level.body=S'ha d'instal·lar {} per a tots els usuaris del dispositiu ( sistema ) ?
|
||||||
flatpak.install.bad_install_level.body=Valor invàlid per a {field} al fitxer de configuració {file}
|
flatpak.install.bad_install_level.body=Valor invàlid per a {field} al fitxer de configuració {file}
|
||||||
flatpak.remotes.system_flathub.error=No s'ha pogut afegir Flathub com a dipòsit del sistema ( remote )
|
flatpak.remotes.system_flathub.error=No s'ha pogut afegir Flathub com a dipòsit del sistema ( remote )
|
||||||
flatpak.config.install_level.system=sistema
|
flatpak.config.install_level.system=system
|
||||||
flatpak.config.install_level.system.tip=Les aplicacions s’instal·laran per a tots els usuaris del dispositiu
|
flatpak.config.install_level.system.tip=Applications will be installed for all the device users
|
||||||
flatpak.config.install_level.user=usuari
|
flatpak.config.install_level.user=user
|
||||||
flatpak.config.install_level.user.tip=L’aplicació s’instal·larà només per a l’usuari actual
|
flatpak.config.install_level.user.tip=Application will be installed only for the current user
|
||||||
flatpak.config.install_level.ask=preguntar
|
flatpak.config.install_level.ask=ask
|
||||||
flatpak.config.install_level.ask.tip={app} demanarà el nivell que s'ha d'aplicar durant la instal·lació de l'aplicació
|
flatpak.config.install_level.ask.tip={app} will ask the level that should be applied during the app installation
|
||||||
flatpak.config.install_level=nivell
|
flatpak.config.install_level=level
|
||||||
@@ -46,9 +46,9 @@ flatpak.install.install_level.body=Sollte {} für alle Gerätebenutzer installie
|
|||||||
flatpak.install.bad_install_level.body=Ungültiger Wert für {field} in der Konfigurationsdatei {file}
|
flatpak.install.bad_install_level.body=Ungültiger Wert für {field} in der Konfigurationsdatei {file}
|
||||||
flatpak.remotes.system_flathub.error=Flathub konnte nicht als System-Repository ( remote ) hinzugefügt werden
|
flatpak.remotes.system_flathub.error=Flathub konnte nicht als System-Repository ( remote ) hinzugefügt werden
|
||||||
flatpak.config.install_level.system=system
|
flatpak.config.install_level.system=system
|
||||||
flatpak.config.install_level.system.tip=Anwendungen werden für alle Gerätebenutzer installiert
|
flatpak.config.install_level.system.tip=Applications will be installed for all the device users
|
||||||
flatpak.config.install_level.user=Benutzer
|
flatpak.config.install_level.user=user
|
||||||
flatpak.config.install_level.user.tip=Die Anwendung wird nur für den aktuellen Benutzer installiert
|
flatpak.config.install_level.user.tip=Application will be installed only for the current user
|
||||||
flatpak.config.install_level.ask=fragen
|
flatpak.config.install_level.ask=ask
|
||||||
flatpak.config.install_level.ask.tip={app} fragt nach der Ebene, die während der App-Installation angewendet werden soll
|
flatpak.config.install_level.ask.tip={app} will ask the level that should be applied during the app installation
|
||||||
flatpak.config.install_level=niveau
|
flatpak.config.install_level=level
|
||||||
@@ -25,10 +25,10 @@ flatpak.install.install_level.title=Tipo di installazione
|
|||||||
flatpak.install.install_level.body={} deve essere installato per tutti gli utenti del dispositivo ( sistema ) ?
|
flatpak.install.install_level.body={} deve essere installato per tutti gli utenti del dispositivo ( sistema ) ?
|
||||||
flatpak.install.bad_install_level.body=Valore non valido per {field} nel file di configurazione {file}
|
flatpak.install.bad_install_level.body=Valore non valido per {field} nel file di configurazione {file}
|
||||||
flatpak.remotes.system_flathub.error=Non è stato possibile aggiungere Flathub come repository di sistema ( remote )
|
flatpak.remotes.system_flathub.error=Non è stato possibile aggiungere Flathub come repository di sistema ( remote )
|
||||||
flatpak.config.install_level.system=sistema
|
flatpak.config.install_level.system=system
|
||||||
flatpak.config.install_level.system.tip=Le applicazioni verranno installate per tutti gli utenti del dispositivo
|
flatpak.config.install_level.system.tip=Applications will be installed for all the device users
|
||||||
flatpak.config.install_level.user=utente
|
flatpak.config.install_level.user=user
|
||||||
flatpak.config.install_level.user.tip=L'applicazione verrà installata solo per l'utente corrente
|
flatpak.config.install_level.user.tip=Application will be installed only for the current user
|
||||||
flatpak.config.install_level.ask=chiedere
|
flatpak.config.install_level.ask=ask
|
||||||
flatpak.config.install_level.ask.tip={app} chiederà il livello da applicare durante l'installazione dell'app
|
flatpak.config.install_level.ask.tip={app} will ask the level that should be applied during the app installation
|
||||||
flatpak.config.install_level=livello
|
flatpak.config.install_level=level
|
||||||
@@ -10,7 +10,7 @@ from bauh.api.abstract.disk import DiskCacheLoader
|
|||||||
from bauh.api.abstract.handler import ProcessWatcher
|
from bauh.api.abstract.handler import ProcessWatcher
|
||||||
from bauh.api.abstract.model import SoftwarePackage, PackageUpdate, PackageHistory, PackageSuggestion, PackageAction
|
from bauh.api.abstract.model import SoftwarePackage, PackageUpdate, PackageHistory, PackageSuggestion, PackageAction
|
||||||
from bauh.api.abstract.view import FormComponent, ViewComponent, TabGroupComponent, TabComponent, SingleSelectComponent, \
|
from bauh.api.abstract.view import FormComponent, ViewComponent, TabGroupComponent, TabComponent, SingleSelectComponent, \
|
||||||
InputOption, PanelComponent, SelectViewType
|
InputOption, PanelComponent, SelectViewType, TextInputComponent, TwoStateButtonComponent
|
||||||
from bauh.api.exception import NoInternetException
|
from bauh.api.exception import NoInternetException
|
||||||
from bauh.commons import internet
|
from bauh.commons import internet
|
||||||
from bauh.commons.config import save_config
|
from bauh.commons.config import save_config
|
||||||
@@ -406,42 +406,74 @@ class GenericSoftwareManager(SoftwareManager):
|
|||||||
def get_working_managers(self):
|
def get_working_managers(self):
|
||||||
return [m for m in self.managers if self._can_work(m)]
|
return [m for m in self.managers if self._can_work(m)]
|
||||||
|
|
||||||
|
def _gen_bool_component(self, label: str, tooltip: str, value: bool, id_: str) -> SingleSelectComponent:
|
||||||
|
opts = [InputOption(label=self.i18n['yes'].capitalize(), value=True),
|
||||||
|
InputOption(label=self.i18n['no'].capitalize(), value=False)]
|
||||||
|
|
||||||
|
return SingleSelectComponent(label=label,
|
||||||
|
options=opts,
|
||||||
|
default_option=[o for o in opts if o.value == value][0],
|
||||||
|
type_=SelectViewType.RADIO,
|
||||||
|
tooltip=tooltip,
|
||||||
|
max_per_line=len(opts),
|
||||||
|
id_=id_)
|
||||||
|
|
||||||
def _gen_settings_panel(self) -> TabComponent:
|
def _gen_settings_panel(self) -> TabComponent:
|
||||||
core_config = read_config()
|
core_config = read_config()
|
||||||
|
|
||||||
current_locale = self.i18n.current_key
|
|
||||||
locale_opts = [InputOption(label=self.i18n['locale.{}'.format(k)].capitalize(), value=k) for k in translation.get_available_keys()]
|
locale_opts = [InputOption(label=self.i18n['locale.{}'.format(k)].capitalize(), value=k) for k in translation.get_available_keys()]
|
||||||
select_locale = SingleSelectComponent(label=self.i18n['core.config.locale.label'],
|
select_locale = SingleSelectComponent(label=self.i18n['core.config.locale.label'],
|
||||||
options=locale_opts,
|
options=locale_opts,
|
||||||
default_option=[l for l in locale_opts if l.value == current_locale][0],
|
default_option=[l for l in locale_opts if l.value == core_config['locale']][0],
|
||||||
type_=SelectViewType.COMBO,
|
type_=SelectViewType.COMBO,
|
||||||
id_='locale')
|
id_='locale')
|
||||||
|
|
||||||
disk_cache = core_config['disk_cache']['enabled']
|
select_dcache = self._gen_bool_component(label=self.i18n['core.config.disk_cache'],
|
||||||
dcache_opts = [InputOption(label=self.i18n['yes'].capitalize(), value=True),
|
tooltip=self.i18n['core.config.disk_cache.tip'].format(app=self.context.app_name),
|
||||||
InputOption(label=self.i18n['no'].capitalize(), value=False)]
|
value=core_config['disk_cache']['enabled'],
|
||||||
|
id_='dcache')
|
||||||
|
|
||||||
select_dcache = SingleSelectComponent(label=self.i18n['core.config.disk_cache'],
|
input_update_interval = TextInputComponent(label=self.i18n['core.config.updates.interval'].capitalize(),
|
||||||
options=dcache_opts,
|
tooltip=self.i18n['core.config.updates.interval.tip'],
|
||||||
default_option=[o for o in dcache_opts if o.value == disk_cache][0],
|
only_int=True,
|
||||||
type_=SelectViewType.RADIO,
|
value=str(core_config['updates']['check_interval']),
|
||||||
tooltip=self.i18n['core.config.disk_cache.tip'].format(app=self.context.app_name),
|
id_="updates_interval")
|
||||||
max_per_line=len(dcache_opts),
|
|
||||||
id_='dcache')
|
|
||||||
|
|
||||||
sub_comps = [select_locale, select_dcache]
|
form_general = FormComponent(label=self.i18n['core.config.tab_label'].capitalize(),
|
||||||
|
components=[select_locale, input_update_interval, select_dcache],
|
||||||
|
id_="form_general")
|
||||||
|
|
||||||
|
select_dicons = self._gen_bool_component(label=self.i18n['core.config.download.icons'],
|
||||||
|
tooltip=self.i18n['core.config.download.icons.tip'],
|
||||||
|
id_="down_icons",
|
||||||
|
value=core_config['download']['icons'])
|
||||||
|
|
||||||
|
select_dmthread = self._gen_bool_component(label=self.i18n['core.config.download.multithreaded'],
|
||||||
|
tooltip=self.i18n['core.config.download.multithreaded.tip'],
|
||||||
|
id_="down_mthread",
|
||||||
|
value=core_config['download']['multithreaded'])
|
||||||
|
|
||||||
|
form_download = FormComponent(label=self.i18n['download'].capitalize(), components=[select_dicons, select_dmthread], id_='form_download')
|
||||||
|
|
||||||
|
sub_comps = [form_general, form_download]
|
||||||
return TabComponent(self.i18n['core.config.tab_label'].capitalize(), PanelComponent([FormComponent(sub_comps)]), None, 'core')
|
return TabComponent(self.i18n['core.config.tab_label'].capitalize(), PanelComponent([FormComponent(sub_comps)]), None, 'core')
|
||||||
|
|
||||||
def _save_settings(self, panel: PanelComponent) -> Tuple[bool, List[str]]:
|
def _save_settings(self, panel: PanelComponent) -> Tuple[bool, List[str]]:
|
||||||
core_config = config.read_config()
|
core_config = config.read_config()
|
||||||
|
|
||||||
main_form = panel.components[0]
|
main_form = panel.components[0]
|
||||||
locale = main_form.get_component('locale').get_selected()
|
locale = main_form.get_component('form_general').get_component('locale').get_selected()
|
||||||
|
|
||||||
if locale != self.i18n.current_key:
|
if locale != self.i18n.current_key:
|
||||||
core_config['locale'] = locale
|
core_config['locale'] = locale
|
||||||
|
|
||||||
core_config['disk_cache']['enabled'] = main_form.get_component('dcache').get_selected()
|
core_config['disk_cache']['enabled'] = main_form.get_component('form_general').get_component('dcache').get_selected()
|
||||||
|
core_config['updates']['check_interval'] = main_form.get_component('form_general').get_component('updates_interval').get_int_value()
|
||||||
|
|
||||||
|
download_icons = main_form.get_component('form_download').get_component('down_icons').get_selected()
|
||||||
|
core_config['download']['icons'] = download_icons
|
||||||
|
|
||||||
|
download_mthreaded = main_form.get_component('form_download').get_component('down_mthread').get_selected()
|
||||||
|
core_config['download']['multithreaded'] = download_mthreaded
|
||||||
|
|
||||||
try:
|
try:
|
||||||
config.save(core_config)
|
config.save(core_config)
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ from typing import Tuple
|
|||||||
from PyQt5.QtCore import Qt, QSize
|
from PyQt5.QtCore import Qt, QSize
|
||||||
from PyQt5.QtGui import QIcon, QPixmap, QIntValidator
|
from PyQt5.QtGui import QIcon, QPixmap, QIntValidator
|
||||||
from PyQt5.QtWidgets import QRadioButton, QGroupBox, QCheckBox, QComboBox, QGridLayout, QWidget, \
|
from PyQt5.QtWidgets import QRadioButton, QGroupBox, QCheckBox, QComboBox, QGridLayout, QWidget, \
|
||||||
QLabel, QSizePolicy, QLineEdit, QToolButton, QHBoxLayout, QFormLayout, QFileDialog, QTabWidget, QVBoxLayout
|
QLabel, QSizePolicy, QLineEdit, QToolButton, QHBoxLayout, QFormLayout, QFileDialog, QTabWidget, QVBoxLayout, QSlider
|
||||||
|
|
||||||
from bauh.api.abstract.view import SingleSelectComponent, InputOption, MultipleSelectComponent, SelectViewType, \
|
from bauh.api.abstract.view import SingleSelectComponent, InputOption, MultipleSelectComponent, SelectViewType, \
|
||||||
TextInputComponent, FormComponent, FileChooserComponent, ViewComponent, TabGroupComponent, PanelComponent
|
TextInputComponent, FormComponent, FileChooserComponent, ViewComponent, TabGroupComponent, PanelComponent, \
|
||||||
|
TwoStateButtonComponent
|
||||||
from bauh.view.qt import css
|
from bauh.view.qt import css
|
||||||
from bauh.view.util import resource
|
from bauh.view.util import resource
|
||||||
from bauh.view.util.translation import I18n
|
from bauh.view.util.translation import I18n
|
||||||
@@ -61,6 +62,21 @@ class CheckboxQt(QCheckBox):
|
|||||||
self.callback(self.model, checked)
|
self.callback(self.model, checked)
|
||||||
|
|
||||||
|
|
||||||
|
class TwoStateButtonQt(QSlider):
|
||||||
|
|
||||||
|
def __init__(self, model: TwoStateButtonComponent):
|
||||||
|
super(TwoStateButtonQt, self).__init__(Qt.Horizontal)
|
||||||
|
self.model = model
|
||||||
|
self.setMaximum(1)
|
||||||
|
self.valueChanged.connect(self._change_state)
|
||||||
|
|
||||||
|
def mousePressEvent(self, QMouseEvent):
|
||||||
|
self.setValue(1 if self.value() == 0 else 0)
|
||||||
|
|
||||||
|
def _change_state(self, state: int):
|
||||||
|
self.model.state = bool(state)
|
||||||
|
|
||||||
|
|
||||||
class ComboBoxQt(QComboBox):
|
class ComboBoxQt(QComboBox):
|
||||||
|
|
||||||
def __init__(self, model: SingleSelectComponent):
|
def __init__(self, model: SingleSelectComponent):
|
||||||
@@ -337,19 +353,7 @@ class FormQt(QGroupBox):
|
|||||||
label, field = self._new_text_input(c)
|
label, field = self._new_text_input(c)
|
||||||
self.layout().addRow(label, field)
|
self.layout().addRow(label, field)
|
||||||
elif isinstance(c, SingleSelectComponent):
|
elif isinstance(c, SingleSelectComponent):
|
||||||
|
label = self._new_label(c)
|
||||||
label = QWidget()
|
|
||||||
label.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
|
|
||||||
label.setLayout(QHBoxLayout())
|
|
||||||
label_comp = QLabel()
|
|
||||||
label.layout().addWidget(label_comp)
|
|
||||||
|
|
||||||
if c.label:
|
|
||||||
label_comp.setText(c.label.capitalize())
|
|
||||||
|
|
||||||
if c.tooltip:
|
|
||||||
label.layout().addWidget(self.gen_tip_icon(c.tooltip))
|
|
||||||
|
|
||||||
field = ComboBoxQt(c) if c.type == SelectViewType.COMBO else RadioBoxQt(c)
|
field = ComboBoxQt(c) if c.type == SelectViewType.COMBO else RadioBoxQt(c)
|
||||||
self.layout().addRow(label, field)
|
self.layout().addRow(label, field)
|
||||||
elif isinstance(c, FileChooserComponent):
|
elif isinstance(c, FileChooserComponent):
|
||||||
@@ -357,11 +361,29 @@ class FormQt(QGroupBox):
|
|||||||
self.layout().addRow(label, field)
|
self.layout().addRow(label, field)
|
||||||
elif isinstance(c, FormComponent):
|
elif isinstance(c, FormComponent):
|
||||||
self.layout().addRow(FormQt(c, self.i18n))
|
self.layout().addRow(FormQt(c, self.i18n))
|
||||||
|
elif isinstance(c, TwoStateButtonComponent):
|
||||||
|
label = self._new_label(c)
|
||||||
|
self.layout().addRow(label, TwoStateButtonQt(c))
|
||||||
else:
|
else:
|
||||||
raise Exception('Unsupported component type {}'.format(c.__class__.__name__))
|
raise Exception('Unsupported component type {}'.format(c.__class__.__name__))
|
||||||
|
|
||||||
self.layout().addRow(QLabel(), QLabel())
|
self.layout().addRow(QLabel(), QLabel())
|
||||||
|
|
||||||
|
def _new_label(self, comp) -> QWidget:
|
||||||
|
label = QWidget()
|
||||||
|
label.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
|
||||||
|
label.setLayout(QHBoxLayout())
|
||||||
|
label_comp = QLabel()
|
||||||
|
label.layout().addWidget(label_comp)
|
||||||
|
|
||||||
|
if comp.label:
|
||||||
|
label_comp.setText(comp.label.capitalize())
|
||||||
|
|
||||||
|
if comp.tooltip:
|
||||||
|
label.layout().addWidget(self.gen_tip_icon(comp.tooltip))
|
||||||
|
|
||||||
|
return label
|
||||||
|
|
||||||
def gen_tip_icon(self, tip: str) -> QLabel:
|
def gen_tip_icon(self, tip: str) -> QLabel:
|
||||||
tip_icon = QLabel()
|
tip_icon = QLabel()
|
||||||
tip_icon.setToolTip(tip.strip())
|
tip_icon.setToolTip(tip.strip())
|
||||||
@@ -481,5 +503,7 @@ def to_widget(comp: ViewComponent, i18n: I18n, parent: QWidget = None) -> QWidge
|
|||||||
return TabGroupQt(comp, i18n, parent)
|
return TabGroupQt(comp, i18n, parent)
|
||||||
elif isinstance(comp, PanelComponent):
|
elif isinstance(comp, PanelComponent):
|
||||||
return PanelQt(comp, i18n, parent)
|
return PanelQt(comp, i18n, parent)
|
||||||
|
elif isinstance(comp, TwoStateButtonComponent):
|
||||||
|
return TwoStateButtonQt(comp)
|
||||||
else:
|
else:
|
||||||
raise Exception("Cannot render instances of " + comp.__class__.__name__)
|
raise Exception("Cannot render instances of " + comp.__class__.__name__)
|
||||||
|
|||||||
@@ -220,10 +220,18 @@ message.file.not_exist=Fitxer no existeix
|
|||||||
message.file.not_exist.body=El fitxer {} sembla no existir
|
message.file.not_exist.body=El fitxer {} sembla no existir
|
||||||
icon_button.tooltip.disabled=Aquesta acció no està disponible
|
icon_button.tooltip.disabled=Aquesta acció no està disponible
|
||||||
user=usuari
|
user=usuari
|
||||||
example.short=ex
|
example.short=e.g
|
||||||
core.config.tab_label=general
|
core.config.tab_label=general
|
||||||
core.config.locale.label=idioma
|
core.config.locale.label=language
|
||||||
core.config.disk_cache=Cau em disco
|
core.config.disk_cache=Disk cache
|
||||||
|
core.config.disk_cache.tip={app} will save some data about your installed applications into the disk to load them faster in the next initializations
|
||||||
|
core.config.updates.interval=Updates interval
|
||||||
|
core.config.updates.interval.tip=Defines the time interval in which the update-checking for the installed applications will happen ( in SECONDS )
|
||||||
|
core.config.downloads=downloads
|
||||||
|
core.config.download.icons=Icons
|
||||||
|
core.config.download.icons.tip=If the application icons should be downloaded and displayed on the table
|
||||||
|
core.config.download.multithreaded=Parallelism
|
||||||
|
core.config.download.multithreaded.tip=Whether applications, packages and files should be downloaded with a tool that works with parallelism / multi-thread (faster). At the moment only the aria2 application is supported
|
||||||
locale.en=anglès
|
locale.en=anglès
|
||||||
locale.es=castellà
|
locale.es=castellà
|
||||||
locale.pt=portuguès
|
locale.pt=portuguès
|
||||||
@@ -232,3 +240,4 @@ locale.de=alemany
|
|||||||
locale.it=italià
|
locale.it=italià
|
||||||
interval=interval
|
interval=interval
|
||||||
installation=instal·lació
|
installation=instal·lació
|
||||||
|
download=download
|
||||||
@@ -175,11 +175,18 @@ message.file.not_exist.body=Die Datei {} scheint nicht zu existieren
|
|||||||
development=Entwicklung
|
development=Entwicklung
|
||||||
icon_button.tooltip.disabled=Diese Aktion ist nicht verfügbar
|
icon_button.tooltip.disabled=Diese Aktion ist nicht verfügbar
|
||||||
user=Benutzer
|
user=Benutzer
|
||||||
example.short=z.B
|
example.short=e.g
|
||||||
core.config.tab_label=Allgemeines
|
core.config.tab_label=general
|
||||||
core.config.locale.label=Sprache
|
core.config.locale.label=language
|
||||||
core.config.disk_cache=Festplattencache
|
core.config.disk_cache=Disk cache
|
||||||
core.config.disk_cache.tip={app} speichert einige Daten zu Ihren installierten Anwendungen auf der Festplatte, um sie bei den nächsten Initialisierungen schneller zu laden
|
core.config.disk_cache.tip={app} will save some data about your installed applications into the disk to load them faster in the next initializations
|
||||||
|
core.config.updates.interval=Updates interval
|
||||||
|
core.config.updates.interval.tip=Defines the time interval in which the update-checking for the installed applications will happen ( in SECONDS )
|
||||||
|
core.config.downloads=downloads
|
||||||
|
core.config.download.icons=Icons
|
||||||
|
core.config.download.icons.tip=If the application icons should be downloaded and displayed on the table
|
||||||
|
core.config.download.multithreaded=Parallelism
|
||||||
|
core.config.download.multithreaded.tip=Whether applications, packages and files should be downloaded with a tool that works with parallelism / multi-thread (faster). At the moment only the aria2 application is supported
|
||||||
locale.en=englisch
|
locale.en=englisch
|
||||||
locale.es=spanisch
|
locale.es=spanisch
|
||||||
locale.pt=portugiesisch
|
locale.pt=portugiesisch
|
||||||
@@ -188,3 +195,4 @@ locale.de=deutsch
|
|||||||
locale.it=italienisch
|
locale.it=italienisch
|
||||||
interval=intervall
|
interval=intervall
|
||||||
installation=Installation
|
installation=Installation
|
||||||
|
download=download
|
||||||
@@ -183,7 +183,13 @@ example.short=e.g
|
|||||||
core.config.tab_label=general
|
core.config.tab_label=general
|
||||||
core.config.locale.label=language
|
core.config.locale.label=language
|
||||||
core.config.disk_cache=Disk cache
|
core.config.disk_cache=Disk cache
|
||||||
core.config.disk_cache.tip={app} will save some data about your installed applications on the disk to load them faster in the next initializations
|
core.config.disk_cache.tip={app} will save some data about your installed applications into the disk to load them faster in the next initializations
|
||||||
|
core.config.updates.interval=Updates interval
|
||||||
|
core.config.updates.interval.tip=Defines the time interval in which the update-checking for the installed applications will happen ( in SECONDS )
|
||||||
|
core.config.download.icons=Icons
|
||||||
|
core.config.download.icons.tip=If the application icons should be downloaded and displayed on the table
|
||||||
|
core.config.download.multithreaded=Parallelism
|
||||||
|
core.config.download.multithreaded.tip=Whether applications, packages and files should be downloaded with a tool that works with parallelism / multi-thread ( faster ). At the moment only the aria2 application is supported
|
||||||
locale.en=english
|
locale.en=english
|
||||||
locale.es=spanish
|
locale.es=spanish
|
||||||
locale.pt=portuguese
|
locale.pt=portuguese
|
||||||
@@ -192,3 +198,4 @@ locale.de=german
|
|||||||
locale.it=italian
|
locale.it=italian
|
||||||
interval=interval
|
interval=interval
|
||||||
installation=installation
|
installation=installation
|
||||||
|
download=download
|
||||||
@@ -224,6 +224,13 @@ core.config.tab_label=general
|
|||||||
core.config.locale.label=idioma
|
core.config.locale.label=idioma
|
||||||
core.config.disk_cache=Cache em disco
|
core.config.disk_cache=Cache em disco
|
||||||
core.config.disk_cache.tip={app} guardará algunos datos sobre sus aplicaciones instaladas en el disco para cargarlas más rápido en las próximas inicializaciones
|
core.config.disk_cache.tip={app} guardará algunos datos sobre sus aplicaciones instaladas en el disco para cargarlas más rápido en las próximas inicializaciones
|
||||||
|
core.config.updates.interval=Intervalo de actualizaciones
|
||||||
|
core.config.updates.interval.tip=Define el intervalo de tiempo en el que se realizará la verificación de actualizaciones para las aplicaciones instaladas ( en SEGUNDOS )
|
||||||
|
core.config.downloads=downloads
|
||||||
|
core.config.download.icons=Iconos
|
||||||
|
core.config.download.icons.tip=Si los íconos de las aplicaciones se deben descargar y mostrar en la tabla
|
||||||
|
core.config.download.multithreaded=Paralelismo
|
||||||
|
core.config.download.multithreaded.tip=Si las aplicaciones, paquetes y archivos deben descargarse con una herramienta que funcione con paralelismo / multi-thread ( más rápido ). Por el momento solo se admite la aplicación aria2
|
||||||
locale.es=inglés
|
locale.es=inglés
|
||||||
locale.es=español
|
locale.es=español
|
||||||
locale.pt=portugués
|
locale.pt=portugués
|
||||||
@@ -232,3 +239,4 @@ locale.de=alemán
|
|||||||
locale.it=italiano
|
locale.it=italiano
|
||||||
interval=intervalo
|
interval=intervalo
|
||||||
installation=instalación
|
installation=instalación
|
||||||
|
download=descarga
|
||||||
@@ -176,11 +176,18 @@ message.file.not_exist.body=Il file {} sembra non esistere
|
|||||||
development=sviluppo
|
development=sviluppo
|
||||||
icon_button.tooltip.disabled=Questa azione non è disponibile
|
icon_button.tooltip.disabled=Questa azione non è disponibile
|
||||||
user=utente
|
user=utente
|
||||||
core.config.tab_label=generale
|
example.short=e.g
|
||||||
core.config.locale.label=idioma
|
core.config.tab_label=general
|
||||||
core.config.disk_cache=cache nel disco
|
core.config.locale.label=language
|
||||||
core.config.disk_cache.tip={app} salverà alcuni dati sulle applicazioni installate sul disco per caricarle più velocemente nelle successive inizializzazioni
|
core.config.disk_cache=Disk cache
|
||||||
example.short=es
|
core.config.disk_cache.tip={app} will save some data about your installed applications into the disk to load them faster in the next initializations
|
||||||
|
core.config.updates.interval=Updates interval
|
||||||
|
core.config.updates.interval.tip=Defines the time interval in which the update-checking for the installed applications will happen ( in SECONDS )
|
||||||
|
core.config.downloads=downloads
|
||||||
|
core.config.download.icons=Icons
|
||||||
|
core.config.download.icons.tip=If the application icons should be downloaded and displayed on the table
|
||||||
|
core.config.download.multithreaded=Parallelism
|
||||||
|
core.config.download.multithreaded.tip=Whether applications, packages and files should be downloaded with a tool that works with parallelism / multi-thread (faster). At the moment only the aria2 application is supported
|
||||||
locale.en=inglese
|
locale.en=inglese
|
||||||
locale.es=spagnolo
|
locale.es=spagnolo
|
||||||
locale.pt=portoghese
|
locale.pt=portoghese
|
||||||
@@ -189,3 +196,4 @@ locale.de=tedesco
|
|||||||
locale.it=italiano
|
locale.it=italiano
|
||||||
interval=intervallo
|
interval=intervallo
|
||||||
installation=installazione
|
installation=installazione
|
||||||
|
download=download
|
||||||
@@ -227,6 +227,13 @@ core.config.tab_label=geral
|
|||||||
core.config.locale.label=idioma
|
core.config.locale.label=idioma
|
||||||
core.config.disk_cache=Cache em disco
|
core.config.disk_cache=Cache em disco
|
||||||
core.config.disk_cache.tip={app} gravará alguns dados sobre seus aplicativos instalados no disco para que eles sejam carregados rapidamente nas próximas inicializações
|
core.config.disk_cache.tip={app} gravará alguns dados sobre seus aplicativos instalados no disco para que eles sejam carregados rapidamente nas próximas inicializações
|
||||||
|
core.config.updates.interval=Intervalo de atualizações
|
||||||
|
core.config.updates.interval.tip=Define o intervalo de tempo em que ocorrerá a verificação de atualizações para os aplicativos instalados ( em SEGUNDOS )
|
||||||
|
core.config.downloads=downloads
|
||||||
|
core.config.download.icons=Ícones
|
||||||
|
core.config.download.icons.tip=Se os ícones dos aplicativos devem ser baixados e exibidos na tabela
|
||||||
|
core.config.download.multithreaded=Paralelismo
|
||||||
|
core.config.download.multithreaded.tip=Se os aplicativos, pacotes e arquivos devem ser baixados através de uma ferramenta que trabalha com paralelismo / multi-thread ( mais rápido ). No momento somente o aplicativo aria2 é suportado.
|
||||||
locale.en=inglês
|
locale.en=inglês
|
||||||
locale.es=espanhol
|
locale.es=espanhol
|
||||||
locale.pt=português
|
locale.pt=português
|
||||||
@@ -235,3 +242,4 @@ locale.de=alemão
|
|||||||
locale.it=italiano
|
locale.it=italiano
|
||||||
interval=intervalo
|
interval=intervalo
|
||||||
installation=instalação
|
installation=instalação
|
||||||
|
download=download
|
||||||
Reference in New Issue
Block a user