id: qtgui_histogram_sink_x
label: QT GUI Histogram Sink
flags: [ python ]

parameters:
-   id: type
    label: Type
    dtype: enum
    default: float
    options: [float, msg_float]
    option_labels: [Float, Float Message]
    option_attributes:
        fcn: [histogram_sink_f, histogram_sink_f]
        t: [float, message]
    hide: part
-   id: name
    label: Name
    dtype: string
    default: '""'
    hide: ${ ('none' if len(name) > 0 else 'part') }
-   id: size
    label: Number of Points
    dtype: int
    default: '1024'
    hide: ${ ('all' if type.startswith('msg') else 'none') }
-   id: bins
    label: Number of Bins
    dtype: int
    default: '100'
-   id: grid
    label: Grid
    dtype: enum
    default: 'False'
    options: ['True', 'False']
    option_labels: ['Yes', 'No']
    hide: part
-   id: autoscale
    label: Autoscale
    dtype: enum
    default: 'True'
    options: ['True', 'False']
    option_labels: ['Yes', 'No']
-   id: accum
    label: Accumulate
    dtype: enum
    default: 'False'
    options: ['True', 'False']
    option_labels: ['Yes', 'No']
-   id: xmin
    label: Min x-axis
    dtype: real
    default: '-1'
-   id: xmax
    label: Max x-axis
    dtype: real
    default: '1'
-   id: nconnections
    label: Number of Inputs
    dtype: int
    default: '1'
    hide: ${ ('all' if type.startswith('msg') else 'part') }
-   id: update_time
    label: Update Period
    dtype: float
    default: '0.10'
    hide: part
-   id: gui_hint
    label: GUI Hint
    dtype: gui_hint
    hide: part
-   id: legend
    label: Legend
    category: Config
    dtype: enum
    default: 'True'
    options: ['True', 'False']
    option_labels: ['Yes', 'No']
    hide: part
-   id: axislabels
    label: Axis Labels
    category: Config
    dtype: enum
    default: 'True'
    options: ['True', 'False']
    option_labels: ['Yes', 'No']
    hide: part
-   id: label1
    label: Line 1 Label
    category: Config
    dtype: string
    hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
-   id: width1
    label: Line 1 Width
    category: Config
    dtype: int
    default: '1'
    hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
-   id: color1
    label: Line 1 Color
    category: Config
    dtype: enum
    options: ['"blue"', '"red"', '"green"', '"black"', '"cyan"', '"magenta"', '"yellow"',
        '"dark red"', '"dark green"', '"dark blue"']
    option_labels: [Blue, Red, Green, Black, Cyan, Magenta, Yellow, Dark Red, Dark
            Green, Dark Blue]
    hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
-   id: style1
    label: Line 1 Style
    category: Config
    dtype: enum
    options: ['1', '2', '3', '4', '5', '0']
    option_labels: [Solid, Dash, Dots, Dash-Dot, Dash-Dot-Dot, None]
    hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
-   id: marker1
    label: Line 1 Marker
    category: Config
    dtype: enum
    options: ['-1', '0', '1', '2', '3', '4', '6', '7', '8', '9']
    option_labels: [None, Circle, Rectangle, Diamond, Triangle, Down Triangle, Left
            Triangle, Right Triangle, Cross, X-Cross]
    hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
-   id: alpha1
    label: Line 1 Alpha
    category: Config
    dtype: float
    default: '1.0'
    hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
-   id: label2
    label: Line 2 Label
    base_key: label1
    hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
-   id: width2
    label: Line 2 Width
    base_key: width1
    hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
-   id: color2
    label: Line 2 Color
    base_key: color1
    default: '"red"'
    hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
-   id: style2
    label: Line 2 Style
    base_key: style1
    hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
-   id: marker2
    label: Line 2 Marker
    base_key: marker1
    hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
-   id: alpha2
    label: Line 2 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
-   id: label3
    label: Line 3 Label
    base_key: label1
    hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
-   id: width3
    label: Line 3 Width
    base_key: width1
    hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
-   id: color3
    label: Line 3 Color
    base_key: color1
    default: '"green"'
    hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
-   id: style3
    label: Line 3 Style
    base_key: style1
    hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
-   id: marker3
    label: Line 3 Marker
    base_key: marker1
    hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
-   id: alpha3
    label: Line 3 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
-   id: label4
    label: Line 4 Label
    base_key: label1
    hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
-   id: width4
    label: Line 4 Width
    base_key: width1
    hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
-   id: color4
    label: Line 4 Color
    base_key: color1
    default: '"black"'
    hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
-   id: style4
    label: Line 4 Style
    base_key: style1
    hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
-   id: marker4
    label: Line 4 Marker
    base_key: marker1
    hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
-   id: alpha4
    label: Line 4 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
-   id: label5
    label: Line 5 Label
    base_key: label1
    hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
-   id: width5
    label: Line 5 Width
    base_key: width1
    hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
-   id: color5
    label: Line 5 Color
    base_key: color1
    default: '"cyan"'
    hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
-   id: style5
    label: Line 5 Style
    base_key: style1
    hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
-   id: marker5
    label: Line 5 Marker
    base_key: marker1
    hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
