mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-11 19:00:04 +01:00
a bunch of small bugs and tasks and fixes
This commit is contained in:
18
actions.py
18
actions.py
@@ -162,14 +162,14 @@ class Actions(object):
|
|||||||
|
|
||||||
def increase_speed(self):
|
def increase_speed(self):
|
||||||
print("increasing speed !")
|
print("increasing speed !")
|
||||||
new_rate = self.video_driver.current_player.change_rate(0.5)
|
new_rate = self.video_driver.current_player.change_rate(1)
|
||||||
current_bank, current_slot = self.data.split_bankslot_number(self.video_driver.current_player.bankslot_number)
|
current_bank, current_slot = self.data.split_bankslot_number(self.video_driver.current_player.bankslot_number)
|
||||||
self.data.update_slot_rate_to_this(current_slot, new_rate)
|
self.data.update_slot_rate_to_this(current_slot, new_rate)
|
||||||
#self._load_this_slot_into_next_player(current_slot)
|
#self._load_this_slot_into_next_player(current_slot)
|
||||||
|
|
||||||
def decrease_speed(self):
|
def decrease_speed(self):
|
||||||
print("increasing speed !")
|
print("increasing speed !")
|
||||||
new_rate = self.video_driver.current_player.change_rate(-0.5)
|
new_rate = self.video_driver.current_player.change_rate(-1)
|
||||||
current_bank, current_slot = self.data.split_bankslot_number(self.video_driver.current_player.bankslot_number)
|
current_bank, current_slot = self.data.split_bankslot_number(self.video_driver.current_player.bankslot_number)
|
||||||
self.data.update_slot_rate_to_this(current_slot, new_rate)
|
self.data.update_slot_rate_to_this(current_slot, new_rate)
|
||||||
#self._load_this_slot_into_next_player(current_slot)
|
#self._load_this_slot_into_next_player(current_slot)
|
||||||
@@ -265,6 +265,17 @@ class Actions(object):
|
|||||||
def set_the_next_video_alpha_continuous(self, amount):
|
def set_the_next_video_alpha_continuous(self, amount):
|
||||||
self.video_driver.next_player.set_alpha_value(amount*255)
|
self.video_driver.next_player.set_alpha_value(amount*255)
|
||||||
|
|
||||||
|
def set_the_shader_param_0_continuous(self, amount):
|
||||||
|
self.shaders.set_param_to_amount(0, amount)
|
||||||
|
|
||||||
|
def set_the_shader_param_1_continuous(self, amount):
|
||||||
|
self.shaders.set_param_to_amount(1, amount)
|
||||||
|
|
||||||
|
def set_the_shader_param_2_continuous(self, amount):
|
||||||
|
self.shaders.set_param_to_amount(2, amount)
|
||||||
|
|
||||||
|
def set_the_shader_param_3_continuous(self, amount):
|
||||||
|
self.shaders.set_param_to_amount(3, amount)
|
||||||
|
|
||||||
def get_midi_status(self):
|
def get_midi_status(self):
|
||||||
self.message_handler.set_message('INFO', 'midi status is {}'.format(self.data.midi_status))
|
self.message_handler.set_message('INFO', 'midi status is {}'.format(self.data.midi_status))
|
||||||
@@ -296,6 +307,7 @@ class Actions(object):
|
|||||||
def check_and_set_output_mode_on_boot(self):
|
def check_and_set_output_mode_on_boot(self):
|
||||||
#### checking if pi display mode is composite
|
#### checking if pi display mode is composite
|
||||||
response = str(subprocess.check_output(['tvservice', '-s']))
|
response = str(subprocess.check_output(['tvservice', '-s']))
|
||||||
|
print('tvservice response is {}'.format(response))
|
||||||
if 'PAL' in response or 'NTSC' in response:
|
if 'PAL' in response or 'NTSC' in response:
|
||||||
self.data.update_setting_value('video', 'OUTPUT', 'composite')
|
self.data.update_setting_value('video', 'OUTPUT', 'composite')
|
||||||
else:
|
else:
|
||||||
@@ -379,8 +391,10 @@ class Actions(object):
|
|||||||
|
|
||||||
def switch_dev_mode(self, state):
|
def switch_dev_mode(self, state):
|
||||||
if state == 'on':
|
if state == 'on':
|
||||||
|
self.video_driver.osc_client.send_message("/dev_mode", True)
|
||||||
self.switch_display_to_hdmi()
|
self.switch_display_to_hdmi()
|
||||||
elif state == 'off':
|
elif state == 'off':
|
||||||
|
self.video_driver.osc_client.send_message("/dev_mode", False)
|
||||||
self.switch_display_to_lcd()
|
self.switch_display_to_lcd()
|
||||||
|
|
||||||
def switch_display_to_hdmi(self):
|
def switch_display_to_hdmi(self):
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ class Display(object):
|
|||||||
self.display_text.tag_configure("NOW_PLAYER_INFO", background="black", foreground="yellow")
|
self.display_text.tag_configure("NOW_PLAYER_INFO", background="black", foreground="yellow")
|
||||||
self.display_text.tag_configure("NEXT_PLAYER_INFO", background="black", foreground="cyan")
|
self.display_text.tag_configure("NEXT_PLAYER_INFO", background="black", foreground="cyan")
|
||||||
self.display_text.tag_configure("COLUMN_NAME", background="black", foreground="VioletRed1")
|
self.display_text.tag_configure("COLUMN_NAME", background="black", foreground="VioletRed1")
|
||||||
|
self.display_text.tag_configure("SHADER_PARAM", background="VioletRed1", foreground="black")
|
||||||
self.display_text.tag_configure("FUNCTION", background="yellow", foreground="black")
|
self.display_text.tag_configure("FUNCTION", background="yellow", foreground="black")
|
||||||
self.display_text.tag_configure("BROKEN_PATH", background="black", foreground="gray")
|
self.display_text.tag_configure("BROKEN_PATH", background="black", foreground="gray")
|
||||||
|
|
||||||
@@ -171,6 +172,8 @@ class Display(object):
|
|||||||
for index in range(self.MENU_HEIGHT - number_of_shader_items):
|
for index in range(self.MENU_HEIGHT - number_of_shader_items):
|
||||||
self.display_text.insert(END, '\n')
|
self.display_text.insert(END, '\n')
|
||||||
self._highlight_this_row(self.shaders.shaders_menu.selected_list_index - self.shaders.shaders_menu.top_menu_index)
|
self._highlight_this_row(self.shaders.shaders_menu.selected_list_index - self.shaders.shaders_menu.top_menu_index)
|
||||||
|
if self.data.control_mode == "SHADER_PARAM":
|
||||||
|
self._highlight_this_param(self.shaders.focused_param)
|
||||||
|
|
||||||
|
|
||||||
def _load_message(self):
|
def _load_message(self):
|
||||||
@@ -198,6 +201,13 @@ class Display(object):
|
|||||||
self.display_text.tag_remove("SELECT", self.ROW_OFFSET + row,
|
self.display_text.tag_remove("SELECT", self.ROW_OFFSET + row,
|
||||||
self.ROW_OFFSET + self.SELECTOR_WIDTH + row)
|
self.ROW_OFFSET + self.SELECTOR_WIDTH + row)
|
||||||
|
|
||||||
|
def _highlight_this_param(self, param_num):
|
||||||
|
param_row = self.ROW_OFFSET - 1
|
||||||
|
column_offset = 0.24
|
||||||
|
param_length = 0.05
|
||||||
|
self.display_text.tag_add("SHADER_PARAM", param_row + column_offset + param_num*param_length,
|
||||||
|
param_row + column_offset + (param_num+1)*param_length)
|
||||||
|
|
||||||
def _get_status_for_player(self):
|
def _get_status_for_player(self):
|
||||||
now_slot, now_status, now_alpha, next_slot, next_status, next_alpha = self.video_driver.get_player_info_for_status()
|
now_slot, now_status, now_alpha, next_slot, next_status, next_alpha = self.video_driver.get_player_info_for_status()
|
||||||
|
|
||||||
@@ -262,7 +272,7 @@ class Display(object):
|
|||||||
elif position > end:
|
elif position > end:
|
||||||
banner_list[max] = '>'
|
banner_list[max] = '>'
|
||||||
elif end - start != 0 and not math.isnan(position) :
|
elif end - start != 0 and not math.isnan(position) :
|
||||||
print('start value is {}, end value is {}, position is {}'.format(start, end, position))
|
#print('start value is {}, end value is {}, position is {}'.format(start, end, position))
|
||||||
marker = int(math.floor(float(position - start) /
|
marker = int(math.floor(float(position - start) /
|
||||||
float(end - start) * (max - 1)) + 1)
|
float(end - start) * (max - 1)) + 1)
|
||||||
banner_list[marker] = '*'
|
banner_list[marker] = '*'
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
{
|
{
|
||||||
"7": {
|
"0": {
|
||||||
"DEFAULT": ["set_the_current_video_alpha_continuous"]
|
"DEFAULT": ["set_the_shader_param_0_continuous"]
|
||||||
|
},
|
||||||
|
"1": {
|
||||||
|
"DEFAULT": ["set_the_shader_param_1_continuous"]
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"DEFAULT": ["set_the_shader_param_2_continuous"]
|
||||||
|
},
|
||||||
|
"3": {
|
||||||
|
"DEFAULT": ["set_the_shader_param_3_continuous"]
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,10 +64,10 @@
|
|||||||
"DEFAULT": ["load_slot_6_into_next_player","toggle_shaders"]
|
"DEFAULT": ["load_slot_6_into_next_player","toggle_shaders"]
|
||||||
},
|
},
|
||||||
"q": {
|
"q": {
|
||||||
"DEFAULT": ["load_slot_7_into_next_player", "start_of_capture_preview"]
|
"DEFAULT": ["load_slot_7_into_next_player", "increase_speed"]
|
||||||
},
|
},
|
||||||
"r": {
|
"r": {
|
||||||
"DEFAULT": ["load_slot_8_into_next_player", "stop_of_capture_preview"]
|
"DEFAULT": ["load_slot_8_into_next_player", "decrease_speed"]
|
||||||
},
|
},
|
||||||
"s": {
|
"s": {
|
||||||
"DEFAULT": ["load_slot_9_into_next_player","quit_the_program"]
|
"DEFAULT": ["load_slot_9_into_next_player","quit_the_program"]
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class AnalogInput(object):
|
|||||||
self.analog_mappings = data.analog_mappings
|
self.analog_mappings = data.analog_mappings
|
||||||
self.analog_delay = 50
|
self.analog_delay = 50
|
||||||
self.last_readings = [0,0,0,0,0,0,0,0]
|
self.last_readings = [0,0,0,0,0,0,0,0]
|
||||||
|
self.analog_input = None
|
||||||
self.check_if_listening_enabled()
|
self.check_if_listening_enabled()
|
||||||
|
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ class AnalogInput(object):
|
|||||||
for i in range(0,8):
|
for i in range(0,8):
|
||||||
if str(i) in self.analog_mappings:
|
if str(i) in self.analog_mappings:
|
||||||
this_reading = self.analog_input.read_adc(i)
|
this_reading = self.analog_input.read_adc(i)
|
||||||
if this_reading - self.last_readings[i] > 3:
|
if abs(this_reading - self.last_readings[i]) > 2:
|
||||||
self.run_action_for_mapped_channel(i, this_reading)
|
self.run_action_for_mapped_channel(i, this_reading)
|
||||||
self.last_readings[i] = this_reading
|
self.last_readings[i] = this_reading
|
||||||
self.root.after(self.analog_delay, self.poll_analog_inputs)
|
self.root.after(self.analog_delay, self.poll_analog_inputs)
|
||||||
|
|||||||
@@ -128,9 +128,9 @@ class AltVideoPlayer:
|
|||||||
if self.rate is None:
|
if self.rate is None:
|
||||||
self.rate = 1
|
self.rate = 1
|
||||||
|
|
||||||
new_rate = self.rate + amount
|
new_rate = amount #self.rate + amount
|
||||||
print('new rate is being set to {}'.format(new_rate))
|
print('new rate is being set to {}'.format(new_rate))
|
||||||
if new_rate >= 0 and new_rate <= 3:
|
if new_rate >= -3 and new_rate <= 3:
|
||||||
self.client.send_message("/player/{}/speed".format(self.name[0]), new_rate)
|
self.client.send_message("/player/{}/speed".format(self.name[0]), new_rate)
|
||||||
self.rate = new_rate
|
self.rate = new_rate
|
||||||
return new_rate
|
return new_rate
|
||||||
@@ -144,13 +144,18 @@ class AltVideoPlayer:
|
|||||||
def set_position(self, position):
|
def set_position(self, position):
|
||||||
self.client.send_message("/player/{}/position".format(self.name[0]), position / self.total_length)
|
self.client.send_message("/player/{}/position".format(self.name[0]), position / self.total_length)
|
||||||
|
|
||||||
|
def exit_after_delay(self):
|
||||||
|
self.root.after(100, self.exit)
|
||||||
|
|
||||||
def exit(self):
|
def exit(self):
|
||||||
|
#self.last_player.exit()
|
||||||
try:
|
try:
|
||||||
#self.client.send_message("/player/{}/quit".format(self.name[0]),True)
|
self.client.send_message("/player/{}/quit".format(self.name[0]),True)
|
||||||
self.player_running = False
|
self.player_running = False
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
## not sure if i am going to implement this atm
|
## not sure if i am going to implement this atm
|
||||||
def set_screen_size_for_dev_mode(self):
|
def set_screen_size_for_dev_mode(self):
|
||||||
if self.data.settings['other']['DEV_MODE_RESET']['value'] == 'on':
|
if self.data.settings['other']['DEV_MODE_RESET']['value'] == 'on':
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ class Capture(object):
|
|||||||
self.update_capture_settings()
|
self.update_capture_settings()
|
||||||
try:
|
try:
|
||||||
self.device = picamera.PiCamera(resolution=self.resolution, framerate=self.framerate, sensor_mode = self.sensor_mode)
|
self.device = picamera.PiCamera(resolution=self.resolution, framerate=self.framerate, sensor_mode = self.sensor_mode)
|
||||||
self.message_handler.set_message('INFO', 'capture didnt error ?')
|
|
||||||
except picamera.exc.PiCameraError as e:
|
except picamera.exc.PiCameraError as e:
|
||||||
self.use_capture = False
|
self.use_capture = False
|
||||||
|
self.data.settings['capture']['DEVICE']['value'] = 'disabled'
|
||||||
print('camera exception is {}'.format(e))
|
print('camera exception is {}'.format(e))
|
||||||
self.message_handler.set_message('INFO', 'no capture device attached')
|
self.message_handler.set_message('INFO', 'no capture device attached')
|
||||||
|
|
||||||
@@ -60,6 +60,8 @@ class Capture(object):
|
|||||||
else:
|
else:
|
||||||
if not self.device or self.device.closed:
|
if not self.device or self.device.closed:
|
||||||
self.create_capture_device()
|
self.create_capture_device()
|
||||||
|
if self.use_capture == False:
|
||||||
|
return False
|
||||||
self.is_previewing = True
|
self.is_previewing = True
|
||||||
self.device.start_preview()
|
self.device.start_preview()
|
||||||
self.set_preview_screen_size()
|
self.set_preview_screen_size()
|
||||||
@@ -99,6 +101,8 @@ class Capture(object):
|
|||||||
return
|
return
|
||||||
if self.device is None or self.device.closed:
|
if self.device is None or self.device.closed:
|
||||||
self.create_capture_device()
|
self.create_capture_device()
|
||||||
|
if self.use_capture == False:
|
||||||
|
return
|
||||||
|
|
||||||
if not os.path.exists(self.video_dir):
|
if not os.path.exists(self.video_dir):
|
||||||
os.makedirs(self.video_dir)
|
os.makedirs(self.video_dir)
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class VideoDriver(object):
|
|||||||
|
|
||||||
def start_video(self):
|
def start_video(self):
|
||||||
self.current_player.start_video()
|
self.current_player.start_video()
|
||||||
self.exit_last_player_after_delay()
|
self.last_player.exit()
|
||||||
self.next_player.try_load(self.get_next_layer_value())
|
self.next_player.try_load(self.get_next_layer_value())
|
||||||
self.in_current_playing_cycle = True
|
self.in_current_playing_cycle = True
|
||||||
self.wait_for_next_cycle()
|
self.wait_for_next_cycle()
|
||||||
@@ -135,12 +135,8 @@ class VideoDriver(object):
|
|||||||
def reload_next_player(self):
|
def reload_next_player(self):
|
||||||
self.next_player.reload(self.get_next_layer_value())
|
self.next_player.reload(self.get_next_layer_value())
|
||||||
|
|
||||||
def exit_last_player_after_delay(self):
|
|
||||||
self.last_player.exit()
|
|
||||||
#self.root.after(100, self.last_player.exit)
|
|
||||||
|
|
||||||
def receive_position(self, unused_addr, player_name, args):
|
def receive_position(self, unused_addr, player_name, args):
|
||||||
print("the position of player {} is set to {}".format(player_name,args))
|
#print("the position of player {} is set to {}".format(player_name,args))
|
||||||
for player in [self.next_player, self.current_player, self.last_player]:
|
for player in [self.next_player, self.current_player, self.last_player]:
|
||||||
if player_name[0] in player.name :
|
if player_name[0] in player.name :
|
||||||
player.position = args * player.total_length
|
player.position = args * player.total_length
|
||||||
|
|||||||
Reference in New Issue
Block a user