fixed 000 issue

This commit is contained in:
langolierz
2018-02-08 07:31:18 +00:00
parent 45060598a2
commit 9a5cfadec5
7 changed files with 50 additions and 48 deletions

View File

@@ -1 +1 @@
[{"name": "mushroom-dreams.mp4", "end": -1, "start": 340.722063, "length": 1132.04, "location": "/media/pi/TIM/videos_to_play/mushroom-dreams.mp4"}, {"name": "samplerloop3s3.mp4", "end": -1, "start": 1.750672, "length": 3.008, "location": "/media/pi/TIM/samplerloop3s3.mp4"}, {"name": "long_spinning.mp4", "end": -1, "start": -1, "length": 804.245, "location": "/media/pi/TIM/videos_to_play/long_spinning.mp4"}, {"name": "colour_pixel_02.mp4", "end": 68.500718, "start": 66.892487, "length": 87.04, "location": "/media/pi/TIM/videos_to_play/colour_pixel_02.mp4"}, {"name": "", "end": -1, "start": -1, "length": -1, "location": ""}, {"name": "", "end": -1, "start": -1, "length": -1, "location": ""}, {"name": "", "end": -1, "start": -1, "length": -1, "location": ""}, {"name": "", "end": -1, "start": -1, "length": -1, "location": ""}, {"name": "", "end": -1, "start": -1, "length": -1, "location": ""}, {"name": "", "end": -1, "start": -1, "length": -1, "location": ""}]
[{"start": 607.690078, "end": 610.079466, "length": 1132.04, "name": "mushroom-dreams.mp4", "location": "/media/pi/TIM/videos_to_play/mushroom-dreams.mp4"}, {"start": -1, "end": -1, "length": 3.008, "name": "samplerloop3s3.mp4", "location": "/media/pi/TIM/samplerloop3s3.mp4"}, {"start": -1, "end": -1, "length": 804.245, "name": "long_spinning.mp4", "location": "/media/pi/TIM/videos_to_play/long_spinning.mp4"}, {"start": 66.892487, "end": 68.500718, "length": 87.04, "name": "colour_pixel_02.mp4", "location": "/media/pi/TIM/videos_to_play/colour_pixel_02.mp4"}, {"end": -1, "start": -1, "length": 52.757, "name": "colour_pixel_03.mp4", "location": "/media/pi/TIM/videos_to_play/colour_pixel_03.mp4"}, {"end": -1, "start": -1, "length": 52.757, "name": "colour_pixel_03.mp4", "location": "/media/pi/TIM/videos_to_play/colour_pixel_03.mp4"}, {"end": -1, "start": -1, "length": 52.757, "name": "colour_pixel_03.mp4", "location": "/media/pi/TIM/videos_to_play/colour_pixel_03.mp4"}, {"end": -1, "start": -1, "length": 52.757, "name": "colour_pixel_03.mp4", "location": "/media/pi/TIM/videos_to_play/colour_pixel_03.mp4"}, {"end": -1, "start": -1, "length": 52.757, "name": "colour_pixel_03.mp4", "location": "/media/pi/TIM/videos_to_play/colour_pixel_03.mp4"}, {"end": -1, "start": -1, "length": 52.757, "name": "colour_pixel_03.mp4", "location": "/media/pi/TIM/videos_to_play/colour_pixel_03.mp4"}]

View File

@@ -1 +1 @@
0
4

View File

