[fix][ui][settings] gems scaling

This commit is contained in:
Vinícius Moreira
2020-01-28 18:53:46 -03:00
parent be7f93d688
commit 2ff36e9ac4
10 changed files with 95 additions and 42 deletions

View File

@@ -7,6 +7,7 @@ import sqlite3
import subprocess
import traceback
from datetime import datetime
from math import floor
from pathlib import Path
from threading import Lock, Thread
from typing import Set, Type, List, Tuple
@@ -499,9 +500,9 @@ class AppImageManager(SoftwareManager):
print('{}[bauh][appimage] An exception has happened when deleting {}{}'.format(Fore.RED, f, Fore.RESET))
traceback.print_exc()
def get_settings(self) -> ViewComponent:
def get_settings(self, screen_width: int, screen_height: int) -> ViewComponent:
config = read_config()
max_width = floor(screen_width * 0.15)
enabled_opts = [InputOption(label=self.i18n['yes'].capitalize(), value=True),
InputOption(label=self.i18n['no'].capitalize(), value=False)]
@@ -513,13 +514,13 @@ class AppImageManager(SoftwareManager):
max_per_line=len(enabled_opts),
type_=SelectViewType.RADIO,
tooltip=self.i18n['appimage.config.db_updates.activated.tip'],
max_width=200,
max_width=max_width,
id_='up_enabled'),
TextInputComponent(label=self.i18n['interval'],
value=str(config['db_updater']['interval']),
tooltip=self.i18n['appimage.config.db_updates.interval.tip'],
only_int=True,
max_width=150,
max_width=max_width,
id_='up_int')
]

View File

@@ -5,6 +5,7 @@ import shutil
import subprocess
import time
import traceback
from math import floor
from pathlib import Path
from threading import Thread
from typing import List, Set, Type, Tuple, Dict
@@ -888,8 +889,9 @@ class ArchManager(SoftwareManager):
def get_screenshots(self, pkg: SoftwarePackage) -> List[str]:
pass
def get_settings(self) -> ViewComponent:
def get_settings(self, screen_width: int, screen_height: int) -> ViewComponent:
config = read_config()
max_width = floor(screen_width * 0.15)
optz_opts = [InputOption(label=self.i18n['yes'].capitalize(), value=True),
InputOption(label=self.i18n['no'].capitalize(), value=False)]
@@ -904,14 +906,14 @@ class ArchManager(SoftwareManager):
max_per_line=len(optz_opts),
type_=SelectViewType.RADIO,
tooltip=self.i18n['arch.config.optimize.tip'],
max_width=200,
max_width=max_width,
id_='opts'),
SingleSelectComponent(label=self.i18n['arch.config.trans_dep_check'].capitalize(),
options=trans_check_opts,
default_option=[o for o in trans_check_opts if o.value == config['transitive_checking']][0],
max_per_line=len(trans_check_opts),
type_=SelectViewType.RADIO,
max_width=200,
max_width=max_width,
tooltip=self.i18n['arch.config.trans_dep_check.tip'],
id_='dep_check')]

View File

@@ -1,5 +1,6 @@
import traceback
from datetime import datetime
from math import floor
from threading import Thread
from typing import List, Set, Type, Tuple
@@ -418,7 +419,7 @@ class FlatpakManager(SoftwareManager):
return urls
def get_settings(self) -> ViewComponent:
def get_settings(self, screen_width: int, screen_height: int) -> ViewComponent:
fields = []
config = read_config()
@@ -436,7 +437,7 @@ class FlatpakManager(SoftwareManager):
options=install_opts,
default_option=[o for o in install_opts if o.value == config['installation_level']][0],
max_per_line=len(install_opts),
max_width=300,
max_width=floor(screen_width * 0.22),
type_=SelectViewType.RADIO))
return PanelComponent([FormComponent(fields, self.i18n['installation'].capitalize())])

View File

@@ -5,6 +5,7 @@ import re
import shutil
import subprocess
import traceback
from math import floor
from pathlib import Path
from threading import Thread
from typing import List, Type, Set, Tuple
@@ -891,14 +892,15 @@ class WebApplicationManager(SoftwareManager):
print('{}[bauh][web] An exception has happened when deleting {}{}'.format(Fore.RED, ENV_PATH, Fore.RESET))
traceback.print_exc()
def get_settings(self) -> ViewComponent:
def get_settings(self, screen_width: int, screen_height: int) -> ViewComponent:
config = read_config()
max_width = floor(screen_width * 0.15)
input_electron = TextInputComponent(label=self.i18n['web.settings.electron.version.label'],
value=config['environment']['electron']['version'],
tooltip=self.i18n['web.settings.electron.version.tooltip'],
placeholder='{}: 7.1.0'.format(self.i18n['example.short']),
max_width=200,
max_width=max_width,
id_='electron_version')
native_opts = [
@@ -911,7 +913,7 @@ class WebApplicationManager(SoftwareManager):
default_option=[o for o in native_opts if o.value == config['environment']['system']][0],
type_=SelectViewType.COMBO,
tooltip=self.i18n['web.settings.nativefier.tip'],
max_width=200,
max_width=max_width,
id_='nativefier')
form_env = FormComponent(label=self.i18n['web.settings.nativefier.env'].capitalize(), components=[input_electron, select_nativefier])