11import tkinter as tk
22from tkinter import messagebox
3- # from ui.utils import *
4- from logic .smp import smp_step_4_answer_provided
3+ from ui .utils import (
4+ enhanced_entry
5+ )
6+ from logic .smp import (
7+ smp_step_4_answer_provided ,
8+ smp_failure_notify_contact
9+ )
510
611class SMPQuestionWindow (tk .Toplevel ):
712 def __init__ (self , master , contact_id , question ):
813 super ().__init__ (master )
914 self .contact_id = contact_id
15+
16+ self .protocol ("WM_DELETE_WINDOW" , self .on_close )
17+
1018
1119 self .title ("Answer Verification Question" )
12- self .geometry ("400x250 " )
20+ self .geometry ("400x200 " )
1321 self .configure (bg = "black" )
1422
1523 # Question label
@@ -24,14 +32,12 @@ def __init__(self, master, contact_id, question):
2432 justify = "left"
2533 ).pack (pady = (10 , 10 ))
2634
27- # Answer input
2835 tk .Label (self , text = "Answer:" , fg = "white" , bg = "black" , anchor = "w" ).pack (fill = "x" , padx = 20 )
2936 self .answer_entry = tk .Entry (self , width = 50 )
3037 self .answer_entry .pack (padx = 20 , pady = (0 , 10 ))
3138
32- # enhanced_entry(self.answer_entry, placeholder="I.e. Central Park")
39+ enhanced_entry (self .answer_entry , placeholder = "I.e. Central Park" )
3340
34- # Send button
3541 tk .Button (
3642 self ,
3743 text = "Send Verification Request" ,
@@ -45,6 +51,10 @@ def __init__(self, master, contact_id, question):
4551 self .transient (master )
4652 self .grab_set ()
4753
54+ def on_close (self ):
55+ smp_failure_notify_contact (self .master .user_data , self .master .user_data_lock , self .contact_id , self .master .ui_queue )
56+ self .destroy ()
57+
4858 def submit (self ):
4959 answer = self .answer_entry .get ().strip ().lower ()
5060 if not answer :
0 commit comments