Add missing settings functions back
This commit is contained in:
parent
fb842cdb69
commit
c302f17087
|
@ -31,6 +31,7 @@ playhead = 0
|
|||
playback = 0
|
||||
liveview_only = 0
|
||||
camera_settings = 0
|
||||
camera_status = []
|
||||
|
||||
# l10n
|
||||
LOCALE = os.getenv('LANG', 'en_EN')
|
||||
|
@ -101,6 +102,49 @@ elif project_settings['cam_type'] == "dslr":
|
|||
else:
|
||||
camera_current_settings = {}
|
||||
|
||||
|
||||
def apply_gphoto_setting(config, setting, new_value):
|
||||
cur_setting = gp.check_result(gp.gp_widget_get_child_by_name(config, setting))
|
||||
# find corresponding choice
|
||||
cur_setting_choice = gp.check_result(gp.gp_widget_get_choice(cur_setting, new_value))
|
||||
# set config value
|
||||
gp.check_result(gp.gp_widget_set_value(cur_setting, cur_setting_choice))
|
||||
|
||||
|
||||
def apply_dslr_settings(camera, config):
|
||||
# iterate over the settings dictionary
|
||||
for setting in camera_settings:
|
||||
# find the capture mode config item
|
||||
# ~ cur_setting = gp.check_result(gp.gp_widget_get_child_by_name(config, setting))
|
||||
# ~ # find corresponding choice
|
||||
# ~ cur_setting_choice = gp.check_result(gp.gp_widget_get_choice(cur_setting, camera_settings[setting]))
|
||||
# ~ # set config value
|
||||
# ~ gp.check_result(gp.gp_widget_set_value(cur_setting, cur_setting_choice))
|
||||
apply_gphoto_setting(config, setting, camera_settings[setting])
|
||||
# validate config
|
||||
gp.check_result(gp.gp_camera_set_config(camera, config))
|
||||
|
||||
|
||||
def check_status_value( config, value, optimal_value=None):
|
||||
cur_check = gp.check_result(gp.gp_widget_get_child_by_name(config, value))
|
||||
cur_check_value = gp.check_result(gp.gp_widget_get_value(cur_check))
|
||||
if optimal_value is not None:
|
||||
cur_check_choice = gp.check_result(gp.gp_widget_get_choice(cur_check, optimal_value[value]))
|
||||
return [cur_check_value, cur_check_choice]
|
||||
else:
|
||||
return cur_check_value
|
||||
|
||||
|
||||
def check_status(camera, config):
|
||||
for value in camera_status:
|
||||
cur_check_value, cur_check_choice = check_status_value(config, value, camera_status)
|
||||
if cur_check_value == cur_check_choice:
|
||||
return True
|
||||
else:
|
||||
# Some values are not optimal
|
||||
return False
|
||||
|
||||
|
||||
def apply_cam_setting(cam_settings:dict, to_set:list=None):
|
||||
# TODO: Refactor so that we can call with whatever camera type and setting, and have the work of determining how to apply it done here
|
||||
# This version should probably be kept and renamed construct_v4l2_cmd()
|
||||
|
@ -517,7 +561,7 @@ def main(args):
|
|||
gp.check_result(gp.gp_camera_init(camera))
|
||||
# get configuration tree
|
||||
current_camera_config = gp.check_result(gp.gp_camera_get_config(camera))
|
||||
apply_camera_settings(camera, current_camera_config)
|
||||
apply_dslr_settings(camera, current_camera_config)
|
||||
if check_status(camera, current_camera_config) is False:
|
||||
print(_("Warning: Some settings are not set to the recommended value!"))
|
||||
except:
|
||||
|
@ -570,7 +614,7 @@ def main(args):
|
|||
if not ret:
|
||||
print(_("Failed to grab frame."))
|
||||
break
|
||||
elif project_settings['cam_type'] == "picam"::
|
||||
elif project_settings['cam_type'] == "picam":
|
||||
overlay = cam.capture_array("main")
|
||||
# Resize preview
|
||||
overlay = cv2.resize(overlay, (project_settings['screen_w'], project_settings['screen_h']))
|
||||
|
@ -585,7 +629,7 @@ def main(args):
|
|||
if not ret:
|
||||
print(_("Failed to grab frame."))
|
||||
break
|
||||
elif project_settings['cam_type'] == "picam"::
|
||||
elif project_settings['cam_type'] == "picam":
|
||||
overlay = cam.capture_array("main")
|
||||
og_frame = overlay.copy()
|
||||
# Resize preview
|
||||
|
|
Loading…
Reference in New Issue