id: qtgui_bercurve_sink
label: QT GUI Bercurve Sink
flags: [ python ]

parameters:
-   id: esno
    label: esno
    dtype: raw
    default: numpy.arange(0.0, 4.0, .5)
    hide: part
-   id: berminerrors
    label: Min. BER Errs.
    dtype: int
    default: '100'
-   id: berlimit
    label: BER Limit
    dtype: real
    default: '-7.0'
-   id: num_curves
    label: Num Curves
    dtype: int
    default: '1'
    hide: part
-   id: curvenames
    label: Curve Names
    dtype: raw
    default: '[]'
    hide: part
-   id: ymin
    label: Y min
    dtype: real
    default: '-10'
    hide: part
-   id: ymax
    label: Y max
    dtype: real
    default: '0'
    hide: part
-   id: update_time
    label: Update Period
    dtype: real
    default: '0.10'
    hide: part
-   id: gui_hint
    label: GUI Hint
    dtype: gui_hint
    hide: part
-   id: label1
    label: Line 1 Label
    category: Config
    dtype: string
    hide: ${ ('part' if int(num_curves) >= 1 else 'all') }
-   id: width1
    label: Line 1 Width
    category: Config
    dtype: int
    default: '1'
    hide: ${ ('part' if int(num_curves) >= 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(num_curves) >= 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(num_curves) >= 1 else 'all') }
-   id: marker1
    label: Line 1 Marker
    category: Config
    dtype: enum
    options: ['0', '1', '2', '3', '4', '6', '7', '8', '9', '-1']
    option_labels: [Circle, Rectangle, Diamond, Triangle, Down Triangle, Left Triangle,
        Right Triangle, Cross, X-Cross, None]
    hide: ${ ('part' if int(num_curves) >= 1 else 'all') }
-   id: alpha1
    label: Line 1 Alpha
    category: Config
    dtype: float
    default: '1.0'
    hide: ${ ('part' if int(num_curves) >= 1 else 'all') }
-   id: label2
    label: Line 2 Label
    base_key: label1
    hide: ${ ('part' if int(num_curves) >= 2 else 'all') }
-   id: width2
    label: Line 2 Width
    base_key: width1
    hide: ${ ('part' if int(num_curves) >= 2 else 'all') }
-   id: color2
    label: Line 2 Color
    base_key: color1
    default: '"red"'
    hide: ${ ('part' if int(num_curves) >= 2 else 'all') }
-   id: style2
    label: Line 2 Style
    base_key: style1
    hide: ${ ('part' if int(num_curves) >= 2 else 'all') }
-   id: marker2
    label: Line 2 Marker
    base_key: marker1
    hide: ${ ('part' if int(num_curves) >= 2 else 'all') }
-   id: alpha2
    label: Line 2 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(num_curves) >= 2 else 'all') }
-   id: label3
    label: Line 3 Label
    base_key: label1
    hide: ${ ('part' if int(num_curves) >= 3 else 'all') }
-   id: width3
    label: Line 3 Width
    base_key: width1
    hide: ${ ('part' if int(num_curves) >= 3 else 'all') }
-   id: color3
    label: Line 3 Color
    base_key: color1
    default: '"green"'
    hide: ${ ('part' if int(num_curves) >= 3 else 'all') }
-   id: style3
    label: Line 3 Style
    base_key: style1
    hide: ${ ('part' if int(num_curves) >= 3 else 'all') }
-   id: marker3
    label: Line 3 Marker
    base_key: marker1
    hide: ${ ('part' if int(num_curves) >= 3 else 'all') }
-   id: alpha3
    label: Line 3 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(num_curves) >= 3 else 'all') }
-   id: label4
    label: Line 4 Label
    base_key: label1
    hide: ${ ('part' if int(num_curves) >= 4 else 'all') }
-   id: width4
    label: Line 4 Width
    base_key: width1
    hide: ${ ('part' if int(num_curves) >= 4 else 'all') }
-   id: color4
    label: Line 4 Color
    base_key: color1
    default: '"black"'
    hide: ${ ('part' if int(num_curves) >= 4 else 'all') }
-   id: style4
    label: Line 4 Style
    base_key: style1
    hide: ${ ('part' if int(num_curves) >= 4 else 'all') }
-   id: marker4
    label: Line 4 Marker
    base_key: marker1
    hide: ${ ('part' if int(num_curves) >= 4 else 'all') }
-   id: alpha4
    label: Line 4 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(num_curves) >= 4 else 'all') }
-   id: label5
    label: Line 5 Label
    base_key: label1
    hide: ${ ('part' if int(num_curves) >= 5 else 'all') }
-   id: width5
    label: Line 5 Width
    base_key: width1
    hide: ${ ('part' if int(num_curves) >= 5 else 'all') }
-   id: color5
    label: Line 5 Color
    base_key: color1
    default: '"cyan"'
    hide: ${ ('part' if int(num_curves) >= 5 else 'all') }
-   id: style5
    label: Line 5 Style
    base_key: style1
    hide: ${ ('part' if int(num_curves) >= 5 else 'all') }
-   id: marker5
    label: Line 5 Marker
    base_key: marker1
    hide: ${ ('part' if int(num_curves) >= 5 else 'all') }
-   id: alpha5
    label: Line 5 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(num_curves) >= 5 else 'all') }
-   id: label6
    label: Line 6 Label
    base_key: label1
    hide: ${ ('part' if int(num_curves) >= 6 else 'all') }
-   id: width6
    label: Line 6 Width
    base_key: width1
    hide: ${ ('part' if int(num_curves) >= 6 else 'all') }
