62 script = self.
scripts[scriptIndex]
if len(self.
scripts) > scriptIndex
else ""
63 window = Application.activeWindow()
67 spec = importlib.util.spec_from_file_location(
68 "users_script", script)
69 users_module = importlib.util.module_from_spec(spec)
70 spec.loader.exec_module(users_module)
72 if (hasattr(users_module,
'main')
73 and callable(users_module.main)):
76 window.activeView().showFloatingMessage(
77 str(i18n(
"Script {0} executed")).format(script), QIcon(), 1500, 2)
79 except Exception
as e:
80 window.activeView().showFloatingMessage(str(e), QIcon(), 2000, 1)
82 window.activeView().showFloatingMessage(
83 str(i18n((
"You did not assign a script to that action"))), QIcon(), 1500, 2)