当前位置: 首页>>代码示例>>Python>>正文


Python config.getfloat函数代码示例

本文整理汇总了Python中quodlibet.config.getfloat函数的典型用法代码示例。如果您正苦于以下问题:Python getfloat函数的具体用法?Python getfloat怎么用?Python getfloat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getfloat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_cfg

def get_cfg(option):
    cfg_option = "%s_%s" % (_PLUGIN_ID, option)
    default = _SETTINGS[option][2]

    if option == "threshold":
        return config.getfloat("plugins", cfg_option, default)
    elif option == "ratio":
        return config.getfloat("plugins", cfg_option, default)
开发者ID:faubiguy,项目名称:quodlibet,代码行数:8,代码来源:compressor.py

示例2: get_cfg

def get_cfg(option):
    cfg_option = "%s_%s" % (_PLUGIN_ID, option)
    default = _SETTINGS[option][1]

    if option == "rate":
        return config.getfloat("plugins", cfg_option, default)
    elif option == "tempo":
        return config.getfloat("plugins", cfg_option, default)
    elif option == "pitch":
        return config.getfloat("plugins", cfg_option, default)
开发者ID:Muges,项目名称:quodlibet,代码行数:10,代码来源:pitch.py

示例3: do_set_property

 def do_set_property(self, property, v):
     if property.name == 'volume':
         self._volume = v
         if self.song and config.getboolean("player", "replaygain"):
             profiles = filter(None, self.replaygain_profiles)[0]
             fb_gain = config.getfloat("player", "fallback_gain")
             pa_gain = config.getfloat("player", "pre_amp_gain")
             scale = self.song.replay_gain(profiles, pa_gain, fb_gain)
             v = min(10.0, max(0.0, v * scale)) # volume supports 0..10
         if self.bin:
             self._vol_element.set_property('volume', v)
     else:
         raise AttributeError
开发者ID:thisfred,项目名称:quodlibet,代码行数:13,代码来源:player.py

示例4: do_set_property

 def do_set_property(self, property, v):
     if property.name == 'volume':
         self._volume = v
         if self.song and config.getboolean("player", "replaygain"):
             profiles = filter(None, self.replaygain_profiles)[0]
             fb_gain = config.getfloat("player", "fallback_gain")
             pa_gain = config.getfloat("player", "pre_amp_gain")
             scale = self.song.replay_gain(profiles, pa_gain, fb_gain)
             v = max(0.0, v * scale)
         v = min(100, int(v * 100))
         xine_set_param(self._stream, XINE_PARAM_AUDIO_AMP_LEVEL, v)
     else:
         raise AttributeError
开发者ID:silkecho,项目名称:glowing-silk,代码行数:13,代码来源:xinebe.py

示例5: __refresh_album

 def __refresh_album(self, menuitem, view):
     albums = self.__get_selected_albums()
     mag = config.getfloat("browsers", "covergrid_magnification", 3.)
     scale_factor = self.get_scale_factor() * mag
     for album in albums:
         album.scan_cover(True, scale_factor=scale_factor)
     self._refresh_albums(albums)
开发者ID:urielz,项目名称:quodlibet,代码行数:7,代码来源:main.py

示例6: bayesian_average

def bayesian_average(nums, c=None, m=None):
    """Returns the Bayesian average of an iterable of numbers,
    with parameters defaulting to config specific to ~#rating."""
    m = m or config.RATINGS.default
    c = c or config.getfloat("settings", "bayesian_rating_factor", 0.0)
    ret = float(m * c + sum(nums)) / (c + len(nums))
    return ret
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:7,代码来源:collection.py

示例7: test_get

 def test_get(self):
     config.set("foo", "int", "1")
     config.set("foo", "float", "1.25")
     config.set("foo", "str", "foobar")
     config.set("foo", "bool", "True")
     self.failUnlessEqual(config.getint("foo", "int"), 1)
     self.failUnlessEqual(config.getfloat("foo", "float"), 1.25)
     self.failUnlessEqual(config.get("foo", "str"), "foobar")
     self.failUnlessEqual(config.getboolean("foo", "bool"), True)
开发者ID:silkecho,项目名称:glowing-silk,代码行数:9,代码来源:test_config.py

示例8: _no_cover

    def _no_cover(self):
        """Returns a cairo surface representing a missing cover"""

        mag = config.getfloat("browsers", "covergrid_magnification", 3.)

        cover_size = get_cover_size()
        scale_factor = self.get_scale_factor() * mag
        pb = get_no_cover_pixbuf(cover_size, cover_size, scale_factor)
        return get_surface_for_pixbuf(self, pb)
开发者ID:urielz,项目名称:quodlibet,代码行数:9,代码来源:main.py

示例9: update_mag

 def update_mag(klass):
     mag = config.getfloat("browsers", "covergrid_magnification", 3.)
     for covergrid in klass.instances():
         covergrid.__cover.set_property('width', get_cover_size() * mag + 8)
         covergrid.__cover.set_property('height',
             get_cover_size() * mag + 8)
         covergrid.view.set_item_width(get_cover_size() * mag + 8)
         covergrid.view.queue_resize()
         covergrid.redraw()
开发者ID:urielz,项目名称:quodlibet,代码行数:9,代码来源:main.py

示例10: __init__

    def __init__(self):
        for (key, text, func) in self.keys:
            val = config.getfloat("plugins", "randomalbum_%s" % key, 0.0)
            self.weights[key] = val

        use = config.getint("plugins", "randomalbum_use_weights", 0)
        self.use_weights = use
        delay = config.getint("plugins", "randomalbum_delay", 0)
        self.delay = delay
