set the color of one or both eyes, and open the eye
(regObj)
| 765 | |
| 766 | |
| 767 | def handle_eye_color(regObj): |
| 768 | ''' |
| 769 | set the color of one or both eyes, and open the eye |
| 770 | ''' |
| 771 | if regObj.group(EYE_COLOR_STRING_GROUP): |
| 772 | r,g,b=eye_colors[regObj.group(EYE_COLOR_STRING_GROUP)] |
| 773 | |
| 774 | if regObj.group(EYE_COLOR_R_GROUP): |
| 775 | r = int(regObj.group(EYE_COLOR_R_GROUP)) |
| 776 | if regObj.group(EYE_COLOR_G_GROUP): |
| 777 | g = int(regObj.group(EYE_COLOR_G_GROUP)) |
| 778 | if regObj.group(EYE_COLOR_B_GROUP): |
| 779 | b = int(regObj.group(EYE_COLOR_B_GROUP)) |
| 780 | if regObj.group(EYE_COLOR_HTML_GROUP): |
| 781 | color = regObj.group(EYE_COLOR_HTML_GROUP) |
| 782 | r,g,b = tuple(int(color[i:i+2], 16) for i in (1, 3 ,5)) |
| 783 | try: |
| 784 | if regObj.group(EYE_COLOR_LEFT_GROUP)==None: |
| 785 | gpg.set_right_eye_color((r,g,b)) |
| 786 | gpg.open_right_eye() |
| 787 | if regObj.group(EYE_COLOR_RIGHT_GROUP)==None: |
| 788 | gpg.set_left_eye_color((r,g,b)) |
| 789 | gpg.open_left_eye() |
| 790 | except Exception as e: |
| 791 | print("handle_eye_color".format(e)) |
| 792 | return None |
| 793 | |
| 794 | |
| 795 | def handle_eyes(regObj): |
no test coverage detected