@@ -95,19 +95,23 @@ class MainWindow:
9595 if not info .i_avail_ports & LINE_IN :
9696 btn .configure (state = DISABLED )
9797 buttons .append (btn )
98- ##
99- btn = Radiobutton (frame ,
100- text = 'CD' ,
101- variable = self .__inputvar ,
102- value = CD ,
103- command = self .__pushtodev ,
104- underline = 0 )
105- btn .grid (row = 2 , column = 1 , sticky = W )
106- root .bind ('<Alt-c>' , self .__cd )
107- root .bind ('<Alt-C>' , self .__cd )
108- if not info .i_avail_ports & CD :
109- btn .configure (state = DISABLED )
110- buttons .append (btn )
98+ ## if SUNAUDIODEV was built on an older version of Solaris, the CD
99+ ## input device won't exist
100+ try :
101+ btn = Radiobutton (frame ,
102+ text = 'CD' ,
103+ variable = self .__inputvar ,
104+ value = CD ,
105+ command = self .__pushtodev ,
106+ underline = 0 )
107+ btn .grid (row = 2 , column = 1 , sticky = W )
108+ root .bind ('<Alt-c>' , self .__cd )
109+ root .bind ('<Alt-C>' , self .__cd )
110+ if not info .i_avail_ports & CD :
111+ btn .configure (state = DISABLED )
112+ buttons .append (btn )
113+ except NameError :
114+ pass
111115 #
112116 # where does output go to?
113117 frame = Frame (root , bd = 1 , relief = RAISED )
@@ -276,13 +280,18 @@ def main():
276280 return
277281
278282 # spec: LONG OPT, SHORT OPT, 0=input,1=output, MASK
279- options = ( ('--microphone' , '-m' , 0 , MICROPHONE ),
283+ options = [ ('--microphone' , '-m' , 0 , MICROPHONE ),
280284 ('--linein' , '-i' , 0 , LINE_IN ),
281- ('--cd' , '-c' , 0 , CD ),
282285 ('--headphones' , '-p' , 1 , HEADPHONE ),
283286 ('--speaker' , '-s' , 1 , SPEAKER ),
284287 ('--lineout' , '-o' , 1 , LINE_OUT ),
285- )
288+ ]
289+ # See the comment above about `CD'
290+ try :
291+ options .append (('--cd' , '-c' , 0 , CD ))
292+ except NameError :
293+ pass
294+
286295 info = device .getinfo ()
287296 # first get the existing values
288297 for arg in sys .argv [1 :]:
0 commit comments