示例#1
0
def Process():
    button = str(SystemState.pressed_button)
    pygame = SystemState.pygame
    screen = SystemState.screen
    screen_mode = SystemState.screen_mode

    if button == 'record':
        if SystemState.AudioState.recording_audio == True:
            SystemState.AudioState.recording_audio = False
            StopRecordingAudio()
        else:
            TextWriter.Write(text='Rec',
                             position=(10, 10),
                             color=(255, 0, 0),
                             state=SystemState,
                             size=20)
            SystemState.AudioState.recording_audio = True
            CallRecordAudio()
    elif button == 'play':
        Menu.JumpTo(screen_mode=3, toggle=True)
        Play()
    elif button == 'pause':
        Menu.JumpTo(screen_mode=2, toggle=True)
        Pause()
    elif button == 'library':
        SystemState.AudioState.recording_audio = False
        Menu.JumpTo(screen_mode=2)
        StopRecordingAudio()
        OpenLibrary()
        Pause()
    elif button == 'go_back':
        SystemState.AudioState.recording_audio = False
        Menu.Back()
    elif button == 'rewind':
        Rewind()
    elif button == 'fast_forward':
        FastForward()
    elif button == 'next':
        if SystemState.AudioState.audio_count > 0:
            NextRecording()
    elif button == 'previous':
        if SystemState.AudioState.audio_count > 0:
            PreviousRecording()
    elif button == 'delete':
        if SystemState.AudioState.audio_count > 0:
            Menu.JumpTo(screen_mode=2)
            TextWriter.Write(state=SystemState,
                             text='Delete?',
                             position=(125, 75),
                             size=20)
    elif button == 'accept':
        DeleteAudio()
        OpenLibrary()
        Menu.Back()
    elif button == 'decline':
        OpenLibrary()
        Menu.Back()
示例#2
0
def Process():
    button = str(SystemState.pressed_button)
    pygame = SystemState.pygame
    screen = SystemState.screen
    serial_port = SystemState.PhoneState.serial_port

    if button == 'delete':
        SystemState.pressed_buttons = SystemState.pressed_buttons[:-1]
        TextWriter.Write(state=SystemState,
                         text=SystemState.pressed_buttons,
                         text_type="top")
    elif button == 'go_back':
        Menu.Back(change_application=True)
    elif button == 'call':
        if SystemState.screen_mode == 1:
            Menu.JumpTo(application='phone',
                        screen_mode=2,
                        store_history=False,
                        change_application=True)
            serial_message = "ATD " + SystemState.pressed_buttons + ';'
            WriteToSerial(serial_port, serial_message)
            TextWriter.Write(text="Calling", text_type='message')
            TextWriter.Write(text=SystemState.pressed_buttons,
                             text_type='subtext')
        else:
            Menu.JumpTo(application='phone',
                        screen_mode=2,
                        store_history=False,
                        change_application=True)
            WriteToSerial(serial_port, "ATA")
            TextWriter.Write(text=SystemState.pressed_buttons,
                             text_type='subtext')
    elif button == 'hangup':
        Menu.Back(change_application=True)
        WriteToSerial(serial_port, "ATH")
        TextWriter.Write(text=SystemState.pressed_buttons, text_type='top')
    elif button == 'hash':
        SystemState.pressed_buttons = SystemState.pressed_buttons + '#'
        TextWriter.Write(text=SystemState.pressed_buttons, text_type='top')
    elif button == 'star':
        SystemState.pressed_buttons = SystemState.pressed_buttons + '*'
        TextWriter.Write(text=SystemState.pressed_buttons, text_type='top')
    else:
        SystemState.pressed_buttons = SystemState.pressed_buttons + str(button)
        TextWriter.Write(text=SystemState.pressed_buttons, text_type='top')
示例#3
0
def Process():
  if SystemState.pressed_button == 'power':
    Menu.JumpTo('desktop', 2)
    TextWriter.Write(
      text="Shutdown Cobblr?",
      text_type='prompt',
      size=25,
      centered=True,
      permatext=True
      )
  elif SystemState.pressed_button == 'decline':
    Menu.Back()
  elif SystemState.pressed_button == 'accept':
    os.system('sudo init 0')
    SystemState.pygame.exit()
    sys.exit(0)
  else:
    Menu.JumpTo(SystemState.pressed_button, 1)
