system_setup: PEP8 linting fixes
This commit is contained in:
parent
300161e0ea
commit
aff93e5cda
|
@ -29,13 +29,14 @@ class SystemSetupClient(SubiquityClient):
|
|||
snapd_socket_path = None
|
||||
|
||||
controllers = [
|
||||
#"Serial",
|
||||
# "Serial",
|
||||
"Welcome",
|
||||
"WSLIdentity",
|
||||
"Integration",
|
||||
"Overview",
|
||||
"Progress",
|
||||
]
|
||||
|
||||
def __init__(self, opts):
|
||||
if opts.reconfigure:
|
||||
self.controllers = [
|
||||
|
@ -45,8 +46,6 @@ class SystemSetupClient(SubiquityClient):
|
|||
]
|
||||
super().__init__(opts)
|
||||
|
||||
|
||||
|
||||
def restart(self, remove_last_screen=True, restart_server=False):
|
||||
log.debug(f"restart {remove_last_screen} {restart_server}")
|
||||
if self.fg_proc is not None:
|
||||
|
|
|
@ -19,7 +19,8 @@ from .integration import IntegrationController
|
|||
from .overview import OverviewController
|
||||
from .reconfiguration import ReconfigurationController
|
||||
|
||||
from subiquity.client.controllers import (ProgressController, WelcomeController)
|
||||
from subiquity.client.controllers import (ProgressController,
|
||||
WelcomeController)
|
||||
|
||||
|
||||
__all__ = [
|
||||
|
@ -30,4 +31,3 @@ __all__ = [
|
|||
'OverviewController',
|
||||
'ReconfigurationController',
|
||||
]
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@ class IntegrationController(SubiquityTuiController):
|
|||
|
||||
def run_answers(self):
|
||||
if all(elem in self.answers for elem in
|
||||
['custom_path', 'custom_mount_opt', 'gen_host', 'gen_resolvconf']):
|
||||
['custom_path', 'custom_mount_opt',
|
||||
'gen_host', 'gen_resolvconf']):
|
||||
integration = WSLConfiguration1Data(
|
||||
custom_path=self.answers['custom_path'],
|
||||
custom_mount_opt=self.answers['custom_mount_opt'],
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
import logging
|
||||
from subiquity.client.controller import SubiquityTuiController
|
||||
|
||||
from subiquitycore.utils import run_command
|
||||
from system_setup.ui.views.overview import OverviewView
|
||||
|
||||
log = logging.getLogger('ubuntu_wsl_oobe.controllers.identity')
|
||||
|
||||
|
||||
|
||||
class OverviewController(SubiquityTuiController):
|
||||
|
||||
async def make_ui(self):
|
||||
|
|
|
@ -15,10 +15,6 @@
|
|||
|
||||
import logging
|
||||
|
||||
import attr
|
||||
|
||||
from subiquitycore.context import with_context
|
||||
|
||||
from subiquity.client.controller import SubiquityTuiController
|
||||
from subiquity.common.types import WSLConfiguration2Data
|
||||
from system_setup.ui.views.reconfiguration import ReconfigurationView
|
||||
|
@ -35,14 +31,20 @@ class ReconfigurationController(SubiquityTuiController):
|
|||
|
||||
def run_answers(self):
|
||||
if all(elem in self.answers for elem in
|
||||
['custom_path', 'custom_mount_opt', 'gen_host', 'gen_resolvconf', 'interop_enabled', 'interop_appendwindowspath', 'gui_theme', 'gui_followwintheme', 'legacy_gui', 'legacy_audio', 'adv_ip_detect', 'wsl_motd_news', 'automount', 'mountfstab']):
|
||||
['custom_path', 'custom_mount_opt', 'gen_host',
|
||||
'gen_resolvconf', 'interop_enabled',
|
||||
'interop_appendwindowspath', 'gui_theme',
|
||||
'gui_followwintheme', 'legacy_gui',
|
||||
'legacy_audio', 'adv_ip_detect',
|
||||
'wsl_motd_news', 'automount', 'mountfstab']):
|
||||
reconfiguration = WSLConfiguration2Data(
|
||||
custom_path=self.answers['custom_path'],
|
||||
custom_mount_opt=self.answers['custom_mount_opt'],
|
||||
gen_host=self.answers['gen_host'],
|
||||
gen_resolvconf=self.answers['gen_resolvconf'],
|
||||
interop_enabled=self.answers['interop_enabled'],
|
||||
interop_appendwindowspath=self.answers['interop_appendwindowspath'],
|
||||
interop_appendwindowspath=self
|
||||
.answers['interop_appendwindowspath'],
|
||||
gui_theme=self.answers['gui_theme'],
|
||||
gui_followwintheme=self.answers['gui_followwintheme'],
|
||||
legacy_gui=self.answers['legacy_gui'],
|
||||
|
|
|
@ -18,7 +18,7 @@ import logging
|
|||
|
||||
from subiquity.models.subiquity import SubiquityModel
|
||||
|
||||
from subiquitycore.utils import run_command, is_wsl
|
||||
from subiquitycore.utils import is_wsl
|
||||
|
||||
|
||||
from subiquity.models.locale import LocaleModel
|
||||
|
@ -41,6 +41,7 @@ ff02::1 ip6-allnodes
|
|||
ff02::2 ip6-allrouters
|
||||
"""
|
||||
|
||||
|
||||
class SystemSetupModel(SubiquityModel):
|
||||
"""The overall model for subiquity."""
|
||||
|
||||
|
@ -91,8 +92,8 @@ class SystemSetupModel(SubiquityModel):
|
|||
}
|
||||
|
||||
def configured(self, model_name):
|
||||
# We need to override the parent class as *_MODEL_NAMES are global variables
|
||||
# in server.py
|
||||
# We need to override the parent class as
|
||||
# *_MODEL_NAMES are global variables in server.py
|
||||
if model_name not in self.ALL_MODEL_NAMES:
|
||||
return
|
||||
self._events[model_name].set()
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
import logging
|
||||
import subprocess
|
||||
import attr
|
||||
import json
|
||||
|
||||
from subiquitycore.utils import run_command
|
||||
|
||||
|
@ -50,7 +49,8 @@ class WSLConfiguration2Model(object):
|
|||
|
||||
def apply_settings(self, result, is_dry_run=False):
|
||||
d = {}
|
||||
#TODO: placholder settings; should be dynamically assgined using ubuntu-wsl-integration
|
||||
# TODO: placholder settings; should be dynamically assgined using
|
||||
# ubuntu-wsl-integration
|
||||
d['custom_path'] = result.custom_path
|
||||
d['custom_mount_opt'] = result.custom_mount_opt
|
||||
d['gen_host'] = result.gen_host
|
||||
|
@ -71,7 +71,8 @@ class WSLConfiguration2Model(object):
|
|||
run_command(["/usr/bin/ubuntuwsl", "reset", "-y"],
|
||||
stdout=subprocess.DEVNULL)
|
||||
# set the settings
|
||||
#TODO: placholder settings; should be dynamically generated using ubuntu-wsl-integration
|
||||
# TODO: placholder settings; should be dynamically generated using
|
||||
# ubuntu-wsl-integration
|
||||
run_command(["/usr/bin/ubuntuwsl", "update",
|
||||
"WSL.automount.enabled", result.automount],
|
||||
stdout=subprocess.DEVNULL)
|
||||
|
@ -100,7 +101,8 @@ class WSLConfiguration2Model(object):
|
|||
result.interop_appendwindowspath],
|
||||
stdout=subprocess.DEVNULL)
|
||||
run_command(["/usr/bin/ubuntuwsl", "update",
|
||||
"ubuntu.GUI.followwintheme", result.gui_followwintheme],
|
||||
"ubuntu.GUI.followwintheme",
|
||||
result.gui_followwintheme],
|
||||
stdout=subprocess.DEVNULL)
|
||||
run_command(["/usr/bin/ubuntuwsl", "update",
|
||||
"ubuntu.GUI.theme", result.gui_theme],
|
||||
|
@ -109,16 +111,17 @@ class WSLConfiguration2Model(object):
|
|||
"ubuntu.Interop.guiintergration", result.legacy_gui],
|
||||
stdout=subprocess.DEVNULL)
|
||||
run_command(["/usr/bin/ubuntuwsl", "update",
|
||||
"ubuntu.Interop.audiointegration", result.legacy_audio],
|
||||
"ubuntu.Interop.audiointegration",
|
||||
result.legacy_audio],
|
||||
stdout=subprocess.DEVNULL)
|
||||
run_command(["/usr/bin/ubuntuwsl", "update",
|
||||
"ubuntu.Interop.advancedipdetection", result.adv_ip_detect],
|
||||
"ubuntu.Interop.advancedipdetection",
|
||||
result.adv_ip_detect],
|
||||
stdout=subprocess.DEVNULL)
|
||||
run_command(["/usr/bin/ubuntuwsl", "update",
|
||||
"ubuntu.Motd.wslnewsenabled", result.wsl_motd_news],
|
||||
stdout=subprocess.DEVNULL)
|
||||
|
||||
|
||||
@property
|
||||
def wslconf2(self):
|
||||
return self._wslconf2
|
||||
|
|
|
@ -13,7 +13,11 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from subiquity.server.controllers.cmdlist import EarlyController, LateController, ErrorController
|
||||
from subiquity.server.controllers.cmdlist import (
|
||||
EarlyController,
|
||||
LateController,
|
||||
ErrorController,
|
||||
)
|
||||
from subiquity.server.controllers.locale import LocaleController
|
||||
from subiquity.server.controllers.reporting import ReportingController
|
||||
from subiquity.server.controllers.userdata import UserdataController
|
||||
|
|
|
@ -17,8 +17,6 @@ import logging
|
|||
|
||||
import attr
|
||||
|
||||
from subiquitycore.context import with_context
|
||||
|
||||
from subiquity.common.types import IdentityData
|
||||
from subiquity.server.controllers.identity import IdentityController
|
||||
|
||||
|
|
|
@ -113,22 +113,24 @@ class WSLConfiguration2Controller(SubiquityController):
|
|||
if b in self.config_ref['ubuntu'][a]:
|
||||
data[self.config_ref['ubuntu'][a][b]] = a_x[b]
|
||||
if data:
|
||||
yes_no_converter = lambda x: x == 'true'
|
||||
def bool_converter(x):
|
||||
return x == 'true'
|
||||
reconf_data = WSLConfiguration2Data(
|
||||
custom_path=data['custom_path'],
|
||||
custom_mount_opt=data['custom_mount_opt'],
|
||||
gen_host=yes_no_converter(data['gen_host']),
|
||||
gen_resolvconf=yes_no_converter(data['gen_resolvconf']),
|
||||
interop_enabled=yes_no_converter(data['interop_enabled']),
|
||||
interop_appendwindowspath=yes_no_converter(data['interop_appendwindowspath']),
|
||||
gen_host=bool_converter(data['gen_host']),
|
||||
gen_resolvconf=bool_converter(data['gen_resolvconf']),
|
||||
interop_enabled=bool_converter(data['interop_enabled']),
|
||||
interop_appendwindowspath=bool_converter(
|
||||
data['interop_appendwindowspath']),
|
||||
gui_theme=data['gui_theme'],
|
||||
gui_followwintheme=yes_no_converter(data['gui_followwintheme']),
|
||||
legacy_gui=yes_no_converter(data['legacy_gui']),
|
||||
legacy_audio=yes_no_converter(data['legacy_audio']),
|
||||
adv_ip_detect=yes_no_converter(data['adv_ip_detect']),
|
||||
wsl_motd_news=yes_no_converter(data['wsl_motd_news']),
|
||||
automount=yes_no_converter(data['automount']),
|
||||
mountfstab=yes_no_converter(data['mountfstab']),
|
||||
gui_followwintheme=bool_converter(data['gui_followwintheme']),
|
||||
legacy_gui=bool_converter(data['legacy_gui']),
|
||||
legacy_audio=bool_converter(data['legacy_audio']),
|
||||
adv_ip_detect=bool_converter(data['adv_ip_detect']),
|
||||
wsl_motd_news=bool_converter(data['wsl_motd_news']),
|
||||
automount=bool_converter(data['automount']),
|
||||
mountfstab=bool_converter(data['mountfstab']),
|
||||
)
|
||||
self.model.apply_settings(reconf_data, self.opts.dry_run)
|
||||
|
||||
|
@ -168,7 +170,8 @@ class WSLConfiguration2Controller(SubiquityController):
|
|||
data.gen_host = self.model.wslconf2.gen_host
|
||||
data.gen_resolvconf = self.model.wslconf2.gen_resolvconf
|
||||
data.interop_enabled = self.model.wslconf2.interop_enabled
|
||||
data.interop_appendwindowspath = self.model.wslconf2.interop_appendwindowspath
|
||||
data.interop_appendwindowspath = \
|
||||
self.model.wslconf2.interop_appendwindowspath
|
||||
data.gui_theme = self.model.wslconf2.gui_theme
|
||||
data.gui_followwintheme = self.model.wslconf2.gui_followwintheme
|
||||
data.legacy_gui = self.model.wslconf2.legacy_gui
|
||||
|
|
|
@ -20,7 +20,11 @@ from urwid import (
|
|||
|
||||
|
||||
from subiquity.common.types import IdentityData
|
||||
from subiquity.ui.views.identity import IdentityForm, IdentityView, setup_password_validation
|
||||
from subiquity.ui.views.identity import (
|
||||
IdentityForm,
|
||||
IdentityView,
|
||||
setup_password_validation,
|
||||
)
|
||||
from subiquitycore.ui.utils import screen
|
||||
from subiquitycore.utils import crypt_password
|
||||
from subiquitycore.view import BaseView
|
||||
|
@ -32,10 +36,12 @@ class WSLIdentityForm(IdentityForm):
|
|||
|
||||
realname = IdentityForm.realname
|
||||
username = IdentityForm.username
|
||||
username.help = _("The username does not need to match your Windows username")
|
||||
username.help = \
|
||||
_("The username does not need to match your Windows username")
|
||||
password = IdentityForm.password
|
||||
confirm_password = IdentityForm.confirm_password
|
||||
|
||||
|
||||
class WSLIdentityView(BaseView):
|
||||
title = IdentityView.title
|
||||
excerpt = _("Please create a default UNIX user account. "
|
||||
|
@ -61,7 +67,8 @@ class WSLIdentityView(BaseView):
|
|||
'username': identity_data.username,
|
||||
}
|
||||
|
||||
# This is the different form model with IdentityView which prevents us from inheriting it
|
||||
# This is the different form model with IdentityView
|
||||
# which prevents us from inheriting it
|
||||
self.form = WSLIdentityForm([], initial)
|
||||
|
||||
connect_signal(self.form, 'submit', self.done)
|
||||
|
|
|
@ -40,8 +40,11 @@ class IntegrationForm(Form):
|
|||
def __init__(self, initial):
|
||||
super().__init__(initial=initial)
|
||||
|
||||
custom_path = MountField(_("Mount Location"), help=_("Location for the automount"))
|
||||
custom_mount_opt = StringField(_("Mount Option"), help=_("Mount option passed for the automount"))
|
||||
custom_path = MountField(_("Mount Location"),
|
||||
help=_("Location for the automount"))
|
||||
custom_mount_opt = StringField(_("Mount Option"),
|
||||
help=_("Mount option passed "
|
||||
"for the automount"))
|
||||
gen_host = BooleanField(_("Enable Host Generation"), help=_(
|
||||
"Selecting enables /etc/host re-generation at every start"))
|
||||
gen_resolvconf = BooleanField(_("Enable resolv.conf Generation"), help=_(
|
||||
|
@ -50,15 +53,18 @@ class IntegrationForm(Form):
|
|||
def validate_custom_path(self):
|
||||
p = self.custom_path.value
|
||||
if p != "" and (re.fullmatch(r"(/[^/ ]*)+/?", p) is None):
|
||||
return _("Mount location must be a absolute UNIX path without space.")
|
||||
return _("Mount location must be a absolute UNIX path"
|
||||
" without space.")
|
||||
|
||||
def validate_custom_mount_opt(self):
|
||||
o = self.custom_mount_opt.value
|
||||
# filesystem independent mount option
|
||||
fsimo = [r"async", r"(no)?atime", r"(no)?auto", r"(fs|def|root)?context=\w+", r"(no)?dev", r"(no)?diratime",
|
||||
r"dirsync", r"(no)?exec", r"group", r"(no)?iversion", r"(no)?mand", r"_netdev", r"nofail",
|
||||
r"(no)?relatime", r"(no)?strictatime", r"(no)?suid", r"owner", r"remount", r"ro", r"rw",
|
||||
r"_rnetdev", r"sync", r"(no)?user", r"users"]
|
||||
fsimo = [r"async", r"(no)?atime", r"(no)?auto",
|
||||
r"(fs|def|root)?context=\w+", r"(no)?dev", r"(no)?diratime",
|
||||
r"dirsync", r"(no)?exec", r"group", r"(no)?iversion",
|
||||
r"(no)?mand", r"_netdev", r"nofail", r"(no)?relatime",
|
||||
r"(no)?strictatime", r"(no)?suid", r"owner", r"remount",
|
||||
r"ro", r"rw", r"_rnetdev", r"sync", r"(no)?user", r"users"]
|
||||
# DrvFs filesystem mount option
|
||||
drvfsmo = r"case=(dir|force|off)|metadata|(u|g)id=\d+|(u|f|d)mask=\d+|"
|
||||
fso = "{0}{1}".format(drvfsmo, '|'.join(fsimo))
|
||||
|
@ -78,27 +84,26 @@ class IntegrationForm(Form):
|
|||
x = x and False
|
||||
if not x:
|
||||
return _("Invalid Input: {}Please check "
|
||||
"https://docs.microsoft.com/en-us/windows/wsl/wsl-config#mount-options "
|
||||
"for correct valid input").format(e_t)
|
||||
"https://docs.microsoft.com/en-us/windows/wsl/"
|
||||
"wsl-config#mount-options "
|
||||
"for correct valid input").format(e_t)
|
||||
|
||||
|
||||
class IntegrationView(BaseView):
|
||||
title = _("Tweaks")
|
||||
excerpt = _("In this page, you can tweak Ubuntu WSL to your needs. \n"
|
||||
)
|
||||
excerpt = _("In this page, you can tweak Ubuntu WSL to your needs. \n")
|
||||
|
||||
def __init__(self, controller, integration_data):
|
||||
self.controller = controller
|
||||
|
||||
initial = {
|
||||
'custom_path': integration_data.custom_path,
|
||||
'custom_mount_opt':integration_data.custom_mount_opt,
|
||||
'custom_mount_opt': integration_data.custom_mount_opt,
|
||||
'gen_host': integration_data.gen_host,
|
||||
'gen_resolvconf': integration_data.gen_resolvconf,
|
||||
}
|
||||
self.form = IntegrationForm(initial=initial)
|
||||
|
||||
|
||||
connect_signal(self.form, 'submit', self.done)
|
||||
super().__init__(
|
||||
screen(
|
||||
|
|
|
@ -26,12 +26,15 @@ class OverviewView(BaseView):
|
|||
os.remove('/var/run/ubuntu_wsl_oobe_assigned_account')
|
||||
complete_text = _("Hi {username},\n"
|
||||
"You have complete the setup!\n\n"
|
||||
"It is suggested to run the following command to update your Ubuntu "
|
||||
"to the latest version:\n\n\n"
|
||||
"It is suggested to run the following command"
|
||||
" to update your Ubuntu to the latest version:"
|
||||
"\n\n\n"
|
||||
" $ sudo apt update\n $ sudo apt upgrade\n\n\n"
|
||||
"You can use the builtin `ubuntuwsl` command to manage your WSL settings:\n\n\n"
|
||||
"You can use the builtin `ubuntuwsl` command to "
|
||||
"manage your WSL settings:\n\n\n"
|
||||
" $ sudo ubuntuwsl ...\n\n\n"
|
||||
"* All settings will take effect after first restart of Ubuntu.").format(username=user_name)
|
||||
"* All settings will take effect after first "
|
||||
"restart of Ubuntu.").format(username=user_name)
|
||||
|
||||
super().__init__(
|
||||
screen(
|
||||
|
|
|
@ -41,38 +41,82 @@ class ReconfigurationForm(Form):
|
|||
def __init__(self, initial):
|
||||
super().__init__(initial=initial)
|
||||
|
||||
#TODO: placholder settings UI; should be dynamically generated using ubuntu-wsl-integration
|
||||
# TODO: placholder settings UI; should be dynamically generated using
|
||||
# ubuntu-wsl-integration
|
||||
automount = BooleanField(_("Enable Auto-Mount"),
|
||||
help=_("Whether the Auto-Mount freature is enabled. This feature allows you to mount Windows drive in WSL"))
|
||||
help=_("Whether the Auto-Mount freature is"
|
||||
" enabled. This feature allows you "
|
||||
"to mount Windows drive in WSL"))
|
||||
mountfstab = BooleanField(_("Mount `/etc/fstab`"),
|
||||
help=_("Whether `/etc/fstab` will be mounted. The configuration file `/etc/fstab` contains the necessary information to automate the process of mounting partitions. "))
|
||||
custom_path = MountField(_("Auto-Mount Location"), help=_("Location for the automount"))
|
||||
custom_mount_opt = StringField(_("Auto-Mount Option"), help=_("Mount option passed for the automount"))
|
||||
help=_("Whether `/etc/fstab` will be mounted."
|
||||
" The configuration file `/etc/fstab` "
|
||||
"contains the necessary information to"
|
||||
" automate the process of mounting "
|
||||
"partitions. "))
|
||||
custom_path = MountField(_("Auto-Mount Location"),
|
||||
help=_("Location for the automount"))
|
||||
custom_mount_opt = StringField(_("Auto-Mount Option"),
|
||||
help=_("Mount option passed for "
|
||||
"the automount"))
|
||||
gen_host = BooleanField(_("Enable Host Generation"), help=_(
|
||||
"Selecting enables /etc/host re-generation at every start"))
|
||||
gen_resolvconf = BooleanField(_("Enable resolv.conf Generation"), help=_(
|
||||
"Selecting enables /etc/resolv.conf re-generation at every start"))
|
||||
interop_enabled = BooleanField(_("Enable Interop"), help=_("Whether the interoperability is enabled"))
|
||||
interop_appendwindowspath = BooleanField(_("Append Windows Path"), help=_("Whether Windows Path will be append in the PATH environment variable in WSL."))
|
||||
gui_theme = ChoiceField(_("GUI Theme"), help=_("This option changes the Ubuntu theme."), choices=["default", "light", "dark"])
|
||||
gui_followwintheme = BooleanField(_("Follow Windows Theme"), help=_("This option manages whether the Ubuntu theme follows the Windows theme; that is, when Windows uses dark theme, Ubuntu also uses dark theme. Requires WSL interoperability enabled. "))
|
||||
legacy_gui = BooleanField(_("Legacy GUI Integration"), help=_("This option enables the Legacy GUI Integration on Windows 10. Requires a Third-party X Server."))
|
||||
legacy_audio = BooleanField(_("Legacy Audio Integration"), help=_("This option enables the Legacy Audio Integration on Windows 10. Requires PulseAudio for Windows Installed."))
|
||||
adv_ip_detect = BooleanField(_("Advanced IP Detection"), help=_("This option enables advanced detection of IP by Windows IPv4 Address which is more reliable to use with WSL2. Requires WSL interoperability enabled."))
|
||||
wsl_motd_news = BooleanField(_("Enable WSL News"), help=_("This options allows you to control your MOTD News. Toggling it on allows you to see the MOTD."))
|
||||
interop_enabled = BooleanField(_("Enable Interop"),
|
||||
help=_("Whether the interoperability is"
|
||||
" enabled"))
|
||||
interop_appendwindowspath = BooleanField(_("Append Windows Path"),
|
||||
help=_("Whether Windows Path "
|
||||
"will be append in the"
|
||||
" PATH environment "
|
||||
"variable in WSL."))
|
||||
gui_theme = ChoiceField(_("GUI Theme"),
|
||||
help=_("This option changes the Ubuntu theme."),
|
||||
choices=["default", "light", "dark"])
|
||||
gui_followwintheme = BooleanField(_("Follow Windows Theme"),
|
||||
help=_("This option manages whether the"
|
||||
" Ubuntu theme follows the "
|
||||
"Windows theme; that is, when "
|
||||
"Windows uses dark theme, "
|
||||
"Ubuntu also uses dark theme."
|
||||
" Requires WSL interoperability"
|
||||
" enabled. "))
|
||||
legacy_gui = BooleanField(_("Legacy GUI Integration"),
|
||||
help=_("This option enables the Legacy GUI "
|
||||
"Integration on Windows 10. Requires"
|
||||
" a Third-party X Server."))
|
||||
legacy_audio = BooleanField(_("Legacy Audio Integration"),
|
||||
help=_("This option enables the Legacy "
|
||||
"Audio Integration on Windows 10. "
|
||||
"Requires PulseAudio for "
|
||||
"Windows Installed."))
|
||||
adv_ip_detect = BooleanField(_("Advanced IP Detection"),
|
||||
help=_("This option enables advanced "
|
||||
"detection of IP by Windows "
|
||||
"IPv4 Address which is more "
|
||||
"reliable to use with WSL2. "
|
||||
"Requires WSL interoperability"
|
||||
" enabled."))
|
||||
wsl_motd_news = BooleanField(_("Enable WSL News"),
|
||||
help=_("This options allows you to control"
|
||||
" your MOTD News. Toggling it on "
|
||||
"allows you to see the MOTD."))
|
||||
|
||||
def validate_custom_path(self):
|
||||
p = self.custom_path.value
|
||||
if p != "" and (re.fullmatch(r"(/[^/ ]*)+/?", p) is None):
|
||||
return _("Mount location must be a absolute UNIX path without space.")
|
||||
return _("Mount location must be a absolute UNIX path"
|
||||
" without space.")
|
||||
|
||||
def validate_custom_mount_opt(self):
|
||||
o = self.custom_mount_opt.value
|
||||
# filesystem independent mount option
|
||||
fsimo = [r"async", r"(no)?atime", r"(no)?auto", r"(fs|def|root)?context=\w+", r"(no)?dev", r"(no)?diratime",
|
||||
r"dirsync", r"(no)?exec", r"group", r"(no)?iversion", r"(no)?mand", r"_netdev", r"nofail",
|
||||
r"(no)?relatime", r"(no)?strictatime", r"(no)?suid", r"owner", r"remount", r"ro", r"rw",
|
||||
r"_rnetdev", r"sync", r"(no)?user", r"users"]
|
||||
fsimo = [r"async", r"(no)?atime", r"(no)?auto",
|
||||
r"(fs|def|root)?context=\w+", r"(no)?dev", r"(no)?diratime",
|
||||
r"dirsync", r"(no)?exec", r"group", r"(no)?iversion",
|
||||
r"(no)?mand", r"_netdev", r"nofail", r"(no)?relatime",
|
||||
r"(no)?strictatime", r"(no)?suid", r"owner", r"remount",
|
||||
r"ro", r"rw", r"_rnetdev", r"sync", r"(no)?user", r"users"]
|
||||
# DrvFs filesystem mount option
|
||||
drvfsmo = r"case=(dir|force|off)|metadata|(u|g)id=\d+|(u|f|d)mask=\d+|"
|
||||
fso = "{0}{1}".format(drvfsmo, '|'.join(fsimo))
|
||||
|
@ -92,24 +136,26 @@ class ReconfigurationForm(Form):
|
|||
x = x and False
|
||||
if not x:
|
||||
return _("Invalid Input: {}Please check "
|
||||
"https://docs.microsoft.com/en-us/windows/wsl/wsl-config#mount-options "
|
||||
"for correct valid input").format(e_t)
|
||||
"https://docs.microsoft.com/en-us/windows/wsl/"
|
||||
"wsl-config#mount-options "
|
||||
"for correct valid input").format(e_t)
|
||||
|
||||
|
||||
class ReconfigurationView(BaseView):
|
||||
title = _("Configuration")
|
||||
excerpt = _("In this page, you can tweak Ubuntu WSL to your needs. \n"
|
||||
)
|
||||
excerpt = _("In this page, you can tweak Ubuntu WSL to your needs. \n")
|
||||
|
||||
def __init__(self, controller, integration_data):
|
||||
self.controller = controller
|
||||
|
||||
initial = {
|
||||
'custom_path': integration_data.custom_path,
|
||||
'custom_mount_opt':integration_data.custom_mount_opt,
|
||||
'custom_mount_opt': integration_data.custom_mount_opt,
|
||||
'gen_host': integration_data.gen_host,
|
||||
'gen_resolvconf': integration_data.gen_resolvconf,
|
||||
'interop_enabled': integration_data.interop_enabled,
|
||||
'interop_appendwindowspath': integration_data.interop_appendwindowspath,
|
||||
'interop_appendwindowspath':
|
||||
integration_data.interop_appendwindowspath,
|
||||
'gui_theme': integration_data.gui_theme,
|
||||
'gui_followwintheme': integration_data.gui_followwintheme,
|
||||
'legacy_gui': integration_data.legacy_gui,
|
||||
|
@ -121,7 +167,6 @@ class ReconfigurationView(BaseView):
|
|||
}
|
||||
self.form = ReconfigurationForm(initial=initial)
|
||||
|
||||
|
||||
connect_signal(self.form, 'submit', self.done)
|
||||
super().__init__(
|
||||
screen(
|
||||
|
@ -139,7 +184,8 @@ class ReconfigurationView(BaseView):
|
|||
gen_host=self.form.gen_host.value,
|
||||
gen_resolvconf=self.form.gen_resolvconf.value,
|
||||
interop_enabled=self.form.interop_enabled.value,
|
||||
interop_appendwindowspath=self.form.interop_appendwindowspath.value,
|
||||
interop_appendwindowspath=self.form
|
||||
.interop_appendwindowspath.value,
|
||||
gui_theme=self.form.gui_theme.value,
|
||||
gui_followwintheme=self.form.gui_followwintheme.value,
|
||||
legacy_gui=self.form.legacy_gui.value,
|
||||
|
|
Loading…
Reference in New Issue