fixing capture bugs and shader display problems

This commit is contained in:
langolierz
2018-10-13 16:25:28 +00:00
parent cbd5ee9d61
commit 20e3c00fc5
7 changed files with 37 additions and 17 deletions

View File

@@ -113,7 +113,7 @@ class Actions(object):
def cycle_display_mode(self):
if self.data.settings['other']['VIDEO_BACKEND']['value'] == 'openframeworks':
display_modes = [["BROWSER",'NAV_BROWSER'],["SETTINGS",'NAV_SETTINGS'],[ "SAMPLER",'PLAYER'],["SHADERS",'NAV_SHADERS']]
display_modes = [["SETTINGS",'NAV_SETTINGS'],[ "SAMPLER",'PLAYER'],["BROWSER",'NAV_BROWSER'],["SHADERS",'NAV_SHADERS']]
else:
display_modes = [["BROWSER",'NAV_BROWSER'],["SETTINGS",'NAV_SETTINGS'],[ "SAMPLER",'PLAYER']]

View File

@@ -151,7 +151,7 @@ class Display(object):
shader = self.shaders.selected_shader
self.display_text.insert(END, '{:<1}:{:<1}{:<2} {:<17} '.format \
(self.shaders.selected_status,shader['shad_type'][0], \
format(shader['shad_index'],'02d'), shader['name'][0:17] ))
format(shader['shad_index'],'02d'), shader['name'].lstrip()[0:17] ))
for i in range(min(4,shader['param_number'])):
display_param = self.format_param_value(self.shaders.selected_param_values[i])
if display_param == 100:

View File

@@ -10,6 +10,19 @@
},
"3": {
"DEFAULT": ["set_the_shader_param_3_continuous"]
}
},
"4": {
"DEFAULT": ["set_the_shader_param_0_continuous"]
},
"5": {
"DEFAULT": ["set_the_shader_param_1_continuous"]
},
"6": {
"DEFAULT": ["set_the_shader_param_2_continuous"]
},
"7": {
"DEFAULT": ["set_the_shader_param_3_continuous"]
}
}

View File

@@ -40,7 +40,8 @@ class AnalogInput(object):
for i in range(0,8):
if str(i) in self.analog_mappings:
this_reading = self.analog_input.read_adc(i)
if abs(this_reading - self.last_readings[i]) > 2:
if abs(this_reading - self.last_readings[i]) > 10:
#print('the diff is {}'.format(this_reading - self.last_readings[i]))
self.run_action_for_mapped_channel(i, this_reading)
self.last_readings[i] = this_reading
self.root.after(self.analog_delay, self.poll_analog_inputs)

View File

@@ -25,16 +25,18 @@ class Capture(object):
def create_capture_device(self):
if self.use_capture:
if self.piCapture_with_no_source():
return
return False
self.update_capture_settings()
try:
self.device = picamera.PiCamera(resolution=self.resolution, framerate=self.framerate, sensor_mode = self.sensor_mode)
return True
except picamera.exc.PiCameraError as e:
self.use_capture = False
self.data.settings['capture']['DEVICE']['value'] = 'disabled'
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')
return False
def piCapture_with_no_source(self):
is_piCapture = subprocess.check_output(['pivideo', '--query', 'ready'])
@@ -72,8 +74,8 @@ class Capture(object):
return False
else:
if not self.device or self.device.closed:
self.create_capture_device()
if self.use_capture == False:
is_created = self.create_capture_device()
if self.use_capture == False or not is_created:
return False
self.is_previewing = True
self.device.start_preview()
@@ -113,8 +115,8 @@ class Capture(object):
if not self.check_available_disk_space():
return
if self.device is None or self.device.closed:
self.create_capture_device()
if self.use_capture == False:
is_created = self.create_capture_device()
if self.use_capture == False or not is_created:
return
if not os.path.exists(self.video_dir):

View File

@@ -22,7 +22,7 @@ class OfCapture(object):
if self.use_capture:
if self.piCapture_with_no_source():
print('its picapture with no source !')
return
return False
self.update_capture_settings()
if not self.check_if_attached_with_picamera():
return
@@ -80,8 +80,8 @@ class OfCapture(object):
return False
else:
if not self.has_capture:
self.create_capture_device()
if self.use_capture == False:
is_created = self.create_capture_device()
if self.use_capture == False or not is_created:
return False
self.is_previewing = True
@@ -110,8 +110,8 @@ class OfCapture(object):
return False
else:
if not self.has_capture:
self.create_capture_device()
if self.use_capture == False:
is_created = self.create_capture_device()
if self.use_capture == False or not is_created:
return False
if not self.check_available_disk_space():

View File

@@ -28,7 +28,9 @@ class Shaders(object):
shad_i = 0
for line in raw_list:
if line['is_shader']:
has_path, path = self.get_path_for_shader(line['name'])
stripped_name = line['name'].lstrip()
has_path, path = self.get_path_for_shader(stripped_name)
print('shader {} , has path {} it is {}'.format(stripped_name, has_path, path))
shad_type = self.determine_if_shader_file_is_processing(path)
parameter_number = self.determine_shader_parameter_number(path)
#print('shader index is {}'.format(shad_i))
@@ -48,6 +50,7 @@ class Shaders(object):
return False, ''
def determine_if_shader_file_is_processing(self, path):
print('the path is {}'.format(path))
with open(path, 'r') as selected_shader:
shader_text = selected_shader.read()
if '//pro-shader' in shader_text:
@@ -88,7 +91,8 @@ class Shaders(object):
is_file, name = self.shaders_menu.extract_file_type_and_name_from_menu_format(
self.shaders_menu_list[index]['name'])
is_selected_shader = False
if is_file and name == self.selected_shader['name']:
print('for the current selection the shader path is {} , and its name is {} , the check says is it a shader {} , '.format(self.shaders_menu_list[index]['path'], self.shaders_menu_list[index]['name'] ,self.shaders_menu_list[index]['is_shader']))
if is_file and name == self.selected_shader['name'].lstrip():
is_selected_shader = True
elif is_file:
self.selected_shader = self.shaders_menu_list[index]