def setRawInputMode(raw):
 if (not os.isatty(sys.stdin.fileno())):
  return
 global old_settings
 if (raw and (old_settings is None)):
  fd = sys.stdin.fileno()
  try:
   old_settings = termios.tcgetattr(fd)
   tty.setraw(sys.stdin.fileno())
  except Exception as e:
   om.out.console(('termios error: ' + str(e)))
 elif (not (raw or (old_settings is None))):
  try:
   termios.tcsetattr(sys.stdin.fileno(), termios.TCSADRAIN, old_settings)
   old_settings = None
  except Exception as e:
   om.out.console(('termios error: ' + str(e)))

def setRawInputMode ( raw ) : if ( not os . isatty ( sys . stdin . fileno ( ) ) ) : return global old_settings if ( raw and ( old_settings is None ) ) : fd = sys . stdin . fileno ( ) try : old_settings = termios . tcgetattr ( fd ) tty . setraw ( sys . stdin . fileno ( ) ) except Exception as e : om . out . console ( ( 'termios error: ' + str ( e ) ) ) elif ( not ( raw or ( old_settings is None ) ) ) : try : termios . tcsetattr ( sys . stdin . fileno ( ) , termios . TCSADRAIN , old_settings ) old_settings = None except Exception as e : om . out . console ( ( 'termios error: ' + str ( e ) ) )
sets the raw input mode for the linux terminal .