Example #1
0
    def __init__(self, message, msg_type, gui, from_modal):
	Frame.__init__(self, Toplevel())
	self['borderwidth'] = 2
	self['relief'] = 'ridge'
	self.pack(side='top', fill = 'both')
	self.master.title("Unit tester typein")
	self.msg = TypeinScrollPane(self, label = message)
	self.msg.pack(side = 'top', fill = 'both', expand = 1)
	d = TaggableScrollPane(self,
			       label = "Or select a frame:")
	d.pack(side = "top", fill = 'both')
	for f in gui.frame_history:
	    d.Write(f + "\n", "<Button-1>", self.MaybeUseFrame)	    
	# Here's where we add the line.
	if msg_type == GalaxyIO.GAL_MESSAGE_MSG_TYPE:
	    p = Frame(self, borderwidth = 2, relief = 'ridge')
	    p.pack(side = 'top', fill = 'x', expand = 1)
	    # Do the grid for the session ID and round trip.
	    session_id = gui.env.GetSessionID()
	    if not session_id: session_id = ""
	    self.session_entry = LabeledEntry(p, label_text = "Session ID:",
					      entry_value = session_id)
	    self.session_entry.entry['state'] = 'normal'
	    # self.session_entry['borderwidth'] = 2
	    # self.session_entry['relief'] = 'ridge'	    
	    self.lock_var = IntVar()
	    self.lock_entry = Checkbutton(p, text = "Lock session",
					  font = HEADERFONT,
					  variable = self.lock_var)
	    self.round_trip_var = IntVar()
	    self.round_trip_entry = Checkbutton(p, text = "Reply required",
						font = HEADERFONT,
						variable = self.round_trip_var)
	    # self.round_trip_entry['borderwidth'] = 2
	    # self.round_trip_entry['relief'] = 'ridge'
	    self.session_entry.grid(row = 0, column = 0, sticky = 'w')
	    self.session_entry.grid_columnconfigure(0, weight = '1')
	    self.session_entry.grid_rowconfigure(0, weight = '1')
	    self.lock_entry.grid(row = 1, column = 0, sticky = 'w')
	    self.lock_entry.grid_columnconfigure(0, weight = '1')
	    self.lock_entry.grid_rowconfigure(0, weight = '1')
	    self.round_trip_entry.grid(row = 2, column = 0, sticky = 'w')
	    self.round_trip_entry.grid_columnconfigure(0, weight = '1')
	    self.round_trip_entry.grid_rowconfigure(2, weight = '1')
	    if gui.as_hub and from_modal:
		self.round_trip_entry['state'] = 'disabled'
	    if gui.as_hub:
		self.lock_entry['state'] = 'disabled'
	else:
	    self.session_entry = None
	    self.round_trip_entry = None
	    self.round_trip_var = None
	    self.lock_entry = None
	    self.lock_var = None
	self.dismiss_row = ConfirmRow(self)
	self.dismiss_row.pack(side='top')
	self.dialogue = None
Example #2
0
    def __init__(self, message):
	Frame.__init__(self, Toplevel())
	self['borderwidth'] = 2
	self['relief'] = 'ridge'
	self.pack(side='top')
	self.master.title("Unit tester typein")
	self.msg = LabeledEntry(self, label_text = message,
				entry_width = 40)	
	self.msg.pack(side = 'top')
	self.msg.Enable()	
	self.dismiss_row = ConfirmRow(self)
	self.dismiss_row.pack(side='top')
	self.dialogue = None
Example #3
0
class ConfirmationTypein(Frame):
    def __init__(self, message):
	Frame.__init__(self, Toplevel())
	self['borderwidth'] = 2
	self['relief'] = 'ridge'
	self.pack(side='top')
	self.master.title("Unit tester typein")
	self.msg = LabeledEntry(self, label_text = message,
				entry_width = 40)	
	self.msg.pack(side = 'top')
	self.msg.Enable()	
	self.dismiss_row = ConfirmRow(self)
	self.dismiss_row.pack(side='top')
	self.dialogue = None

    def succeed(self):
	if self.dialogue is not None:
	    self.dialogue.confirmation_result = 1, self.msg.GetValue()
	self.master.destroy()

    def fail(self):
	if self.dialogue is not None:
	    self.dialogue.confirmation_result = 0, None
	self.master.destroy()
