Class: SpectrumNetflixKeyboard

Inherits:
Keyboard show all
Defined in:
lib/keyboard/stb/spectrum/spectrum_netflix_keyboard.rb

Direct Known Subclasses

SpectrumNetflixNameKeyboard

Constant Summary

Constants inherited from Keyboard

Keyboard::DEBUG

Instance Method Summary collapse

Methods inherited from Keyboard

#displayed?, #reset, #type?

Constructor Details

#initialize(*args) ⇒ SpectrumNetflixKeyboard

Returns a new instance of SpectrumNetflixKeyboard.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/keyboard/stb/spectrum/spectrum_netflix_keyboard.rb', line 6

def initialize(*args)
  super(*args)
  # see Keyboard for explanation of layouts
  letters = [
      %w[1 2 3 4 5 6 7 8 9 0],
      %w[q w e r t y u i o p],
      %w[a s d f g h j k l -],
      [:SHIFT_LOCK, :SHIFT_LOCK, 'z', 'x', 'c', 'v', 'b', 'n', 'm', "'"],
      [:SYMBOLS, :SYMBOLS, :SPECIAL, :SPECIAL, :SPACE, :SPACE, :SPACE, :BACKSPACE, :BACKSPACE, :BACKSPACE]
  ]
  symbols = [
      %w[` ~ ! @ # $ % ^ & *],
      %w[( ) - _ = + [ ] { }],
      %w[\ | ; : ' " , . < >],
      %w[/ ? ¡ ¿ ª º ¢  £ ¥],
      [:LETTERS, :LETTERS, :SPECIAL, :SPECIAL, :SPACE, :SPACE, :SPACE, :BACKSPACE, :BACKSPACE, :BACKSPACE]
  ]
  special = [] #TODO: get them here - http://www.addressmunger.com/special_ascii_characters/
  @layouts << KeyboardLayout.new(letters, [2, 4], nav_to_key: :LETTERS, name: 'default letters')
  @layouts << KeyboardLayout.new(symbols, [4, 0], nav_to_key: :SYMBOLS, name: 'default symbols')
  # Restrict traversals to/from the multi-column keys.
  @deny_traversals = [
      [:SHIFT_LOCK, 's'], ['s', :SHIFT_LOCK], [:SPECIAL, 'z'], ['z', :SPECIAL], [:SPACE, 'c'], ['c', :SPACE],
      [:SPACE, 'b'], ['b', :SPACE], [:BACKSPACE, 'n'], ['n', :BACKSPACE], [:BACKSPACE, "'"], ["'", :BACKSPACE],
      [:SHIFT_LOCK, 'S'], ['S', :SHIFT_LOCK], [:SPECIAL, 'Z'], ['Z', :SPECIAL], [:SPACE, 'C'], ['C', :SPACE],
      [:SPACE, 'B'], ['B', :SPACE], [:BACKSPACE, 'N'], ['N', :BACKSPACE],
      [:LETTERS, '?'], ['?', :LETTERS], [:SPECIAL, '¿'], ['¿', :SPECIAL], [:SPACE, 'ª'], ['ª', :SPACE],
      [:SPACE, '¢'], ['¢', :SPACE], [:BACKSPACE, ''], ['', :BACKSPACE], [:BACKSPACE, '¥'], ['¥', :BACKSPACE]
  ]
end