开发者ID:LudoBike,项目名称:quodlibet,代码行数:9,代码来源:randomalbum.py

示例11: __init__

    def __init__(self, parent, player, library):
        super(TopBar, self).__init__()

        # play controls
        control_item = Gtk.ToolItem()
        self.insert(control_item, 0)
        t = PlayControls(player, library.librarian)
        self.volume = t.volume

        # only restore the volume in case it is managed locally, otherwise
        # this could affect the system volume
        if not player.has_external_volume:
            player.volume = config.getfloat("memory", "volume")

        connect_destroy(player, "notify::volume", self._on_volume_changed)
        control_item.add(t)

        self.insert(Gtk.SeparatorToolItem(), 1)

        info_item = Gtk.ToolItem()
        self.insert(info_item, 2)
        info_item.set_expand(True)

        box = Gtk.Box(spacing=6)
        info_item.add(box)
        qltk.add_css(self, "GtkToolbar {padding: 3px;}")

        self._pattern_box = Gtk.VBox()

        # song text
        info_pattern_path = os.path.join(quodlibet.get_user_dir(), "songinfo")
        text = SongInfo(library.librarian, player, info_pattern_path)
        self._pattern_box.pack_start(Align(text, border=3), True, True, 0)
        box.pack_start(self._pattern_box, True, True, 0)

        # cover image
        self.image = CoverImage(resize=True)
        connect_destroy(player, 'song-started', self.__new_song)

        # FIXME: makes testing easier
        if app.cover_manager:
            connect_destroy(
                app.cover_manager, 'cover-changed',
                self.__song_art_changed, library)

        box.pack_start(Align(self.image, border=2), False, True, 0)

        # On older Gtk+ (3.4, at least)
        # setting a margin on CoverImage leads to errors and result in the
        # QL window not being visible for some reason.
        assert self.image.props.margin == 0

        for child in self.get_children():
            child.show_all()

        context = self.get_style_context()
        context.add_class("primary-toolbar")
开发者ID:zsau,项目名称:quodlibet,代码行数:57,代码来源:quodlibetwindow.py

示例12: mag_changed

 def mag_changed(mag):
     if self.mag_lock:
         return
     newmag = mag.get_value()
     oldmag = config.getfloat("browsers", "covergrid_magnification", 3.0)
     if newmag == oldmag:
         print_d("Covergrid magnification haven't changed: {0}".format(newmag))
         return
     print_d("Covergrid magnification update from {0} to {1}".format(oldmag, newmag))
     config.set("browsers", "covergrid_magnification", mag.get_value())
     browser.update_mag()
开发者ID:piotrdrag,项目名称:quodlibet,代码行数:11,代码来源:prefs.py

示例13: test_bayesian_multiple_ratings

    def test_bayesian_multiple_ratings(s):
        # separated from above to avoid caching
        c, r1, r2 = 5, 1.0, 0.5
        songs = [Fakesong({"~#rating": r1}), Fakesong({"~#rating": r2})]
        album = Album(songs[0])
        album.songs = set(songs)

        config.set("settings", "bayesian_rating_factor", float(c))
        s.failUnlessEqual(config.getfloat("settings", "bayesian_rating_factor"), float(c))
        expected = avg(c * [config.RATINGS.default] + [r1, r2])
        s.failUnlessEqual(album("~#rating:bav"), expected)
        s.failUnlessEqual(album("~#rating"), expected)
开发者ID:faubiguy,项目名称:quodlibet,代码行数:12,代码来源:test_util_collection.py

示例14: calc_replaygain_volume

    def calc_replaygain_volume(self, volume):
        """Returns a new float volume for the given volume.

        Takes into account the global active replaygain profile list,
        the user specified replaygain settings and the tags available
        for that song.

        Args:
            volume (float): 0.0..1.0
        Returns:
            float: adjusted volume, can be outside of 0.0..0.1
        """

        if self.song and config.getboolean("player", "replaygain"):
            profiles = listfilter(None, self.replaygain_profiles)[0]
            fb_gain = config.getfloat("player", "fallback_gain")
            pa_gain = config.getfloat("player", "pre_amp_gain")
            scale = self.song.replay_gain(profiles, pa_gain, fb_gain)
        else:
            scale = 1
        return volume * scale
开发者ID:elfalem,项目名称:quodlibet,代码行数:21,代码来源:_base.py

示例15: __init__

    def __init__(self, songs, library):
        super(WeightedPlaylist, self).__init__(songs, library)

        for key,_ in self.options["weights"]:
            val = config.getfloat("plugins", "weightedlibrary_%s" % key, 0.0)
            self.weights[key] = val
        for key,_,min_value,max_value in self.options["values"]:
            val = config.getfloat("plugins", "weightedlibrary_%s" % key, (min_value+max_value)/2.)
            self.weights[key] = val


        for key,val in self.weights.items():
            print "%s = %s" % (key,val)

        rater = ModifiedAveragedRater()
        # Raters are a weighted sum
        rater.add_rater(weight=self.weights["rating"], rater=SongRatingRater())
        rater.add_rater(weight=self.weights["tempo"], rater=BpmRater(target_bpm=self.weights["tempo_target"], spread=self.weights["tempo_spread"])) # Variety is between 0 and 50
        # Modifiers work multiplicatively
        rater.add_modifier(weight=3., rater=RepeaterRater())

        self.rater = rater
开发者ID:brachiel,项目名称:weightedlibrary,代码行数:22,代码来源:weightedPlaylist.py


注:本文中的quodlibet.config.getfloat函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。