33"""Program to control the Solaris audio device.
44
55When no arguments are given, this pops up a graphical window which lets you
6- choose which audio output device you want sound to go to .
6+ choose the audio input and output devices .
77
88This program can be driven via the command line, and when done so, no window
99pops up. Options have the general form:
@@ -27,10 +27,13 @@ The list of devices and their short options are:
2727
2828Other options are:
2929
30+ --version
31+ -v
32+ Print the version number and exit.
33+
3034 --help
3135 -h
3236 Print this message and exit.
33-
3437"""
3538
3639import sys
@@ -41,20 +44,22 @@ from SUNAUDIODEV import *
4144# Milliseconds between interrupt checks
4245KEEPALIVE_TIMER = 500
4346
47+ __version__ = '1.0'
48+
4449
4550
4651class MainWindow :
4752 def __init__ (self , device ):
4853 self .__devctl = device
4954 info = device .getinfo ()
5055 #
51- self .__tkroot = tkroot = Tk (className = 'Pynche ' )
56+ self .__tkroot = tkroot = Tk (className = 'Audiopy ' )
5257 tkroot .withdraw ()
5358 # now create the top level window
5459 root = self .__root = Toplevel (tkroot , class_ = 'Audiopy' )
5560 root .protocol ('WM_DELETE_WINDOW' , self .__quit )
56- root .title ('Audiopy' )
57- root .iconname ('Audiopy' )
61+ root .title ('audiopy ' + __version__ )
62+ root .iconname ('audiopy ' + __version__ )
5863 root .tk .createtimerhandler (KEEPALIVE_TIMER , self .__keepalive )
5964 #
6065 buttons = []
@@ -284,6 +289,9 @@ def main():
284289 if arg in ('-h' , '--help' ):
285290 usage (code = 0 )
286291 # does not return
292+ elif arg in ('-v' , '--version' ):
293+ print 'audiopy version' , __version__
294+ sys .exit (0 )
287295 for long , short , io , mask in options :
288296 if arg in (long , short ):
289297 # toggle the option
0 commit comments