abstract_solmisation_addon.py 文件源码

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

项目:Solfege 作者: RannyeriDev 项目源码 文件源码
def new_question(self):
        """returns:
            self.ERR_PICKY : if the question is not yet solved and the
            teacher is picky (== you have to solve the
            question before a new is asked).
            self.OK : if a new question was created.
            self.ERR_NO_ELEMS : if no elements are set to be practised.
            """
        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 self.ERR_PICKY

        self.q_status = self.QSTATUS_NO
        if not self.m_P.header.solmisation_elements:
            return self.ERR_NO_ELEMS
        self.m_question = []
        for x in range(self.get_int("num_notes")):
            self.m_question.append(random.choice(self.m_P.header.solmisation_elements))
        self.q_status = self.QSTATUS_NEW
        self.m_transp = random.randint(-5, 6)
        return self.OK
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号