AGW Logo

agw_title PeakMeterCtrl

The main PeakMeterCtrl implementation.

hierarchy Inheritance Diagram

Inheritance diagram for: PeakMeterCtrl

Inheritance diagram of PeakMeterCtrl


appearance Control Appearance


PeakMeterCtrl

PeakMeterCtrl


method_summary Methods Summary

__init__Default class constructor.
DoGetBestSizeGets the size which best suits the window: for a control, it would be the
DoTimerProcessingPeakMeterCtrl animation, does the wx.EVT_TIMER processing.
DrawHorzBandDraws horizontal bands.
DrawVertBandDraws vertical bands.
GetAGWWindowStyleFlagReturns the PeakMeterCtrl window style.
GetFalloffEffectReturns the falloff effect flag.
GetRangeValueGet range value of PeakMeterCtrl.
InitDataInitializes the control.
IsGridVisibleReturns if gridlines are visible.
IsStartedCheck if animation is active.
OnEraseBackgroundHandles the wx.EVT_ERASE_BACKGROUND event for PeakMeterCtrl.
OnPaintHandles the wx.EVT_PAINT event for PeakMeterCtrl.
OnSizeHandles the wx.EVT_SIZE event for PeakMeterCtrl.
OnTimerHandles the wx.EVT_TIMER event for PeakMeterCtrl.
ResetControlResets the PeakMeterCtrl.
SetAGWWindowStyleFlagSets the PeakMeterCtrl window style flags.
SetBackgroundColourChanges the background colour of PeakMeterCtrl.
SetBandsColourSet bands colour for PeakMeterCtrl.
SetDataChange data value.
SetFalloffDelaySet peak value speed before falling off.
SetFalloffEffectSet falloff effect flag.
SetMeterBandsSet number of vertical or horizontal bands to display.
SetRangeValueSets the ranges for low, medium and high bands.
ShowGridRequest to have gridlines visible or not.
StartStart the timer and animation effect.
StopStop the timer and animation effect.

API Class API

class PeakMeterCtrl(wx.PyControl)[source]

The main PeakMeterCtrl implementation.



__init__(parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=PM_VERTICAL)[source]

Default class constructor.

Parameters:
  • parent – the PeakMeterCtrl parent. Must not be None
  • id – window identifier. A value of -1 indicates a default value;
  • pos – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;
  • size – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;
  • style – the underlying wx.PyControl window style;
  • agwStyle – the AGW-specific window style, which can be one of the following bits:


    Window Styles Hex Value Description
    PM_HORIZONTAL 0x0 Shows horizontal bands in PeakMeterCtrl.
    PM_VERTICAL 0x1 Shows vertical bands in PeakMeterCtrl.


DoGetBestSize()[source]

Gets the size which best suits the window: for a control, it would be the minimal size which doesn’t truncate the control, for a panel - the same size as it would have after a call to Fit().

Note

Overridden from wx.PyControl.



DoTimerProcessing()[source]

PeakMeterCtrl animation, does the wx.EVT_TIMER processing.



DrawHorzBand(dc, rect)[source]

Draws horizontal bands.

Parameters:
  • dc – an instance of wx.DC;
  • rect – the horizontal bands client rectangle.

Todo

Implement falloff effect for horizontal bands.



DrawVertBand(dc, rect)[source]

Draws vertical bands.

Parameters:
  • dc – an instance of wx.DC;

  • rect – the vertical bands client rectangle.


GetAGWWindowStyleFlag()[source]

Returns the PeakMeterCtrl window style.

See also

SetAGWWindowStyleFlag for a list of possible window style flags.



GetFalloffEffect()[source]

Returns the falloff effect flag.



GetRangeValue()[source]

Get range value of PeakMeterCtrl.



InitData()[source]

Initializes the control.



IsGridVisible()[source]

Returns if gridlines are visible.



IsStarted()[source]

Check if animation is active.



OnEraseBackground(event)[source]

Handles the wx.EVT_ERASE_BACKGROUND event for PeakMeterCtrl.

Parameters:event – a wx.EraseEvent event to be processed.

Note

This method is intentionally empty to reduce flicker.



OnPaint(event)[source]

Handles the wx.EVT_PAINT event for PeakMeterCtrl.

Parameters:event – a wx.PaintEvent event to be processed.


OnSize(event)[source]

Handles the wx.EVT_SIZE event for PeakMeterCtrl.

Parameters:event – a wx.SizeEvent event to be processed.


OnTimer(event)[source]

Handles the wx.EVT_TIMER event for PeakMeterCtrl.

Parameters:event – a wx.TimerEvent event to be processed.


ResetControl()[source]

Resets the PeakMeterCtrl.



SetAGWWindowStyleFlag(agwStyle)[source]

Sets the PeakMeterCtrl window style flags.

Parameters:agwStyle – the AGW-specific window style. This can be a combination of the following bits:


Window Styles Hex Value Description
PM_HORIZONTAL 0x0 Shows horizontal bands in PeakMeterCtrl.
PM_VERTICAL 0x1 Shows vertical bands in PeakMeterCtrl.


SetBackgroundColour(colourBgnd)[source]

Changes the background colour of PeakMeterCtrl.

Parameters:colourBgnd – the colour to be used as the background colour, pass wx.NullColour to reset to the default colour.

Note

The background colour is usually painted by the default wx.EraseEvent event handler function under Windows and automatically under GTK.

Note

Setting the background colour does not cause an immediate refresh, so you may wish to call wx.Window.ClearBackground or wx.Window.Refresh after calling this function.

Note

Overridden from wx.PyControl.



SetBandsColour(colourNormal, colourMedium, colourHigh)[source]

Set bands colour for PeakMeterCtrl.

Parameters:
  • colourNormal – the colour for normal (low) bands, a valid wx.Colour object;
  • colourMedium – the colour for medium bands, a valid wx.Colour object;

  • colourHigh – the colour for high bands, a valid wx.Colour object.



SetData(arrayValue, offset, size)[source]

Change data value. Use this function to change only a set of values. All bands can be changed or only 1 band, depending on the application.

Parameters:
  • arrayValue – a Python list containing the PeakMeterData values;
  • offset – the (optional) offset where to start applying the new data;
  • size – the size of the input data.


SetFalloffDelay(speed)[source]

Set peak value speed before falling off.

Parameters:speed – the speed at which the falloff happens.


SetFalloffEffect(falloffEffect)[source]

Set falloff effect flag.

Parameters:falloffEffectTrue to enable the falloff effect, False to disable it.


SetMeterBands(numBands, ledBands)[source]

Set number of vertical or horizontal bands to display.

Parameters:
  • numBands – number of bands to display (either vertical or horizontal);
  • ledBands – the number of leds per band.

Note

You can obtain a smooth effect by setting nHorz or nVert to “1”, these cannot be 0.



SetRangeValue(minVal, medVal, maxVal)[source]

Sets the ranges for low, medium and high bands.

Parameters:
  • minVal – the value for low bands;
  • medVal – the value for medium bands;
  • maxVal – the value for high bands.

Note

The conditions to be satisfied are:

Min: [0 - nMin[, Med: [nMin - nMed[, Max: [nMed - nMax]



ShowGrid(showGrid)[source]

Request to have gridlines visible or not.

Parameters:showGridTrue to show grid lines, False otherwise.


Start(delay)[source]

Start the timer and animation effect.

Parameters:delay – the animation effect delay, in milliseconds.


Stop()[source]

Stop the timer and animation effect.

Tree

Table Of Contents

Previous topic

peakmeter

Next topic

PeakMeterData