Source code for FoxDot

#!/usr/bin/python

"""

FoxDot is a Python library and programming environment that provides a fast and
user-friendly abstraction to the powerful audio-engine, SuperCollider. It comes
with its own IDE, which means it can be used straight out of the box; all you need
is Python and SuperCollider and you're ready to go!

For more information on installation, check out `the guide <https://taconi.codeberg.page/FoxDot/install.html>`_,
or if you're already set up, you can also find a useful starter guide that introduces the
key components of FoxDot on `the website <https://taconi.codeberg.page/FoxDot/>`_.

Please see the `documentation <taconi.codeberg.page/FoxDot/docs/>`_ for more detailed information on
the FoxDot classes and how to implement them.

Copyright Ryan Kirkbride 2015
"""

import argparse
import sys
import traceback

from .lib import *
from .lib import _, _Clock


[docs] def Go(): """ Function to be called at the end of Python files with FoxDot code in to keep the TempoClock thread alive. """ try: import time while 1: time.sleep(100) except KeyboardInterrupt: pass finally: Clock.stop() Server.quit()
# ---- CLI parser = argparse.ArgumentParser( prog='FoxDot', description='Live coding with Python and SuperCollider', epilog='More information: https://taconi.codeberg.page/FoxDot/', ) parser.add_argument( '-p', '--pipe', action='store_true', help='run FoxDot from the command line interface', ) parser.add_argument( '-d', '--dir', help='use an alternate directory for looking up samples' ) parser.add_argument('-s', '--startup', help='use an alternate startup file') parser.add_argument( '-S', '--simple', action='store_true', help='run FoxDot in simple (accessible) mode', ) parser.add_argument( '-n', '--no-startup', action='store_true', help='does not load startup.py on boot', ) parser.add_argument( '-b', '--boot', action='store_true', help='Boot SuperCollider from the command line', ) def main(): args = parser.parse_args() if args.dir: try: # Use given directory FoxDotCode.use_sample_directory(args.dir) except OSError: sys.exit(traceback.format_exc(limit=1)) if args.startup: try: FoxDotCode.use_startup_file(args.startup) except OSError: sys.exit(traceback.format_exc(limit=1)) if args.no_startup: FoxDotCode.no_startup() if args.boot: Server.boot() if args.pipe: # Just take commands from the CLI handle_stdin() else: # Open the GUI if args.simple: from .lib.Workspace.Simple import workspace else: from .lib.Workspace.Editor import workspace workspace(FoxDotCode).run() # It must be kept at the end of the file. # So that everything is imported when you run `from FoxDot import *`, including the variables that you use with _ __all__ = list(globals())