phoenix_title wx.lib.agw.peakmeter.PeakMeterCtrl

The main PeakMeterCtrl implementation.


class_hierarchy Class Hierarchy

Inheritance diagram for class PeakMeterCtrl:

appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


super_classes Known Superclasses

wx.Control


method_summary Methods Summary

__init__

Default class constructor.

DoGetBestSize

Gets the size which best suits the window: for a control, it would be the

DoTimerProcessing

PeakMeterCtrl animation, does the wx.EVT_TIMER processing.

DrawHorzBand

Draws horizontal bands.

DrawVertBand

Draws vertical bands.

DrawVertBandInverted

Draws vertical bands inverted.

GetAGWWindowStyleFlag

Returns the PeakMeterCtrl window style.

GetFalloffEffect

Returns the falloff effect flag.

GetRangeValue

Get range value of PeakMeterCtrl.

InitData

Initializes the control.

IsGridVisible

Returns if gridlines are visible.

IsStarted

Check if animation is active.

OnEraseBackground

Handles the wx.EVT_ERASE_BACKGROUND event for PeakMeterCtrl.

OnPaint

Handles the wx.EVT_PAINT event for PeakMeterCtrl.

OnSize

Handles the wx.EVT_SIZE event for PeakMeterCtrl.

OnTimer

Handles the wx.EVT_TIMER event for PeakMeterCtrl.

ResetControl

Resets the PeakMeterCtrl.

SetAGWWindowStyleFlag

Sets the PeakMeterCtrl window style flags.

SetBackgroundColour

Changes the background colour of PeakMeterCtrl.

SetBandsColour

Set bands colour for PeakMeterCtrl.

SetData

Change data value. Use this function to change only

SetFalloffDelay

Set peak value speed before falling off.

SetFalloffEffect

Set falloff effect flag.

SetMeterBands

Set number of vertical or horizontal bands to display.

SetRangeValue

Sets the ranges for low, medium and high bands.

ShowGrid

Request to have gridlines visible or not.

Start

Start the timer and animation effect.

Stop

Stop the timer and animation effect.


api Class API

class PeakMeterCtrl(wx.Control)

The main PeakMeterCtrl implementation.


Methods

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

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.Control 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.

    PM_VERTICAL_INVERTED

    0x2

    Shows inverted vertical bands in PeakMeterCtrl.



DoGetBestSize(self)

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.Control.



DoTimerProcessing(self)

PeakMeterCtrl animation, does the wx.EVT_TIMER processing.



DrawHorzBand(self, dc, rect)

Draws horizontal bands.

Parameters
  • dc – an instance of wx.DC;

  • rect – the horizontal bands client rectangle.

Todo

Implement falloff effect for horizontal bands.



DrawVertBand(self, dc, rect)

Draws vertical bands.

Parameters
  • dc – an instance of wx.DC;

  • rect – the vertical bands client rectangle.



DrawVertBandInverted(self, dc, rect)

Draws vertical bands inverted.

Parameters
  • dc – an instance of wx.DC;

  • rect – the vertical bands client rectangle.



GetAGWWindowStyleFlag(self)

Returns the PeakMeterCtrl window style.

See also

PeakMeterCtrl.SetAGWWindowStyleFlag for a list of possible window style flags.



GetFalloffEffect(self)

Returns the falloff effect flag.



GetRangeValue(self)

Get range value of PeakMeterCtrl.



InitData(self)

Initializes the control.



IsGridVisible(self)

Returns if gridlines are visible.



IsStarted(self)

Check if animation is active.



OnEraseBackground(self, event)

Handles the wx.EVT_ERASE_BACKGROUND event for PeakMeterCtrl.

Parameters

event – a EraseEvent event to be processed.

Note

This method is intentionally empty to reduce flicker.



OnPaint(self, event)

Handles the wx.EVT_PAINT event for PeakMeterCtrl.

Parameters

event – a PaintEvent event to be processed.



OnSize(self, event)

Handles the wx.EVT_SIZE event for PeakMeterCtrl.

Parameters

event – a wx.SizeEvent event to be processed.



OnTimer(self, event)

Handles the wx.EVT_TIMER event for PeakMeterCtrl.

Parameters

event – a TimerEvent event to be processed.



ResetControl(self)

Resets the PeakMeterCtrl.



SetAGWWindowStyleFlag(self, agwStyle)

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.

PM_VERTICAL_INVERTED

0x2

Shows inverted vertical bands in PeakMeterCtrl.



SetBackgroundColour(self, colourBgnd)

Changes the background colour of PeakMeterCtrl.

Parameters

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

Note

The background colour is usually painted by the default 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.Control.



SetBandsColour(self, colourNormal, colourMedium, colourHigh)

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(self, arrayValue, offset, size)

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(self, speed)

Set peak value speed before falling off.

Parameters

speed – the speed at which the falloff happens.



SetFalloffEffect(self, falloffEffect)

Set falloff effect flag.

Parameters

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



SetMeterBands(self, numBands, ledBands)

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(self, minVal, medVal, maxVal)

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(self, showGrid)

Request to have gridlines visible or not.

Parameters

showGridTrue to show grid lines, False otherwise.



Start(self, delay)

Start the timer and animation effect.

Parameters

delay – the animation effect delay, in milliseconds.



Stop(self)

Stop the timer and animation effect.