WinGui: Fix another instance of the Caliburn vs Json.net sillyness where objects...
[HandBrake.git] / gtk / src / makedeps.py
blob1a04a9f06ce26965458df14a8b0cdc3af0bad213
1 #! /usr/bin/python
3 import collections
4 import sys
5 import json
7 DepEntry = collections.namedtuple('DepEntry', 'widget dep enable die hide')
8 dep_map = (
9 DepEntry("title", "queue_add", "none", True, False),
10 DepEntry("title", "queue_add_menu", "none", True, False),
11 DepEntry("title", "queue_add_multiple_menu", "none", True, False),
12 DepEntry("title", "preview_frame", "none", True, False),
13 DepEntry("title", "picture_summary", "none", True, False),
14 DepEntry("title", "picture_summary2", "none", True, False),
15 DepEntry("title", "chapters_tab", "none", True, False),
16 DepEntry("title", "start_point", "none", True, False),
17 DepEntry("title", "end_point", "none", True, False),
18 DepEntry("title", "angle", "none", True, False),
19 DepEntry("title", "angle_label", "1", True, False),
20 DepEntry("use_dvdnav", "angle", "0", True, True),
21 DepEntry("use_dvdnav", "angle_label", "0", True, True),
22 DepEntry("angle_count", "angle", "1", True, True),
23 DepEntry("angle_count", "angle_label", "1", True, True),
24 DepEntry("vquality_type_bitrate", "VideoAvgBitrate", "1", False, False),
25 DepEntry("vquality_type_constant", "VideoQualitySlider", "1", False, False),
26 DepEntry("vquality_type_constant", "VideoTwoPass", "1", True, False),
27 DepEntry("vquality_type_constant", "VideoTurboTwoPass", "1", True, False),
28 DepEntry("VideoFramerate", "VideoFrameratePFR", "auto", True, True),
29 DepEntry("VideoFramerate", "VideoFramerateVFR", "auto", False, True),
30 DepEntry("VideoTwoPass", "VideoTurboTwoPass", "1", False, False),
31 DepEntry("PictureDecombDeinterlace", "PictureDeinterlace", "1", True, True),
32 DepEntry("PictureDecombDeinterlace", "PictureDeinterlaceCustom", "1", True, True),
33 DepEntry("PictureDecombDeinterlace", "PictureDeinterlaceLabel", "1", True, True),
34 DepEntry("PictureDecombDeinterlace", "PictureDecomb", "0", True, True),
35 DepEntry("PictureDecombDeinterlace", "PictureDecombCustom", "0", True, True),
36 DepEntry("PictureDecombDeinterlace", "PictureDecombLabel", "0", True, True),
37 DepEntry("PictureDeinterlace", "PictureDeinterlaceCustom", "custom", False, True),
38 DepEntry("PictureDenoiseFilter", "PictureDenoisePreset", "off", True, True),
39 DepEntry("PictureDenoiseFilter", "PictureDenoisePresetLabel", "off", True, True),
40 DepEntry("PictureDenoiseFilter", "PictureDenoiseTune", "nlmeans", False, True),
41 DepEntry("PictureDenoiseFilter", "PictureDenoiseTuneLabel", "nlmeans", False, True),
42 DepEntry("PictureDenoiseFilter", "PictureDenoiseCustom", "off", True, True),
43 DepEntry("PictureDenoisePreset", "PictureDenoiseCustom", "custom", False, True),
44 DepEntry("PictureDenoisePreset", "PictureDenoiseTune", "custom", True, True),
45 DepEntry("PictureDenoisePreset", "PictureDenoiseTuneLabel", "custom", True, True),
46 DepEntry("PictureDecomb", "PictureDecombCustom", "custom", False, True),
47 DepEntry("PictureDetelecine", "PictureDetelecineCustom", "custom", False, True),
48 DepEntry("PictureWidthEnable", "PictureWidth", "1", False, False),
49 DepEntry("PictureHeightEnable", "PictureHeight", "1", False, False),
50 DepEntry("PictureAutoCrop", "PictureTopCrop", "0", False, False),
51 DepEntry("PictureAutoCrop", "PictureBottomCrop", "0", False, False),
52 DepEntry("PictureAutoCrop", "PictureLeftCrop", "0", False, False),
53 DepEntry("PictureAutoCrop", "PictureRightCrop", "0", False, False),
54 DepEntry("x264_bframes", "x264_bpyramid", "<2", True, False),
55 DepEntry("x264_bframes", "x264_direct", "0", True, False),
56 DepEntry("x264_bframes", "x264_b_adapt", "0", True, False),
57 DepEntry("x264_subme", "x264_psy_rd", "<6", True, False),
58 DepEntry("x264_subme", "x264_psy_trell", "<6", True, False),
59 DepEntry("x264_trellis", "x264_psy_trell", "0", True, False),
60 DepEntry("VideoEncoder", "x264FastDecode", "x264", False, True),
61 DepEntry("VideoEncoder", "x264UseAdvancedOptions", "x264", False, True),
62 DepEntry("HideAdvancedVideoSettings", "x264UseAdvancedOptions", "1", True, True),
63 DepEntry("VideoEncoder", "VideoOptionExtraWindow", "x264|x265|mpeg4|mpeg2|VP8", False, True),
64 DepEntry("VideoEncoder", "VideoOptionExtraLabel", "x264|x265|mpeg4|mpeg2|VP8", False, True),
65 DepEntry("x264UseAdvancedOptions", "VideoSettingsTable", "1", True, False),
66 DepEntry("VideoEncoder", "x264_box", "x264", False, True),
67 DepEntry("x264UseAdvancedOptions", "x264_box", "0", True, False),
68 DepEntry("auto_name", "autoname_box", "1", False, False),
71 def main():
73 try:
74 depsfile = open("widget.deps", "w")
75 except Exception, err:
76 print >> sys.stderr, ( "Error: %s" % str(err) )
77 sys.exit(1)
79 try:
80 revfile = open("widget_reverse.deps", "w")
81 except Exception, err:
82 print >> sys.stderr, ( "Error: %s" % str(err))
83 sys.exit(1)
85 top = dict()
86 for ii in dep_map:
87 if ii.widget in top:
88 continue
89 deps = list()
90 for jj in dep_map:
91 if jj.widget == ii.widget:
92 deps.append(jj.dep)
93 top[ii.widget] = deps
94 json.dump(top, depsfile, indent=4)
96 top = dict()
97 for ii in dep_map:
98 if ii.dep in top:
99 continue
100 deps = list()
101 for jj in dep_map:
102 if ii.dep == jj.dep:
103 rec = list()
104 rec.append(jj.widget)
105 rec.append(jj.enable)
106 rec.append(jj.die)
107 rec.append(jj.hide)
108 deps.append(rec)
109 top[ii.dep] = deps
110 json.dump(top, revfile, indent=4)
112 main()