AGW Logo

svn SVN Revision 68881 For peakmeter

This file contains the SVN revision history for peakmeter, at revision 68881.

Available information include commit date, the name of the committer, the file size, the SVN log messages and a diff from the previous version (if available).


file_info File Information

  • Commit Date: 17-Oct-2008 19:15:31 UTC
  • Committer: AG
  • File Size: 26021 byte(s)

svn_log Log Messages

The following log message was entered by the committer:

  • AGW: General overhaul of the documentation, much improved. All the widgets have their own sample usage in the docs as well;

  • FlatNotebook: Added the FNB_NAV_BUTTONS_WHEN_NEEDED style, which hides the navigation left/right arrows if all tabs fit;

  • RibbonBar: - Added the EVT_RIBBONBAR_TAB_LEFT_DCLICK event, which generates a special event

    when a ribbon bar tab is double-clicked;

    • Added support for toggle buttons;
    • Improved support for ribbon panel sizers: panels with sizers should now automatically minimise at small sizes, and behave properly when popping up from a minimised state;
    • Added tooltips via SetToolTip for those buttons which have the help_string attribute set.
  • XLSGrid: a new widget was added to AGW, termed XLSGrid. It’s based on wx.grid.Grid and can be used to faithfully reproduce the appearance of a Microsoft Excel spreadsheets.


svn_diff Diff To Previous Version (68362)

Version SVN diff:

--- wxPython/3rdParty/AGW/agw/peakmeter.py  2011/07/24 21:36:47     68362
+++ wxPython/3rdParty/AGW/agw/peakmeter.py  2011/08/25 16:40:17     68881
@@ -2,7 +2,7 @@
# PEAKMETERCTRL wxPython IMPLEMENTATION
#
# Andrea Gavana, @ 07 October 2008
-# Latest Revision: 14 Apr 2010, 12.00 GMT
+# Latest Revision: 17 Aug 2011, 15.00 GMT
#
#
# TODO List
@@ -25,14 +25,14 @@
# --------------------------------------------------------------------------------- #

"""
-PeakMeterCtrl mimics the behaviour of equalizers that are usually found in stereos
+L{PeakMeterCtrl} mimics the behaviour of equalizers that are usually found in stereos
and MP3 players.


Description
===========

-PeakMeterCtrl mimics the behaviour of equalizers that are usually found in stereos
+L{PeakMeterCtrl} mimics the behaviour of equalizers that are usually found in stereos
and MP3 players. This widgets supports:

* Vertical and horizontal led bands;
@@ -44,10 +44,90 @@
And a lot more. Check the demo for an almost complete review of the functionalities.


+Usage
+=====
+
+Usage example::
+
+    import wx
+    import random
+
+    import wx.lib.agw.peakmeter as PM
+
+    class MyFrame(wx.Frame):
+
+        def __init__(self, parent):
+
+            wx.Frame.__init__(self, parent, -1, "PeakMeterCtrl Demo")
+
+            panel = wx.Panel(self)
+
+            # Initialize Peak Meter control 1
+            self.vertPeak = PM.PeakMeterCtrl(panel, -1, style=wx.SIMPLE_BORDER, agwStyle=PM.PM_VERTICAL)
+            # Initialize Peak Meter control 2
+            self.horzPeak = PM.PeakMeterCtrl(panel, -1, style=wx.SUNKEN_BORDER, agwStyle=PM.PM_HORIZONTAL)
+
+            self.vertPeak.SetMeterBands(10, 15)
+            self.horzPeak.SetMeterBands(10, 15)
+
+            # Layout the two PeakMeterCtrl
+            mainSizer = wx.BoxSizer(wx.HORIZONTAL)
+            mainSizer.Add(self.vertPeak, 0, wx.EXPAND|wx.ALL, 15)
+            mainSizer.Add(self.horzPeak, 0, wx.EXPAND|wx.ALL, 15)
+
+            panel.SetSizer(mainSizer)
+            mainSizer.Layout()
+
+            self.timer = wx.Timer(self)
+            self.Bind(wx.EVT_TIMER, self.OnTimer)
+
+            wx.CallLater(500, self.Start)
+
+
+        def Start(self):
+            ''' Starts the PeakMeterCtrl. '''
+
+            self.timer.Start(1000/2)            # 2 fps
+
+            self.vertPeak.Start(1000/18)        # 18 fps
+            self.horzPeak.Start(1000/20)        # 20 fps
+
+
+        def OnTimer(self, event):
+            '''
+            Handles the ``wx.EVT_TIMER`` event for L{PeakMeterCtrl}.
+
+            :param `event`: a `wx.TimerEvent` event to be processed.
+            '''
+
+            # Generate 15 random number and set them as data for the meter
+            nElements = 15
+            arrayData = []
+
+            for i in xrange(nElements):
+                nRandom = random.randint(0, 100)
+                arrayData.append(nRandom)
+
+            self.vertPeak.SetData(arrayData, 0, nElements)
+            self.horzPeak.SetData(arrayData, 0, nElements)
+
+
+    # our normal wxApp-derived class, as usual
+
+    app = wx.PySimpleApp()
+
+    frame = MyFrame(None)
+    app.SetTopWindow(frame)
+    frame.Show()
+
+    app.MainLoop()
+
+
+
Supported Platforms
===================

-PeakMeterCtrl has been tested on the following platforms:
+L{PeakMeterCtrl} has been tested on the following platforms:
* Windows (Windows XP).


@@ -59,8 +139,8 @@
================= =========== ==================================================
Window Styles     Hex Value   Description
================= =========== ==================================================
-``PM_HORIZONTAL``         0x0 Shows horizontal bands in `PeakMeterCtrl`.
-``PM_VERTICAL``           0x1 Shows vertical bands in `PeakMeterCtrl`.
+``PM_HORIZONTAL``         0x0 Shows horizontal bands in L{PeakMeterCtrl}.
+``PM_VERTICAL``           0x1 Shows vertical bands in L{PeakMeterCtrl}.
================= =========== ==================================================


@@ -73,9 +153,9 @@
License And Version
===================

-PeakMeterCtrl is distributed under the wxPython license.
+L{PeakMeterCtrl} is distributed under the wxPython license.

-Latest Revision: Andrea Gavana @ 12 Apr 2010, 12.00 GMT
+Latest Revision: Andrea Gavana @ 17 Aug 2011, 15.00 GMT

Version 0.3

@@ -85,9 +165,9 @@

# Horizontal or vertical PeakMeterCtrl
PM_HORIZONTAL = 0
-""" Shows horizontal bands in `PeakMeterCtrl`. """
+""" Shows horizontal bands in L{PeakMeterCtrl}. """
PM_VERTICAL = 1
-""" Shows vertical bands in `PeakMeterCtrl`. """
+""" Shows vertical bands in L{PeakMeterCtrl}. """

# Some useful constants...
BAND_DEFAULT = 8
@@ -559,6 +639,8 @@
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`.
"""

# something is better than nothing...
Tree

Table Of Contents

Previous topic

SVN Revision 68362 For peakmeter

Next topic

persist library