From ecd201ba165056f61dec47d50bd5ced8e7cbb893 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Sun, 6 Dec 2020 21:49:03 +0100 Subject: Detected batch mode in the new scripting plugin. --- plugins/python/scripting/core.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/plugins/python/scripting/core.py b/plugins/python/scripting/core.py index 71afaf2..3e96c8e 100644 --- a/plugins/python/scripting/core.py +++ b/plugins/python/scripting/core.py @@ -33,33 +33,33 @@ class ScriptingEngine(PluginModule): # Insert the new menu item into 'File' submenu - bar = gcore.find_editor_item_by_type(MenuBar) - builder = gcore.get_editor_builder() - file_menu = builder.get_object('file').get_submenu() - sep_item = builder.get_object('file_sep_1') - save_item = builder.get_object('file_save_project') + if builder: + + file_menu = builder.get_object('file').get_submenu() + sep_item = builder.get_object('file_sep_1') + save_item = builder.get_object('file_save_project') - index = EasyGtk.find_contained_child_index(file_menu, save_item) + index = EasyGtk.find_contained_child_index(file_menu, save_item) - if index == -1: - raise RuntimeError('file menu not found') + if index == -1: + raise RuntimeError('file menu not found') - prev = EasyGtk.get_nth_contained_child(file_menu, index - 1) + prev = EasyGtk.get_nth_contained_child(file_menu, index - 1) - if sep_item == prev: + if sep_item == prev: - sep = Gtk.SeparatorMenuItem() - sep.show() + sep = Gtk.SeparatorMenuItem() + sep.show() - file_menu.insert(sep, index) + file_menu.insert(sep, index) - item = Gtk.MenuItem(label='Run Python script...') - item.connect("activate", self._on_file_run_script_activate) - item.show() + item = Gtk.MenuItem(label='Run Python script...') + item.connect("activate", self._on_file_run_script_activate) + item.show() - file_menu.insert(item, index) + file_menu.insert(item, index) def _notify_plugins_loaded(self, action): -- cgit v0.11.2-87-g4458