pep8 fixes for subiquity/ui/views/keyboard.py

This commit is contained in:
Ryan Harper 2018-05-23 16:21:38 -05:00
parent c02ee0b0f3
commit a047064475
1 changed files with 27 additions and 12 deletions

View File

@ -56,10 +56,13 @@ class AutoDetectBase(WidgetWrap):
self.step = step
lb = LineBox(self.make_body(), _("Keyboard auto-detection"))
super().__init__(lb)
def start(self):
pass
def stop(self):
pass
def keypress(self, size, key):
if key == 'esc':
self.keyboard_detector.backup()
@ -77,7 +80,9 @@ class AutoDetectIntro(AutoDetectBase):
def make_body(self):
return Pile([
Text(_("Keyboard detection starting. You will be asked a series of questions about your keyboard. Press escape at any time to go back to the previous screen.")),
Text(_("Keyboard detection starting. You will be asked a "
"series of questions about your keyboard. Press escape "
"at any time to go back to the previous screen.")),
Text(""),
button_pile([
ok_btn(label=_("OK"), on_press=self.ok),
@ -98,6 +103,7 @@ class AutoDetectFailed(AutoDetectBase):
button_pile([ok_btn(label="OK", on_press=self.ok)]),
])
class AutoDetectResult(AutoDetectBase):
preamble = _("""\
@ -147,7 +153,8 @@ class AutoDetectPressKey(AutoDetectBase):
return Pile([
Text(_("Please press one of the following keys:")),
Text(""),
Columns([Text(s, align="center") for s in self.step.symbols], dividechars=1),
Columns([Text(s, align="center")
for s in self.step.symbols], dividechars=1),
Text(""),
Color.info_error(self.error_text),
])
@ -174,7 +181,8 @@ class AutoDetectPressKey(AutoDetectBase):
elif key.startswith('press '):
code = int(key[len('press '):])
if code not in self.step.keycodes:
self.error_text.set_text(_("Input was not recognized, try again"))
self.error_text.set_text(_("Input was not recognized, "
"try again"))
return
v = self.step.keycodes[code]
else:
@ -260,6 +268,7 @@ class Detector:
self.overlay.start()
self.keyboard_view.show_overlay(self.overlay)
class ApplyingConfig(WidgetWrap):
def __init__(self, loop):
spinner = Spinner(loop, style='dots')
@ -277,9 +286,13 @@ class ApplyingConfig(WidgetWrap):
toggle_text = _("""\
You will need a way to toggle the keyboard between the national layout and the standard Latin layout.
You will need a way to toggle the keyboard between the national layout and
the standard Latin layout.
Right Alt or Caps Lock keys are often chosen for ergonomic reasons (in the latter case, use the combination Shift+Caps Lock for normal Caps toggle). Alt+Shift is also a popular combination; it will however lose its usual behavior in Emacs and other programs that use it for specific needs.
Right Alt or Caps Lock keys are often chosen for ergonomic reasons (in the
latter case, use the combination Shift+Caps Lock for normal Caps toggle).
Alt+Shift is also a popular combination; it will however lose its usual
behavior in Emacs and other programs that use it for specific needs.
Not all listed keys are present on all keyboards. """)
@ -391,7 +404,8 @@ class KeyboardView(BaseView):
lb_contents.extend([
Text(""),
button_pile([
other_btn(label=_("Identify keyboard"), on_press=self.detect)]),
other_btn(label=_("Identify keyboard"),
on_press=self.detect)]),
])
super().__init__(screen(lb_contents, self.form.buttons, excerpt=excerpt))
@ -434,7 +448,8 @@ class KeyboardView(BaseView):
log.debug("%s", layout)
opts = []
default_i = -1
for i, (variant, variant_desc) in enumerate(self.model.variants[layout].items()):
layout_items = enumerate(self.model.variants[layout].items())
for i, (variant, variant_desc) in layout_items:
if variant == "":
default_i = i
opts.append(Option((variant_desc, True, variant)))