summaryrefslogtreecommitdiff
path: root/plugins/python
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-12-06 20:49:03 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-12-06 20:49:03 (GMT)
commitecd201ba165056f61dec47d50bd5ced8e7cbb893 (patch)
treec5f30836edc41b5d8097ef4aad27c239355dfae0 /plugins/python
parent358a098d35d2036c10634e0f12d5c5812641352f (diff)
Detected batch mode in the new scripting plugin.
Diffstat (limited to 'plugins/python')
-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):