mirror of
https://github.com/GradienceTeam/Gradience.git
synced 2024-07-04 18:27:52 +00:00
feat: add message dialog if unable to remove plugin
This commit is contained in:
parent
3a708fe173
commit
ca630b25db
|
@ -40,6 +40,7 @@ if is_local:
|
|||
)
|
||||
|
||||
pkgdatadir = '@PKGDATA_DIR@'
|
||||
print(pkgdatadir)
|
||||
localedir = '@LOCALE_DIR@'
|
||||
|
||||
sys.dont_write_bytecode = True
|
||||
|
|
|
@ -22,7 +22,8 @@ configure_file(
|
|||
'PROJECT_URL': PROJECT_URL,
|
||||
'BUGTRACKER_URL': BUGTRACKER_URL,
|
||||
'HELP_URL': HELP_URL,
|
||||
'TRANSLATE_URL': TRANSLATE_URL
|
||||
'TRANSLATE_URL': TRANSLATE_URL,
|
||||
'PKGDATA_DIR': PKGDATA_DIR,
|
||||
}),
|
||||
install: true,
|
||||
install_dir: PY_INSTALLDIR.get_install_dir() / 'gradience',
|
||||
|
|
|
@ -66,7 +66,19 @@ class GradiencePluginRow(Adw.ActionRow):
|
|||
USER_PLUGIN_DIR / f"{self.plugin_object.plugin_id}.yapsy-plugin"
|
||||
)
|
||||
buglog("remove", plugin_yapsy_file)
|
||||
os.remove(plugin_yapsy_file)
|
||||
try:
|
||||
os.remove(plugin_yapsy_file)
|
||||
except FileNotFoundError:
|
||||
error_dialog = Adw.MessageDialog(
|
||||
#transient_for=self.props.active_window,
|
||||
heading=_("Unable to remove"),
|
||||
body=_(
|
||||
"This is a system plugin, and cannot be removed. "
|
||||
)
|
||||
)
|
||||
error_dialog.add_response("close", _("Close"))
|
||||
error_dialog.present()
|
||||
buglog("remove", plugin_yapsy_file)
|
||||
Gtk.Application.get_default().reload_plugins()
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
|
|
|
@ -34,6 +34,10 @@ SYSTEM_PLUGIN_DIR = os.path.join(
|
|||
"plugins",
|
||||
)
|
||||
|
||||
print("=======================")
|
||||
print(pkgdatadir)
|
||||
print(SYSTEM_PLUGIN_DIR)
|
||||
|
||||
|
||||
class GradiencePluginsList:
|
||||
"""Represent the plugin group in Advanced"""
|
||||
|
@ -54,6 +58,7 @@ class GradiencePluginsList:
|
|||
|
||||
def reload(self):
|
||||
self.pm = PluginManager()
|
||||
print(SYSTEM_PLUGIN_DIR)
|
||||
self.pm.setPluginPlaces([USER_PLUGIN_DIR, SYSTEM_PLUGIN_DIR])
|
||||
self.pm.collectPlugins()
|
||||
for pluginInfo in self.pm.getAllPlugins():
|
||||
|
@ -106,7 +111,7 @@ class GradiencePluginsList:
|
|||
empty = False
|
||||
if empty:
|
||||
row = Adw.ActionRow()
|
||||
row.set_title(_("No plugins found"))
|
||||
row.set_title(_("No plugins found."))
|
||||
group.add(row)
|
||||
return group
|
||||
|
||||
|
|
Loading…
Reference in a new issue