Example #4
0
class ConfirmationFrameTypein(Frame):
    def __init__(self, message, msg_type, gui, from_modal):
	Frame.__init__(self, Toplevel())
	self['borderwidth'] = 2
	self['relief'] = 'ridge'
	self.pack(side='top', fill = 'both')
	self.master.title("Unit tester typein")
	self.msg = TypeinScrollPane(self, label = message)
	self.msg.pack(side = 'top', fill = 'both', expand = 1)
	d = TaggableScrollPane(self,
			       label = "Or select a frame:")
	d.pack(side = "top", fill = 'both')
	for f in gui.frame_history:
	    d.Write(f + "\n", "<Button-1>", self.MaybeUseFrame)	    
	# Here's where we add the line.
	if msg_type == GalaxyIO.GAL_MESSAGE_MSG_TYPE:
	    p = Frame(self, borderwidth = 2, relief = 'ridge')
	    p.pack(side = 'top', fill = 'x', expand = 1)
	    # Do the grid for the session ID and round trip.
	    session_id = gui.env.GetSessionID()
	    if not session_id: session_id = ""
	    self.session_entry = LabeledEntry(p, label_text = "Session ID:",
					      entry_value = session_id)
	    self.session_entry.entry['state'] = 'normal'
	    # self.session_entry['borderwidth'] = 2
	    # self.session_entry['relief'] = 'ridge'	    
	    self.lock_var = IntVar()
	    self.lock_entry = Checkbutton(p, text = "Lock session",
					  font = HEADERFONT,
					  variable = self.lock_var)
	    self.round_trip_var = IntVar()
	    self.round_trip_entry = Checkbutton(p, text = "Reply required",
						font = HEADERFONT,
						variable = self.round_trip_var)
	    # self.round_trip_entry['borderwidth'] = 2
	    # self.round_trip_entry['relief'] = 'ridge'
	    self.session_entry.grid(row = 0, column = 0, sticky = 'w')
	    self.session_entry.grid_columnconfigure(0, weight = '1')
	    self.session_entry.grid_rowconfigure(0, weight = '1')
	    self.lock_entry.grid(row = 1, column = 0, sticky = 'w')
	    self.lock_entry.grid_columnconfigure(0, weight = '1')
	    self.lock_entry.grid_rowconfigure(0, weight = '1')
	    self.round_trip_entry.grid(row = 2, column = 0, sticky = 'w')
	    self.round_trip_entry.grid_columnconfigure(0, weight = '1')
	    self.round_trip_entry.grid_rowconfigure(2, weight = '1')
	    if gui.as_hub and from_modal:
		self.round_trip_entry['state'] = 'disabled'
	    if gui.as_hub:
		self.lock_entry['state'] = 'disabled'
	else:
	    self.session_entry = None
	    self.round_trip_entry = None
	    self.round_trip_var = None
	    self.lock_entry = None
	    self.lock_var = None
	self.dismiss_row = ConfirmRow(self)
	self.dismiss_row.pack(side='top')
	self.dialogue = None

    # This is generated by mouse clicks in the history pane.
    # If there's a message typein visible, use the text.
    # Duh. The message typein is modal. Can't use it.
    
    def MaybeUseFrame(self, text, event):
	self.msg.Clear()
	self.msg.Write(text)

    def succeed(self):
	if self.dialogue is not None:
	    f_text = self.msg.textbox.get('0.0', 'end')
	    if self.session_entry:
		session = self.session_entry.GetValue()
	    else:
		session = None
	    if self.round_trip_var:
		round_trip = self.round_trip_var.get()
	    else:
		round_trip = None
	    if self.lock_var:
		lock = self.lock_var.get()
	    else:
		lock = None
	    self.dialogue.confirmation_result = 1, (f_text, session, round_trip, lock)
	self.master.destroy()
	
    def fail(self):
	if self.dialogue is not None:
	    self.dialogue.confirmation_result = 0, None
	self.master.destroy()