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://FoxDotExtensions.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://FoxDotExtensions.codeberg.page/FoxDot/>`_.

Please see the `documentation <FoxDotExtensions.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
from .lib.Translation import gettext


[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=gettext('Live coding with Python and SuperCollider'), epilog=gettext( 'More information: https://FoxDotExtensions.codeberg.page/FoxDot/' ), add_help=False, ) parser.add_argument( '-h', '--help', action='store_true', help=gettext('show this help message and exit'), ) parser.add_argument( '-p', '--pipe', action='store_true', help=gettext('run FoxDot from the command line interface'), ) parser.add_argument( '-d', '--dir', help=gettext('use an alternate directory for looking up samples'), ) parser.add_argument( '-s', '--startup', help=gettext('use an alternate startup file') ) parser.add_argument( '-S', '--simple', action='store_true', help=gettext('run FoxDot in simple (accessible) mode'), ) parser.add_argument( '-n', '--no-startup', action='store_true', help=gettext('does not load startup.py on boot'), ) parser.add_argument( '-b', '--boot', action='store_true', help=gettext('Boot SuperCollider from the command line'), ) def main(): args = parser.parse_args() if args.help: parser.print_help() return 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())