mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 01:14:15 +02:00
[appimage] improvement: limiting the UI components width of the file installation and upgrade windows
This commit is contained in:
@@ -26,6 +26,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
<img src="https://raw.githubusercontent.com/vinifmor/bauh-files/master/pictures/releases/0.10.1/bkp_remove.png">
|
<img src="https://raw.githubusercontent.com/vinifmor/bauh-files/master/pictures/releases/0.10.1/bkp_remove.png">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
- AppImage
|
||||||
|
- Limiting the UI components width of the file installation and upgrade windows
|
||||||
|
|
||||||
- Arch
|
- Arch
|
||||||
- text length of some popups reduced
|
- text length of some popups reduced
|
||||||
|
|
||||||
|
|||||||
@@ -85,27 +85,31 @@ class AppImageManager(SoftwareManager):
|
|||||||
self._search_unfilled_attrs: Optional[Tuple[str, ...]] = None
|
self._search_unfilled_attrs: Optional[Tuple[str, ...]] = None
|
||||||
|
|
||||||
def install_file(self, root_password: Optional[str], watcher: ProcessWatcher) -> bool:
|
def install_file(self, root_password: Optional[str], watcher: ProcessWatcher) -> bool:
|
||||||
|
max_width = 350
|
||||||
file_chooser = FileChooserComponent(label=self.i18n['file'].capitalize(),
|
file_chooser = FileChooserComponent(label=self.i18n['file'].capitalize(),
|
||||||
allowed_extensions={'AppImage', '*'},
|
allowed_extensions={'AppImage', '*'},
|
||||||
search_path=get_default_manual_installation_file_dir())
|
search_path=get_default_manual_installation_file_dir(),
|
||||||
input_name = TextInputComponent(label=self.i18n['name'].capitalize())
|
max_width=max_width)
|
||||||
input_version = TextInputComponent(label=self.i18n['version'].capitalize())
|
input_name = TextInputComponent(label=self.i18n['name'].capitalize(), max_width=max_width)
|
||||||
|
input_version = TextInputComponent(label=self.i18n['version'].capitalize(), max_width=max_width)
|
||||||
file_chooser.observers.append(ManualInstallationFileObserver(input_name, input_version))
|
file_chooser.observers.append(ManualInstallationFileObserver(input_name, input_version))
|
||||||
|
|
||||||
input_description = TextInputComponent(label=self.i18n['description'].capitalize())
|
input_description = TextInputComponent(label=self.i18n['description'].capitalize(), max_width=max_width)
|
||||||
|
|
||||||
cat_ops = [InputOption(label=self.i18n['category.none'].capitalize(), value=0)]
|
cat_ops = [InputOption(label=self.i18n['category.none'].capitalize(), value=0)]
|
||||||
cat_ops.extend([InputOption(label=self.i18n.get(f'category.{c.lower()}', c.lower()).capitalize(), value=c) for c in self.context.default_categories])
|
cat_ops.extend([InputOption(label=self.i18n.get(f'category.{c.lower()}', c.lower()).capitalize(), value=c) for c in self.context.default_categories])
|
||||||
inp_cat = SingleSelectComponent(label=self.i18n['category'], type_=SelectViewType.COMBO, options=cat_ops,
|
inp_cat = SingleSelectComponent(label=self.i18n['category'], type_=SelectViewType.COMBO, options=cat_ops,
|
||||||
default_option=cat_ops[0])
|
default_option=cat_ops[0], max_width=max_width)
|
||||||
|
|
||||||
form = FormComponent(label='', components=[file_chooser, input_name, input_version, input_description, inp_cat], spaces=False)
|
form = FormComponent(label='', components=[file_chooser, input_name, input_version, input_description, inp_cat],
|
||||||
|
spaces=False)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if watcher.request_confirmation(title=self.i18n['appimage.custom_action.install_file.details'], body=None,
|
if watcher.request_confirmation(title=self.i18n['appimage.custom_action.install_file.details'], body=None,
|
||||||
components=[form],
|
components=[form],
|
||||||
confirmation_label=self.i18n['proceed'].capitalize(),
|
confirmation_label=self.i18n['proceed'].capitalize(),
|
||||||
deny_label=self.i18n['cancel'].capitalize()):
|
deny_label=self.i18n['cancel'].capitalize(),
|
||||||
|
min_height=100, max_width=max_width + 150):
|
||||||
if not file_chooser.file_path or not os.path.isfile(file_chooser.file_path) or not file_chooser.file_path.lower().strip().endswith('.appimage'):
|
if not file_chooser.file_path or not os.path.isfile(file_chooser.file_path) or not file_chooser.file_path.lower().strip().endswith('.appimage'):
|
||||||
watcher.request_confirmation(title=self.i18n['error'].capitalize(),
|
watcher.request_confirmation(title=self.i18n['error'].capitalize(),
|
||||||
body=self.i18n['appimage.custom_action.install_file.invalid_file'],
|
body=self.i18n['appimage.custom_action.install_file.invalid_file'],
|
||||||
@@ -139,17 +143,20 @@ class AppImageManager(SoftwareManager):
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
def update_file(self, pkg: AppImage, root_password: Optional[str], watcher: ProcessWatcher):
|
def update_file(self, pkg: AppImage, root_password: Optional[str], watcher: ProcessWatcher):
|
||||||
|
max_width = 350
|
||||||
file_chooser = FileChooserComponent(label=self.i18n['file'].capitalize(),
|
file_chooser = FileChooserComponent(label=self.i18n['file'].capitalize(),
|
||||||
allowed_extensions={'AppImage', '*'},
|
allowed_extensions={'AppImage', '*'},
|
||||||
search_path=get_default_manual_installation_file_dir())
|
search_path=get_default_manual_installation_file_dir(),
|
||||||
input_version = TextInputComponent(label=self.i18n['version'].capitalize())
|
max_width=max_width)
|
||||||
|
input_version = TextInputComponent(label=self.i18n['version'].capitalize(), max_width=max_width)
|
||||||
file_chooser.observers.append(ManualInstallationFileObserver(None, input_version))
|
file_chooser.observers.append(ManualInstallationFileObserver(None, input_version))
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if watcher.request_confirmation(title=self.i18n['appimage.custom_action.manual_update.details'], body=None,
|
if watcher.request_confirmation(title=self.i18n['appimage.custom_action.manual_update.details'], body=None,
|
||||||
components=[FormComponent(label='', components=[file_chooser, input_version], spaces=False)],
|
components=[FormComponent(label='', components=[file_chooser, input_version], spaces=False)],
|
||||||
confirmation_label=self.i18n['proceed'].capitalize(),
|
confirmation_label=self.i18n['proceed'].capitalize(),
|
||||||
deny_label=self.i18n['cancel'].capitalize()):
|
deny_label=self.i18n['cancel'].capitalize(),
|
||||||
|
min_height=100, max_width=max_width + 150):
|
||||||
|
|
||||||
if not file_chooser.file_path or not os.path.isfile(file_chooser.file_path) or not file_chooser.file_path.lower().strip().endswith('.appimage'):
|
if not file_chooser.file_path or not os.path.isfile(file_chooser.file_path) or not file_chooser.file_path.lower().strip().endswith('.appimage'):
|
||||||
watcher.request_confirmation(title=self.i18n['error'].capitalize(),
|
watcher.request_confirmation(title=self.i18n['error'].capitalize(),
|
||||||
|
|||||||
Reference in New Issue
Block a user