@@ -76,8 +76,9 @@ class Display(object):
self.display_text.insert(END, '{:^4} {:<22} {:<4} {:<4} {:<4} \n'.format(
'slot', 'name', 'length', 'start', 'end'))
for index, slot in enumerate(bank_data):
name_without_extension = slot['name'].rsplit('.',1)[0]
self.display_text.insert(END, '{:^4} {:<22} {:<4} {:<4} {:<4} \n'.format(
index, slot['name'][0:22], self.format_time_value(slot['length']),
index, name_without_extension[0:22], self.format_time_value(slot['length']),
self.format_time_value(slot['start']), self.format_time_value(slot['end'])))
if self.video_driver.current_player.slot_number is '-':
self.selected_list_index = 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -9,10 +9,8 @@ class NumpadInput(object):
self.actions = actions
self.key_mappings = data.get_keypad_mapping_data()
self.bind_actions()
self.last_0_press_time = datetime.datetime.now()
self.last_0_difference = 2000
self.number_of_0_represses = 0
self.is_triple = False
self.in_0_event = False
self.additional_0_in_event = 0
def bind_actions(self):
self.display.display_text.bind("<Key>", self.on_key_press)
@@ -20,54 +18,57 @@ class NumpadInput(object):
def on_key_press(self, event):
numpad = list(string.ascii_lowercase[0:19])
if event.char is 's':
self.on_0_press()
if event.char is '.':
self.actions.quit_the_program()
if event.char is 's':
event.char = self.on_0_key_press()
elif event.char in numpad:
this_mapping = self.key_mappings[event.char]
if self.display.display_mode in this_mapping:
mode = self.display.display_mode
elif 'DEFAULT' in this_mapping:
mode = 'DEFAULT'
if self.message_handler.function_on and len(this_mapping[mode]) > 1:
print('the action being called is {}'.format(this_mapping[mode][1]))
getattr(self.actions, this_mapping[mode][1])()
else:
print('the action being called is {}'.format(this_mapping[mode][0]))
getattr(self.actions, this_mapping[mode][0])()
self.display.refresh_display()
self.run_action_for_mapped_key(event.char)
else:
print('{} is not in keypad map'.format(event.char))
def on_0_press(self):
this_press_time = datetime.datetime.now()
print('the last 0 press was at {}'.format(self.last_0_press_time))
self.last_0_difference = this_press_time - self.last_0_press_time
print('the difference between last and now is {}'.format(self.last_0_difference))
print('the total dif in secs is {}.'.format(self.last_0_difference.total_seconds()))
self.last_0_press_time = this_press_time
if (self.last_0_difference.total_seconds() < 0.7):
self.number_of_0_represses = self.number_of_0_represses + 1
self.last_0_press_time = this_press_time
self.root.after(1000, self.respond_to_0_press)
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
elif 'DEFAULT' in this_mapping:
mode = 'DEFAULT'
def respond_to_0_press(self):
print('current represses is {},.'.format(self.number_of_0_represses))
if(self.number_of_0_represses == 0):
print('doing single action now')
elif(self.number_of_0_represses == 1):
print('waiting for another...')
elif(self.number_of_0_represses == 2):
print('doing triple action now')
self.number_of_0_represses = -10
self.root.after(1000, self.set_represses_to_0)
if self.message_handler.function_on and len(this_mapping[mode]) > 1:
print('the action being called is {}'.format(this_mapping[mode][1]))
getattr(self.actions, this_mapping[mode][1])()
else:
print('the action being called is {}'.format(this_mapping[mode][0]))
getattr(self.actions, this_mapping[mode][0])()
self.display.refresh_display()
def set_represses_to_0(self):
print('clearing repress from {}'.format(self.number_of_0_represses))
self.number_of_0_represses = 0
def on_0_key_press(self) :
if(not self.in_0_event ):
self.in_0_event = True
self.additional_0_in_event = 0
self.root.after(600, self.check_event_outcome)
else:
self.additional_0_in_event = self.additional_0_in_event + 1
def check_event_outcome(self):
if(self.additional_0_in_event == 0 ):
self.in_0_event = False
self.run_action_for_mapped_key('s')
elif(self.additional_0_in_event > 1):
self.in_0_event = False
self.run_action_for_mapped_key('n')
elif(self.additional_0_in_event == 1):
print('this doesnt happen - may not be needed')
self.root.after(600, self.second_check_event_outcome)
def second_check_event_outcome(self):
if(self.additional_0_in_event == 1 ):
self.in_0_event = False
self.run_action_for_mapped_key('s')
elif(self.additional_0_in_event > 1):
self.in_0_event = False
self.run_action_for_mapped_key('n')