From f6ef0135d2d2916262c3378c3c89a53fe3932e23 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Thu, 11 Aug 2022 16:44:03 -0700 Subject: [PATCH] *: Add setup method on all apps that don't have it This is needed for the apps to get enabled soon after installation. In case of 'sharing' app, a shortcut will appear on the apps page. This also brings uniformity to help later refactoring. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/api/__init__.py | 5 +++++ plinth/modules/diagnostics/__init__.py | 5 +++++ plinth/modules/first_boot/__init__.py | 5 +++++ plinth/modules/help/__init__.py | 5 +++++ plinth/modules/names/__init__.py | 5 +++++ plinth/modules/power/__init__.py | 5 +++++ plinth/modules/sharing/__init__.py | 5 +++++ 7 files changed, 35 insertions(+) diff --git a/plinth/modules/api/__init__.py b/plinth/modules/api/__init__.py index 44fefaed8..153718faf 100644 --- a/plinth/modules/api/__init__.py +++ b/plinth/modules/api/__init__.py @@ -20,3 +20,8 @@ class ApiApp(app_module.App): info = app_module.Info(app_id=self.app_id, version=self._version, is_essential=True) self.add(info) + + def setup(self, old_version): + """Install and configure the app.""" + super().setup(old_version) + self.enable() diff --git a/plinth/modules/diagnostics/__init__.py b/plinth/modules/diagnostics/__init__.py index 7bb51f071..6931e7162 100644 --- a/plinth/modules/diagnostics/__init__.py +++ b/plinth/modules/diagnostics/__init__.py @@ -67,6 +67,11 @@ class DiagnosticsApp(app_module.App): interval = 180 if cfg.develop else 3600 glib.schedule(interval, _warn_about_low_ram_space) + def setup(self, old_version): + """Install and configure the app.""" + super().setup(old_version) + self.enable() + def diagnose(self): """Run diagnostics and return the results.""" results = super().diagnose() diff --git a/plinth/modules/first_boot/__init__.py b/plinth/modules/first_boot/__init__.py index 2419dea62..a608f569d 100644 --- a/plinth/modules/first_boot/__init__.py +++ b/plinth/modules/first_boot/__init__.py @@ -51,6 +51,11 @@ class FirstBootApp(app_module.App): """Perform post initialization operations.""" post_setup.connect(_clear_first_boot_steps) + def setup(self, old_version): + """Install and configure the app.""" + super().setup(old_version) + self.enable() + def _clear_first_boot_steps(sender, module_name, **kwargs): """Flush the cache of first boot steps so it is recreated.""" diff --git a/plinth/modules/help/__init__.py b/plinth/modules/help/__init__.py index 3517b2c28..26e317e72 100644 --- a/plinth/modules/help/__init__.py +++ b/plinth/modules/help/__init__.py @@ -74,3 +74,8 @@ class HelpApp(app_module.App): static_files = web_server.StaticFiles('static-files-help', directory_map) self.add(static_files) + + def setup(self, old_version): + """Install and configure the app.""" + super().setup(old_version) + self.enable() diff --git a/plinth/modules/names/__init__.py b/plinth/modules/names/__init__.py index a3f8162df..948486b80 100644 --- a/plinth/modules/names/__init__.py +++ b/plinth/modules/names/__init__.py @@ -59,6 +59,11 @@ class NamesApp(app_module.App): domain_added.connect(on_domain_added) domain_removed.connect(on_domain_removed) + def setup(self, old_version): + """Install and configure the app.""" + super().setup(old_version) + self.enable() + def on_domain_added(sender, domain_type, name='', description='', services=None, **kwargs): diff --git a/plinth/modules/power/__init__.py b/plinth/modules/power/__init__.py index 51b5900ac..489fc580d 100644 --- a/plinth/modules/power/__init__.py +++ b/plinth/modules/power/__init__.py @@ -40,3 +40,8 @@ class PowerApp(app_module.App): backup_restore = BackupRestore('backup-restore-power', **manifest.backup) self.add(backup_restore) + + def setup(self, old_version): + """Install and configure the app.""" + super().setup(old_version) + self.enable() diff --git a/plinth/modules/sharing/__init__.py b/plinth/modules/sharing/__init__.py index 7498285c9..94ebf1635 100644 --- a/plinth/modules/sharing/__init__.py +++ b/plinth/modules/sharing/__init__.py @@ -49,6 +49,11 @@ class SharingApp(app_module.App): **manifest.backup) self.add(backup_restore) + def setup(self, old_version): + """Install and configure the app.""" + super().setup(old_version) + self.enable() + def list_shares(): """Return a list of shares."""