<?xml version="1.0"?>
<!--
###################################################
##QT GUI Sink
###################################################
 -->
<block>
  <name>QT GUI Bercurve Sink</name>
  <key>qtgui_bercurve_sink</key>
  <import>from PyQt4 import Qt</import>
  <import>from gnuradio import qtgui</import>
  <import>import sip</import>
  <import>import numpy</import>
  <make>#set $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
  )
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]
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 xrange($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])

self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
$(gui_hint() % $win)</make>

  <param>
    <name>esno</name>
    <key>esno</key>
    <value>numpy.arange(0.0, 4.0, .5)</value>
    <type>raw</type>
  </param>

  <param>
    <name>Min. BER Errs.</name>
    <key>berminerrors</key>
    <value>100</value>
    <type>int</type>
  </param>

  <param>
    <name>BER Limit</name>
    <key>berlimit</key>
    <value>-7.0</value>
    <type>real</type>
  </param>

  <param>
    <name>Num Curves</name>
    <key>num_curves</key>
    <value>1</value>
    <type>int</type>
  </param>

  <param>
    <name>Curve Names</name>
    <key>curvenames</key>
    <value>[]</value>
    <type>raw</type>
    <hide>part</hide>
  </param>

  <param>
    <name>Y min</name>
    <key>ymin</key>
    <value>-10</value>
    <type>real</type>
    <hide>part</hide>
  </param>

  <param>
    <name>Y max</name>
    <key>ymax</key>
    <value>0</value>
    <type>real</type>
    <hide>part</hide>
  </param>

  <param>
    <name>Update Period</name>
    <key>update_time</key>
    <value>0.10</value>
    <type>real</type>
    <hide>part</hide>
  </param>

  <param>
    <name>GUI Hint</name>
    <key>gui_hint</key>
    <value></value>
    <type>gui_hint</type>
    <hide>part</hide>
  </param>

  <param>
    <name>Line 1 Label</name>
    <key>label1</key>
    <type>string</type>
    <hide>#if int($num_curves()) >= 1 then 'part' else 'all'#</hide>
    <tab>Config</tab>
  </param>

  <param>
    <name>Line 1 Width</name>
    <key>width1</key>
    <value>1</value>
    <type>int</type>
    <hide>#if int($num_curves()) >= 1 then 'part' else 'all'#</hide>
    <tab>Config</tab>
  </param>

  <param>
    <name>Line 1 Color</name>
    <key>color1</key>
    <type>enum</type>
    <hide>#if int($num_curves()) >= 1 then 'part' else 'all'#</hide>
    <option>
      <name>Blue</name>
      <key>"blue"</key>
    </option>
    <option>
      <name>Red</name>
      <key>"red"</key>
    </option>
    <option>
      <name>Green</name>
      <key>"green"</key>
    </option>
    <option>
      <name>Black</name>
      <key>"black"</key>
    </option>
    <option>
      <name>Cyan</name>
      <key>"cyan"</key>
    </option>
    <option>
      <name>Magenta</name>
      <key>"magenta"</key>
    </option>
    <option>
      <name>Yellow</name>
      <key>"yellow"</key>
    </option>
    <option>
      <name>Dark Red</name>
      <key>"dark red"</key>
    </option>
    <option>
      <name>Dark Green</name>
      <key>"dark green"</key>
    </option>
    <option>
      <name>Dark Blue</name>
      <key>"Dark Blue"</key>
    </option>
    <tab>Config</tab>
  </param>

  <param>
    <name>Line 1 Style</name>
    <key>style1</key>
    <type>enum</type>
    <hide>#if int($num_curves()) >= 1 then 'part' else 'all'#</hide>
    <option>
      <name>Solid</name>
      <key>1</key>
    </option>
    <option>
      <name>Dash</name>
      <key>2</key>
    </option>
    <option>
      <name>Dots</name>
      <key>3</key>
    </option>
    <option>
      <name>Dash-Dot</name>
      <key>4</key>
    </option>
    <option>
      <name>Dash-Dot-Dot</name>
      <key>5</key>
    </option>
    <option>
      <name>None</name>
      <key>0</key>
    </option>
    <tab>Config</tab>
  </param>

  <param>
    <name>Line 1 Marker</name>
    <key>marker1</key>
    <type>enum</type>
    <hide>#if int($num_curves()) >= 1 then 'part' else 'all'#</hide>
    <option>
      <name>Circle</name>
      <key>0</key>
    </option>
    <option>
      <name>Rectangle</name>
      <key>1</key>
    </option>
    <option>
      <name>Diamond</name>
      <key>2</key>
    </option>
    <option>
      <name>Triangle</name>
      <key>3</key>
    </option>
    <option>
      <name>Down Triangle</name>
      <key>4</key>
    </option>
    <option>
      <name>Left Triangle</name>
      <key>6</key>
    </option>
    <option>
      <name>Right Triangle</name>
      <key>7</key>
    </option>
    <option>
      <name>Cross</name>
      <key>8</key>
    </option>
    <option>
      <name>X-Cross</name>
      <key>9</key>
    </option>
    <option>
      <name>None</name>
      <key>-1</key>
    </option>
    <tab>Config</tab>
  </param>

  <param>
    <name>Line 1 Alpha</name>
    <key>alpha1</key>
    <value>1.0</value>
    <type>float</type>
    <hide>#if int($num_curves()) >= 1 then 'part' else 'all'#</hide>
    <tab>Config</tab>
  </param>


  <param>
    <base_key>label1</base_key>
    <name>Line 2 Label</name>
    <key>label2</key>
    <hide>#if int($num_curves()) >= 2 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>width1</base_key>
    <name>Line 2 Width</name>
    <key>width2</key>
    <hide>#if int($num_curves()) >= 2 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>color1</base_key>
    <name>Line 2 Color</name>
    <key>color2</key>
    <value>"red"</value>
    <hide>#if int($num_curves()) >= 2 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>style1</base_key>
    <name>Line 2 Style</name>
    <key>style2</key>
    <hide>#if int($num_curves()) >= 2 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>marker1</base_key>
    <name>Line 2 Marker</name>
    <key>marker2</key>
    <hide>#if int($num_curves()) >= 2 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>alpha1</base_key>
    <name>Line 2 Alpha</name>
    <key>alpha2</key>
    <hide>#if int($num_curves()) >= 2 then 'part' else 'all'#</hide>
  </param>


  <param>
    <base_key>label1</base_key>
    <name>Line 3 Label</name>
    <key>label3</key>
    <hide>#if int($num_curves()) >= 3 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>width1</base_key>
    <name>Line 3 Width</name>
    <key>width3</key>
    <hide>#if int($num_curves()) >= 3 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>color1</base_key>
    <name>Line 3 Color</name>
    <key>color3</key>
    <value>"green"</value>
    <hide>#if int($num_curves()) >= 3 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>style1</base_key>
    <name>Line 3 Style</name>
    <key>style3</key>
    <hide>#if int($num_curves()) >= 3 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>marker1</base_key>
    <name>Line 3 Marker</name>
    <key>marker3</key>
    <hide>#if int($num_curves()) >= 3 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>alpha1</base_key>
    <name>Line 3 Alpha</name>
    <key>alpha3</key>
    <hide>#if int($num_curves()) >= 3 then 'part' else 'all'#</hide>
  </param>


  <param>
    <base_key>label1</base_key>
    <name>Line 4 Label</name>
    <key>label4</key>
    <hide>#if int($num_curves()) >= 4 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>width1</base_key>
    <name>Line 4 Width</name>
    <key>width4</key>
    <hide>#if int($num_curves()) >= 4 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>color1</base_key>
    <name>Line 4 Color</name>
    <key>color4</key>
    <value>"black"</value>
    <hide>#if int($num_curves()) >= 4 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>style1</base_key>
    <name>Line 4 Style</name>
    <key>style4</key>
    <hide>#if int($num_curves()) >= 4 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>marker1</base_key>
    <name>Line 4 Marker</name>
    <key>marker4</key>
    <hide>#if int($num_curves()) >= 4 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>alpha1</base_key>
    <name>Line 4 Alpha</name>
    <key>alpha4</key>
    <hide>#if int($num_curves()) >= 4 then 'part' else 'all'#</hide>
  </param>


  <param>
    <base_key>label1</base_key>
    <name>Line 5 Label</name>
    <key>label5</key>
    <hide>#if int($num_curves()) >= 5 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>width1</base_key>
    <name>Line 5 Width</name>
    <key>width5</key>
    <hide>#if int($num_curves()) >= 5 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>color1</base_key>
    <name>Line 5 Color</name>
    <key>color5</key>
    <value>"cyan"</value>
    <hide>#if int($num_curves()) >= 5 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>style1</base_key>
    <name>Line 5 Style</name>
    <key>style5</key>
    <hide>#if int($num_curves()) >= 5 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>marker1</base_key>
    <name>Line 5 Marker</name>
    <key>marker5</key>
    <hide>#if int($num_curves()) >= 5 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>alpha1</base_key>
    <name>Line 5 Alpha</name>
    <key>alpha5</key>
    <hide>#if int($num_curves()) >= 5 then 'part' else 'all'#</hide>
  </param>


  <param>
    <base_key>label1</base_key>
    <name>Line 6 Label</name>
    <key>label6</key>
    <hide>#if int($num_curves()) >= 6 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>width1</base_key>
    <name>Line 6 Width</name>
    <key>width6</key>
    <hide>#if int($num_curves()) >= 6 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>color1</base_key>
    <name>Line 6 Color</name>
    <key>color6</key>
    <value>"magenta"</value>
    <hide>#if int($num_curves()) >= 6 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>style1</base_key>
    <name>Line 6 Style</name>
    <key>style6</key>
    <hide>#if int($num_curves()) >= 6 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>marker1</base_key>
    <name>Line 6 Marker</name>
    <key>marker6</key>
    <hide>#if int($num_curves()) >= 6 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>alpha1</base_key>
    <name>Line 6 Alpha</name>
    <key>alpha6</key>
    <hide>#if int($num_curves()) >= 6 then 'part' else 'all'#</hide>
  </param>


  <param>
    <base_key>label1</base_key>
    <name>Line 7 Label</name>
    <key>label7</key>
    <hide>#if int($num_curves()) >= 7 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>width1</base_key>
    <name>Line 7 Width</name>
    <key>width7</key>
    <hide>#if int($num_curves()) >= 7 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>color1</base_key>
    <name>Line 7 Color</name>
    <key>color7</key>
    <value>"yellow"</value>
    <hide>#if int($num_curves()) >= 7 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>style1</base_key>
    <name>Line 7 Style</name>
    <key>style7</key>
    <hide>#if int($num_curves()) >= 7 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>marker1</base_key>
    <name>Line 7 Marker</name>
    <key>marker7</key>
    <hide>#if int($num_curves()) >= 7 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>alpha1</base_key>
    <name>Line 7 Alpha</name>
    <key>alpha7</key>
    <hide>#if int($num_curves()) >= 7 then 'part' else 'all'#</hide>
  </param>


  <param>
    <base_key>label1</base_key>
    <name>Line 8 Label</name>
    <key>label8</key>
    <hide>#if int($num_curves()) >= 8 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>width1</base_key>
    <name>Line 8 Width</name>
    <key>width8</key>
    <hide>#if int($num_curves()) >= 8 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>color1</base_key>
    <name>Line 8 Color</name>
    <key>color8</key>
    <value>"dark red"</value>
    <hide>#if int($num_curves()) >= 8 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>style1</base_key>
    <name>Line 8 Style</name>
    <key>style8</key>
    <hide>#if int($num_curves()) >= 8 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>marker1</base_key>
    <name>Line 8 Marker</name>
    <key>marker8</key>
    <hide>#if int($num_curves()) >= 8 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>alpha1</base_key>
    <name>Line 8 Alpha</name>
    <key>alpha8</key>
    <hide>#if int($num_curves()) >= 8 then 'part' else 'all'#</hide>
  </param>


  <param>
    <base_key>label1</base_key>
    <name>Line 9 Label</name>
    <key>label9</key>
    <hide>#if int($num_curves()) >= 9 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>width1</base_key>
    <name>Line 9 Width</name>
    <key>width9</key>
    <hide>#if int($num_curves()) >= 9 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>color1</base_key>
    <name>Line 9 Color</name>
    <key>color9</key>
    <value>"dark green"</value>
    <hide>#if int($num_curves()) >= 9 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>style1</base_key>
    <name>Line 9 Style</name>
    <key>style9</key>
    <hide>#if int($num_curves()) >= 9 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>marker1</base_key>
    <name>Line 9 Marker</name>
    <key>marker9</key>
    <hide>#if int($num_curves()) >= 9 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>alpha1</base_key>
    <name>Line 9 Alpha</name>
    <key>alpha9</key>
    <hide>#if int($num_curves()) >= 9 then 'part' else 'all'#</hide>
  </param>


  <param>
    <base_key>label1</base_key>
    <name>Line 10 Label</name>
    <key>label10</key>
    <hide>#if int($num_curves()) >= 10 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>width1</base_key>
    <name>Line 10 Width</name>
    <key>width10</key>
    <hide>#if int($num_curves()) >= 10 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>color1</base_key>
    <name>Line 10 Color</name>
    <key>color10</key>
    <value>"dark blue"</value>
    <hide>#if int($num_curves()) >= 10 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>style1</base_key>
    <name>Line 10 Style</name>
    <key>style10</key>
    <hide>#if int($num_curves()) >= 10 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>marker1</base_key>
    <name>Line 10 Marker</name>
    <key>marker10</key>
    <hide>#if int($num_curves()) >= 10 then 'part' else 'all'#</hide>
  </param>

  <param>
    <base_key>alpha1</base_key>
    <name>Line 10 Alpha</name>
    <key>alpha10</key>
    <hide>#if int($num_curves()) >= 10 then 'part' else 'all'#</hide>
  </param>


  <sink>
    <name>out</name>
    <type>byte</type>
    <nports>len($esno)*2*$num_curves</nports>
  </sink>

  <bus_structure_sink>map(lambda b: map(lambda a: b * len($esno) * 2 + a, range(len($esno)*2)), range($num_curves))</bus_structure_sink>

  <doc>
    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.
  </doc>
</block>
