|
|
|
@ -19,6 +19,7 @@ import re
|
|
|
|
|
from calculate.lib.datavars import (Variable, ReadonlyVariable,
|
|
|
|
|
ReadonlyTableVariable, FieldValue,
|
|
|
|
|
HumanReadable)
|
|
|
|
|
from calculate.lib.utils.common import getValueFromCmdLine, CmdlineParams
|
|
|
|
|
from calculate.lib.utils.portage import isPkgInstalled
|
|
|
|
|
from calculate.lib.utils.files import readFile, readLinesFile
|
|
|
|
|
from calculate.install.distr import DistributiveError
|
|
|
|
@ -42,13 +43,20 @@ class VariableOsAudio(Variable):
|
|
|
|
|
self.help = _("set the audio system")
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
return self.choice()[0][0]
|
|
|
|
|
|
|
|
|
|
def set(self, value):
|
|
|
|
|
return {'none': ''}.get(value, value)
|
|
|
|
|
"""
|
|
|
|
|
pulseaudio по умолчанию если доступно или вписано в /etc/asound.conf
|
|
|
|
|
"""
|
|
|
|
|
avail = [x[0] for x in self.Get('os_audio_available')]
|
|
|
|
|
if "pulseaudio" in avail:
|
|
|
|
|
audio = getValueFromCmdLine(CmdlineParams.Calculate,
|
|
|
|
|
CmdlineParams.Audio)
|
|
|
|
|
if audio and audio == "alsa":
|
|
|
|
|
return "alsa"
|
|
|
|
|
return "pulseaudio"
|
|
|
|
|
return "alsa"
|
|
|
|
|
|
|
|
|
|
def choice(self):
|
|
|
|
|
return self.Get('os_audio_available') or [('', _('None'))]
|
|
|
|
|
return self.Get('os_audio_available')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VariableOsAudioAvailable(Variable):
|
|
|
|
@ -60,7 +68,7 @@ class VariableOsAudioAvailable(Variable):
|
|
|
|
|
def get(self):
|
|
|
|
|
mapAudioConf = (('pulseaudio', 'media-sound/pulseaudio',
|
|
|
|
|
_("PulseAudio")),
|
|
|
|
|
('alsa', 'media-sound/alsa-utils', _('ALSA')))
|
|
|
|
|
('alsa', None, _('ALSA')))
|
|
|
|
|
image = self.Get('cl_image')
|
|
|
|
|
if image:
|
|
|
|
|
with image as distr:
|
|
|
|
|