示例#4
0
def Process():
    button = str(SystemState.pressed_button)
    pygame = SystemState.pygame
    screen = SystemState.screen
    screen_mode = SystemState.screen_mode
    back_pressed = 0

    try:
        if button == 'delete':
            SystemState.pressed_buttons = SystemState.pressed_buttons[:-1]
        elif button == 'plus':
            SystemState.pressed_buttons = SystemState.pressed_buttons + '+'
        elif button == 'minus':
            SystemState.pressed_buttons = SystemState.pressed_buttons + '-'
        elif button == 'multiply':
            SystemState.pressed_buttons = SystemState.pressed_buttons + '*'
        elif button == 'divide':
            SystemState.pressed_buttons = SystemState.pressed_buttons + '/'
        elif button == 'equals' and len(SystemState.pressed_buttons) > 0:
            SystemState.pressed_buttons = str(eval(
                SystemState.pressed_buttons))
        elif button == 'point':
            SystemState.pressed_buttons = SystemState.pressed_buttons + '.'
        elif button == 'right_parentheses':
            SystemState.pressed_buttons = SystemState.pressed_buttons + '('
        elif button == 'left_parentheses':
            SystemState.pressed_buttons = SystemState.pressed_buttons + ')'
        elif button == 'alt':
            print 'alt'
        elif button == 'go_back':
            back_pressed = 1
            Menu.Back()
        else:
            SystemState.pressed_buttons = SystemState.pressed_buttons + str(
                button)

        if back_pressed == 0:
            UpdateText(0)
    except:
        if back_pressed == 0:
            UpdateText(1)
示例#5
0
def Process():
    button = str(SystemState.pressed_button)
    pygame = SystemState.pygame
    screen = SystemState.screen
    back_pressed = 0

    if button == 'play' and len(SystemState.MusicState.song_archive) > 0:
        if SystemState.MusicState.player_state == 'Cannot Play':
            ChangeSong(1)
        else:
            LoadSong()
        if SystemState.MusicState.player_state == 'Paused' and SystemState.MusicState.song_position > 1:
            pygame.mixer.music.play(0, SystemState.MusicState.song_position)
        else:
            pygame.mixer.music.play(0, 0)
        SystemState.MusicState.player_state = 'Now Playing'
        Menu.JumpTo(screen_mode=2, toggle=True)

    if button == 'pause':
        pygame.mixer.music.pause()
        SystemState.MusicState.song_position = SystemState.MusicState.song_position + pygame.mixer.music.get_pos(
        ) / 1000.0
        SystemState.MusicState.player_state = 'Paused'
        Menu.JumpTo(screen_mode=1, toggle=True)

    if button == 'stop':
        pygame.mixer.music.stop()
        SystemState.MusicState.player_state = 'Stopped'
        if SystemState.screen_mode == 2:
            Menu.JumpTo(screen_mode=1)
        elif SystemState.screen_mode == 3:
            Menu.JumpTo(screen_mode=3, toggle=True)

    if button == 'backward':
        ChangeSong(-1)
        if SystemState.MusicState.player_state == 'Now Playing':
            pygame.mixer.music.play(0, SystemState.MusicState.song_position)

    if button == 'forward':
        ChangeSong(1)
        if SystemState.MusicState.player_state == 'Now Playing':
            pygame.mixer.music.play(0, SystemState.MusicState.song_position)

    if button == 'alt':
        if SystemState.screen_mode == 1 or SystemState.screen_mode == 2:
            Menu.JumpTo(screen_mode=3, toggle=True)
        elif SystemState.screen_mode == 3:
            if SystemState.MusicState.player_state == 'Now Playing':
                Menu.JumpTo(screen_mode=2, toggle=True)
            else:
                Menu.JumpTo(screen_mode=1, toggle=True)

    if button == 'volume_up':
        pygame.mixer.music.set_volume(pygame.mixer.music.get_volume() + 0.1)

    if button == 'repeat':
        pass

    if button == 'volume_down':
        pygame.mixer.music.set_volume(pygame.mixer.music.get_volume() - 0.1)

    if button == 'go_back':
        back_pressed = 1
        Menu.Back()

    if back_pressed == 0:
        UpdateMusicText()
