Passed
Push — master ( 1ed32d...5696b4 )
by manny
01:30 queued 11s
created

scripting.fill_source_list()   B

Complexity

Conditions 6

Size

Total Lines 13
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 13
rs 8.6666
c 0
b 0
f 0
cc 6
nop 1
1
import obspython as obs
2
from helpers.obs_context_manager import source_list_ar
3
4
5
def fill_source_list(p):
6
    obs.obs_property_list_clear(p)
7
    obs.obs_property_list_add_string(p, "", "")
8
    with source_list_ar() as sources:
9
        if sources is not None:
10
            for source in sources:
11
                source_id = obs.obs_source_get_unversioned_id(source)
12
                if (
13
                    source_id == "text_gdiplus" or
14
                    source_id == "text_ft2_source"
15
                ):
16
                    name = obs.obs_source_get_name(source)
17
                    obs.obs_property_list_add_string(p, name, name)
18