-   id: color6
    label: Line 6 Color
    base_key: color1
    default: '"magenta"'
    hide: ${ ('part' if int(num_curves) >= 6 else 'all') }
-   id: style6
    label: Line 6 Style
    base_key: style1
    hide: ${ ('part' if int(num_curves) >= 6 else 'all') }
-   id: marker6
    label: Line 6 Marker
    base_key: marker1
    hide: ${ ('part' if int(num_curves) >= 6 else 'all') }
-   id: alpha6
    label: Line 6 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(num_curves) >= 6 else 'all') }
-   id: label7
    label: Line 7 Label
    base_key: label1
    hide: ${ ('part' if int(num_curves) >= 7 else 'all') }
-   id: width7
    label: Line 7 Width
    base_key: width1
    hide: ${ ('part' if int(num_curves) >= 7 else 'all') }
-   id: color7
    label: Line 7 Color
    base_key: color1
    default: '"yellow"'
    hide: ${ ('part' if int(num_curves) >= 7 else 'all') }
-   id: style7
    label: Line 7 Style
    base_key: style1
    hide: ${ ('part' if int(num_curves) >= 7 else 'all') }
-   id: marker7
    label: Line 7 Marker
    base_key: marker1
    hide: ${ ('part' if int(num_curves) >= 7 else 'all') }
-   id: alpha7
    label: Line 7 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(num_curves) >= 7 else 'all') }
-   id: label8
    label: Line 8 Label
    base_key: label1
    hide: ${ ('part' if int(num_curves) >= 8 else 'all') }
-   id: width8
    label: Line 8 Width
    base_key: width1
    hide: ${ ('part' if int(num_curves) >= 8 else 'all') }
-   id: color8
    label: Line 8 Color
    base_key: color1
    default: '"dark red"'
    hide: ${ ('part' if int(num_curves) >= 8 else 'all') }
-   id: style8
    label: Line 8 Style
    base_key: style1
    hide: ${ ('part' if int(num_curves) >= 8 else 'all') }
-   id: marker8
    label: Line 8 Marker
    base_key: marker1
    hide: ${ ('part' if int(num_curves) >= 8 else 'all') }
-   id: alpha8
    label: Line 8 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(num_curves) >= 8 else 'all') }
-   id: label9
    label: Line 9 Label
    base_key: label1
    hide: ${ ('part' if int(num_curves) >= 9 else 'all') }
-   id: width9
    label: Line 9 Width
    base_key: width1
    hide: ${ ('part' if int(num_curves) >= 9 else 'all') }
-   id: color9
    label: Line 9 Color
    base_key: color1
    default: '"dark green"'
    hide: ${ ('part' if int(num_curves) >= 9 else 'all') }
-   id: style9
    label: Line 9 Style
    base_key: style1
    hide: ${ ('part' if int(num_curves) >= 9 else 'all') }
-   id: marker9
    label: Line 9 Marker
    base_key: marker1
    hide: ${ ('part' if int(num_curves) >= 9 else 'all') }
-   id: alpha9
    label: Line 9 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(num_curves) >= 9 else 'all') }
-   id: label10
    label: Line 10 Label
    base_key: label1
    hide: ${ ('part' if int(num_curves) >= 10 else 'all') }
-   id: width10
    label: Line 10 Width
    base_key: width1
    hide: ${ ('part' if int(num_curves) >= 10 else 'all') }
-   id: color10
    label: Line 10 Color
    base_key: color1
    default: '"dark blue"'
    hide: ${ ('part' if int(num_curves) >= 10 else 'all') }
-   id: style10
    label: Line 10 Style
    base_key: style1
    hide: ${ ('part' if int(num_curves) >= 10 else 'all') }
-   id: marker10
    label: Line 10 Marker
    base_key: marker1
    hide: ${ ('part' if int(num_curves) >= 10 else 'all') }
-   id: alpha10
    label: Line 10 Alpha
    base_key: alpha1
    hide: ${ ('part' if int(num_curves) >= 10 else 'all') }
-   id: bus_structure_sink
    default: list(map(lambda b:list(map(lambda a:b * len(esno) * 2 + a, range(len(esno)*2))), range(num_curves))) 
    dtype: raw
    hide: all

inputs:
-   domain: stream
    dtype: byte
    multiplicity: ${ len(esno)*2*num_curves }

templates:
    imports: |-
        import sip
        import numpy
    make: |-
        <%
            win = 'self._%s_win'%id
        %>\
        qtgui.ber_sink_b(
            ${esno}, #range of esnos
            ${num_curves}, #number of curves
            ${berminerrors}, #ensure at least
            ${berlimit}, #cutoff
            ${curvenames}, #indiv. curve names
            None # parent
        )
        self.${id}.set_update_time(${update_time})
        self.${id}.set_y_axis(${ymin}, ${ymax})
        self.${id}.set_x_axis(${esno}[0], ${esno}[-1])

        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}]
        alphas = [${alpha1}, ${alpha2}, ${alpha3}, ${alpha4}, ${alpha5},
            ${alpha6}, ${alpha7}, ${alpha8}, ${alpha9}, ${alpha10}]
        styles = [${style1}, ${style2}, ${style3}, ${style4}, ${style5},
            ${style6}, ${style7}, ${style8}, ${style9}, ${style10}]
        markers = [${marker1}, ${marker2}, ${marker3}, ${marker4}, ${marker5},
            ${marker6}, ${marker7}, ${marker8}, ${marker9}, ${marker10}]
            
        for i in range(${num_curves}):
            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
