[wgem] adding category

This commit is contained in:
Vinícius Moreira
2019-12-13 16:35:00 -03:00
parent 7a3df32471
commit 174349cf5b
17 changed files with 156 additions and 59 deletions

View File

@@ -277,6 +277,9 @@ class FormQt(QGroupBox):
line_edit.setText(c.value)
line_edit.setCursorPosition(0)
if c.read_only:
line_edit.setEnabled(False)
def update_model(text: str):
c.value = text

View File

@@ -1,12 +1,12 @@
from typing import List
from PyQt5.QtCore import QSize
from PyQt5.QtCore import QSize, Qt
from PyQt5.QtWidgets import QMessageBox, QVBoxLayout, QLabel, QWidget, QScrollArea, QFrame
from bauh.api.abstract.view import ViewComponent, SingleSelectComponent, MultipleSelectComponent, TextInputComponent, \
FormComponent
from bauh.view.qt import css
from bauh.view.qt.components import MultipleSelectQt, new_single_select, TextInputQt, FormQt
from bauh.view.qt.components import MultipleSelectQt, new_single_select, TextInputQt, FormQt, new_spacer
from bauh.view.util.translation import I18n
@@ -28,6 +28,7 @@ class ConfirmationDialog(QMessageBox):
self.layout().addWidget(QLabel(body), 0, 1)
width = 0
if components:
scroll = QScrollArea(self)
scroll.setFrameShape(QFrame.NoFrame)
@@ -52,13 +53,21 @@ class ConfirmationDialog(QMessageBox):
raise Exception("Cannot render instances of " + comp.__class__.__name__)
height += inst.sizeHint().height()
if inst.sizeHint().width() > width:
width = inst.sizeHint().width()
comps_container.layout().addWidget(inst)
height = height if height < int(screen_size.height() / 2.5) else int(screen_size.height() / 2.5)
scroll.setFixedHeight(height)
self.layout().addWidget(scroll, 1, 1)
if not body and width > 0:
self.layout().addWidget(QLabel(' ' * int(width / 2)), 0, 1)
self.exec_()
def is_confirmed(self):

View File

@@ -174,12 +174,14 @@ texteditor=editor de text
server=servidor
cloud=núvol
instantmessaging=missatgeria
messaging=missatgeria
2dgraphics=gràfics 2d
vectorgraphics=gràfics vectorials
office=oficina
devices=dispositius
security=seguretat
audiovideo=àudio/vídeo
audio=àudio
amusement=diversió
webdevelopment=desenvolupament web
filetransfer=transferència de fitxers
@@ -202,4 +204,8 @@ mirror=mirall
emulator=emulador
do_not.install=no instal·leu
repository=dipòsit
details=detalls
details=detalls
communication=comunicació
administration=administració
settings=configuració
address=adreça

View File

@@ -137,9 +137,11 @@ texteditor=Texteditor
screenshots.bt_next.label=Weiter
screenshots.bt_back.label=Zurück
instantmessaging=Kommunikation
messaging=messaging
2dgraphics=2d Grafik
vectorgraphics=Vectorgrafik
audiovideo=Audio / Video
audio=audio
webdevelopment=Webentwicklung
filetransfer=Dateiübertragung
packagemanager=Paketmanager
@@ -156,4 +158,8 @@ publisher.verified=Verifiziert
emulator=emulator
do_not.install=nicht installieren
repository=repository
details=details
details=details
communication=Kommunikation
administration=Verwaltung
settings=Einstellungen
address=Adresse

View File

@@ -157,4 +157,12 @@ mirror=mirror
emulator=emulator
do_not.install=don't install
repository=repository
details=details
details=details
communication=communication
web=web
office=office
messaging=messaging
administration=administration
audio=audio
settings=settings
address=address

View File

@@ -174,12 +174,14 @@ texteditor=editor de texto
server=servidor
cloud=nube
instantmessaging=mensajería
messaging=mensajería
2dgraphics=gráficos 2d
vectorgraphics=gráficos vectoriales
office=oficina
devices=dispositivos
security=seguridad
audiovideo=audio y vídeo
audio=audio
amusement=diversión
webdevelopment=desarrollo web
filetransfer=transferencia de archivos
@@ -201,4 +203,8 @@ mirror=espejo
emulator=emulador
do_not.install=no instalar
repository=repositorio
details=detalles
details=detalles
communication=comunicación
administration=administración
settings=configuraciones
address=dirección

View File

@@ -137,9 +137,11 @@ texteditor=editor di testo
screenshots.bt_next.label=prossimo
screenshots.bt_back.label=precedente
instantmessaging=messaggistica
messaging=messaggistica
2dgraphics=Grafica 2D
vectorgraphics=grafica vettoriale
audiovideo=audio / video
audio=audio
webdevelopment=sviluppo web
filetransfer=trasferimento di file
packagemanager=gestore pacchetti
@@ -157,4 +159,8 @@ mirror=specchio
emulator=emulatore
do_not.install=non installare
repository=deposito
details=dettagli
details=dettagli
communication=comunicazione
administration=amministrazione
settings=impostazioni
address=indirizzo

View File

@@ -172,16 +172,18 @@ news=notícias
weather=tempo
finance=finanças
desktopsettings=configurações
settings=configurações
texteditor=editor de texto
server=servidor
cloud=nuvem
instantmessaging=mensagens
instantmessaging=mensagem
2dgraphics=gŕaficos 2d
vectorgraphics=gráficos vetoriais
office=escritório
devices=dispositivos
security=segurança
audiovideo=áudio / vídeo
audio=áudio
amusement=diversão
webdevelopment=desenvolvimento web
filetransfer=transferência de arquivos
@@ -204,4 +206,8 @@ mirror=espelho
emulator=emulador
do_not.install=não instalar
repository=repositório
details=detalhes
details=detalhes
communication=comunicação
messaging=mensagem
administration=administração
address=endereço

View File

@@ -5,6 +5,8 @@ import time
from threading import Thread, Lock
from typing import Type, Dict
import yaml
from bauh.api.abstract.cache import MemoryCache
from bauh.api.abstract.disk import DiskCacheLoader, DiskCacheLoaderFactory
from bauh.api.abstract.model import SoftwarePackage
@@ -52,16 +54,25 @@ class AsyncDiskCacheLoader(Thread, DiskCacheLoader):
def _fill_cached_data(self, pkg: SoftwarePackage) -> bool:
if self.enabled:
if os.path.exists(pkg.get_disk_data_path()):
with open(pkg.get_disk_data_path()) as f:
cached_data = json.loads(f.read())
if cached_data:
pkg.fill_cached_data(cached_data)
cache = self.cache_map.get(pkg.__class__)\
disk_path = pkg.get_disk_data_path()
ext = disk_path.split('.')[-1]
if cache:
cache.add_non_existing(pkg.id, cached_data)
with open(disk_path) as f:
if ext == 'json':
cached_data = json.loads(f.read())
elif ext in {'yml', 'yaml'}:
cached_data = yaml.load(f.read())
else:
raise Exception('The cached data file {} has an unsupported format'.format(disk_path))
return True
if cached_data:
pkg.fill_cached_data(cached_data)
cache = self.cache_map.get(pkg.__class__)
if cache:
cache.add_non_existing(pkg.id, cached_data)
return True
return False