-   id: alpha5
    label: Line 5 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
-   id: label6
    label: Line 6 Label
    base_key: label1
    hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
-   id: width6
    label: Line 6 Width
    base_key: width1
    hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
-   id: color6
    label: Line 6 Color
    base_key: color1
    default: '"magenta"'
    hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
-   id: style6
    label: Line 6 Style
    base_key: style1
    hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
-   id: marker6
    label: Line 6 Marker
    base_key: marker1
    hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
-   id: alpha6
    label: Line 6 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
-   id: label7
    label: Line 7 Label
    base_key: label1
    hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
-   id: width7
    label: Line 7 Width
    base_key: width1
    hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
-   id: color7
    label: Line 7 Color
    base_key: color1
    default: '"yellow"'
    hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
-   id: style7
    label: Line 7 Style
    base_key: style1
    hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
-   id: marker7
    label: Line 7 Marker
    base_key: marker1
    hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
-   id: alpha7
    label: Line 7 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
-   id: label8
    label: Line 8 Label
    base_key: label1
    hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
-   id: width8
    label: Line 8 Width
    base_key: width1
    hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
-   id: color8
    label: Line 8 Color
    base_key: color1
    default: '"dark red"'
    hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
-   id: style8
    label: Line 8 Style
    base_key: style1
    hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
-   id: marker8
    label: Line 8 Marker
    base_key: marker1
    hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
-   id: alpha8
    label: Line 8 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
-   id: label9
    label: Line 9 Label
    base_key: label1
    hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
-   id: width9
    label: Line 9 Width
    base_key: width1
    hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
-   id: color9
    label: Line 9 Color
    base_key: color1
    default: '"dark green"'
    hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
-   id: style9
    label: Line 9 Style
    base_key: style1
    hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
-   id: marker9
    label: Line 9 Marker
    base_key: marker1
    hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
-   id: alpha9
    label: Line 9 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
-   id: label10
    label: Line 10 Label
    base_key: label1
    hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
-   id: width10
    label: Line 10 Width
    base_key: width1
    hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
-   id: color10
    label: Line 10 Color
    base_key: color1
    default: '"dark blue"'
    hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
-   id: style10
    label: Line 10 Style
    base_key: style1
    hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
-   id: marker10
    label: Line 10 Marker
    base_key: marker1
    hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
-   id: alpha10
    label: Line 10 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(nconnections) >= 10 else 'all') }

inputs:
-   domain: stream
    dtype: ${ type.t }
    multiplicity: ${ (0 if type.startswith('msg') else nconnections) }
    optional: ${ (True if type.startswith('msg') else False) }

templates:
    imports: |-
        import sip
    callbacks:
    - set_update_time(${update_time})
    - set_bins(${bins})
    - set_x_axis(${xmin}, ${xmax})
    make: |-
        <%
            win = 'self._%s_win'%id
        %>\
        qtgui.histogram_sink_f(
            ${size},
            ${bins},
            ${xmin},
            ${xmax},
            ${name},
            ${ 0 if type.startswith('msg') else nconnections},
            None # parent
        )

        self.${id}.set_update_time(${update_time})
        self.${id}.enable_autoscale(${autoscale})
        self.${id}.enable_accumulate(${accum})
        self.${id}.enable_grid(${grid})
        self.${id}.enable_axis_labels(${axislabels})

        % if legend == "False":
        self.${id}.disable_legend()
        % endif

        labels = [${label1}, ${label2}, ${label3}, ${label4}, ${label5},
            ${label6}, ${label7}, ${label8}, ${label9}, ${label10}]
        widths = [${width1}, ${width2}, ${width3}, ${width4}, ${width5},
            ${width6}, ${width7}, ${width8}, ${width9}, ${width10}]
        colors = [${color1}, ${color2}, ${color3}, ${color4}, ${color5},
            ${color6}, ${color7}, ${color8}, ${color9}, ${color10}]
        styles = [${style1}, ${style2}, ${style3}, ${style4}, ${style5},
            ${style6}, ${style7}, ${style8}, ${style9}, ${style10}]
        markers= [${marker1}, ${marker2}, ${marker3}, ${marker4}, ${marker5},
            ${marker6}, ${marker7}, ${marker8}, ${marker9}, ${marker10}]
        alphas = [${alpha1}, ${alpha2}, ${alpha3}, ${alpha4}, ${alpha5},
            ${alpha6}, ${alpha7}, ${alpha8}, ${alpha9}, ${alpha10}]

        for i in range(${1 if type.startswith('msg') else nconnections}):
            if len(labels[i]) == 0:
                self.${id}.set_line_label(i, "Data {0}".format(i))
            else:
                self.${id}.set_line_label(i, labels[i])
            self.${id}.set_line_width(i, widths[i])
            self.${id}.set_line_color(i, colors[i])
            self.${id}.set_line_style(i, styles[i])
            self.${id}.set_line_marker(i, markers[i])
            self.${id}.set_line_alpha(i, alphas[i])

        ${win} = sip.wrapinstance(self.${id}.qwidget(), Qt.QWidget)
        ${gui_hint() % win}

documentation: |-
    The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.

file_format: 1
