seperated the relative controls from the display mode so more functions can be loaded into them

This commit is contained in:
langolierz
2018-02-18 03:59:41 +00:00
parent ac4afdf080
commit e9eb6c1c9e
5 changed files with 21 additions and 14 deletions

View File

@@ -7,7 +7,7 @@ class Actions(object):
self.data = data
self.video_driver = video_driver
self.display = display
def move_browser_selection_down(self):
self.display.navigate_menu('down', len(self.data.return_browser_list()))
@@ -86,10 +86,13 @@ class Actions(object):
self.display.selected_list_index = self.display.top_menu_index
if self.display.display_mode == "BROWSER":
self.display.display_mode = "SETTINGS"
self.display.control_mode = 'NAV_SETTINGS'
elif self.display.display_mode == "SAMPLER":
self.display.display_mode = "BROWSER"
self.display.control_mode = 'NAV_BROWSER'
elif self.display.display_mode == "SETTINGS":
self.display.display_mode = "SAMPLER"
self.display.control_mode = 'PLAYER'
def toggle_pause_on_player(self):
self.video_driver.current_player.toggle_pause()

View File

@@ -1 +1 @@
[{"location": "/media/pi/TIM1/videos_to_play/colour_pixel_01.mp4", "length": 49.28, "start": -1, "name": "colour_pixel_01.mp4", "end": -1}, {"length": -1, "start": -1, "name": "", "end": -1, "location": ""}, {"length": -1, "start": -1, "name": "", "end": -1, "location": ""}, {"length": -1, "start": -1, "name": "", "end": -1, "location": ""}, {"length": -1, "start": -1, "name": "", "end": -1, "location": ""}, {"length": -1, "start": -1, "name": "", "end": -1, "location": ""}, {"length": -1, "start": -1, "name": "", "end": -1, "location": ""}, {"length": -1, "start": -1, "name": "", "end": -1, "location": ""}, {"length": -1, "start": -1, "name": "", "end": -1, "location": ""}, {"length": -1, "start": -1, "name": "", "end": -1, "location": ""}]
[{"name": "colour_pixel_01.mp4", "length": 49.28, "end": -1, "start": -1, "location": "/media/pi/TIM1/videos_to_play/colour_pixel_01.mp4"}, {"name": "colour_pixel_02.mp4", "start": -1, "location": "/media/pi/TIM1/videos_to_play/colour_pixel_02.mp4", "length": 87.04, "end": -1}, {"name": "", "length": -1, "location": "", "start": -1, "end": -1}, {"name": "", "length": -1, "location": "", "start": -1, "end": -1}, {"name": "", "length": -1, "location": "", "start": -1, "end": -1}, {"name": "", "length": -1, "location": "", "start": -1, "end": -1}, {"name": "", "length": -1, "location": "", "start": -1, "end": -1}, {"name": "", "length": -1, "location": "", "start": -1, "end": -1}, {"name": "", "length": -1, "location": "", "start": -1, "end": -1}, {"name": "", "length": -1, "location": "", "start": -1, "end": -1}]

View File

@@ -1,18 +1,18 @@
{
"a": {
"BROWSER": ["move_browser_selection_up"],
"SAMPLER": ["seek_back_on_player"],
"SETTINGS": ["move_settings_selection_up"]
"NAV_BROWSER": ["move_browser_selection_up"],
"PLAYER": ["seek_back_on_player"],
"NAV_SETTINGS": ["move_settings_selection_up"]
},
"b": {
"BROWSER": ["move_browser_selection_down"],
"SAMPLER": ["seek_forward_on_player"],
"SETTINGS": ["move_settings_selection_down"]
"NAV_BROWSER": ["move_browser_selection_down"],
"PLAYER": ["seek_forward_on_player"],
"NAV_SETTINGS": ["move_settings_selection_down"]
},
"c": {
"BROWSER": ["enter_on_browser_selection"],
"SAMPLER": ["toggle_pause_on_player"],
"SETTINGS": ["enter_on_settings_selection"]
"NAV_BROWSER": ["enter_on_browser_selection"],
"PLAYER": ["toggle_pause_on_player"],
"NAV_SETTINGS": ["enter_on_settings_selection"]
},
"d": {
"DEFAULT": ["trigger_next_player"]

View File

@@ -17,6 +17,7 @@ class Display(object):
self.data = data
self.display_mode = "SAMPLER"
self.control_mode = 'PLAYER'
self.top_menu_index = 0
self.selected_list_index = self.top_menu_index
self.browser_list = self.data.rewrite_browser_list()
@@ -124,7 +125,7 @@ class Display(object):
def _load_message(self):
if self.message_handler.current_message[1]:
self.display_text.insert(END, '{:5}: {:38}'.format(
self.display_text.insert(END, '{:5} {:38}'.format(
self.message_handler.current_message[0], self.message_handler.current_message[1][0:38]))
self.display_text.tag_add('{}_MESSAGE'.format(
self.message_handler.current_message[0]), 16.0,16.0 + self.SELECTOR_WIDTH)
@@ -135,6 +136,9 @@ class Display(object):
elif self.message_handler.function_on:
self.display_text.insert(END, '{:^45}'.format('< FUNCTION KEY ON >'))
self.display_text.tag_add('FUNCTION', 16.0,16.0 + self.SELECTOR_WIDTH)
else:
self.display_text.insert(END, '{:8} {:<10}'.format('CONTROL:', self.control_mode))
self.display_text.tag_add('TITLE', 16.0,16.0 + self.SELECTOR_WIDTH)
def _highlight_this_row(self, row):
self.display_text.tag_add("SELECT", self.ROW_OFFSET + row,

View File

@@ -31,8 +31,8 @@ class NumpadInput(object):
def run_action_for_mapped_key(self, key):
this_mapping = self.key_mappings[key]
if self.display.display_mode in this_mapping:
mode = self.display.display_mode
if self.display.control_mode in this_mapping:
mode = self.display.control_mode
elif 'DEFAULT' in this_mapping:
mode = 'DEFAULT'