diff options
Diffstat (limited to 'plugins/python/scripting/manager.py')
-rw-r--r-- | plugins/python/scripting/manager.py | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/plugins/python/scripting/manager.py b/plugins/python/scripting/manager.py deleted file mode 100644 index 6b27b48..0000000 --- a/plugins/python/scripting/manager.py +++ /dev/null @@ -1,53 +0,0 @@ - -import os - -from gi.repository import GLib, Gtk - - -_manager = None - - -def get_recent_python_script_manager(xbel = None): - """Provide the manager for the recently run Python scripts.""" - - global _manager - - # As a first panel creation is forced by the Chrysalide core to register - # its final GType, xbel is not defined at the first call of this function. - # Thus relying on the definition of xbel is a better filter than relying - # on the existence of _manager. - # - # In that special initial case, result is None - - if not(xbel is None): - - assert(_manager is None) - - _manager = Gtk.RecentManager(filename=xbel) - - return _manager - - -def remember_python_script(filename): - """Register a Python script into the recents list.""" - - uri = GLib.filename_to_uri(filename) - - recent_data = Gtk.RecentData() - recent_data.app_name = 'Chrysalide Python plugin' - recent_data.app_exec = 'chrysalide' - recent_data.display_name = os.path.basename(filename) - recent_data.description = 'Python script run inside Chrysalide' - recent_data.mime_type = 'text/x-python' - - manager = get_recent_python_script_manager() - manager.add_full(uri, recent_data) - - -def forget_python_script(filename): - """Unregister a Python script from the recents list.""" - - uri = GLib.filename_to_uri(filename) - - manager = get_recent_python_script_manager() - manager.remove_item(uri) |