compareintervals.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:Solfege 作者: RannyeriDev 项目源码 文件源码
def new_question(self):
        """
        Return a true value if a new question was created otherwise false.
        """
        if self.m_timeout_handle:
            GObject.source_remove(self.m_timeout_handle)
            self.m_timeout_handle = None

        if self.get_bool('config/picky_on_new_question') \
                 and self.q_status in [self.QSTATUS_NEW, self.QSTATUS_WRONG]:
            return Teacher.ERR_PICKY

        first = self.get_list('first_interval_up')
        if self.get_string('first_interval_type') == 'melodic':
            first = first + map(lambda a: -a, self.get_list('first_interval_down'))
        last = self.get_list('last_interval_up')
        if self.get_string('last_interval_type') == 'melodic':
            last = last + map(lambda a: -a, self.get_list('last_interval_down'))
        if not (first and last):
            return self.ERR_CONFIGURE
        self.m_intervals = [random.choice(first), random.choice(last)]
        self.m_tonikas = [mpd.MusicalPitch().randomize("f", "f'"),
                          mpd.MusicalPitch().randomize("f", "f'")]
        self.q_status = self.QSTATUS_NEW
        return self.OK
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号