disable plugin only temporarily

This commit is contained in:
deltragon 2024-07-16 18:11:01 +02:00
parent df3ae00e92
commit 4d7cdfb35e
No known key found for this signature in database
GPG Key ID: 41F552553C6D94B5
3 changed files with 13 additions and 14 deletions

View File

@ -67,15 +67,15 @@
<property name="label" translatable="yes">Click here for more information</property>
<property name="uri">https://slgobinath.github.io/SafeEyes</property>
<property name="visible">0</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
</object>
</child>
<child>
<object class="GtkLabel" id="lbl_main">
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="label" translatable="1">Please install the dependencies or disable the plugin.</property>
<property name="margin">5</property>
<property name="wrap">1</property>
<property name="justify">center</property>
<property name="max-width-chars">60</property>
<property name="label" translatable="1">Please install the dependencies or disable the plugin. To hide this message, you can also deactivate the plugin in the settings.</property>
<attributes>
<attribute name="style" value="normal"></attribute>
</attributes>
@ -106,7 +106,7 @@
</child>
<child>
<object class="GtkButton" id="btn_disable_plugin">
<property name="label" translatable="1">Disable plugin</property>
<property name="label" translatable="1">Disable plugin temporarily</property>
</object>
</child>
</object>

View File

@ -156,9 +156,6 @@ class SafeEyes(Gtk.Application):
settings_dialog.show()
def show_required_plugin_dialog(self, plugin_id, plugin_name, message):
"""
Listen to tray icon About action and send the signal to About dialog.
"""
logging.info("Show RequiredPlugin dialog")
dialog = RequiredPluginDialog(
plugin_id,
@ -170,16 +167,15 @@ class SafeEyes(Gtk.Application):
dialog.show()
def disable_plugin(self, plugin_id):
"""
Temporarily disable plugin, and restart SafeEyes.
"""
config = self.config.clone()
for plugin in config.get('plugins'):
if plugin['id'] == plugin_id:
plugin['enabled'] = False
logging.info("Saving settings to safeeyes.json")
config.save()
self.required_plugin_dialog_active = False
self.restart(config, set_active=True)

View File

@ -46,7 +46,10 @@ class RequiredPluginDialog:
builder.get_object('lbl_header').set_label(_("The required plugin '%s' is missing dependencies!") % _(plugin_name))
builder.get_object('lbl_main').set_label(_("Please install the dependencies or disable the plugin."))
builder.get_object('lbl_main').set_label(_("Please install the dependencies or disable the plugin. To hide this message, you can also deactivate the plugin in the settings."))
builder.get_object('btn_close').set_label(_("Quit"))
builder.get_object('btn_disable_plugin').set_label(_("Disable plugin temporarily"))
if isinstance(message, PluginDependency):
builder.get_object('lbl_message').set_label(_(message.message))