def on_btn_q_red_released(self): try: q1 = self.get_q_q(1) result = rational.RED_Q_Q(q1) self.add_history_record('%s = %s' % ( pretty.rational(q1), pretty.rational(result), )) except Exception as e: self.on_exception(e)
def on_btn_q_div_released(self): try: q1 = self.get_q_q(1) q2 = self.get_q_q(2) result = rational.DIV_QQ_Q(q1, q2) self.add_history_record('%s / %s = %s' % ( pretty.rational(q1), pretty.rational(q2), pretty.rational(result), )) except Exception as e: self.on_exception(e)
def on_btn_p_fac_released(self): try: p1 = self.get_p_p(1) result = polynom.FAC_P_Q(p1) self.add_history_record('Fac(%s) = %s' % ( pretty.polynom(p1), pretty.rational(result), )) except Exception as e: self.on_exception(e)
def on_btn_q_transqz_released(self): try: q1 = self.get_q_q(1) result = rational.TRANS_Q_Z(q1) self.add_history_record('%s = %d' % ( pretty.rational(q1), common.Z_to_num(result), )) except Exception as e: self.on_exception(e)
def on_btn_q_transzq_released(self): try: z = self.get_q_z() result = rational.TRANS_Z_Q(z) self.add_history_record('%d = %s' % ( common.Z_to_num(z), pretty.rational(result), )) except Exception as e: self.on_exception(e)
def on_btn_q_int_released(self): try: q1 = self.get_q_q(1) result = rational.INT_Q_B(q1) self.add_history_record('%s - %sцелое' % ( pretty.rational(q1), '' if result else 'не ', )) except Exception as e: self.on_exception(e)
def on_btn_p_mulq_released(self): try: p1 = self.get_p_p(1) q = self.get_p_q() result = polynom.MUL_PQ_P(p1, q) self.add_history_record('(%s) * %s = %s' % ( pretty.polynom(p1), pretty.rational(q), pretty.polynom(result), )) except Exception as e: self.on_exception(e)