1# -*- coding: utf-8 -*-
2# ------------------------------------------------------------------------------
3# Name:          test.toggleDebug.py
4# Purpose:       Changes debug on if off, off if on...
5#
6# Authors:       Michael Scott Cuthbert
7#
8# Copyright:    Copyright © 2010, 2012 Michael Scott Cuthbert and the music21 Project
9# License:      BSD, see license.txt
10# ------------------------------------------------------------------------------
11'''
12Run from command line to toggle debug status.
13'''
14
15import music21.environment
16
17
18def toggleDebug():
19    '''
20    Changes debug status from 0 to 1 or 1 to 0.  Reload environment after calling.
21    '''
22    e = music21.environment.UserSettings()
23    if e['debug'] == 1:
24        print('debug was ' + str(e['debug']) + '; switching to 0')
25        e['debug'] = 0
26    else:
27        print('debug was ' + str(e['debug']) + '; switching to 1')
28        e['debug'] = 1
29
30
31if __name__ == '__main__':
32    toggleDebug()
33