mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 00:04:15 +02:00
[view] improvement: only displaying a confirmation dialog for custom actions that start immediately
This commit is contained in:
@@ -25,6 +25,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- checking for javascript fixes based on the Electron version (saved on disk as `~/.local/share/bauh/web/fixes/electron_{branch}/{app_name}.js`)
|
- checking for javascript fixes based on the Electron version (saved on disk as `~/.local/share/bauh/web/fixes/electron_{branch}/{app_name}.js`)
|
||||||
- handling http redirect errors
|
- handling http redirect errors
|
||||||
- installation form title
|
- installation form title
|
||||||
|
|
||||||
|
- UI
|
||||||
|
- only displaying a confirmation dialog for custom actions that start immediately
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- Web
|
- Web
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ class CustomSoftwareAction:
|
|||||||
requires_root: bool, manager: "SoftwareManager" = None,
|
requires_root: bool, manager: "SoftwareManager" = None,
|
||||||
backup: bool = False, refresh: bool = True,
|
backup: bool = False, refresh: bool = True,
|
||||||
i18n_confirm_key: str = None,
|
i18n_confirm_key: str = None,
|
||||||
requires_internet: bool = False):
|
requires_internet: bool = False,
|
||||||
|
requires_confirmation: bool = True):
|
||||||
"""
|
"""
|
||||||
:param i18n_label_key: the i18n key that will be used to display the action name
|
:param i18n_label_key: the i18n key that will be used to display the action name
|
||||||
:param i18n_status_key: the i18n key that will be used to display the action name being executed
|
:param i18n_status_key: the i18n key that will be used to display the action name being executed
|
||||||
@@ -23,6 +24,7 @@ class CustomSoftwareAction:
|
|||||||
:param refresh: if the a full app refresh should be done if the action succeeds
|
:param refresh: if the a full app refresh should be done if the action succeeds
|
||||||
:param i18n_confirm_key: action confirmation message
|
:param i18n_confirm_key: action confirmation message
|
||||||
:param requires_internet: if the action requires internet connection to be executed
|
:param requires_internet: if the action requires internet connection to be executed
|
||||||
|
:param requires_confirmation: if a confirmation popup should be displayed to the user before calling the action
|
||||||
"""
|
"""
|
||||||
self.i18n_label_key = i18n_label_key
|
self.i18n_label_key = i18n_label_key
|
||||||
self.i18n_status_key = i18n_status_key
|
self.i18n_status_key = i18n_status_key
|
||||||
@@ -34,6 +36,7 @@ class CustomSoftwareAction:
|
|||||||
self.refresh = refresh
|
self.refresh = refresh
|
||||||
self.i18n_confirm_key = i18n_confirm_key
|
self.i18n_confirm_key = i18n_confirm_key
|
||||||
self.requires_internet = requires_internet
|
self.requires_internet = requires_internet
|
||||||
|
self.requires_confirmation = requires_confirmation
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return self.i18n_label_key.__hash__() + self.i18n_status_key.__hash__() + self.manager_method.__hash__()
|
return self.i18n_label_key.__hash__() + self.i18n_status_key.__hash__() + self.manager_method.__hash__()
|
||||||
|
|||||||
@@ -1422,7 +1422,8 @@ class ManageWindow(QWidget):
|
|||||||
self.progress_bar.setValue(value)
|
self.progress_bar.setValue(value)
|
||||||
|
|
||||||
def begin_execute_custom_action(self, pkg: Optional[PackageView], action: CustomSoftwareAction):
|
def begin_execute_custom_action(self, pkg: Optional[PackageView], action: CustomSoftwareAction):
|
||||||
if pkg is None and not ConfirmationDialog(title=self.i18n['confirmation'].capitalize(),
|
if pkg is None and action.requires_confirmation and \
|
||||||
|
not ConfirmationDialog(title=self.i18n['confirmation'].capitalize(),
|
||||||
body='<p>{}</p>'.format(self.i18n['custom_action.proceed_with'].capitalize().format(bold(self.i18n[action.i18n_label_key]))),
|
body='<p>{}</p>'.format(self.i18n['custom_action.proceed_with'].capitalize().format(bold(self.i18n[action.i18n_label_key]))),
|
||||||
icon=QIcon(action.icon_path) if action.icon_path else QIcon(resource.get_path('img/logo.svg')),
|
icon=QIcon(action.icon_path) if action.icon_path else QIcon(resource.get_path('img/logo.svg')),
|
||||||
i18n=self.i18n).ask():
|
i18n=self.i18n).ask():
|
||||||
|
|||||||
Reference in New Issue
Block a user