Sampled Instrument Player with static and monolithic design. All instruments are built-in.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
3.0 KiB

#! /usr/bin/env python3
# -*- coding: utf-8 -*-
Copyright 2022, Nils Hilbricht, Germany ( )
This file is part of the Laborejo Software Suite ( ),
This application is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <>.
import logging; logger = logging.getLogger(__name__);"import")
import os.path
#from code import InteractiveInterpreter
import engine.api as api
class DebugScriptRunner(object):
"""We do not provide our own text editor in the GUI. Instead the user must edit
in our NSM Session directory, save and then"""
def __init__(self, apilocals):
self.apilocals = apilocals
self.absoluteScriptFilePath = None
def trueInit(self, nsmClient):
assert nsmClient
self.nsmClient = nsmClient
self.absoluteScriptFilePath = os.path.join(self.nsmClient.ourPath, "")"{self.nsmClient.ourClientNameUnderNSM}: Using script file: {self.absoluteScriptFilePath}")
def _createEmptyDebugScript(self):
assert self.absoluteScriptFilePath
print(f"{self.nsmClient.ourClientNameUnderNSM}: Script file not found. Initializing: {self.absoluteScriptFilePath}")"{self.nsmClient.ourClientNameUnderNSM}: Script file not found. Initializing: {self.absoluteScriptFilePath}")
text = ("""#! /usr/bin/env python3"""
"""# -*- coding: utf-8 -*-"""
"#This file is in the Qt-MainWindow (-> self) scope.\n#You can also call api commands which will trigger a GUI callback. Like api.undo(), api.redo() etc."
"""print ("Hello World")"""
with open(self.absoluteScriptFilePath, "w", encoding="utf-8") as f:
def run(self):
if not os.path.exists(self.absoluteScriptFilePath):
if not os.path.exists(self.nsmClient.ourPath):
exec(compile(open(self.absoluteScriptFilePath).read(), filename=self.absoluteScriptFilePath, mode="exec"), globals(), self.apilocals)
except Exception as e:
print (e)
#with open(self.absoluteScriptFilePath, "r", encoding="utf-8") as f:
# source =
#self.runsource(source=source, filename=self.absoluteScriptFilePath)