Ejemplo n.º 1
0
    def on_run(self, event):
        # ask for save before run if script has been modified
        if self.stc.GetModify():
            answer = cjr.confirm_yes_no(
                            self,
                            "Save changes to '%s' ?" % self.filename
                            )
            if answer == wx.ID_YES:
                self.save(True)
            elif answer == wx.ID_CANCEL:
                return

        if self.filename == "":
            cjr.show_information_message(
                "I'm quite stupid, so please you Supreme Intelligence\n" \
                "save the file so I can look at its extension and know\n" \
                "which file type this script is."
                )
        if self.filename.endswith('.lua'):
            servers.get_lua_server().runscript(
                str( format.mangle_path(self.filename) )
                )
        elif self.filename.endswith('.py'):
            servers.get_python_server().runscript(
                str( format.mangle_path(self.filename) )
                )
Ejemplo n.º 2
0
def run_script(index):
    scripts = guisettings.Repository.getsettingvalue(guisettings.ID_ScriptList)
    script_data = scripts[index]
    if index in range(len(scripts)):
        path = script_data['path']
        if path.endswith('.lua'):
            servers.get_lua_server().runscript(str(path))
        elif path.endswith('.py'):
            # Run the script, setting first its custom data
            script.custom_data = script_data['custom data']
            servers.get_python_server().runscript(str(path))

            # Store the new custom data
            script_data['custom data'] = script.custom_data
            scripts[index] = script_data
            guisettings.Repository.setsettingvalue(guisettings.ID_ScriptList,
                                                   scripts)
Ejemplo n.º 3
0
def run_script(index):
    scripts = guisettings.Repository.getsettingvalue(
                    guisettings.ID_ScriptList
                    )
    script_data = scripts[index]
    if index in range(len(scripts)):
        path = script_data['path']
        if path.endswith('.lua'):
            servers.get_lua_server().runscript(str(path))
        elif path.endswith('.py'):
            # Run the script, setting first its custom data
            script.custom_data = script_data['custom data']
            servers.get_python_server().runscript(str(path))
            
            # Store the new custom data
            script_data['custom data'] = script.custom_data
            scripts[index] = script_data
            guisettings.Repository.setsettingvalue(
                guisettings.ID_ScriptList, 
                scripts
                )
Ejemplo n.º 4
0
    def on_run(self, event):
        # ask for save before run if script has been modified
        if self.stc.GetModify():
            answer = cjr.confirm_yes_no(
                self, "Save changes to '%s' ?" % self.filename)
            if answer == wx.ID_YES:
                self.save(True)
            elif answer == wx.ID_CANCEL:
                return

        if self.filename == "":
            cjr.show_information_message(
                "I'm quite stupid, so please you Supreme Intelligence\n" \
                "save the file so I can look at its extension and know\n" \
                "which file type this script is."
                )
        if self.filename.endswith('.lua'):
            servers.get_lua_server().runscript(
                str(format.mangle_path(self.filename)))
        elif self.filename.endswith('.py'):
            servers.get_python_server().runscript(
                str(format.mangle_path(self.filename)))