Exemple #1
0
    def _createEnoughLevelWidgets(self, numchannels):
        """
        This method dynamically creates labels and level meters for channels
        that currently do not have level meters. The glade file no longer
        contains the labels or the level meters. Also the table size in the
        glade file is set to 50 and the widgets inside the table that are
        statically configured have a bottom y of 50 allowing about 23 channels
        in the audio.

        @param numchannels: total number of channels there is volume data for
        """
        if numchannels > len(self.level_widgets):
            totalLevelWidgets = len(self.level_widgets)
            for chan in range(totalLevelWidgets, numchannels):
                levelWidget = FVUMeter()
                levelLabel = gtk.Label()
                if chan == 0 and numchannels > 1:
                    levelLabel.set_text(_("Left channel level:"))
                elif numchannels == 1:
                    levelLabel.set_text(_("Mono channel level:"))
                elif chan == 1:
                    levelLabel.set_text(_("Right channel level:"))
                else:
                    levelLabel.set_text(_("Channel %d level:") % chan)
                levelLabel.set_property("xpad", 0)
                levelLabel.set_property("ypad", 0)
                levelLabel.set_property("xalign", 0)
                levelLabel.set_property("yalign", 0.5)
                levelLabel.set_justify(gtk.JUSTIFY_LEFT)
                self.widget.attach(levelLabel,
                                   0,
                                   1,
                                   chan * 2,
                                   chan * 2 + 1,
                                   xoptions=gtk.FILL,
                                   yoptions=0,
                                   xpadding=3,
                                   ypadding=3)
                self.widget.attach(levelWidget,
                                   0,
                                   1,
                                   chan * 2 + 1,
                                   chan * 2 + 2,
                                   yoptions=gtk.FILL,
                                   xpadding=6,
                                   ypadding=3)
                levelLabel.show()
                levelWidget.show()
                self.level_widgets.append(levelWidget)
Exemple #2
0
    def testScale(self):
        w = FVUMeter()

        self.assertEquals(w.iec_scale(-80.0), 0.0)
        self.assertEquals(w.iec_scale(-70.0), 0.0)
        self.assertEquals(w.iec_scale(-60.0), 2.5)
        self.assertEquals(w.iec_scale(-50.0), 7.5)
        self.assertEquals(w.iec_scale(-40.0), 15)
        self.assertEquals(w.iec_scale(-30.0), 30)
        self.assertEquals(w.iec_scale(-20.0), 50)
        self.assertEquals(w.iec_scale(-10.0), 75)
        self.assertEquals(w.iec_scale(0.0), 100)
Exemple #3
0
    def _createEnoughLevelWidgets(self, numchannels):
        """
        This method dynamically creates labels and level meters for channels
        that currently do not have level meters. The glade file no longer
        contains the labels or the level meters. Also the table size in the
        glade file is set to 50 and the widgets inside the table that are
        statically configured have a bottom y of 50 allowing about 23 channels
        in the audio.

        @param numchannels: total number of channels there is volume data for
        """
        if numchannels > len(self.level_widgets):
            totalLevelWidgets = len(self.level_widgets)
            for chan in range(totalLevelWidgets, numchannels):
                levelWidget = FVUMeter()
                levelLabel = gtk.Label()
                if chan == 0 and numchannels > 1:
                    levelLabel.set_text(_("Left channel level:"))
                elif numchannels == 1:
                    levelLabel.set_text(_("Mono channel level:"))
                elif chan == 1:
                    levelLabel.set_text(_("Right channel level:"))
                else:
                    levelLabel.set_text(_("Channel %d level:") % chan)
                levelLabel.set_property("xpad", 0)
                levelLabel.set_property("ypad", 0)
                levelLabel.set_property("xalign", 0)
                levelLabel.set_property("yalign", 0.5)
                levelLabel.set_justify(gtk.JUSTIFY_LEFT)
                self.widget.attach(levelLabel, 0, 1, chan * 2, chan * 2 + 1,
                    xoptions=gtk.FILL, yoptions=0, xpadding=3, ypadding=3)
                self.widget.attach(levelWidget, 0, 1, chan * 2 + 1,
                    chan * 2 + 2, yoptions=gtk.FILL,
                    xpadding=6, ypadding=3)
                levelLabel.show()
                levelWidget.show()
                self.level_widgets.append(levelWidget)
Exemple #4
0
 def testWidget(self):
     w = FVUMeter()
     window = gtk.Window()
     window.add(w)
     window.show_all()
     gobject.timeout_add(0 * INTERVAL, w.set_property, 'peak', -50.0)
     gobject.timeout_add(1 * INTERVAL, w.set_property, 'peak', -5.0)
     gobject.timeout_add(2 * INTERVAL, gtk.main_quit)
     gtk.main()
     # these four calls make sure the window doesn't hang around during
     # other tests
     window.hide()
     gtk.main_iteration()
     window.destroy()
     gtk.main_iteration()
Exemple #5
0
    def testScale(self):
        w = FVUMeter()

        self.assertEquals(w.iec_scale(-80.0), 0.0)
        self.assertEquals(w.iec_scale(-70.0), 0.0)
        self.assertEquals(w.iec_scale(-60.0), 2.5)
        self.assertEquals(w.iec_scale(-50.0), 7.5)
        self.assertEquals(w.iec_scale(-40.0), 15)
        self.assertEquals(w.iec_scale(-30.0), 30)
        self.assertEquals(w.iec_scale(-20.0), 50)
        self.assertEquals(w.iec_scale(-10.0), 75)
        self.assertEquals(w.iec_scale(0.0), 100)
Exemple #6
0
 def testGetSet(self):
     w = FVUMeter()
     w.set_property('peak', -50.0)
     self.assertEquals(w.get_property('peak'), -50.0)
     w.set_property('decay', -50.0)
     self.assertEquals(w.get_property('decay'), -50.0)
     w.set_property('orange-threshold', -50.0)
     self.assertEquals(w.get_property('orange-threshold'), -50.0)
     w.set_property('red-threshold', -50.0)
     self.assertEquals(w.get_property('red-threshold'), -50.0)
Exemple #7
0
 def testGetSet(self):
     w = FVUMeter()
     w.set_property('peak', -50.0)
     self.assertEquals(w.get_property('peak'), -50.0)
     w.set_property('decay', -50.0)
     self.assertEquals(w.get_property('decay'), -50.0)
     w.set_property('orange-threshold', -50.0)
     self.assertEquals(w.get_property('orange-threshold'), -50.0)
     w.set_property('red-threshold', -50.0)
     self.assertEquals(w.get_property('red-threshold'), -50.0)