示例#6
0
def Process():
  """Determines what buttons were pressed with each screen touch."""
  button = str(SystemState.pressed_button)
  pygame = SystemState.pygame
  screen = SystemState.screen
  screen_mode = SystemState.screen_mode

  if button == 'flash_on':
    Menu.JumpTo(screen_mode=2, toggle=True)
    SystemState.CameraState.flash_enabled = False
  elif button == 'flash_off':
    Menu.JumpTo(screen_mode=1, toggle=True)
    SystemState.CameraState.flash_enabled = True
  elif button == 'go_back':
    Menu.Back()
    SystemState.CameraState.setting = 'none'
    SystemState.CameraState.album = False
  elif button == 'gallery':
    Menu.JumpTo(screen_mode=3)
    OpenAlbum()
  elif button == 'right_arrow':
    __ProcessRightArrow()
  elif button == 'left_arrow':
    __ProcessLeftArrow()
  elif button == 'capture':
    CallTakePhoto()
  elif button == 'delete' and SystemState.CameraState.photo_count > 0:
    Menu.JumpTo(screen_mode=4)
    BlitImage(SystemState.CameraState.current_photo, SystemState.pygame, SystemState.screen)
    TextWriter.Write(state=SystemState, text='Delete?', position=(125, 75), size=20)
  elif button == 'iso':
    Menu.JumpTo(screen_mode=6)
    SystemState.CameraState.setting = 'iso'
  elif button == 'image_effect':
    Menu.JumpTo(screen_mode=6)
    SystemState.CameraState.setting = 'image_effect'
  elif button == 'rotation':
    Menu.JumpTo(screen_mode=6)
    SystemState.CameraState.setting = 'rotation'
  elif button == 'brightness':
    Menu.JumpTo(screen_mode=6)
    SystemState.CameraState.setting = 'brightness'
  elif button == 'saturation':
    Menu.JumpTo(screen_mode=6)
    SystemState.CameraState.setting = 'saturation'
  elif button == 'contrast':
    Menu.JumpTo(screen_mode=6)
    SystemState.CameraState.setting = 'contrast'
  elif button == 'sharpness':
    Menu.JumpTo(screen_mode=6)
    SystemState.CameraState.setting = 'sharpness'
  elif button == 'zoom':
    Menu.JumpTo(screen_mode=6)
    SystemState.CameraState.setting = 'zoom'
  elif button == 'meter_mode':
    Menu.JumpTo(screen_mode=6)
    SystemState.CameraState.setting = 'meter_mode'
  elif button == 'awb':
    Menu.JumpTo(screen_mode=6)
    SystemState.CameraState.setting = 'awb_mode'
  elif button == 'shutter_speed':
    Menu.JumpTo(screen_mode=6)
    SystemState.CameraState.setting = 'shutter_speed'
  elif button == 'exposure_mode':
    Menu.JumpTo(screen_mode=6)
    SystemState.CameraState.setting = 'exposure_mode'
  elif button == 'settings':
    Menu.JumpTo(screen_mode=5)
  elif button == 'accept':
    DeletePhoto()
    Menu.Back()
    OpenAlbum()
  elif button == 'decline':
    Menu.Back()
    OpenAlbum()

  if SystemState.screen_mode == 5 and SystemState.next_screen_mode == 6:
    setting = SystemState.CameraState.setting
    setting_values = setting + '_values'
    __CurrentSetting(setting_values, setting)

  SystemState.CameraState.camera_stream = False
示例#7
0
def Process():
  """Processing button presses."""
  button = str(SystemState.pressed_button)
  pygame = SystemState.pygame
  screen = SystemState.screen
  screen_mode = SystemState.screen_mode
  
  if button == 'library':
    OpenAlbum()
    Menu.JumpTo(screen_mode=4)
  elif button == 'go_back':
    Menu.Back()
    SystemState.VideoState.setting = 'none'
  elif button == 'play':
    __PlayVideo()
  elif button == 'settings':
    Menu.JumpTo(screen_mode=2, refresh_screen=False)
  elif button == 'delete':
    if SystemState.VideoState.video_count > 0:
      Menu.JumpTo(screen_mode=5)
      TextWriter.Write(
          state=SystemState, 
          text='Delete?', 
          position=(125, 75), 
          size=20
      )
  elif button == 'right_arrow':
    __ProcessRightArrow()
  elif button == 'left_arrow':
    __ProcessLeftArrow()
  elif button == 'iso':
    Menu.JumpTo(screen_mode=3)
    SystemState.VideoState.setting = 'iso'
  elif button == 'image_effect':
    Menu.JumpTo(screen_mode=3, refresh_screen=False)
    SystemState.VideoState.setting = 'image_effect'
  elif button == 'rotation':
    Menu.JumpTo(screen_mode=3, refresh_screen=False)
    SystemState.VideoState.setting = 'rotation'
  elif button == 'brightness':
    Menu.JumpTo(screen_mode=3, refresh_screen=False)
    SystemState.VideoState.setting = 'brightness'
  elif button == 'saturation':
    Menu.JumpTo(screen_mode=3, refresh_screen=False)
    SystemState.VideoState.setting = 'saturation'
  elif button == 'contrast':
    Menu.JumpTo(screen_mode=3, refresh_screen=False)
    SystemState.VideoState.setting = 'contrast'
  elif button == 'sharpness':
    Menu.JumpTo(screen_mode=3, refresh_screen=False)
    SystemState.VideoState.setting = 'sharpness'
  elif button == 'zoom':
    Menu.JumpTo(screen_mode=3, refresh_screen=False)
    SystemState.VideoState.setting = 'zoom'
  elif button == 'meter_mode':
    Menu.JumpTo(screen_mode=3, refresh_screen=False)
    SystemState.VideoState.setting = 'meter_mode'
  elif button == 'awb':
    Menu.JumpTo(screen_mode=3, refresh_screen=False)
    SystemState.VideoState.setting = 'awb_mode'
  elif button == 'video_stabilization':
    Menu.JumpTo(screen_mode=3, refresh_screen=False)
    SystemState.VideoState.setting = 'video_stabilization'
  elif button == 'exposure_mode':
    Menu.JumpTo(screen_mode=3, refresh_screen=False)
    SystemState.VideoState.setting = 'exposure_mode'
  elif button == 'accept':
    __DeleteVideo()
    Menu.Back()
    OpenAlbum()
  elif button == 'decline':
    Menu.Back()
    OpenAlbum()
  
  # Displaying settings title and values when you first enter a menu.
  if SystemState.screen_mode == 2 and SystemState.next_screen_mode == 3:
    setting = SystemState.VideoState.setting
    setting_values = setting + '_values'
    __CurrentSetting(setting_values, setting)