Добавлена настройка звука

master3.4 3.4.6.13
parent 99055edd9c
commit 6630986bdf

@ -19,13 +19,61 @@ import re
from calculate.lib.datavars import (Variable, ReadonlyVariable,
ReadonlyTableVariable, FieldValue,
HumanReadable)
from calculate.lib.utils.portage import isPkgInstalled
from calculate.lib.utils.files import readFile
from calculate.install.distr import DistributiveError
from calculate.lib.cl_lang import setLocalTranslate, _
setLocalTranslate('cl_install3', sys.modules[__name__])
class VariableOsAudio(Variable):
"""
Выбранная аудиосистема
"""
type = "choice"
opt = ['--audio']
metavalue = "AUDIO"
def init(self):
self.label = _("Audio system")
self.help = _("set the audio system")
def get(self):
return self.choice()[0][0]
def set(self, value):
return {'none': ''}.get(value, value)
def choice(self):
return self.Get('os_audio_available') or [('',_('None'))]
class VariableOsAudioAvailable(Variable):
"""
Доступные звуковые системы
"""
type = "list"
def get(self):
mapAudioConf = (('pulseaudio', 'media-sound/pulseaudio',
_("PulseAudio")),
('alsa', 'media-sound/alsa-utils', _('ALSA')))
image = self.Get('cl_image')
if image:
with image as distr:
try:
distrPath = image.getDirectory()
return map(lambda x:x[0::2],
filter(lambda x: not x[1] or isPkgInstalled(x[1],
prefix=distrPath),
mapAudioConf))
except DistributiveError as e:
pass
return sorted(map(lambda x:x[0::2], mapNetConf[-1:]), key=lambda x:x[1])
class VariableOsAudioData(ReadonlyTableVariable):
"""
Information about audio cards
@ -99,7 +147,8 @@ class VariableOsAudioDefault(Variable):
Current default audio card
"""
type = "choice"
opt = ['--audio']
opt = ['--audio-card']
metavalue = "CARD"
def init(self):
self.label = _("Default audio card")

@ -29,7 +29,7 @@ from calculate.core.server.func import WsdlBase
from calculate.install.utils.cl_install import ClInstallAction
from calculate.install.utils.cl_setup import (
ClSetupLocaleAction, ClSetupVideoAction, ClSetupSystemAction,
ClSetupBootAction, ClSetupNetworkAction,
ClSetupBootAction, ClSetupNetworkAction, ClSetupAudioAction,
ClSetupSessionAction)
@ -112,6 +112,9 @@ class Wsdl(WsdlBase):
expert=('cl_install_home_crypt_set',),
hide=('cl_migrate_data',),
brief=('cl_migrate_data_brief',)),
lambda group: group(_("Audio"),
normal=('os_audio',),
expert=('os_audio_default',)),
lambda group: group(_("Video"),
normal=('os_install_x11_video_drv',
'os_install_x11_composite',
@ -288,6 +291,31 @@ class Wsdl(WsdlBase):
'cl_dispatch_conf',
'cl_verbose_set'),
next_label=_("Save"))]},
{
# настройка звука
'method_name': "setup_audio",
'category': __("Configuration"),
'title': __("Audio"),
'image': 'audio-card',
'command': 'cl-setup-audio',
'gui': True,
'rights': ['setupaudio'],
'logic': {'Install': install.Install},
'action': ClSetupAudioAction,
'datavars': "install",
'native_error': (
VariableError, DataVarsError, install.InstallError),
'setvars': {'cl_action!': 'merge', 'cl_merge_pkg!': [None],
'cl_merge_set!': "on", 'cl_setup': 'audio'},
'groups': [
lambda group: group(_("Audio"),
normal=('os_audio',),
expert=(
'os_audio_default',
'cl_templates_locate',
'cl_dispatch_conf',
'cl_verbose_set'),
next_label=_("Save"))]},
{
# настройка локали
'method_name': "setup_locale",

Loading…
Cancel
Save