summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/python/scripting/core.py34
1 files 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):