Vous ne pouvez pas sélectionner plus de 25 sujetsLes noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
parser.add_argument("-s","--save",action='store',dest="directory",help="Use this directory to save. Will be created or loaded from if already present. Deactivates Non-Session-Manager support.")
parser.add_argument("-p","--profiler",action='store_true',help="(Development) Run the python profiler and produce a .cprof file at quit. The name will appear in your STDOUT.")
parser.add_argument("-m","--mute",action='store_true',help="(Development) Use a fake cbox module, effectively deactivating midi and audio.")
parser.add_argument("-V","--verbose",action='store_true',help="(Development) Switch the logger to INFO and print out all kinds of information to get a high-level idea of what the program is doing.")
#NSM changes our cwd to whereever we started non-session-manager from.
#print (os.getcwd())
importsys
fromosimportgetenv
ifnotgetenv("NSM_URL"):#NSMClient checks for this itself but we can anticipate an error and inform the user.
fromPyQt5.QtWidgetsimportQMessageBox,QApplication
qSessionDirApp=QApplication(sys.argv)
setPaletteAndFont(qSessionDirApp)
pathDialog=ChooseSessionDirectory(qSessionDirApp)
qSessionDirApp.quit()#pathDialog somehow survives
ifpathDialog.path:
startPseudoNSMServer(pathDialog.path)
else:
sys.exit()
#message = f"""Please start {prettyName} only through the Non Session Manager (NSM) or use the --save command line parameter."""
#exitWithMessage(message)
def_is_jack_running():
"""Check for JACK"""
importctypes
importos
silent=os.open(os.devnull,os.O_WRONLY)
stdout=os.dup(1)
stderr=os.dup(2)
os.dup2(silent,1)#stdout
os.dup2(silent,2)#stderr
cjack=ctypes.cdll.LoadLibrary("libjack.so.0")
classjack_client_t(ctypes.Structure):
_fields_=[]
cjack.jack_client_open.argtypes=[ctypes.c_char_p,ctypes.c_int,ctypes.POINTER(ctypes.c_int)]#the two ints are enum and pointer to enum. #http://jackaudio.org/files/docs/html/group__ClientFunctions.html#gab8b16ee616207532d0585d04a0bd1d60
startSingleNSMServer(path)#provides NSM_URL environment variable and a limited drop-in replacement for NSM that will only answer to our application
assertgetenv("NSM_URL")
sys.path.append("site-packages")# If you compiled but did not install you can still run with the local build of cbox in our temp dir site-packages. Add path to the last place, in case there is an installed or bundled version
ifargs.directory:
#Switch to the mode without NSM.
startPseudoNSMServer(args.directory)
checkNsmOrExit(METADATA["name"])
checkJackOrExit(args.mute,METADATA["name"])
setProcessName(METADATA["shortName"])
ifargs.mute:
"""This uses the fact that imports are global and only triggered once.
logging.info("Looking for calfbox shared library in absolute path: {}".format(os.environ["CALFBOXLIBABSPATH"]))
else:
logging.info("Looking for calfbox shared library systemwide through ctypes.util.find_library")
try:
fromcalfboximportcbox
logging.info("{}: using cbox python module from {} . Local version has higher priority than system wide.".format(METADATA["name"],os.path.abspath(cbox.__file__)))
exceptExceptionase:
print(e)
print("Here is some information. Please show this to the developers.")