In [1]:
import IPython
import ipywidgets

import context
import gopro_helper as gopro

In [2]:
%load_ext autoreload
%autoreload 2

Dropdown feature/option selection widget

Driven entirely by GoPro JSON configuration file.


In [3]:
# State information
state = gopro.Struct()
state._raw_status = None
state._raw_settings = None
state._mode = None

In [4]:
# Fetch new information from camera
raw_status, raw_settings = gopro.commands.get_raw_status_settings()

state._raw_status = raw_status
state._raw_settings = raw_settings

info_status = gopro.api.parse_status_names(raw_status)
name_mode, name_sub_mode = gopro.api.parse_mode_sub_mode(info_status)

state._mode = name_mode

In [5]:
state._mode


Out[5]:
'video'

Features and Options


In [6]:
gopro.commands.set_mode_photo()

In [7]:
# List features for current mode (copied from API notebook)
features = gopro.api.mode_features(state._mode)
    
for F in features:
    print('{:2d} - {:22s} [{}]'.format(F['id'], F['path_segment'], F['display_name']))


 1 - default_sub_mode       [Default Video Sub Mode]
68 - current_sub_mode       [Video Sub Mode]
 2 - resolution             [Resolution]
 3 - fps                    [Frames Per Second]
 4 - fov                    [Field of View]
 5 - timelapse_rate         [Interval]
 6 - looping                [Interval]
 7 - piv                    [Interval]
 8 - low_light              [Low Light]
78 - eis                    [Video Stabilization]
10 - protune                [Protune]
11 - protune_white_balance  [White Balance]
12 - protune_color          [Color]
14 - protune_sharpness      [Sharpness]
15 - protune_ev             [EV Comp]
73 - exposure_time          [Shutter]
13 - protune_iso            [ISO]
74 - protune_iso_mode       [ISO Mode]
96 - no_audio               [No Audio Track]

In [8]:
# List features for current mode (copied from API notebook)
features = gopro.api.mode_features(state._mode)
    
for F in features:
    print(F['path_segment'])


default_sub_mode
current_sub_mode
resolution
fps
fov
timelapse_rate
looping
piv
low_light
eis
protune
protune_white_balance
protune_color
protune_sharpness
protune_ev
exposure_time
protune_iso
protune_iso_mode
no_audio

In [9]:
# Feature options (copied from API notebook)
f_name_or_id = 'protune_color'

f_name, fid, options = gopro.api.feature_options(state._mode, f_name_or_id)
d_name = gopro.api.feature_display_name(state._mode, f_name)


print('Option IDs and values for feature "{}" [mode "{}"]:'.format(d_name, state._mode))
for item in options:
    print('[{:2d}] - {} '.format(item['value'], item['display_name']))


Option IDs and values for feature "Color" [mode "video"]:
[ 1] - Flat 
[ 0] - GoPro 

Basic feature option dropdown widget, driven by camara's JSON data


In [10]:
wid_drop = gopro.feature_dropdown_widget(state._mode, f_name, callback=None)

In [11]:
wid_drop


The Widget


In [10]:
wid = gopro.Settings()



In [18]:
wid.start()



In [19]:
wid.stop()

In [ ]:
gopro.commands.set_mode_photo()

In [11]:
gopro.commands.set_mode_video()

In [ ]:
wid.up