diff --git a/data_centre/data.py b/data_centre/data.py index 1958374..c300e70 100644 --- a/data_centre/data.py +++ b/data_centre/data.py @@ -149,7 +149,6 @@ class Data(object): if use_fixed_length and use_rand_start: max_increase = int(max(end - start - max(fixed_length_value, 4),0)) - print('max increase is {} '.format(max_increase)) random_increase = randint(0,max_increase) new_start = start + random_increase new_end = min(new_start + fixed_length_value, end) @@ -157,11 +156,9 @@ class Data(object): new_end = min(new_start + fixed_length_value, end) elif not use_fixed_length and use_rand_start: max_increase = int(max(end - start - 4,0)) - print('max increase is {} '.format(max_increase)) random_increase = randint(0,max_increase) new_start = start + random_increase - print('new start: {}, new end: {} '.format(new_start, new_end)) return new_start, new_end def _update_next_bankslot_value(self, slot_num): diff --git a/data_centre/json_objects/display_data.json b/data_centre/json_objects/display_data.json index df1412a..8e83b68 100644 --- a/data_centre/json_objects/display_data.json +++ b/data_centre/json_objects/display_data.json @@ -50,25 +50,25 @@ }, { "end": -1, - "length": -1, - "location": "", - "name": "", + "length": 7.4, + "location": "/home/pi/Videos/recordings/rec-2018-05-03-0.mp4", + "name": "rec-2018-05-03-0.mp4", "rate": 1, "start": -1 }, { "end": -1, - "length": -1, - "location": "", - "name": "", + "length": 2.32, + "location": "/home/pi/Videos/recordings/rec-2018-05-03-1.mp4", + "name": "rec-2018-05-03-1.mp4", "rate": 1, "start": -1 }, { "end": -1, - "length": -1, - "location": "", - "name": "", + "length": 3.36, + "location": "/home/pi/Videos/recordings/rec-2018-05-03-2.mp4", + "name": "rec-2018-05-03-2.mp4", "rate": 1, "start": -1 }, diff --git a/display_centre/display.py b/display_centre/display.py index c7544d0..c0d6267 100644 --- a/display_centre/display.py +++ b/display_centre/display.py @@ -225,6 +225,7 @@ class Display(object): def _set_colour_from_alpha(self, now_alpha, preview_alpha, next_alpha): upper_bound = 150 + is_recording = self.capture.is_recording == True ### scale values scaled_now = int(( now_alpha / 255 ) * (255 - upper_bound) + upper_bound) scaled_preview = int(( preview_alpha / 255 ) * (255 - upper_bound) + upper_bound) @@ -232,7 +233,7 @@ class Display(object): ### convert to hex now_colour = self.hex_from_rgb(scaled_now, scaled_now, 0) - capture_colour = self.hex_from_rgb(255 * self.capture.is_recording, 0, scaled_preview) + capture_colour = self.hex_from_rgb(255 * is_recording, 100, scaled_preview ) next_colour = self.hex_from_rgb(0, scaled_next, scaled_next) ### update the colours self.display_text.tag_configure("NOW_ALPHA", background="black", foreground=now_colour) @@ -243,7 +244,6 @@ class Display(object): def hex_from_rgb(r, g, b): return '#%02x%02x%02x' % (r, g, b) - def _update_screen_every_second(self): self.refresh_display() self.tk.after(500, self._update_screen_every_second) diff --git a/display_centre/messages.py b/display_centre/messages.py index 7b3e521..026d33f 100644 --- a/display_centre/messages.py +++ b/display_centre/messages.py @@ -17,7 +17,7 @@ class MessageHandler(object): return logger def set_message(self, message_type, message, stacktrace=''): - self.current_message = [message_type, message, True] + self.current_message = [message_type, str(message), True] self.number_of_messages = self.number_of_messages + 1 if message_type is 'ERROR': self.logger.error('ERROR MESSAGE IS: {} \n STACKTRACE IS: {}'.format(message, stacktrace)) diff --git a/r_e_c_u_r.py b/r_e_c_u_r.py index aca942f..c1035cd 100644 --- a/r_e_c_u_r.py +++ b/r_e_c_u_r.py @@ -43,7 +43,12 @@ actions.toggle_x_autorepeat() frame.pack() tk.attributes("-fullscreen", True) -try: - tk.mainloop() -except: - message_handler.set_message(traceback.print_tb(sys.exc_traceback, limit=1, file=sys.stdout)) +def handle_error(exc, val, tb): + print('traceback for error : {}'.format(traceback.format_exc())) + message_handler.set_message('ERROR', val, traceback.format_exc()) + +tk.report_callback_exception = handle_error + + +tk.mainloop() + diff --git a/user_input/midi_input.py b/user_input/midi_input.py index 164350c..02fee4d 100644 --- a/user_input/midi_input.py +++ b/user_input/midi_input.py @@ -98,11 +98,7 @@ class MidiInput(object): def call_method_name(self, method_name, argument=None): if argument is not None: - # try: getattr(self.actions, method_name)(argument) - #except TypeError as e: - # print(e) - # self.message_handler.set_message('INFO', 'bad midi cc mapping') else: getattr(self.actions, method_name)() diff --git a/user_input/numpad_input.py b/user_input/numpad_input.py index 24e1c0a..2cb33f1 100644 --- a/user_input/numpad_input.py +++ b/user_input/numpad_input.py @@ -1,5 +1,7 @@ import string import datetime +import traceback +import sys class NumpadInput(object): def __init__(self, root, message_handler, display, actions, data): @@ -29,6 +31,11 @@ class NumpadInput(object): else: print('{} is not in keypad map'.format(event.char)) + def on_key_release(self, event): + numpad = list(string.ascii_lowercase[0:19]) + if event.char in numpad: + self.check_key_release_settings(event.char) + def run_action_for_mapped_key(self, key): this_mapping = self.key_mappings[key] if self.data.control_mode in this_mapping: @@ -47,10 +54,7 @@ class NumpadInput(object): self.display.refresh_display() - def on_key_release(self, event): - numpad = list(string.ascii_lowercase[0:19]) - if event.char in numpad: - self.check_key_release_settings(event.char) + def check_key_release_settings(self, key): diff --git a/video_centre/video_player.py b/video_centre/video_player.py index 3aa7970..84af2e9 100644 --- a/video_centre/video_player.py +++ b/video_centre/video_player.py @@ -93,6 +93,7 @@ class VideoPlayer: if(position > end_threshold): self.status = 'FINISHED' self.omx_player.pause() + print('its paused at end!') elif(self.omx_running): self.root.after(5, self.pause_at_end)