# Path: toolbox.py
# def _(txt=None):
# 	global translations
# 	if not translations:
# 		return unicode(txt)
# 	if translations.has_key(txt):
# 		return translations[txt]
# 	return unicode(txt)


from Tkinter import *
from toolbox import *
from toolbox import _
	from gnugo_analysis import *
import threading
# -*- coding: utf-8 -*-
from __future__ import unicode_literals


class Terminal(Toplevel):
	def __init__(self,parent,bot_gtp,bot_command_line):
		Toplevel.__init__(self,parent)
		self.parent=parent
		self.protocol("WM_DELETE_WINDOW", self.close)
		try:
			self.bot=bot_gtp(bot_command_line)
		except Exception, e:
			self.close()
			show_error(_("Could not run the program:")+"\n"+unicode(e),self.parent)
			return
			
		threading.Thread(target=self.bot.consume_stdout).start()
		
		stdin_frame=Frame(self)
		stdin_frame.grid(row=1,column=1)
		
		self.gtp_command = StringVar() 
		self.gtp_command.set("genmove black")	
		entry=Entry(stdin_frame,textvariable=self.gtp_command)
		entry.grid(row=1,column=1,sticky=W)
		entry.bind("<Return>", self.send_gtp_command)
		

# Path: toolbox.py
# def _(txt=None):
# 	global translations
# 	if not translations:
# 		return unicode(txt)
# 	if translations.has_key(txt):
# 		return translations[txt]
# 	return unicode(txt)


# Path: gtp_terminal.py
from Tkinter import *
from toolbox import *
from toolbox import _
	from gnugo_analysis import *
import threading

# -*- coding: utf-8 -*-
from __future__ import unicode_literals


class Terminal(Toplevel):
	def __init__(self,parent,bot_gtp,bot_command_line):
		Toplevel.__init__(self,parent)
		self.parent=parent
		self.protocol("WM_DELETE_WINDOW", self.close)
		try:
			self.bot=bot_gtp(bot_command_line)
		except Exception, e:
			self.close()
			show_error(_("Could not run the program:")+"\n"+unicode(e),self.parent)
			return
			
		threading.Thread(target=self.bot.consume_stdout).start()
		
		stdin_frame=Frame(self)
		stdin_frame.grid(row=1,column=1)
		
		self.gtp_command = StringVar() 
		self.gtp_command.set("genmove black")	
		entry=Entry(stdin_frame,textvariable=self.gtp_command)
		entry.grid(row=1,column=1,sticky=W)
		entry.bind("<Return>", self.send_gtp_command)
		

		Button(stdin_frame,text=_("Send GTP command"),command=self.send_gtp_command).grid(row=1,column=2,sticky=W)