Skip to content

Commit

Permalink
[flatpak] improvement: not displaying the installation target option …
Browse files Browse the repository at this point in the history
…when bauh is launched by the root user (settings)
  • Loading branch information
vinifmor committed Nov 30, 2021
1 parent 4592409 commit f511121
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -32,6 +32,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- AppImage
- faster reading of installed applications (subprocess call replaced by Python call)

- Flatpak
- settings: not displaying the installation target option when bauh is launched by the root user

- Web
- the Electron builds cache directory has been moved to the environment directory `~/.local/share/bauh/web/env/electron`
- letting the Electron client to download the Electron build file instead of bauh (to avoid wrong caching paths)
Expand Down
43 changes: 22 additions & 21 deletions bauh/gems/flatpak/controller.py
Expand Up @@ -592,27 +592,28 @@ def get_screenshots(self, pkg: SoftwarePackage) -> List[str]:
return urls

def get_settings(self, screen_width: int, screen_height: int) -> Optional[ViewComponent]:
fields = []

flatpak_config = self.configman.get_config()

install_opts = [InputOption(label=self.i18n['flatpak.config.install_level.system'].capitalize(),
value='system',
tooltip=self.i18n['flatpak.config.install_level.system.tip']),
InputOption(label=self.i18n['flatpak.config.install_level.user'].capitalize(),
value='user',
tooltip=self.i18n['flatpak.config.install_level.user.tip']),
InputOption(label=self.i18n['ask'].capitalize(),
value=None,
tooltip=self.i18n['flatpak.config.install_level.ask.tip'].format(app=self.context.app_name))]
fields.append(SingleSelectComponent(label=self.i18n['flatpak.config.install_level'],
options=install_opts,
default_option=[o for o in install_opts if o.value == flatpak_config['installation_level']][0],
max_per_line=len(install_opts),
max_width=floor(screen_width * 0.22),
type_=SelectViewType.RADIO))

return PanelComponent([FormComponent(fields, self.i18n['installation'].capitalize())])
if not self.context.root_user:
fields = []

flatpak_config = self.configman.get_config()

install_opts = [InputOption(label=self.i18n['flatpak.config.install_level.system'].capitalize(),
value='system',
tooltip=self.i18n['flatpak.config.install_level.system.tip']),
InputOption(label=self.i18n['flatpak.config.install_level.user'].capitalize(),
value='user',
tooltip=self.i18n['flatpak.config.install_level.user.tip']),
InputOption(label=self.i18n['ask'].capitalize(),
value=None,
tooltip=self.i18n['flatpak.config.install_level.ask.tip'].format(app=self.context.app_name))]
fields.append(SingleSelectComponent(label=self.i18n['flatpak.config.install_level'],
options=install_opts,
default_option=[o for o in install_opts if o.value == flatpak_config['installation_level']][0],
max_per_line=len(install_opts),
max_width=floor(screen_width * 0.22),
type_=SelectViewType.RADIO))

return PanelComponent([FormComponent(fields, self.i18n['installation'].capitalize())])

def save_settings(self, component: PanelComponent) -> Tuple[bool, Optional[List[str]]]:
flatpak_config = self.configman.get_config()
Expand Down

0 comments on commit f511121

Please sign in to comment.